/* QuackWell Design System */
/* Foundation & Color System - Phase 1 Implementation */

:root {
  /* === COLOR PALETTE === */
  /* Primary Colors */
  --color-primary-blue: #3b82f6;
  --color-primary-blue-dark: #1d4ed8;
  --color-primary-blue-light: #60a5fa;
  
  /* Accent Colors */
  --color-accent-purple: #8b5cf6;
  --color-accent-purple-dark: #7c3aed;
  --color-accent-purple-light: #a78bfa;
  
  /* Success (reduced usage) */
  --color-success: #10b981;
  --color-success-dark: #059669;
  --color-success-light: #34d399;
  
  /* Neutral Grays */
  --color-gray-900: #35466b;
  --color-gray-800: #1f2937;
  --color-gray-700: #374151;
  --color-gray-600: #4b5563;
  --color-gray-500: #6b7280;
  --color-gray-400: #9ca3af;
  --color-gray-300: #d1d5db;
  --color-gray-200: #e5e7eb;
  --color-gray-100: #f3f4f6;
  
  /* Semantic Colors */
  --color-danger: #ef4444;
  --color-warning: #f59e0b;
  --color-info: var(--color-primary-blue);
  
  /* Background Colors */
  --bg-primary: var(--color-gray-900);
  --bg-secondary: var(--color-gray-800);
  --bg-tertiary: var(--color-gray-700);
  --bg-card: rgba(31, 41, 55, 0.8);
  --bg-glass: rgba(31, 41, 55, 0.6);
  
  /* Text Colors - WCAG AA Compliant */
  --text-primary: #f9fafb;
  --text-secondary: #e5e7eb;
  --text-tertiary: #d1d5db;
  --text-muted: #9ca3af;
  --text-on-primary: #ffffff;
  
  /* Border Colors */
  --border-primary: rgba(255, 255, 255, 0.1);
  --border-secondary: rgba(255, 255, 255, 0.05);
  --border-accent: rgba(59, 130, 246, 0.3);
  
  /* === 8-POINT SPACING SYSTEM === */
  --space-1: 4px;   /* 0.25rem */
  --space-2: 8px;   /* 0.5rem */
  --space-3: 12px;  /* 0.75rem */
  --space-4: 16px;  /* 1rem */
  --space-5: 20px;  /* 1.25rem */
  --space-6: 24px;  /* 1.5rem */
  --space-8: 32px;  /* 2rem */
  --space-10: 40px; /* 2.5rem */
  --space-12: 48px; /* 3rem */
  --space-16: 64px; /* 4rem */
  --space-20: 80px; /* 5rem */
  
  /* === TYPOGRAPHY SCALE === */
  --text-xs: 12px;
  --text-sm: 14px;
  --text-base: 16px;
  --text-lg: 18px;
  --text-xl: 20px;
  --text-2xl: 24px;
  --text-3xl: 30px;
  --text-4xl: 36px;
  
  /* === ELEVATION/SHADOWS === */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.1);
  --shadow-2xl: 0 25px 50px rgba(0, 0, 0, 0.25);
  
  /* === BORDER RADIUS === */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-2xl: 16px;
  --radius-full: 9999px;
  
  /* === TRANSITIONS === */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-medium: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
  
  /* === GLASS MORPHISM === */
  --backdrop-blur: blur(12px);
  --backdrop-blur-sm: blur(8px);
  --backdrop-blur-lg: blur(16px);
}

/* === COMPONENT CLASSES === */

/* Primary CTA Button - Dominant Visual Element */
.btn-primary {
  background: linear-gradient(135deg, var(--color-primary-blue) 0%, var(--color-primary-blue-dark) 100%);
  color: var(--text-on-primary);
  border: none;
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-md);
  transform: scale(1);
}

.btn-primary:hover {
  transform: scale(1.02);
  box-shadow: 0 10px 25px rgba(59, 130, 246, 0.25);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-primary:focus {
  outline: 2px solid var(--color-primary-blue-light);
  outline-offset: 2px;
}

/* Secondary Button */
.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-base);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-secondary:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-accent);
  color: var(--text-primary);
}

/* Neutral Button (for de-emphasized elements) */
.btn-neutral {
  background: var(--bg-tertiary);
  color: var(--text-tertiary);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-lg);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  opacity: 0.8;
}

.btn-neutral:hover {
  opacity: 1;
  background: var(--color-gray-600);
}

/* Glass Morphism Card */
.card-glass {
  background: var(--bg-glass);
  backdrop-filter: var(--backdrop-blur-sm);
  -webkit-backdrop-filter: var(--backdrop-blur-sm);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}

/* Segmented Control */
.segmented-control {
  display: flex;
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  padding: var(--space-1);
  gap: var(--space-1);
  margin-bottom: 0;
}

.segmented-control button {
  flex: 1;
  padding: var(--space-1) var(--space-2);
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.segmented-control button.active {
  background: var(--color-primary-blue);
  color: var(--text-on-primary);
  box-shadow: var(--shadow-sm);
}

.segmented-control button:hover:not(.active) {
  background: var(--color-gray-600);
  color: var(--text-secondary);
}

/* Input Field */
.input-field {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  color: var(--text-primary);
  font-size: var(--text-base);
  transition: all var(--transition-fast);
}

.input-field:focus {
  outline: none;
  border-color: var(--color-primary-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.input-field::placeholder {
  color: var(--text-muted);
}

/* Progress Bar */
.progress-bar {
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  height: var(--space-2);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width var(--transition-medium);
}

.progress-bar-fill.primary {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.7) 0%, rgba(96, 165, 250, 0.7) 100%);
}

.progress-bar-fill.success {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.7) 0%, rgba(52, 211, 153, 0.7) 100%);
}

.progress-bar-fill.warning {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.7) 0%, rgba(251, 191, 36, 0.7) 100%);
}

/* Utility Classes */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-muted { color: var(--text-muted); }

.bg-primary { background-color: var(--bg-primary); }
.bg-secondary { background-color: var(--bg-secondary); }
.bg-tertiary { background-color: var(--bg-tertiary); }

.border-primary { border-color: var(--border-primary); }
.border-accent { border-color: var(--border-accent); }

/* Spacing Utilities */
.p-1 { padding: var(--space-1); }
.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-5 { padding: var(--space-5); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }

.m-1 { margin: var(--space-1); }
.m-2 { margin: var(--space-2); }
.m-3 { margin: var(--space-3); }
.m-4 { margin: var(--space-4); }
.m-5 { margin: var(--space-5); }
.m-6 { margin: var(--space-6); }
.m-8 { margin: var(--space-8); }

.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* === ACCESSIBILITY ENHANCEMENTS === */

/* High contrast focus indicators */
*:focus {
  outline: 2px solid var(--color-primary-blue-light);
  outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --text-primary: #ffffff;
    --text-secondary: #ffffff;
    --border-primary: rgba(255, 255, 255, 0.3);
    --bg-card: rgba(0, 0, 0, 0.9);
  }
}

/* Light Mode Theme Variables */
[data-theme="light"] {
  /* Background Colors */
  --bg-primary: #faf8f5; /* Warm off-white for main background */
  --bg-secondary: #fffef9; /* Soft cream for sidebar and cards */
  --bg-tertiary: #f5f3f0; /* Light beige for accents */
  --bg-card: rgba(255, 254, 249, 0.9); /* Matching card background */
  --bg-glass: rgba(255, 254, 249, 0.7); /* Matching glass effect */
  
  /* Text Colors */
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-tertiary: #64748b;
  --text-muted: #94a3b8;
  --text-on-primary: #ffffff;
  
  /* Border Colors */
  --border-primary: rgba(0, 0, 0, 0.12);
  --border-secondary: rgba(0, 0, 0, 0.08);
  --border-accent: rgba(59, 130, 246, 0.4);
  
  /* Color overrides for light mode */
  --color-gray-900: #f8fafc;
  --color-gray-800: #ffffff;
  --color-gray-700: #f1f5f9;
  --color-gray-600: #e2e8f0;
  --color-gray-500: #cbd5e1;
  --color-gray-400: #94a3b8;
  --color-gray-300: #64748b;
  --color-gray-200: #475569;
  --color-gray-100: #334155;
}

/* === CHAT UI COMPONENTS === */

/* Dark chat canvas - full background */
.chat-canvas {
  background: #0F1929 !important;
  height: 100vh; /* Fixed height, no scrolling */
  padding: 0;
  width: 100%;
  overflow: hidden; /* Prevent any scroll */
  position: relative;
}

/* Floating input panel - compact design */
.floating-input-panel {
  position: fixed; /* Use fixed for viewport-based positioning */
  bottom: -4px; /* Slight overlap to prevent gap */
  left: calc(255px + (100% - 255px) / 2); /* Center in chat area (after 255px sidebar) */
  transform: translateX(-50%);
  width: calc(100% - 48px - 255px); /* Account for sidebar width */
  max-width: 768px; /* Match message width */
  background: #1A2635; /* Match user message bubble color */
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-bottom: none;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.15);
  padding: 6px 4px 2px; /* Reduced bottom padding */
  z-index: 10;
  box-sizing: border-box; 
}

/* Compact input panel styling */
.input-area {
  padding: 8px 12px 2px; /* Even less bottom padding */
}

.input-area textarea {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1.4;
  resize: none;
  outline: none;
  font-family: inherit;
  min-height: 40px;
  max-height: 120px;
  padding: 0;
}

.input-area textarea::placeholder {
  color: var(--text-muted);
}

.input-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 12px 12px; /* Extend bottom padding to fill to edge */
  border-top: none; /* Remove border to integrate better */
}

.left-controls {
  display: flex;
  align-items: center;
  gap: 8px; /* 0.5rem spacing between buttons */
}

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

.control-btn {
  display: flex;
  align-items: center;
  gap: 6px; /* 4px between icon and text */
  height: 30px; /* Slightly smaller height */
  padding: 0 12px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2); /* Hair-line border */
  border-radius: 9999px; /* Pill shape */
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500; /* Medium weight */
  cursor: pointer;
  transition: all 100ms cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  outline: none; /* Remove focus ring */
}

.control-btn:focus {
  outline: none; /* Remove blue focus ring */
}

.control-btn i {
  font-size: 16px; /* 16px mono-stroke icons */
}

.control-btn:hover {
  background: rgba(255, 255, 255, 0.06); /* 5-8% tint on hover */
  border-color: rgba(255, 255, 255, 0.3);
  color: var(--text-primary);
}

.control-btn:active {
  transform: scale(0.97); /* Quick scale-down */
  background: rgba(255, 255, 255, 0.1); /* 10-12% on active */
}

.control-btn.disabled {
  opacity: 0.5;
}

.control-btn.disabled:hover {
  background: rgba(255, 255, 255, 0.02); /* Much more subtle hover */
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--text-secondary);
}


/* Search button specific styling - blue when active */
.control-btn.search-toggle.active {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.4);
  color: var(--color-primary-blue-light);
}

.control-btn.search-toggle.active:hover {
  background: rgba(59, 130, 246, 0.2);
}

/* Prompt Version Indicator - Subtle Shimmer Effect */
.control-btn:has(#prompt-version-indicator) {
  position: relative;
  overflow: hidden;
}

/* Shimmer effect overlay */
.control-btn:has(#prompt-version-indicator)::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent 30%,
    rgba(255, 255, 255, 0.1) 50%,
    transparent 70%
  );
  transform: rotate(45deg);
  animation: shimmer 3s ease-in-out infinite;
}

/* Prompt indicator text */
#prompt-version-indicator {
  position: relative;
  z-index: 1;
  font-weight: 600;
}

/* Animations */
@keyframes shimmer {
  0% {
    transform: translateX(-100%) translateY(-100%) rotate(45deg);
  }
  100% {
    transform: translateX(100%) translateY(100%) rotate(45deg);
  }
}

.style-dropdown,
.model-dropdown {
  position: relative;
}

.dropdown-arrow {
  font-size: 12px;
  opacity: 0.7;
  transition: transform 100ms cubic-bezier(0.4, 0, 0.2, 1);
}

.style-dropdown.open .dropdown-arrow,
.model-dropdown.open .dropdown-arrow {
  transform: rotate(180deg);
}

.style-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  background: rgba(31, 41, 55, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 4px 0;
  min-width: 120px;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.3);
  z-index: 30;
}

.style-menu.hidden {
  display: none;
}

.style-option {
  display: block;
  width: 100%;
  padding: 10px 16px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  transition: background-color var(--transition-fast);
  text-align: left;
}

.style-option:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.style-option.active {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
  font-weight: 600;
}

/* For smaller screens - responsive width */
@media (max-width: 1200px) {
  .floating-input-panel {
    left: calc(255px + (100% - 255px) / 2); /* Keep sidebar offset */
    width: calc(100% - 48px - 255px);
    max-width: none;
    transform: translateX(-50%);
  }
}

@media (max-width: 768px) {
  .floating-input-panel {
    left: calc(255px + (100% - 255px) / 2); /* Keep sidebar offset on mobile too */
    width: calc(100% - 24px - 255px);
    padding: 12px 16px;
    transform: translateX(-50%);
  }
}

/* Empty state study guide */
.study-guide-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  max-width: 600px;
  text-align: center;
  opacity: 1;
  transition: opacity var(--transition-medium);
}

.study-guide-container.fade-out {
  opacity: 0;
  pointer-events: none;
}

.study-guide-headline {
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-6);
}

.study-guide-list {
  list-style: none;
  padding: 0;
  margin: 0;
  text-align: left;
}

.study-guide-item {
  background: var(--bg-glass);
  backdrop-filter: var(--backdrop-blur-sm);
  -webkit-backdrop-filter: var(--backdrop-blur-sm);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  color: var(--text-secondary);
  font-size: var(--text-lg);
  line-height: 1.6;
}

.study-guide-referral {
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border-secondary);
  color: var(--text-tertiary);
  font-size: var(--text-base);
}

/* Message containers on navy canvas */
.message-wrapper {
  max-width: 768px;
  margin: 0 auto var(--space-6);
  padding: 0 var(--space-4);
}

/* Override card styles for seamless canvas */
.message {
  margin: var(--space-4) auto;
  max-width: 768px;
}

/* Chat container and wrapper structure */
.chat-wrapper {
  background: #0F1929;
  width: 100%;
  height: 100vh; /* Full height, no extra */
  position: relative;
  display: flex;
  flex-direction: column;
  margin: 0;
}

#chat-controller {
  background: transparent;
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
}


.chat-wrapper:has(#chat-controller.hidden) {
  /* Ensure wrapper maintains dimensions */
  min-height: 100vh;
}

#chat-container {
  background: transparent; /* Transparent to show canvas color */
  width: 100%;
  max-width: 768px;
  margin: 0 auto;
  padding: 20px 20px 100px; /* Normal padding */
  flex: 1; /* Take remaining space */
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
}

/* Add invisible spacer after last message */
#chat-container::after {
  content: "";
  display: block;
  height: 400px; /* This pushes the last message up by 400px */
  width: 100%;
  pointer-events: none;
}

/* Message styling for conversation layout */
.message.user-message {
  margin-left: auto !important;
  margin-right: 0 !important;
  max-width: 60% !important;
  float: right !important;
  clear: both !important;
  margin-bottom: 24px !important;
  background: #1A2635 !important; /* Slightly lighter navy blue for user messages */
  backdrop-filter: blur(10px) !important;
  border-radius: 18px !important;
  padding: 12px 16px !important;
  box-shadow: var(--shadow-md) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.message.assistant-message {
  margin-left: 0 !important;
  margin-right: auto !important;
  max-width: 100% !important;
  float: left !important;
  clear: both !important;
  margin-bottom: 24px !important;
  background: transparent !important; /* No background for assistant */
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  color: var(--text-primary) !important;
}

.message {
  margin: 16px 0;
  display: block;
  width: auto;
}

/* Clear floats after messages */
#chat-container::after {
  content: "";
  display: table;
  clear: both;
}

/* Hide existing sticky input styles */
.sticky-chat-input {
  display: none;
}

/* Remove any container backgrounds */
.main-content {
  background: #0F1929; /* Match canvas color */
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Ensure sidebars don't cause scroll */
.sidebar, aside {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .floating-input-panel {
    width: calc(100% - 32px);
    bottom: 16px;
  }
  
  #chat-container {
    padding: 60px 16px 300px; /* Increased mobile bottom padding */
  }
  
  .study-guide-container {
    max-width: 100%;
  }
}

/* === VOICE FEATURES === */
/* Microphone Button */
.mic-button {
  background: var(--border-accent);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-full);
  width: 32px;
  height: 32px;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  position: relative;
  margin-right: 16px; 
}

.mic-button:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--color-primary-blue);
}

.mic-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.mic-button.recording {
  background: #1533e0;
  color: white;
  border-color: #1533e0;
  animation: pulse 1.5s infinite;
}

.mic-button.recording:hover {
  background: #2657dc;
  border-color: #2657dc;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

/* Audio Button */
.message-audio-btn {
  display: flex;
  align-items: center;
}

.audio-button {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-sm);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
}

.audio-button:hover {
  color: var(--color-primary-blue);
}

.audio-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.audio-button i {
  font-size: var(--text-base);
}

/* Audio playing indicator */
.audio-button .fa-pause {
  color: var(--color-primary-blue);
}

/* Audio button playing state */
.audio-button.playing {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: var(--radius-md);
}

.audio-button.playing:hover {
  background: rgba(59, 130, 246, 0.2);
  color: var(--color-primary-blue-light);
}

/* Message actions layout adjustment */
.message-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-2);
  flex-wrap: wrap;
}

/* Voice notification styles */
.voice-permission-notice {
  background: var(--bg-card);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  margin: var(--space-2) 0;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.voice-permission-notice i {
  color: var(--color-primary-blue);
}

/* Responsive adjustments for voice features */
@media (max-width: 768px) {
  .mic-button {
    width: 36px;
    height: 36px;
  }
  
  .message-actions {
    gap: var(--space-2);
  }
  
  .audio-button {
    padding: var(--space-1);
  }
}

/* === LIGHT MODE SPECIFIC OVERRIDES === */

/* Default dark mode body background */
body {
  background-color: #0F1929;
}

/* Light mode body background */
[data-theme="light"] body {
  background-color: #faf8f5 !important; /* Warm off-white */
}

/* Light mode chat canvas */
[data-theme="light"] .chat-canvas {
  background: #faf8f5 !important; /* Warm off-white */
}

[data-theme="light"] .chat-wrapper {
  background: #faf8f5 !important; /* Warm off-white */
}

[data-theme="light"] .main-content {
  background: #faf8f5 !important; /* Warm off-white */
}

/* Light mode message styling */
[data-theme="light"] .message.user-message {
  background: #3b82f6 !important; /* Keep blue for user messages */
  color: white !important;
  border: 1px solid rgba(59, 130, 246, 0.2) !important;
}

[data-theme="light"] .message.assistant-message {
  background: transparent !important;
  color: var(--text-primary) !important;
}

/* Light mode floating input panel */
[data-theme="light"] .floating-input-panel {
  background: rgba(255, 254, 249, 0.95) !important; /* Soft cream with transparency */
  border: 1px solid rgba(0, 0, 0, 0.12) !important;
  border-bottom: none !important;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.1) !important;
}

[data-theme="light"] .input-area textarea {
  color: var(--text-primary) !important;
}

[data-theme="light"] .input-area textarea::placeholder {
  color: var(--text-muted) !important;
}

/* Light mode control buttons */
[data-theme="light"] .control-btn {
  border: 1px solid rgba(0, 0, 0, 0.12) !important;
  color: var(--text-secondary) !important;
}

[data-theme="light"] .control-btn:hover {
  background: rgba(0, 0, 0, 0.04) !important;
  border-color: rgba(0, 0, 0, 0.2) !important;
  color: var(--text-primary) !important;
}

[data-theme="light"] .control-btn:active {
  background: rgba(0, 0, 0, 0.08) !important;
}

[data-theme="light"] .control-btn.search-toggle.active {
  background: rgba(59, 130, 246, 0.1) !important;
  border-color: rgba(59, 130, 246, 0.4) !important;
  color: var(--color-primary-blue) !important;
}

/* Light mode prompt indicator shimmer */
[data-theme="light"] .control-btn:has(#prompt-version-indicator)::before {
  background: linear-gradient(
    45deg,
    transparent 30%,
    rgba(255, 255, 255, 0.5) 50%,
    transparent 70%
  );
}

/* Light mode style menu */
[data-theme="light"] .style-menu {
  background: rgba(255, 254, 249, 0.98) !important; /* Soft cream with transparency */
  border: 1px solid rgba(0, 0, 0, 0.12) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15) !important;
}

[data-theme="light"] .style-option {
  color: var(--text-secondary) !important;
}

[data-theme="light"] .style-option:hover {
  background: rgba(0, 0, 0, 0.04) !important;
  color: var(--text-primary) !important;
}

[data-theme="light"] .style-option.active {
  background: rgba(0, 0, 0, 0.08) !important;
  color: var(--text-primary) !important;
}

/* Light mode sidebar */
[data-theme="light"] aside.sidebar {
  background-color: #fffef9 !important; /* Soft cream */
  border-right: 1px solid rgba(0, 0, 0, 0.12) !important;
}

[data-theme="light"] .sidebar-link {
  color: var(--text-secondary) !important;
}

[data-theme="light"] .sidebar-link:hover {
  background-color: rgba(0, 0, 0, 0.04) !important;
  color: var(--text-primary) !important;
}

/* Light mode header */
[data-theme="light"] header {
  background: rgba(255, 254, 249, 0.95) !important; /* Soft cream with transparency */
  border-bottom: 1px solid rgba(0, 0, 0, 0.12) !important;
  backdrop-filter: blur(8px) !important;
}

[data-theme="light"] header h1 {
  color: var(--text-primary) !important;
}

[data-theme="light"] header .text-gray-400 {
  color: var(--text-tertiary) !important;
}

/* Light mode forms and inputs */
[data-theme="light"] select,
[data-theme="light"] input[type="text"],
[data-theme="light"] textarea {
  background: var(--bg-secondary) !important;
  border: 1px solid var(--border-primary) !important;
  color: var(--text-primary) !important;
}

[data-theme="light"] select:focus,
[data-theme="light"] input[type="text"]:focus,
[data-theme="light"] textarea:focus {
  border-color: var(--color-primary-blue) !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
}

/* Light mode study guide */
[data-theme="light"] .study-guide-item {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-primary) !important;
  color: var(--text-secondary) !important;
}

[data-theme="light"] .study-guide-headline {
  color: var(--text-primary) !important;
}

/* Light mode study guide components */
[data-theme="light"] .study-guide-container-wide {
  color: var(--text-primary) !important;
}

[data-theme="light"] .flow-header-compact h1 {
  color: var(--text-primary) !important;
}

[data-theme="light"] .step-card-compact {
  background: rgba(255, 254, 249, 0.8) !important; /* Soft cream with transparency */
  border: 1px solid rgba(0, 0, 0, 0.1) !important;
  color: var(--text-secondary) !important;
}

[data-theme="light"] .step-card-compact:hover {
  background: rgba(255, 254, 249, 0.95) !important; /* Soft cream with transparency */
  border-color: rgba(0, 0, 0, 0.15) !important;
}

[data-theme="light"] .step-content-compact h3 {
  color: var(--text-primary) !important;
}

[data-theme="light"] .step-content-compact p,
[data-theme="light"] .step-content-compact .inline-features span {
  color: var(--text-tertiary) !important;
}

[data-theme="light"] .step-icon-compact {
  background: rgba(59, 130, 246, 0.1) !important;
  color: var(--color-primary-blue) !important;
}

/* Light mode study instructions */
[data-theme="light"] .study-instructions-compact {
  background: rgba(255, 254, 249, 0.6) !important; /* Soft cream with transparency */
  border: 1px solid rgba(0, 0, 0, 0.1) !important;
}

[data-theme="light"] .instructions-header {
  color: var(--text-primary) !important;
}

[data-theme="light"] .instructions-header h3 {
  color: var(--text-primary) !important;
}

[data-theme="light"] .instructions-header:hover {
  background: rgba(0, 0, 0, 0.04) !important;
}

[data-theme="light"] .instruction-section {
  background: rgba(255, 254, 249, 0.7) !important; /* Soft cream with transparency */
  color: var(--text-secondary) !important;
}

[data-theme="light"] .instruction-section h4,
[data-theme="light"] .instruction-section h5 {
  color: var(--text-primary) !important;
}

[data-theme="light"] .instruction-section p {
  color: var(--text-tertiary) !important;
}

/* Light mode study instruction specific colors */
[data-theme="light"] .text-blue-300 {
  color: var(--color-primary-blue) !important;
}

[data-theme="light"] .text-green-400 {
  color: #059669 !important;
}

[data-theme="light"] .text-gray-300,
[data-theme="light"] .text-gray-400 {
  color: var(--text-tertiary) !important;
}

[data-theme="light"] .bg-blue-900\/20 {
  background: rgba(59, 130, 246, 0.1) !important;
}

[data-theme="light"] .border-blue-700\/30 {
  border-color: rgba(59, 130, 246, 0.2) !important;
}

[data-theme="light"] .bg-gray-800 {
  background: rgba(0, 0, 0, 0.05) !important;
  border: 1px solid rgba(0, 0, 0, 0.1) !important;
}

/* Light mode chevron and icons */
[data-theme="light"] .text-gray-400 svg {
  color: var(--text-muted) !important;
}

/* Light mode welcome message components */
[data-theme="light"] .welcome-card {
  background: linear-gradient(135deg, #fffef9 0%, #faf8f5 100%) !important; /* Cream to warm off-white gradient */
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
}

[data-theme="light"] .welcome-greeting h2 {
  color: var(--text-primary) !important;
}

[data-theme="light"] .welcome-date {
  color: var(--text-tertiary) !important;
}

/* Light mode message actions */
[data-theme="light"] .feedback-btn {
  background: rgba(0, 0, 0, 0.04) !important;
  color: var(--text-muted) !important;
}

[data-theme="light"] .feedback-btn:hover {
  background-color: rgba(0, 0, 0, 0.08) !important;
}

[data-theme="light"] .feedback-btn.like:hover,
[data-theme="light"] .feedback-btn.like.active {
  color: #10b981 !important;
  background: rgba(16, 185, 129, 0.1) !important;
}

[data-theme="light"] .feedback-btn.dislike:hover,
[data-theme="light"] .feedback-btn.dislike.active {
  color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.1) !important;
}

/* Light mode theme toggle button */
.theme-toggle {
  position: relative;
  width: 50px;
  height: 24px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
}

.theme-toggle::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: transform var(--transition-fast);
  transform: translateX(0);
  box-shadow: var(--shadow-sm);
}

[data-theme="light"] .theme-toggle::before {
  transform: translateX(26px);
  background: var(--color-primary-blue);
}

.theme-toggle i {
  font-size: 12px;
  color: var(--text-muted);
  z-index: 1;
}

.theme-toggle:hover {
  background: var(--bg-secondary);
}

/* Light mode additional study guide overrides */
[data-theme="light"] .onboarding-flow-compact,
[data-theme="light"] .flow-steps-compact {
  color: var(--text-secondary) !important;
}

[data-theme="light"] .instructions-content-compact {
  background: rgba(255, 254, 249, 0.4) !important; /* Soft cream with transparency */
}

[data-theme="light"] .grid > div h5 {
  color: var(--text-primary) !important;
}

[data-theme="light"] .grid > div p {
  color: var(--text-tertiary) !important;
}

/* Light mode referral notice */
[data-theme="light"] .mb-3.p-2 .flex.items-center span {
  color: var(--text-muted) !important;
}

[data-theme="light"] .mb-3.p-2 .flex.items-center a {
  color: var(--color-primary-blue) !important;
}

/* End of file adjustment */
.study-guide-container {
    max-width: calc(100% - 32px);
}