/* Created with love 🩶 by Denvil 🧑‍💻 */
/* NEXUS AI Modern 3D Chat Interface Styles */

/* CSS Variables for Theme Support */
:root {
  /* Colors - Updated for NEXUS AI */
  --primary-color: #6366f1;
  --primary-hover: #4f46e5;
  --secondary-color: #6b7280;
  --accent-color: #10b981;
  --danger-color: #ef4444;
  --nexus-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --nexus-glow: 0 0 30px rgba(102, 126, 234, 0.3);
  
  /* Light Theme */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --border-color: #e2e8f0;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-3d: 0 10px 30px rgba(0, 0, 0, 0.15), 0 0 50px rgba(102, 126, 234, 0.1);
  --glass-bg: rgba(255, 255, 255, 0.25);
  --glass-border: rgba(255, 255, 255, 0.18);
}

[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --border-color: #475569;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
  --shadow-3d: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 50px rgba(102, 126, 234, 0.2);
  --glass-bg: rgba(15, 23, 42, 0.25);
  --glass-border: rgba(148, 163, 184, 0.18);
}

/* 3D Background Canvas */
.three-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

/* Logo 3D Container */
.logo-container {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo-3d {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.2);
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow: hidden;
  transition: all 0.3s ease;
  perspective: 1000px;
}

/* App Container */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 100vw;
  overflow: hidden;
  position: relative;
}

/* Header - Minimal Design */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 10;
  position: relative;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.app-title {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
}

.app-title .app-icon {
  font-size: 1.5rem;
  opacity: 0.8;
}

.app-title .app-name {
  font-size: 1.5rem;
  font-weight: 700;
  background: var(--nexus-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.app-title .app-tagline {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
  opacity: 0.8;
}

.language-selector-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-right: 1rem;
}

.language-selector-container label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.language-selector {
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.875rem;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.language-selector:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.app-icon {
  font-size: 1.8rem;
}

.service-selector-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.service-selector-container label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.service-selector {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.875rem;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.service-selector:focus {
  outline: none;
  border-color: var(--primary-color);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.status {
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-weight: 500;
  transition: all 0.3s ease;
}

.status.info {
  background-color: var(--primary-color);
  color: white;
}

.status.success {
  background-color: var(--accent-color);
  color: white;
}

.status.error {
  background-color: var(--danger-color);
  color: white;
}

.icon-button {
  padding: 0.5rem;
  border: none;
  border-radius: 0.5rem;
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 1.2rem;
  transition: background-color 0.2s ease;
}

.icon-button:hover {
  background-color: var(--border-color);
}

/* Main Chat Area - Simplified */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 2rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Messages - Clean Design */
.message {
  display: flex;
  flex-direction: column;
  max-width: 100%;
  animation: messageSlideIn 0.3s ease-out;
}

.message-entering {
  animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.user-message {
  align-self: flex-end;
  max-width: 85%;
}
}

.assistant-message {
  align-self: flex-start;
}

.message-content {
  padding: 1rem 1.25rem;
  border-radius: 1rem;
  position: relative;
}

.user-message .message-content {
  background-color: var(--primary-color);
  color: white;
  border-bottom-right-radius: 0.5rem;
}

.assistant-message .message-content {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border-bottom-left-radius: 0.5rem;
  border: 1px solid var(--border-color);
}

.welcome-message .message-content {
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  color: white;
  border: none;
}

.message-text {
  font-size: 0.95rem;
  line-height: 1.5;
  word-wrap: break-word;
}

.message-text code {
  background-color: rgba(255, 255, 255, 0.1);
  padding: 0.2rem 0.4rem;
  border-radius: 0.25rem;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.875rem;
}

.message-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  opacity: 0.7;
}

.message-service {
  background-color: rgba(255, 255, 255, 0.2);
  padding: 0.2rem 0.5rem;
  border-radius: 1rem;
  font-weight: 500;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  border-bottom-left-radius: 0.5rem;
  max-width: 200px;
  margin: 0 1rem;
}

.typing-dots {
  display: flex;
  gap: 0.25rem;
}

.typing-dots span {
  width: 0.5rem;
  height: 0.5rem;
  background-color: var(--text-secondary);
  border-radius: 50%;
  animation: typingPulse 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingPulse {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.typing-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-style: italic;
}

/* Input Area - Minimal Design */
.input-container {
  padding: 1.5rem 2rem;
  background: rgba(255, 255, 255, 0.02);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

.input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.input-wrapper:focus-within {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.message-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 1rem;
  line-height: 1.5;
  resize: none;
  min-height: 1.5rem;
  max-height: 120px;
  overflow-y: auto;
  font-family: inherit;
}

.message-input::placeholder {
  color: var(--text-secondary);
}

.input-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.voice-button, .image-button {
  padding: 0.5rem;
  border: none;
  border-radius: 8px;
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary-color);
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.voice-button:hover, .image-button:hover {
  background-color: var(--border-color);
}

.image-button:hover {
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  color: white;
}

.voice-button.active {
  background-color: var(--danger-color);
  color: white;
  animation: pulse 2s infinite;
}

.image-button.generating {
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  color: white;
  animation: pulse 2s infinite;
}

.voice-button.disabled, .image-button.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.send-button {
  padding: 0.75rem;
  border: none;
  border-radius: 0.5rem;
  background-color: var(--primary-color);
  color: white;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.send-button:hover {
  background-color: var(--primary-hover);
}

.send-icon {
  font-size: 1.2rem;
  transform: rotate(-45deg);
}

.voice-status {
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
  min-height: 1.2rem;
}

/* Settings Panel */
.settings-panel {
  position: fixed;
  top: 0;
  right: -400px;
  width: 400px;
  height: 100vh;
  background-color: var(--bg-primary);
  border-left: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  transition: right 0.3s ease;
  z-index: 1000;
  overflow-y: auto;
}

.settings-panel.open {
  right: 0;
}

.settings-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.settings-panel.open + .settings-overlay {
  opacity: 1;
  visibility: visible;
}

.settings-content {
  padding: 2rem;
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.settings-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.close-settings {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.25rem;
  transition: background-color 0.2s ease;
}

.close-settings:hover {
  background-color: var(--bg-secondary);
}

.settings-section {
  margin-bottom: 2rem;
}

.settings-section h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.settings-description {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.api-key-group {
  margin-bottom: 1.5rem;
}

.api-key-group label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.service-icon {
  font-size: 1.2rem;
}

.api-key-input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: border-color 0.2s ease;
}

.api-key-input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.api-key-group small {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.api-key-group a {
  color: var(--primary-color);
  text-decoration: none;
}

.api-key-group a:hover {
  text-decoration: underline;
}

.settings-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.settings-button {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.settings-button:hover {
  background-color: var(--bg-tertiary);
  border-color: var(--primary-color);
}

.settings-button.danger {
  border-color: var(--danger-color);
  color: var(--danger-color);
}

.settings-button.danger:hover {
  background-color: var(--danger-color);
  color: white;
}

.about-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1rem;
}

.version-info {
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.version-info small {
  color: var(--text-secondary);
  font-size: 0.75rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  .app-header {
    padding: 1rem;
  }
  
  .header-left {
    gap: 1rem;
  }
  
  .app-title {
    font-size: 1.25rem;
  }
  
  .service-selector-container {
    display: none;
  }
  
  .input-container {
    padding: 1rem;
  }
  
  .settings-panel {
    width: 100vw;
    right: -100vw;
  }
  
  .settings-content {
    padding: 1rem;
  }
  
  .message {
    max-width: 95%;
  }
}

@media (max-width: 480px) {
  .app-header {
    padding: 0.75rem;
  }
  
  .header-right {
    gap: 0.5rem;
  }
  
  .icon-button {
    padding: 0.375rem;
    font-size: 1rem;
  }
  
  .message-content {
    padding: 0.75rem 1rem;
  }
  
  .input-wrapper {
    padding: 0.5rem;
  }
  
  .message-input {
    font-size: 0.875rem;
  }
}

/* Scrollbar Styling */
.messages-container::-webkit-scrollbar,
.settings-panel::-webkit-scrollbar {
  width: 6px;
}

.messages-container::-webkit-scrollbar-track,
.settings-panel::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

.messages-container::-webkit-scrollbar-thumb,
.settings-panel::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.messages-container::-webkit-scrollbar-thumb:hover,
.settings-panel::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* Focus Styles for Accessibility */
*:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

button:focus,
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: -2px;
}

/* Support Section Styles */
.support-channels {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 1rem 0;
}

.support-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 0.75rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateZ(5px);
}

.support-item:hover {
  transform: translateZ(10px) translateY(-2px);
  box-shadow: var(--shadow-3d);
  background: rgba(102, 126, 234, 0.1);
}

.support-icon {
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  background: var(--nexus-gradient);
  border-radius: 50%;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.support-info {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.support-info strong {
  font-weight: 600;
  color: var(--text-primary);
}

.support-info a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
}

.support-info a:hover {
  color: var(--primary-hover);
  text-shadow: 0 0 8px rgba(102, 126, 234, 0.4);
}

.support-note {
  text-align: center;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-style: italic;
  background: var(--nexus-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 600;
}

/* Enhanced Message Bubbles with 3D Effects */
.message {
  transform-style: preserve-3d;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.message:hover {
  transform: translateZ(5px);
}

.user-message .message-content {
  background: var(--nexus-gradient);
  box-shadow: var(--shadow-3d);
  transform: translateZ(2px);
}

.assistant-message .message-content {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  transform: translateZ(1px);
}

/* Enhanced Input with 3D Effects */
.input-container {
  transform: translateZ(10px);
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--glass-border);
}

.message-input:focus {
  box-shadow: var(--nexus-glow), var(--shadow-lg);
  transform: translateZ(5px);
}

/* Enhanced Buttons with 3D Effects */
.send-button {
  background: var(--nexus-gradient) !important;
  transform: translateZ(5px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.send-button:hover {
  transform: translateZ(8px) scale(1.05);
  box-shadow: var(--nexus-glow), var(--shadow-lg);
}

.icon-button {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateZ(2px);
}

.icon-button:hover {
  transform: translateZ(5px) scale(1.1);
  box-shadow: var(--shadow-3d);
}

/* Floating Animation for Interactive Elements */
@keyframes float {
  0%, 100% { transform: translateY(0px) translateZ(0px); }
  50% { transform: translateY(-5px) translateZ(5px); }
}

.floating {
  animation: float 3s ease-in-out infinite;
}

/* Responsive Design - Mobile First */
@media (max-width: 768px) {
  .app-header {
    padding: 1rem;
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }
  
  .header-left {
    gap: 0.5rem;
  }
  
  .app-title .app-name {
    font-size: 1.25rem;
  }
  
  .app-title .app-tagline {
    font-size: 0.7rem;
  }
  
  .chat-main {
    max-width: 100%;
  }
  
  .messages-container {
    padding: 1rem;
    gap: 1rem;
  }
  
  .input-container {
    padding: 1rem;
  }
  
  .user-message {
    max-width: 95%;
  }
  
  .three-background {
    opacity: 0.5; /* Reduce 3D effects on mobile for performance */
  }
}

@media (max-width: 480px) {
  .app-header {
    padding: 0.75rem;
  }
  
  .app-title .app-name {
    font-size: 1rem;
  }
  
  .header-right {
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
  }
  
  .input-wrapper {
    padding: 0.75rem;
  }
  
  .input-actions {
    gap: 0.25rem;
  }
  
  .voice-button, .image-button {
    padding: 0.4rem;
    font-size: 1rem;
  }
}