/* =====================
   RESET & BASE STYLES
   ===================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Colors */
  --background: #0A0B0F;
  --card: #121418;
  --border: rgba(28, 31, 39, 0.4);
  --border-hover: rgba(28, 31, 39, 0.8);
  --primary: #F0C53A;
  --primary-hover: #D4AA2E;
  --foreground: #EAEEF7;
  --muted: #9AA3B2;
  --accent: #F5C76B;
  --glass-bg: rgba(18, 20, 24, 0.6);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
}

/* =====================
   PARTICLE BACKGROUND
   ===================== */

#particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  #particles {
    display: none;
  }
}

/* =====================
   HEADER
   ===================== */

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.header-content {
  max-width: 1920px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sparkles {
  width: 24px;
  height: 24px;
  color: var(--primary);
  filter: drop-shadow(0 0 8px rgba(240, 197, 58, 0.4));
  animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.brand {
  font-family: 'Poppins', sans-serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin: 0;
  background: linear-gradient(135deg, var(--foreground) 0%, var(--muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-accent {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* =====================
   RESEARCHER MODE TOGGLE
   ===================== */

.researcher-toggle-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toggle-text {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  cursor: pointer;
}

.toggle-switch input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: relative;
  display: block;
  width: 44px;
  height: 24px;
  background: rgba(28, 31, 39, 0.6);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  top: 2px;
  background: var(--muted);
  border-radius: 50%;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-switch input[type="checkbox"]:checked + .toggle-slider {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  border-color: var(--primary);
  box-shadow: 0 0 16px rgba(240, 197, 58, 0.5);
}

.toggle-switch input[type="checkbox"]:checked + .toggle-slider::before {
  transform: translateX(20px);
  background: #0A0B0F;
}

/* =====================
   HEADER RIGHT CONTROLS
   ===================== */

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.credits-display {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(240, 197, 58, 0.1);
  border: 1px solid rgba(240, 197, 58, 0.3);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--primary);
}

.credits-display svg {
  color: var(--primary);
}

.credits-display.unlimited {
  background: rgba(76, 175, 80, 0.1);
  border-color: rgba(76, 175, 80, 0.3);
  color: #4CAF50;
}

.credits-display.unlimited svg {
  color: #4CAF50;
}

.buy-credits-btn {
  padding: 8px 16px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #0A0B0F;
  cursor: pointer;
  transition: all 0.2s ease;
}

.buy-credits-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(240, 197, 58, 0.4);
}

.user-controls {
  display: flex;
  align-items: center;
}

.login-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--foreground);
  text-decoration: none;
  transition: all 0.2s ease;
}

.login-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(240, 197, 58, 0.1);
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}

.user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--foreground);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-btn {
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  transition: all 0.2s ease;
}

.logout-btn:hover {
  border-color: #f44336;
  color: #f44336;
  background: rgba(244, 67, 54, 0.1);
}

/* Login required overlay */
.login-required-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 11, 15, 0.95);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.login-required-content {
  text-align: center;
  padding: 48px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 400px;
}

.login-required-content h2 {
  font-family: 'Poppins', sans-serif;
  font-size: 24px;
  margin-bottom: 12px;
  color: var(--foreground);
}

.login-required-content p {
  color: var(--muted);
  margin-bottom: 24px;
}

.login-required-content .login-btn {
  display: inline-flex;
  padding: 12px 24px;
  font-size: 15px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #0A0B0F;
  border: none;
}

.login-required-content .login-btn:hover {
  color: #0A0B0F;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(240, 197, 58, 0.4);
}

/* No credits message */
.no-credits-message {
  padding: 16px;
  background: rgba(244, 67, 54, 0.1);
  border: 1px solid rgba(244, 67, 54, 0.3);
  border-radius: 8px;
  margin: 16px;
  text-align: center;
}

.no-credits-message p {
  color: #f44336;
  margin-bottom: 12px;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .header-right {
    gap: 8px;
  }
  
  .credits-display {
    padding: 6px 10px;
    font-size: 12px;
  }
  
  .buy-credits-btn {
    padding: 6px 10px;
    font-size: 12px;
  }
  
  .user-name {
    display: none;
  }
  
  .toggle-text {
    display: none;
  }
}

/* =====================
   MAIN APP CONTAINER
   ===================== */

.app-container {
  max-width: 1920px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 24px;
  min-height: calc(100vh - 100px);
  position: relative;
  z-index: 1;
}

/* =====================
   SIDEBAR
   ===================== */

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sidebar-section {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.section-label svg {
  color: var(--primary);
  opacity: 0.6;
}

/* =====================
   MAP SELECTOR
   ===================== */

.select-wrapper {
  position: relative;
}

.select-wrapper select {
  width: 100%;
  appearance: none;
  background: rgba(10, 11, 15, 0.8);
  color: var(--foreground);
  border: 1px solid var(--border);
  padding: 12px 40px 12px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.select-wrapper select:hover {
  border-color: var(--border-hover);
  background: rgba(10, 11, 15, 0.9);
}

.select-wrapper select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(240, 197, 58, 0.1);
}

.select-chevron {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  transition: transform 0.2s ease;
}

.select-wrapper:hover .select-chevron {
  color: var(--foreground);
}

/* =====================
   FILE UPLOAD ZONE
   ===================== */

.upload-zone {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: rgba(10, 11, 15, 0.3);
}

.upload-zone:hover {
  border-color: var(--primary);
  background: rgba(240, 197, 58, 0.02);
}

.upload-zone.drag-over {
  border-style: solid;
  border-color: var(--primary);
  background: rgba(240, 197, 58, 0.05);
}

.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.upload-icon {
  color: var(--muted);
  margin: 0 auto 12px;
  opacity: 0.5;
  transition: all 0.2s ease;
}

.upload-zone:hover .upload-icon {
  color: var(--primary);
  opacity: 1;
  transform: translateY(-2px);
}

.upload-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--foreground);
  margin: 0 0 4px;
}

.upload-hint {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}

.uploaded-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(240, 197, 58, 0.05);
  border: 1px solid rgba(240, 197, 58, 0.2);
  border-radius: 10px;
  margin-top: 12px;
}

.uploaded-file .file-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--primary);
  font-family: 'JetBrains Mono', monospace;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remove-file {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.remove-file:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--foreground);
}

/* =====================
   ACTIVE MAP INFO
   ===================== */

.active-map-card {
  background: rgba(240, 197, 58, 0.05);
  border: 1px solid rgba(240, 197, 58, 0.15);
  border-radius: 10px;
  padding: 14px;
}

.map-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 4px;
}

.map-meta {
  font-size: 12px;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
}

/* =====================
   SIDEBAR FOOTER
   ===================== */

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 20px;
  background: rgba(10, 11, 15, 0.5);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-top: auto;
}

.sidebar-footer svg {
  color: var(--primary);
  opacity: 0.4;
  flex-shrink: 0;
}

.sidebar-footer p {
  font-size: 11px;
  color: var(--muted);
  margin: 0;
  line-height: 1.4;
}

.legal-links {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  width: 100%;
  justify-content: center;
}

.legal-links a {
  font-size: 11px;
  color: var(--primary);
  text-decoration: none;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.legal-links a:hover {
  opacity: 1;
  text-decoration: underline;
}

.legal-separator {
  color: var(--muted);
}

/* =====================
   MAP DOCUMENTATION LINKS
   ===================== */

.doc-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.doc-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(10, 11, 15, 0.6);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--foreground);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.doc-link:hover {
  background: rgba(240, 197, 58, 0.08);
  border-color: rgba(240, 197, 58, 0.3);
  color: var(--primary);
}

.doc-link svg {
  color: var(--primary);
  opacity: 0.7;
  flex-shrink: 0;
}

/* =====================
   CHAT PANEL
   ===================== */

.chat-panel {
  display: flex;
  flex-direction: column;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  min-height: calc(100vh - 150px);
}

/* =====================
   MESSAGES
   ===================== */

.messages-wrapper {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

/* Custom Scrollbar */
.messages::-webkit-scrollbar {
  width: 6px;
}

.messages::-webkit-scrollbar-track {
  background: transparent;
}

.messages::-webkit-scrollbar-thumb {
  background: rgba(154, 163, 178, 0.2);
  border-radius: 3px;
}

.messages::-webkit-scrollbar-thumb:hover {
  background: rgba(154, 163, 178, 0.4);
}

/* =====================
   WELCOME MESSAGE
   ===================== */

.welcome-message {
  text-align: center;
  padding: 60px 24px;
  max-width: 600px;
  margin: 0 auto;
}

.welcome-icon {
  color: var(--primary);
  opacity: 0.6;
  margin: 0 auto 24px;
  filter: drop-shadow(0 0 20px rgba(240, 197, 58, 0.3));
}

.welcome-message h2 {
  font-family: 'Poppins', sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--foreground);
  margin: 0 0 12px;
}

.welcome-message p {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.7;
  margin: 0;
}

/* =====================
   MESSAGE BUBBLES
   ===================== */

.msg {
  max-width: 75%;
  padding: 14px 18px;
  border-radius: 18px;
  border: 1px solid var(--border);
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.6;
  font-size: 14px;
  animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

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

.msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(240, 197, 58, 0.12) 0%, rgba(240, 197, 58, 0.06) 100%);
  border-color: rgba(240, 197, 58, 0.3);
  color: var(--foreground);
}

.msg.bot {
  align-self: flex-start;
  background: rgba(18, 20, 24, 0.6);
  border-color: var(--border);
  color: var(--foreground);
}

.msg.system {
  align-self: center;
  background: rgba(154, 163, 178, 0.1);
  border-color: rgba(154, 163, 178, 0.2);
  color: var(--muted);
  font-size: 13px;
  max-width: 90%;
  text-align: center;
}

/* =====================
   TABS (RESEARCHER MODE)
   ===================== */

.tabs-container {
  display: flex;
  gap: 2px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.tab-button {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  padding: 8px 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.tab-button:hover {
  color: var(--foreground);
  background: rgba(240, 197, 58, 0.05);
}

.tab-button.active {
  color: var(--primary);
  background: rgba(240, 197, 58, 0.1);
}

.tab-content {
  display: none;
  margin-top: 12px;
}

.tab-content.active {
  display: block;
}

.trace-actions {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
}

.download-trace-btn {
  background: rgba(240, 197, 58, 0.1);
  border: 1px solid rgba(240, 197, 58, 0.3);
  color: var(--primary);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.download-trace-btn:hover {
  background: rgba(240, 197, 58, 0.15);
  transform: scale(0.98);
}

.trace-content,
.evidence-content,
.self-tests-content {
  background: rgba(10, 11, 15, 0.8);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  overflow-x: auto;
  max-height: 300px;
  overflow-y: auto;
  line-height: 1.6;
}

.trace-content pre,
.evidence-content pre,
.self-tests-content pre {
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* =====================
   SUGGESTED PROMPTS
   ===================== */

.suggested-prompts {
  padding: 0 24px 12px;
  background: transparent;
}

.prompts-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.prompt-chip {
  background: rgba(240, 197, 58, 0.08);
  border: 1px solid rgba(240, 197, 58, 0.2);
  color: var(--foreground);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.prompt-chip:hover {
  background: rgba(240, 197, 58, 0.15);
  border-color: rgba(240, 197, 58, 0.4);
  color: var(--primary);
  transform: translateY(-1px);
}

.prompt-chip:active {
  transform: scale(0.98);
}

.prompt-chip .prompt-icon {
  font-size: 14px;
}

/* Attack/Counter prompt special styling */
.prompt-chip.attack-prompt {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.2);
}

.prompt-chip.attack-prompt:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
}

/* =====================
   INPUT COMPOSER
   ===================== */

.composer {
  padding: 20px 24px;
  border-top: 1px solid var(--border);
  background: rgba(10, 11, 15, 0.5);
}

.input-wrapper {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  background: rgba(18, 20, 24, 0.8);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 4px;
  transition: all 0.2s ease;
}

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

.input-wrapper textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--foreground);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  padding: 12px 14px;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  overflow-y: auto;
}

.input-wrapper textarea:focus {
  outline: none;
}

.input-wrapper textarea::placeholder {
  color: var(--muted);
  opacity: 0.6;
}

/* Custom Scrollbar for Textarea */
.input-wrapper textarea::-webkit-scrollbar {
  width: 6px;
}

.input-wrapper textarea::-webkit-scrollbar-track {
  background: transparent;
}

.input-wrapper textarea::-webkit-scrollbar-thumb {
  background: rgba(154, 163, 178, 0.2);
  border-radius: 3px;
}

.send-button {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #0A0B0F;
  border: none;
  border-radius: 10px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(240, 197, 58, 0.25);
  flex-shrink: 0;
}

.send-button:hover {
  transform: scale(0.98);
  box-shadow: 0 6px 16px rgba(240, 197, 58, 0.35);
}

.send-button:active {
  transform: scale(0.95);
}

.send-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* =====================
   RESPONSIVE DESIGN
   ===================== */

@media (max-width: 1024px) {
  .app-container {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .sidebar {
    order: 2;
  }

  .chat-panel {
    order: 1;
    min-height: 500px;
  }

  .msg {
    max-width: 85%;
  }
}

@media (max-width: 640px) {
  .app-container {
    padding: 16px;
  }

  .header-content {
    padding: 12px 16px;
    flex-wrap: wrap;
  }

  .brand {
    font-size: 18px;
  }

  .toggle-text {
    font-size: 10px;
  }

  .sidebar-section {
    padding: 16px;
  }

  .messages {
    padding: 16px;
  }

  .composer {
    padding: 16px;
  }

  .msg {
    max-width: 90%;
    font-size: 13px;
  }

  .welcome-message {
    padding: 40px 16px;
  }

  .welcome-message h2 {
    font-size: 20px;
  }

  .welcome-icon {
    width: 48px;
    height: 48px;
  }
}

/* =====================
   MODAL STYLES
   ===================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-family: 'Poppins', sans-serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--foreground);
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.modal-close:hover {
  color: var(--foreground);
  background: rgba(255, 255, 255, 0.05);
}

.modal-body {
  padding: 24px;
}

.modal-description {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 20px;
  line-height: 1.6;
}

.credit-packages {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.credit-package {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  background: rgba(240, 197, 58, 0.05);
  border: 1px solid rgba(240, 197, 58, 0.2);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.credit-package:hover {
  background: rgba(240, 197, 58, 0.1);
  border-color: rgba(240, 197, 58, 0.4);
  transform: translateY(-2px);
}

.credit-package:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}

.package-credits {
  font-family: 'Poppins', sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 4px;
}

.package-price {
  font-size: 24px;
  font-weight: 700;
  color: var(--foreground);
  margin-bottom: 4px;
}

.package-per-credit {
  font-size: 12px;
  color: var(--muted);
}

/* Credits display improvements */
.credits-display.unlimited {
  color: var(--primary);
}

.buy-credits-btn {
  padding: 8px 16px;
  background: linear-gradient(135deg, var(--primary) 0%, #d4a82e 100%);
  color: var(--background);
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.buy-credits-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(240, 197, 58, 0.3);
}

/* =====================
   EXPORT CHAT BUTTON
   ===================== */

.export-chat-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(240, 197, 58, 0.1);
  color: var(--primary);
  border: 1px solid rgba(240, 197, 58, 0.3);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.export-chat-btn:hover {
  background: rgba(240, 197, 58, 0.2);
  border-color: rgba(240, 197, 58, 0.5);
}

.export-chat-btn svg {
  color: var(--primary);
}

/* =====================
   ADMIN DASHBOARD LINK
   ===================== */

.admin-dashboard-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(147, 51, 234, 0.1);
  color: #a855f7;
  border: 1px solid rgba(147, 51, 234, 0.3);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.3s ease;
}

.admin-dashboard-link:hover {
  background: rgba(147, 51, 234, 0.2);
  border-color: rgba(147, 51, 234, 0.5);
}

/* =====================
   CONVERSATION HISTORY
   ===================== */

.section-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.new-chat-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: rgba(240, 197, 58, 0.1);
  color: var(--primary);
  border: 1px solid rgba(240, 197, 58, 0.3);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.new-chat-btn:hover {
  background: rgba(240, 197, 58, 0.2);
  border-color: rgba(240, 197, 58, 0.5);
}

.conversation-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
}

.conversation-list::-webkit-scrollbar {
  width: 4px;
}

.conversation-list::-webkit-scrollbar-track {
  background: transparent;
}

.conversation-list::-webkit-scrollbar-thumb {
  background: rgba(240, 197, 58, 0.3);
  border-radius: 2px;
}

.conversation-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.conversation-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-hover);
}

.conversation-item.active {
  background: rgba(240, 197, 58, 0.1);
  border-color: rgba(240, 197, 58, 0.3);
}

.conversation-info {
  flex: 1;
  min-width: 0;
}

.conversation-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.conversation-delete {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  background: transparent;
  color: var(--muted);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0;
  transition: all 0.2s ease;
}

.conversation-item:hover .conversation-delete {
  opacity: 1;
}

.conversation-delete:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.conversation-empty {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  padding: 16px;
}

/* =====================
   ANALYTICS MODAL
   ===================== */

.analytics-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.analytics-content {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 900px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 24px;
}

.analytics-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.analytics-header h2 {
  font-family: 'Poppins', sans-serif;
  font-size: 24px;
  font-weight: 600;
  color: var(--foreground);
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.analytics-stat {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.analytics-stat-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.analytics-stat-value {
  font-family: 'Poppins', sans-serif;
  font-size: 28px;
  font-weight: 600;
  color: var(--primary);
}

.analytics-section {
  margin-bottom: 24px;
}

.analytics-section h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 12px;
}

.analytics-table {
  width: 100%;
  border-collapse: collapse;
}

.analytics-table th,
.analytics-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.analytics-table th {
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
}

.analytics-table td {
  color: var(--foreground);
}

.analytics-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}
