:root {
  /* Herb-Inspired Calming Color Palette */
  --ahi-primary: rgba(76, 140, 85, 0.95);    /* Soft Sage Green */
  --ahi-secondary: rgba(147, 177, 166, 0.9); /* Muted Eucalyptus */
  --ahi-accent: rgba(92, 153, 102, 0.95);    /* Fresh Herb Green */
  --ahi-earth: rgba(141, 124, 87, 0.9);      /* Warm Earth */
  --ahi-light: rgba(247, 249, 246, 0.98);    /* Off-White */
  --ahi-dark: rgba(34, 42, 34, 0.95);        /* Deep Forest */
  --ahi-shadow: rgba(0, 0, 0, 0.08);

  /* Semantic Colors */
  --ahi-healing: rgba(142, 198, 163, 0.95);  /* Healing Green */
  --ahi-calm: rgba(218, 229, 217, 0.95);     /* Calming Mint */
  --ahi-focus: rgba(106, 153, 78, 0.95);     /* Focus Green */
}

/* Base Styles */
body {
  font-family: 'Inter', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bs-dark);
  color: var(--bs-light);
  line-height: 1.6;
  -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
}

/* Header & Navigation */
.navbar {
  background-color: var(--ahi-primary);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1rem 0;
}

.navbar-brand {
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--ahi-light);
}

.feather-small {
  width: 18px;
  height: 18px;
  stroke-width: 2;
  vertical-align: -0.125em;
}

.nav-link {
  color: var(--ahi-light);
  position: relative;
  padding: 0.5rem 1rem;
  transition: color 0.3s ease;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--ahi-healing);
  transition: width 0.3s ease;
}

.nav-link:hover::after {
  width: 100%;
}

/* Welcome Section */
.welcome-guidance {
  max-width: 800px;
  margin: 2rem auto;
  padding: 2.5rem;
  background-color: rgba(255, 255, 255, 0.03);
  border-radius: 1.5rem;
  box-shadow: 0 4px 12px var(--ahi-shadow);
}

.support-areas {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 2rem 0;
}

.support-areas .badge {
  font-size: 1rem;
  padding: 0.75rem 1.25rem;
  background-color: var(--ahi-primary);
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: all 0.3s ease;
}

.support-areas .badge:hover {
  transform: translateY(-2px);
  background-color: var(--ahi-accent);
}

/* Mood Check */
.mood-options {
  display: flex;
  gap: 0.5rem;
}

.mood-btn {
  font-size: 1.5rem;
  padding: 0.25rem;
  transition: transform 0.2s ease;
}

.mood-btn:hover {
  transform: scale(1.2);
}

.quick-prompts select {
  background-color: var(--ahi-primary);
  border-color: var(--ahi-healing);
  color: var(--ahi-light);
}

.quick-prompts select:focus {
  box-shadow: 0 0 0 0.25rem rgba(142, 198, 163, 0.25);
}

.theme-toggle button {
  width: 38px;
  height: 38px;
  padding: 0.375rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.voice-selector select {
  background-color: var(--ahi-primary);
  border-color: var(--ahi-healing);
  color: var(--ahi-light);
  min-width: 160px;
}

.voice-selector select:focus {
  box-shadow: 0 0 0 0.25rem rgba(142, 198, 163, 0.25);
}

/* Speaking animation */
.message.speaking {
  position: relative;
  animation: pulse 2s infinite;
}

.voice-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background-color: var(--ahi-healing);
  transition: width 0.3s ease-out;
}

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

/* Animated thinking indicator */
.thinking-animation {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 80px;
  margin: 10px auto;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #2c3e50, #1a2a38);
  border-radius: 12px;
  box-shadow: 0 4px 22px rgba(0, 0, 0, 0.3);
}

/* Make Thinking animation more visible and persistent */
.thinking-message {
  margin: 15px auto 30px auto;
  position: sticky;
  bottom: 20px;
  z-index: 5;
  opacity: 0.95;
  max-width: 90%;
}

.galaxy-container {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.star {
  position: absolute;
  width: 3px;
  height: 3px;
  background-color: white;
  border-radius: 50%;
  opacity: 0;
  animation: twinkle 3s infinite;
}

.planet {
  position: absolute;
  border-radius: 50%;
  animation: orbit 15s linear infinite;
}

.planet-1 {
  width: 8px;
  height: 8px;
  background-color: #3498db;
  animation-duration: 20s;
}

.planet-2 {
  width: 12px;
  height: 12px;
  background-color: #e74c3c;
  animation-duration: 15s;
}

.planet-3 {
  width: 6px;
  height: 6px;
  background-color: #f1c40f;
  animation-duration: 25s;
}

.thinking-text {
  position: absolute;
  color: white;
  font-weight: 400;
  font-size: 16px;
  letter-spacing: 1px;
  animation: pulse 1.5s infinite;
  z-index: 2;
  text-shadow: 0 0 4px rgba(0,0,0,0.5);
}

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

@keyframes orbit {
  0% { transform: rotate(0deg) translateX(35px) rotate(0deg); }
  100% { transform: rotate(360deg) translateX(35px) rotate(-360deg); }
}

/* Mobile-friendly improvements */
@media (max-width: 768px) {
  .thinking-animation {
    height: 70px;
    width: 90%;
  }
  
  .thinking-text {
    font-size: 14px;
  }
}

/* Mobile-first container */
.chat-container {
  height: 100vh;
  height: -webkit-fill-available; /* iOS viewport fix */
  display: flex;
  flex-direction: column;
  background-color: var(--ahi-dark);
  transition: background-color 0.3s ease;
  overflow: hidden;
  max-width: 100vw; /* Prevent horizontal overflow */
  position: relative;
  -webkit-tap-highlight-color: transparent; /* Remove tap highlight */
}

/* Enhanced Message Styling */
.chat-messages {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch; /* Smooth scroll on iOS */
  scroll-behavior: smooth;
  padding-bottom: 110px; /* Space for input area */
  overscroll-behavior-y: contain; /* Prevent scroll bleed */
  will-change: scroll-position; /* Hardware acceleration hint */
  display: flex;
  flex-direction: column;
}

.message {
  max-width: 95%; /* Wider messages on mobile */
  margin-bottom: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: 1.25rem;
  font-size: 1rem;
  line-height: 1.5;
  animation: messageAppear 0.3s ease-out;
  word-wrap: break-word; /* Prevent text overflow */
  touch-action: pan-y; /* Better touch handling */
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); /* Subtle shadow for depth */
  backface-visibility: hidden; /* Reduce jagged edges during animations */
  transform: translate3d(0, 0, 0); /* Force GPU acceleration */
  transition: transform 0.2s ease;
}

.user-message {
  align-self: flex-end;
  background-color: var(--ahi-primary);
  color: white;
  margin-left: auto;
  border-bottom-right-radius: 0.25rem;
}

.assistant-message {
  align-self: flex-start;
  background-color: #3a3b3c;
  color: white;
  margin-right: auto;
  border-bottom-left-radius: 0.25rem;
}

.system-message, .error-message {
  align-self: center;
  background-color: rgba(255, 204, 0, 0.15);
  color: #ffcc00;
  margin: 1rem auto;
  border-radius: 0.75rem;
  padding: 0.75rem 1.25rem;
  max-width: 90%;
  text-align: center;
  font-size: 0.9rem;
  border: 1px solid rgba(255, 204, 0, 0.3);
}

.error-message {
  background-color: rgba(255, 102, 102, 0.15);
  color: #ff6666;
  border: 1px solid rgba(255, 102, 102, 0.3);
}

.message:active {
  transform: scale(0.99); /* Subtle feedback on touch */
}

/* Use more readable system fonts and optimize for legibility */
@media (max-width: 768px) {
  .message {
    font-size: 16px; /* Minimum readable size for most users */
    line-height: 1.5;
    padding: 0.75rem 0.85rem;
    margin-bottom: 0.65rem;
  }
}

/* Improved Input Area */
.chat-input {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.75rem;
  background-color: var(--bs-dark);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 1000;
  transition: transform 0.3s ease;
  will-change: transform; /* Hardware acceleration hint */
}

.input-group {
  display: flex;
  align-items: center;
  background: rgba(40, 42, 45, 0.95);
  border-radius: 1.5rem;
  padding: 0.5rem;
  gap: 0.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); /* Subtle shadow for depth */
}

.input-group .form-control {
  background: transparent;
  border: none;
  color: var(--bs-light);
  font-size: 1rem;
  padding: 0.75rem;
  height: auto;
  flex: 1;
  -webkit-appearance: none; /* Remove iOS styling */
  -moz-appearance: none;
  appearance: none;
}

.input-group .form-control:focus {
  box-shadow: none;
  outline: none;
  background: transparent;
}

.input-group .btn {
  width: 48px; /* Larger touch target */
  height: 48px; /* Larger touch target */
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--bs-light);
  opacity: 0.9;
  transition: all 0.2s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent; /* Remove tap highlight */
}

.input-group .btn:active {
  transform: scale(0.95);
  background: rgba(255, 255, 255, 0.2);
}

.input-group .btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
}

.input-group .btn i {
  width: 22px;
  height: 22px;
}

/* Keep input area visible during keyboard appearance on mobile */
@media (max-width: 768px) {
  .chat-input {
    position: sticky;
  }
}

/* Hide mood tracking on mobile */
@media (max-width: 768px) {
  .mood-tracking {
    display: none;
  }

  .chat-input {
    padding: 0.5rem;
  }

  .input-group {
    margin: 0;
  }

  #messageInput {
    font-size: 1rem;
  }

  /* Ensure chat messages don't get hidden behind input */
  #chatMessages {
    padding-bottom: 80px;
  }
}

/* Adjust spacing for messages to not overlap with input */
#chatMessages {
  padding-bottom: 120px;
}

/* Enhanced touch targets */
.btn {
  min-height: 44px; /* iOS minimum touch target */
  padding: 0.75rem 1.25rem;
  margin: 0.25rem;
  touch-action: manipulation;
}

/* Improved Mobile Navigation */
.navbar {
  padding: 0.5rem;
  position: sticky;
  top: 0;
  z-index: 1030;
}

.navbar-brand {
  font-size: 1.25rem;
  padding: 0.5rem;
}

.nav-link {
  padding: 0.75rem 1rem;
  margin: 0.25rem;
  min-height: 44px; /* Minimum touch target size */
  display: flex;
  align-items: center;
}

/* Mobile-optimized Feature Tabs */
.feature-tabs {
  display: flex;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.5rem;
  gap: 0.5rem;
  background-color: var(--ahi-primary);
  margin-bottom: 1rem;
  position: sticky;
  top: 56px; /* Height of navbar */
  z-index: 1020;
  scrollbar-width: none; /* Firefox */
}

.feature-tabs::-webkit-scrollbar {
  display: none; /* Hide scrollbar for Chrome/Safari */
}

.feature-tab {
  flex: 0 0 auto;
  padding: 0.75rem 1rem;
  white-space: nowrap;
  border-radius: 0.5rem;
  min-height: 44px; /* Minimum touch target size */
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.feature-tab:active {
  transform: scale(0.95);
}


/* Mobile Responsive Support Areas */
.support-areas {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.5rem;
  padding: 0.5rem;
}

.support-areas .badge {
  width: 100%;
  text-align: center;
  padding: 0.75rem;
  font-size: 0.9rem;
}

/* Mobile-friendly Mood Options */
.mood-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
  gap: 0.5rem;
  padding: 0.5rem;
}

.mood-btn {
  font-size: 1.25rem;
  padding: 0.5rem;
  min-height: 44px;
}

/* Enhanced Mobile Media Queries */
@media (max-width: 768px) {
  .welcome-guidance {
    margin: 0.5rem;
    padding: 1rem;
  }

  .message {
    max-width: 95%;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
  }

  .chat-input {
    padding: 1rem;
  }

  .navbar-brand {
    font-size: 1.1rem;
  }

  /* Stack elements vertically on mobile */
  .voice-selector,
  .theme-toggle {
    width: 100%;
    margin-bottom: 0.5rem;
  }
  .input-group {
    flex-wrap: nowrap;
  }

  .input-group .btn {
    padding: 0.5rem;
  }

  .input-group .form-control {
    font-size: 1rem;
    padding: 0.5rem 1rem;
  }
}

/* Mobile-friendly animations */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Safe area insets for modern mobile devices */
@supports (padding: max(0px)) {
  .chat-input {
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }
}

/* Mental Health & Addiction Sections */
.mental-health-section,
.addiction-support-section {
  background-color: var(--ahi-primary);
  padding: 2rem;
  border-radius: 1.5rem;
  margin-bottom: 2rem;
}

/* Age Indicator */
.age-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 1rem;
}

.age-indicator .badge {
  font-size: 1.2rem;
  padding: 0.5rem 1rem;
  background-color: var(--ahi-primary);
  border: 2px solid rgba(255, 255, 255, 0.15);
  transition: all 0.3s ease;
}

/* Card improvements */
.card {
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 1rem;
  padding: 1.5rem;
  margin-bottom: 1rem;
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.card:hover {
  transform: translateY(-3px);
  background-color: rgba(255, 255, 255, 0.08);
  border-color: var(--ahi-healing);
}

/* Resource card specific improvements */
.resource-card {
  transition: all 0.2s ease;
}

.resource-card .btn {
  transition: all 0.2s ease;
  touch-action: manipulation;
}

.resource-card .btn:active {
  transform: scale(0.95);
}

/* Touch-friendly phone buttons */
.btn-outline-primary.rounded-pill,
.btn-outline-info.rounded-pill {
  padding: 0.5rem 1rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  margin: 0;
  border-width: 2px;
  font-weight: 500;
}

.btn-outline-primary.rounded-pill:active,
.btn-outline-info.rounded-pill:active {
  transform: scale(0.96);
}

/* Responsive improvements */
@media (max-width: 768px) {
  .age-indicator .badge {
    font-size: 1rem;
    padding: 0.4rem 0.8rem;
  }

  .card {
    padding: 1rem;
    margin-bottom: 0.75rem;
  }
}

/* Animations */
@keyframes messageAppear {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Enhanced Accessibility & Responsiveness */
.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

[role="alert"] {
  border: 2px solid currentColor;
  padding: 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
}

@media (max-width: 768px) {
  .message {
    max-width: 90%;
  }

  .welcome-guidance {
    margin: 1rem;
    padding: 1.5rem;
  }

  .support-areas {
    gap: 0.5rem;
  }
}

/* Dark mode optimization */
[data-bs-theme="dark"] {
  --bs-body-bg: var(--ahi-dark);
  --bs-body-color: var(--ahi-light);
}

/* Focus states for accessibility */
button:focus,
a:focus {
  outline: 3px solid var(--ahi-healing);
  outline-offset: 2px;
}

/* Coping Strategies */
.coping-strategies {
  background-color: var(--ahi-primary);
  border-radius: 1rem;
  padding: 1.5rem;
}

.strategy-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.strategy-card {
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 0.75rem;
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: transform 0.3s ease;
}

.strategy-card:hover {
  transform: translateY(-3px);
}

/* Screen reader only elements */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Progress tracking styles */
.progress-tracking-container {
  padding: 20px 0;
}

.progress-tracking-container .card {
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border: none;
  background-color: rgba(255, 255, 255, 0.08);
}

.progress-tracking-container .card-header {
  background-color: rgba(0, 0, 0, 0.15);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding: 15px 20px;
  color: var(--ahi-light);
}

.chart-container {
  padding: 10px;
}

.stat-item .progress {
  height: 8px;
  border-radius: 10px;
}

.trend-indicator {
  margin-top: 5px;
  font-size: 0.8rem;
}

.form-range::-webkit-slider-thumb {
  cursor: pointer;
}

.common-tags {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 15px;
}

.badge {
  font-weight: 500;
  padding: 5px 10px;
}

/* Form styling for progress page */
.progress-tracking-container .form-group label {
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--ahi-light);
}

.progress-tracking-container .form-control, 
.progress-tracking-container .form-select {
  border-radius: 8px;
  border-color: rgba(255, 255, 255, 0.15);
  background-color: rgba(0, 0, 0, 0.2);
  color: var(--ahi-light);
}

.progress-tracking-container .form-control:focus, 
.progress-tracking-container .form-select:focus {
  box-shadow: 0 0 0 0.25rem rgba(142, 198, 163, 0.25);
  background-color: rgba(0, 0, 0, 0.3);
}

/* Button styling for progress page */
.progress-tracking-container .btn-primary {
  border-radius: 8px;
  padding: 8px 16px;
  background-color: var(--ahi-primary);
  border-color: var(--ahi-healing);
}

.progress-tracking-container .btn-primary:hover {
  background-color: var(--ahi-accent);
}

.progress-tracking-container .btn-outline-primary {
  border-color: var(--ahi-healing);
  color: var(--ahi-light);
}

.progress-tracking-container .btn-outline-primary:hover {
  background-color: var(--ahi-primary);
  color: var(--ahi-light);
}

.progress-tracking-container .btn-outline-primary.active {
  background-color: var(--ahi-primary);
  color: var(--ahi-light);
}/* Animated thinking indicator */
.thinking-animation {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 60px;
    margin: 10px auto;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #2c3e50, #1a2a38);
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.galaxy-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.star {
    position: absolute;
    width: 2px;
    height: 2px;
    background-color: white;
    border-radius: 50%;
    opacity: 0;
    animation: twinkle 2s infinite;
}

.planet {
    position: absolute;
    border-radius: 50%;
    animation: orbit 15s linear infinite;
}

.planet-1 {
    width: 6px;
    height: 6px;
    background-color: #3498db;
    animation-duration: 20s;
}

.planet-2 {
    width: 8px;
    height: 8px;
    background-color: #e74c3c;
    animation-duration: 15s;
}

.planet-3 {
    width: 4px;
    height: 4px;
    background-color: #f1c40f;
    animation-duration: 25s;
}

.thinking-text {
    position: absolute;
    color: white;
    font-weight: 300;
    letter-spacing: 1px;
    animation: pulse 1.5s infinite;
    z-index: 2;
}

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

@keyframes orbit {
    0% { transform: rotate(0deg) translateX(30px) rotate(0deg); }
    100% { transform: rotate(360deg) translateX(30px) rotate(-360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}
/* Improved message container scroll behavior */
.chat-container {
    height: calc(100vh - 180px);
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
}

#chatMessages {
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 10px;
    padding-bottom: 90px; /* Extra space at bottom to see latest messages better */
}

/* Make Thinking animation more visible and persistent */
.thinking-message {
    margin: 15px 0 30px 0;
    position: sticky;
    bottom: 20px;
    z-index: 5;
    opacity: 0.95;
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
}

.thinking-animation {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 80px; /* Increased height */
    margin: 10px auto;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #2c3e50, #1a2a38);
    border-radius: 12px; /* Slightly more rounded */
    box-shadow: 0 4px 22px rgba(0, 0, 0, 0.3); /* Enhanced shadow */
}

.galaxy-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.star {
    position: absolute;
    width: 3px; /* Slightly larger stars */
    height: 3px;
    background-color: white;
    border-radius: 50%;
    opacity: 0;
    animation: twinkle 3s infinite; /* Longer animation */
}

.planet {
    position: absolute;
    border-radius: 50%;
    animation: orbit 15s linear infinite;
}

.planet-1 {
    width: 8px; /* Larger planets */
    height: 8px;
    background-color: #3498db;
    animation-duration: 20s;
}

.planet-2 {
    width: 12px;
    height: 12px;
    background-color: #e74c3c;
    animation-duration: 15s;
}

.planet-3 {
    width: 6px;
    height: 6px;
    background-color: #f1c40f;
    animation-duration: 25s;
}

.thinking-text {
    position: absolute;
    color: white;
    font-weight: 400; /* Slightly bolder */
    font-size: 16px; /* Larger text */
    letter-spacing: 1px;
    animation: pulse 1.5s infinite;
    z-index: 2;
    text-shadow: 0 0 4px rgba(0,0,0,0.5); /* Text shadow for better visibility */
}

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

@keyframes orbit {
    0% { transform: rotate(0deg) translateX(35px) rotate(0deg); } /* Larger orbit radius */
    100% { transform: rotate(360deg) translateX(35px) rotate(-360deg); }
}

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

/* Mobile-friendly improvements */
@media (max-width: 768px) {
    .chat-container {
        height: calc(100vh - 140px);
        padding: 10px;
    }
    
    .message {
        margin: 10px 0;
        max-width: 95%;
        font-size: 15px;
    }
    
    .thinking-animation {
        height: 70px;
        width: 90%;
    }
    
    .thinking-text {
        font-size: 14px;
    }
    
    .input-container {
        padding: 12px;
    }
    
    .send-button, .mic-button {
        width: 44px;
        height: 44px;
    }
    
    /* Make chat input more touch-friendly */
    #messageInput {
        font-size: 16px; /* iOS optimal size to prevent zoom */
        padding: 12px;
        border-radius: 20px;
    }
    
    /* Add some haptic feedback styles */
    .send-button:active, .mic-button:active {
        transform: scale(0.92);
        transition: transform 0.1s;
    }
}

/* Better visibility for AI responses on smaller screens */
@media (max-width: 480px) {
    .ai-message {
        max-width: 92%;
        padding: 14px;
        margin-left: 8px;
    }
    
    .user-message {
        max-width: 92%;
        padding: 14px;
        margin-right: 8px;
    }
}
/* Animated thinking indicator */
.thinking-animation {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 80px;
  margin: 10px auto;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #2c3e50, #1a2a38);
  border-radius: 12px;
  box-shadow: 0 4px 22px rgba(0, 0, 0, 0.3);
}

/* Make Thinking animation more visible and persistent */
.thinking-message {
  margin: 15px auto 30px auto;
  position: sticky;
  bottom: 20px;
  z-index: 5;
  opacity: 0.95;
  max-width: 90%;
}

.galaxy-container {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.star {
  position: absolute;
  width: 3px;
  height: 3px;
  background-color: white;
  border-radius: 50%;
  opacity: 0;
  animation: twinkle 3s infinite;
}

.planet {
  position: absolute;
  border-radius: 50%;
  animation: orbit 15s linear infinite;
}

.planet-1 {
  width: 8px;
  height: 8px;
  background-color: #3498db;
  animation-duration: 20s;
}

.planet-2 {
  width: 12px;
  height: 12px;
  background-color: #e74c3c;
  animation-duration: 15s;
}

.planet-3 {
  width: 6px;
  height: 6px;
  background-color: #f1c40f;
  animation-duration: 25s;
}

.thinking-text {
  position: absolute;
  color: white;
  font-weight: 400;
  font-size: 16px;
  letter-spacing: 1px;
  animation: pulse 1.5s infinite;
  z-index: 2;
  text-shadow: 0 0 4px rgba(0,0,0,0.5);
}

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

@keyframes orbit {
  0% { transform: rotate(0deg) translateX(35px) rotate(0deg); }
  100% { transform: rotate(360deg) translateX(35px) rotate(-360deg); }
}

/* Mobile-friendly improvements */
@media (max-width: 768px) {
  .thinking-animation {
    height: 70px;
    width: 90%;
  }
  
  .thinking-text {
    font-size: 14px;
  }
}
/* Fix for message container to ensure proper scrolling and visibility */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 60px); /* Adjust height to account for header */
  overflow: hidden;
  position: relative;
}

#chatMessages {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  padding-bottom: 120px; /* Extra padding to ensure messages aren't hidden */
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* Fixed position for the input area at the bottom */
.chat-input {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bs-dark);
  padding: 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 100;
  box-shadow: 0 -5px 10px rgba(0, 0, 0, 0.2);
}

/* Updated thinking message positioning */
.thinking-message {
  position: fixed;
  bottom: 90px; /* Position above the input area */
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  max-width: 80%;
  margin: 0 auto;
}

/* Mobile optimizations */
@media (max-width: 768px) {
  .chat-container {
    height: calc(100vh - 50px);
  }
  
  #chatMessages {
    padding-bottom: 100px;
  }
  
  .chat-input {
    padding: 10px;
  }
  
  .thinking-message {
    bottom: 80px;
    max-width: 90%;
  }
}
/* Fix for message container to ensure proper scrolling and visibility */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 60px); /* Adjust height to account for header */
  overflow: hidden;
  position: relative;
}

#chatMessages {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  padding-bottom: 120px; /* Extra padding to ensure messages aren't hidden */
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* Fixed position for the input area at the bottom */
.chat-input {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--dark, #212529);
  padding: 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 100;
  box-shadow: 0 -5px 10px rgba(0, 0, 0, 0.2);
}

/* Updated thinking message positioning */
.thinking-message {
  position: fixed;
  bottom: 90px; /* Position above the input area */
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  max-width: 80%;
  margin: 0 auto;
}

/* Ensure messages are not hidden */
.message {
  margin-bottom: 15px;
  max-width: 85%;
  clear: both;
}

/* Mobile optimizations */
@media (max-width: 768px) {
  .chat-container {
    height: calc(100vh - 50px);
  }
  
  #chatMessages {
    padding-bottom: 100px;
  }
  
  .chat-input {
    padding: 10px;
  }
  
  .thinking-message {
    bottom: 80px;
    max-width: 90%;
  }
}
/* Chat layout with fixed header, scrollable messages, and fixed input */
.chat-layout {
    height: calc(100vh - 120px);
    margin: 0;
}

.chat-column {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0;
    position: relative;
    overflow: hidden;
}

.chat-header {
    padding: 15px;
    background-color: rgba(33, 37, 41, 0.95);
    z-index: 10;
}

.messages-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    position: relative;
    scroll-behavior: smooth;
}

.chat-messages {
    padding: 15px;
    padding-bottom: 100px; /* Space for input area */
}

.chat-input-wrapper {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--dark, #212529);
    padding: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1000;
    width: 100%;
    max-width: 75%; /* Match column width */
}

@media (max-width: 767px) {
    .chat-input-wrapper {
        max-width: 100%;
    }
}

/* Message styles */
.message {
    margin-bottom: 15px;
    max-width: 85%;
    clear: both;
}

.user-message {
    float: right;
    background-color: #28a745;
    color: white;
    border-radius: 18px 18px 0 18px;
    padding: 10px 15px;
    align-self: flex-end;
}

.ai-message {
    float: left;
    background-color: #343a40;
    color: white;
    border-radius: 18px 18px 18px 0;
    padding: 10px 15px;
    align-self: flex-start;
}

.system-message {
    background-color: #6c757d;
    color: white;
    border-radius: 18px;
    padding: 10px 15px;
    margin: 10px auto;
    text-align: center;
    max-width: 70%;
    clear: both;
}

.error-message {
    background-color: #dc3545 !important;
}

/* Thinking animation container */
.thinking-container {
    position: relative;
    width: 100%;
    height: 0;
    z-index: 90;
}

.thinking-message {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(33, 37, 41, 0.7);
    border-radius: 18px;
    padding: 15px;
    max-width: 80%;
    margin: 0 auto;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
}

/* Galaxy animation */
.galaxy-container {
    position: relative;
    width: 200px;
    height: 100px;
    margin: 0 auto;
    overflow: hidden;
}

.star {
    position: absolute;
    background-color: white;
    width: 2px;
    height: 2px;
    border-radius: 50%;
    animation: twinkle 3s infinite;
}

.planet {
    position: absolute;
    border-radius: 50%;
    animation: orbit 20s infinite linear;
}

.planet-1 {
    width: 10px;
    height: 10px;
    background-color: #64c1ff;
    animation-duration: 15s;
}

.planet-2 {
    width: 8px;
    height: 8px;
    background-color: #ff6584;
    animation-duration: 25s;
}

.planet-3 {
    width: 12px;
    height: 12px;
    background-color: #84ff65;
    animation-duration: 35s;
}

@keyframes twinkle {
    0% { opacity: 0.3; }
    50% { opacity: 1; }
    100% { opacity: 0.3; }
}

@keyframes orbit {
    0% {
        transform: rotate(0deg) translateX(40px) rotate(0deg);
    }
    100% {
        transform: rotate(360deg) translateX(40px) rotate(-360deg);
    }
}

.thinking-text {
    text-align: center;
    margin-top: 10px;
    color: white;
}

/* Record button animation */
.recording-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    background-color: #dc3545;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

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

/* Make input buttons more touch-friendly */
.input-group .btn {
    padding: 8px 12px;
    font-size: 1.1rem;
}

/* Make sure the forms look good */
input, button, .form-control {
    border-radius: 18px;
}

.btn {
    border-radius: 18px;
}

/* Clear the floats after messages */
#chatMessages:after {
    content: "";
    display: table;
    clear: both;
}
/* Chat container */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 110px);
  position: relative;
}

/* Messages container */
#chatMessages {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  padding-bottom: 80px;
  scroll-behavior: smooth;
}

/* Chat input wrapper - fixed at bottom */
.chat-controls {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: var(--bs-dark);
  padding: 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 100;
  width: 100%;
}

/* Message styles */
.message {
  margin-bottom: 15px;
  max-width: 80%;
  clear: both;
}

.user-message {
  float: right;
  background-color: #28a745;
  color: white;
  border-radius: 18px 18px 0 18px;
  padding: 10px 15px;
}

.ai-message {
  float: left;
  background-color: #343a40;
  color: white;
  border-radius: 18px 18px 18px 0;
  padding: 10px 15px;
}

.system-message {
  background-color: #6c757d;
  color: white;
  border-radius: 18px;
  padding: 10px 15px;
  margin: 10px auto;
  text-align: center;
  clear: both;
  max-width: 60%;
}

.error-message {
  background-color: #dc3545 !important;
}

/* Galaxy animation for thinking message */
.thinking-message {
  margin: 0 auto;
  max-width: 250px;
  text-align: center;
  clear: both;
}

.galaxy-container {
  position: relative;
  width: 200px;
  height: 100px;
  margin: 0 auto;
  overflow: hidden;
}

.star {
  position: absolute;
  background-color: white;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  animation: twinkle 3s infinite;
}

.planet {
  position: absolute;
  border-radius: 50%;
  animation: orbit 20s infinite linear;
}

.planet-1 {
  width: 10px;
  height: 10px;
  background-color: #64c1ff;
  animation-duration: 15s;
}

.planet-2 {
  width: 8px;
  height: 8px;
  background-color: #ff6584;
  animation-duration: 25s;
}

.planet-3 {
  width: 12px;
  height: 12px;
  background-color: #84ff65;
  animation-duration: 35s;
}

@keyframes twinkle {
  0% { opacity: 0.3; }
  50% { opacity: 1; }
  100% { opacity: 0.3; }
}

@keyframes orbit {
  0% {
    transform: rotate(0deg) translateX(40px) rotate(0deg);
  }
  100% {
    transform: rotate(360deg) translateX(40px) rotate(-360deg);
  }
}

.thinking-text {
  text-align: center;
  margin-top: 10px;
  color: white;
}

/* Recording indicator */
.recording-indicator {
  display: inline-block;
  width: 10px;
  height: 10px;
  background-color: #dc3545;
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

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

/* Clear floats */
#chatMessages:after {
  content: "";
  display: table;
  clear: both;
}

/* Mobile optimizations */
@media (max-width: 768px) {
  .chat-container {
    height: calc(100vh - 90px);
  }
  
  .message {
    max-width: 90%;
  }
  
  .system-message {
    max-width: 80%;
  }
}
