/* Font import moved to index.html for non-blocking page load */

/* Color Variables and Themes - Green Theme Update */
:root {
  --bg-primary: #f4fbf7;
  --bg-secondary: rgba(240, 253, 244, 0.5);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  
  --color-green-50: #f0fdf4;
  --color-green-100: #dcfce7;
  --color-green-500: #22c55e;
  --color-green-600: #16a34a;
  --color-green-700: #15803d;
  
  --accent-primary: #10b981; /* Emerald 500 */
  --accent-primary-rgb: 16, 185, 129;
  --accent-secondary: #059669; /* Emerald 600 */
  --accent-secondary-rgb: 5, 150, 105;
  --accent-light: #f0fdf4; /* Mint 50 */
  --accent-light-rgb: 240, 253, 244;
  
  --success: #10b981;
  --success-light: #ecfdf5;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  
  --border-color: rgba(16, 185, 129, 0.18);
  --border-focus: #10b981;
  
  --glass-bg: rgba(240, 253, 244, 0.75);
  --glass-border: rgba(16, 185, 129, 0.22);
  --glass-shadow: 0 12px 32px 0 rgba(16, 185, 129, 0.06);
  
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode Overrides */
body.dark-mode {
  --bg-primary: #030705;
  --bg-secondary: rgba(6, 20, 14, 0.45);
  --text-primary: #f3f4f6;
  --text-secondary: #a3a3a3;
  
  --accent-primary: #10b981;
  --accent-light: rgba(16, 185, 129, 0.15);
  --border-color: rgba(16, 185, 129, 0.25);
  --border-focus: #10b981;
  
  --glass-bg: rgba(6, 18, 12, 0.65);
  --glass-border: rgba(16, 185, 129, 0.3);
  --glass-shadow: 0 8px 32px 0 rgba(16, 185, 129, 0.04);
  
  --color-green-50: #032014;
  --color-green-100: #053320;
  --accent-light-rgb: 16, 185, 129;

  background: radial-gradient(circle at 50% 50%, rgba(16, 185, 129, 0.08) 0%, #050b08 70%, #010202 100%) !important;
}

/* Glowing background blobs for dark mode */
body.dark-mode::before,
body.dark-mode::after {
  content: "";
  position: fixed;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.12;
  pointer-events: none;
  z-index: -1;
}

body.dark-mode::before {
  background: var(--accent-primary);
  top: -100px;
  right: -100px;
}

body.dark-mode::after {
  background: #047857;
  bottom: -150px;
  left: -150px;
}

/* Reset & Global Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  background-image: radial-gradient(circle at 10% 20%, rgba(16, 185, 129, 0.02) 0%, rgba(248, 250, 252, 1) 90%);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background-color var(--transition-normal), color var(--transition-normal);
  position: relative;
}

button, input, select, textarea {
  font-family: inherit;
}

a {
  text-decoration: none;
  color: inherit;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* Onboarding Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.onboarding-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  width: 90%;
  max-width: 500px;
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
  transform: scale(0.9);
  transition: transform var(--transition-normal);
}

.modal-overlay.active .onboarding-card {
  transform: scale(1);
}

.logo-header {
  text-align: center;
  margin-bottom: 24px;
}

.logo-icon-wrap {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 28px;
  margin: 0 auto 12px;
  box-shadow: 0 8px 16px rgba(var(--accent-primary-rgb), 0.2);
}

.onboarding-card h2 {
  font-weight: 700;
  font-size: 24px;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.onboarding-card p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 24px;
}

.form-group {
  margin-bottom: 20px;
  position: relative;
}

.form-group label {
  display: block;
  font-weight: 500;
  font-size: 14px;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 15px;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(var(--accent-primary-rgb), 0.15);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.btn-primary {
  width: 100%;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: white;
  border: none;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 8px 16px -4px rgba(var(--accent-primary-rgb), 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), opacity var(--transition-fast);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 20px -4px rgba(var(--accent-primary-rgb), 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

/* App Header Layout */
.app-header {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--glass-shadow);
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

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

.brand-logo {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
  box-shadow: 0 4px 8px rgba(var(--accent-primary-rgb), 0.2);
}

.brand-name {
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.5px;
}

.brand-name span {
  color: var(--accent-primary);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-personalization {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  background: var(--accent-light);
  border-radius: var(--radius-full);
  border: 1px solid rgba(var(--accent-primary-rgb), 0.1);
  font-weight: 500;
  font-size: 14px;
}

.user-avatar {
  width: 24px;
  height: 24px;
  background: var(--accent-primary);
  color: white;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.theme-toggle-btn {
  background: transparent;
  border: 1.5px solid var(--border-color);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.theme-toggle-btn:hover {
  border-color: var(--accent-primary);
  background: var(--accent-light);
}

/* App Bottom Settings */
.speech-switch-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.switch-container {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

.switch-container input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--border-color);
  transition: .3s;
  border-radius: 20px;
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 14px; width: 14px;
  left: 3px; bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .switch-slider {
  background-color: var(--accent-primary);
}

input:checked + .switch-slider:before {
  transform: translateX(16px);
}

/* App Main Navigation Layout */
.app-container {
  display: flex;
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 24px;
  gap: 24px;
}

.app-sidebar {
  width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 15px;
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
}

.sidebar-btn:hover {
  background: var(--accent-light);
  color: var(--accent-primary);
}

.sidebar-btn.active {
  background: var(--accent-primary);
  color: white;
  font-weight: 600;
  box-shadow: 0 8px 16px -4px rgba(var(--accent-primary-rgb), 0.2);
}

.sidebar-btn svg {
  width: 20px;
  height: 20px;
}

/* App Bottom Navigation for Mobile */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--glass-border);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.05);
  grid-template-columns: repeat(5, 1fr);
  z-index: 99;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bottom-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 0;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  gap: 4px;
  cursor: pointer;
}

.bottom-nav-btn.active {
  color: var(--accent-primary);
}

/* Main Workspace Tabs Content */
.main-workspace {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.tab-panel {
  display: none;
  animation: fadeIn var(--transition-normal) forwards;
}

.tab-panel.active {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Fade in animation */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Tab 1: AI Doctor Chat Interface */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 670px;
  background: var(--glass-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border);
  overflow: hidden;
  box-shadow: var(--glass-shadow);
  position: relative; /* REQUIRED for overlay positioning */
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

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

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .chat-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .chat-header-actions {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
  }
}

/* ----------------------------------------------------
   INTERACTIVE SVG DOCTOR AVATAR STYLING & ANIMATIONS
---------------------------------------------------- */
.doctor-avatar-container {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--color-green-50), var(--color-green-100));
  border: 2px solid var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible; /* Allows glowing circles to exceed avatar bounds */
  box-shadow: 0 4px 10px rgba(var(--accent-primary-rgb), 0.15);
}

.avatar-svg {
  width: 100%;
  height: 100%;
}

/* Avatar Sub-Elements */
.avatar-head {
  transform-origin: 26px 24px;
  animation: avatarBreathe 3s ease-in-out infinite alternate;
}

.avatar-eyes {
  transform-origin: 26px 21px;
}

.avatar-eye {
  transform-origin: center;
  animation: avatarBlink 4s ease-in-out infinite;
}

.avatar-mouth {
  transform-origin: 26px 27px;
  transition: transform var(--transition-fast), d var(--transition-fast);
}

/* Avatar States */
/* speaking mouth animation: vibrates scaleY when talking */
.doctor-avatar-container.speaking .avatar-mouth {
  animation: avatarTalk 0.18s ease-in-out infinite alternate;
}

/* thinking state: pulses glowing rings around container and oscillates head */
.doctor-avatar-container.thinking {
  animation: avatarThinkingPulse 1.5s ease-in-out infinite alternate;
}

.doctor-avatar-container.thinking .avatar-head {
  animation: avatarThinkingTilt 1.2s ease-in-out infinite alternate;
}

/* Glowing ring for thinking */
.doctor-avatar-container::before {
  content: "";
  position: absolute;
  top: -4px; left: -4px; right: -4px; bottom: -4px;
  border-radius: var(--radius-full);
  border: 2px solid var(--accent-primary);
  opacity: 0;
  transform: scale(1);
  transition: all var(--transition-fast);
  pointer-events: none;
}

.doctor-avatar-container.thinking::before {
  animation: thinkingGlow 1.5s ease-in-out infinite;
}

/* Avatar Animations Keyframes */
@keyframes avatarBreathe {
  0% { transform: translateY(0) scale(1); }
  100% { transform: translateY(0.8px) scale(0.99); }
}

@keyframes avatarBlink {
  0%, 90%, 94%, 98%, 100% { transform: scaleY(1); }
  92%, 96% { transform: scaleY(0.1); }
}

@keyframes avatarTalk {
  0% { transform: scaleY(0.4); }
  100% { transform: scaleY(2.2); }
}

@keyframes avatarThinkingTilt {
  0% { transform: rotate(-3deg); }
  100% { transform: rotate(3deg); }
}

@keyframes avatarThinkingPulse {
  0% { box-shadow: 0 4px 10px rgba(var(--accent-primary-rgb), 0.15); }
  100% { box-shadow: 0 4px 20px rgba(var(--accent-primary-rgb), 0.4); }
}

@keyframes thinkingGlow {
  0% { opacity: 0.6; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.2); }
}
/* ---------------------------------------------------- */

.doctor-status-wrap {
  position: relative;
}

.status-dot {
  width: 10px;
  height: 10px;
  background: var(--success);
  border: 2px solid var(--bg-secondary);
  border-radius: var(--radius-full);
  position: absolute;
  bottom: 0;
  right: 0;
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.doctor-info h3 {
  font-size: 16px;
  font-weight: 600;
}

.doctor-info p {
  font-size: 12px;
  color: var(--text-secondary);
}

.chat-history {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: radial-gradient(circle at 10% 20%, rgba(var(--accent-secondary-rgb), 0.03) 0%, rgba(var(--accent-primary-rgb), 0.01) 90%);
}

.message-bubble {
  max-width: 80%;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 15px;
  line-height: 1.5;
  animation: messageSlide var(--transition-fast) forwards;
}

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

.message-bubble.doctor {
  align-self: flex-start;
  background: var(--glass-bg) !important;
  border: 1px solid var(--glass-border) !important;
  color: var(--text-primary);
  border-top-left-radius: 4px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.message-bubble.user {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(5, 150, 105, 0.45)) !important;
  border: 1px solid rgba(16, 185, 129, 0.4) !important;
  color: var(--text-primary) !important;
  border-top-right-radius: 4px;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.08) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Typing Indicator Animation */
.typing-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

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

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

@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1.0); }
}

/* Symptom selector pills */
.quick-symptom-section {
  display: none !important;
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.quick-symptom-section p {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.symptom-pills-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 80px;
  overflow-y: auto;
}

.symptom-pill {
  padding: 6px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.symptom-pill:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: var(--accent-light);
}

.symptom-pill.selected {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}

/* Chat Input Bar */
.chat-input-bar {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-secondary);
}

.chat-input-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.chat-input {
  width: 100%;
  padding: 14px 44px 14px 16px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 15px;
  outline: none;
  resize: none;
  height: 48px;
  transition: all var(--transition-fast);
}

.chat-input:focus {
  border-color: var(--border-focus);
  background: var(--bg-secondary);
  box-shadow: 0 0 0 3px rgba(var(--accent-primary-rgb), 0.1);
}

/* Recording Overlay and waveforms */
.mic-btn {
  background: var(--accent-light);
  border: none;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  color: var(--accent-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.mic-btn:hover {
  background: var(--accent-primary);
  color: white;
}

.mic-btn.recording {
  background: var(--danger);
  color: white;
  animation: micPulse 1.5s infinite;
}

@keyframes micPulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  70% { 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); }
}

.send-btn {
  background: var(--accent-primary);
  border: none;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.send-btn:hover {
  background: var(--color-green-700);
}

.recording-status-overlay {
  display: none;
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1.5px solid var(--danger);
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  animation: fadeIn var(--transition-fast);
}

.recording-status-overlay.active {
  display: flex;
}

.record-indicator {
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: var(--radius-full);
  animation: blink 1s infinite alternate;
}

@keyframes blink {
  from { opacity: 0.3; }
  to { opacity: 1; }
}

.recording-time {
  font-size: 14px;
  font-weight: 500;
  color: var(--danger);
}

/* Sound Wave Animation Visualizer */
.waveform {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 24px;
  flex: 1;
}

.waveform-bar {
  width: 3px;
  background: var(--danger);
  border-radius: var(--radius-full);
  animation: bounceBar 1.2s ease-in-out infinite alternate;
  height: 4px;
}

.waveform-bar:nth-child(2) { animation-delay: 0.15s; }
.waveform-bar:nth-child(3) { animation-delay: 0.3s; }
.waveform-bar:nth-child(4) { animation-delay: 0.45s; }
.waveform-bar:nth-child(5) { animation-delay: 0.2s; }
.waveform-bar:nth-child(6) { animation-delay: 0.35s; }
.waveform-bar:nth-child(7) { animation-delay: 0.1s; }

@keyframes bounceBar {
  from { height: 4px; }
  to { height: 24px; }
}

.cancel-record-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cancel-record-btn:hover {
  background: var(--bg-primary);
  color: var(--danger);
}

/* Medical Report Layout - inside chat bubbles */
.medical-report {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--accent-primary);
  padding: 16px;
  margin-top: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
  color: var(--text-primary);
}

.medical-report h4 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.conf-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
}

.conf-badge.low { background: var(--warning-light); color: var(--warning); }
.conf-badge.medium { background: var(--accent-light); color: var(--accent-primary); }
.conf-badge.high { background: var(--success-light); color: var(--success); }

.report-section {
  margin-bottom: 14px;
}

.report-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-primary);
  text-transform: uppercase;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.report-list {
  padding-left: 18px;
  font-size: 13.5px;
  color: var(--text-secondary);
}

.report-list li {
  margin-bottom: 4px;
}

.report-warning-box {
  background: var(--danger-light);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-sm);
  padding: 12px;
  color: #b91c1c;
  font-size: 13px;
  margin-top: 12px;
}

body.dark-mode .report-warning-box {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
}

.report-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
  gap: 12px;
}

.btn-outline-sm {
  background: transparent;
  border: 1.5px solid var(--border-color);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.btn-outline-sm:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: var(--accent-light);
}

/* Voice Player for Audio Feedback */
.voice-player {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--accent-light);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-top: 10px;
  width: fit-content;
  max-width: 100%;
}

.voice-play-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--accent-primary);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.voice-progress {
  width: 120px;
  height: 4px;
  background: var(--border-color);
  border-radius: var(--radius-full);
  position: relative;
  overflow: hidden;
}

.voice-progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0;
  background: var(--accent-primary);
}

/* Tab 2: Dashboard Vitals */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.dashboard-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 24px;
  box-shadow: var(--glass-shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dashboard-card.col-2 {
  grid-column: span 2;
}

.card-header-vitals {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-title-vitals {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
}

.vital-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.vital-icon.blue { background: var(--accent-light); color: var(--accent-primary); }
.vital-icon.green { background: var(--success-light); color: var(--success); }
.vital-icon.yellow { background: var(--warning-light); color: var(--warning); }
.vital-icon.red { background: var(--danger-light); color: var(--danger); }

.vital-value {
  font-size: 28px;
  font-weight: 700;
}

.vital-value span {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-left: 4px;
}

.vital-status {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  width: fit-content;
}

.vital-status.normal { background: var(--success-light); color: var(--success); }
.vital-status.alert { background: var(--warning-light); color: var(--warning); }

/* Custom SVG Chart Styling */
.chart-box {
  width: 100%;
  height: 200px;
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
}

.chart-svg {
  width: 100%;
  height: 100%;
}

.chart-tooltip {
  position: absolute;
  background: rgba(15, 23, 42, 0.9);
  color: white;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  pointer-events: none;
  display: none;
  z-index: 10;
}

/* Medication reminders widget */
.med-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 250px;
  overflow-y: auto;
}

.med-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  transition: all var(--transition-fast);
}

.med-item:hover {
  transform: translateX(4px);
  border-color: var(--accent-primary);
}

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

.med-pill-icon {
  font-size: 20px;
}

.med-info h5 {
  font-size: 14.5px;
  font-weight: 600;
}

.med-info p {
  font-size: 12px;
  color: var(--text-secondary);
}

.med-checkbox-custom {
  cursor: pointer;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: transparent;
  transition: all var(--transition-fast);
}

.med-item.taken .med-checkbox-custom {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.med-item.taken .med-info h5 {
  text-decoration: line-through;
  color: var(--text-secondary);
}

/* Add Medication form overlay */
.add-med-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Tab 3: Knowledge Hub styling */
.knowledge-nav {
  display: flex;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

.knowledge-nav-btn {
  background: transparent;
  border: none;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 8px 16px;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.knowledge-nav-btn:hover {
  background: var(--accent-light);
  color: var(--accent-primary);
}

.knowledge-nav-btn.active {
  background: var(--accent-primary);
  color: white;
  font-weight: 600;
}

.knowledge-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.article-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  overflow: hidden;
  box-shadow: var(--glass-shadow);
  display: flex;
  flex-direction: column;
}

.article-cover {
  height: 180px;
  background-size: cover;
  background-position: center;
  position: relative;
}

.article-category {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--accent-primary);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}

.article-content {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.article-content h4 {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
}

.article-content p {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.article-footer {
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-secondary);
}

.read-more-link {
  color: var(--accent-primary);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Risk Calculator interactive panel */
.risk-calc-card {
  grid-column: span 2;
  background: linear-gradient(135deg, var(--bg-secondary), var(--accent-light));
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 32px;
  box-shadow: var(--glass-shadow);
}

body.dark-mode .risk-calc-card {
  background: linear-gradient(135deg, var(--bg-secondary), #061f14);
}

.risk-calc-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.risk-calc-interactive {
  width: 320px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.quiz-question {
  font-size: 14.5px;
  font-weight: 600;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quiz-option {
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  background: transparent;
  transition: all var(--transition-fast);
}

.quiz-option:hover {
  background: var(--bg-primary);
  border-color: var(--accent-primary);
}

.quiz-option.selected {
  background: var(--accent-light);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  font-weight: 600;
}

.quiz-result-radial {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  animation: fadeIn var(--transition-normal);
}

.radial-progress-svg {
  width: 120px;
  height: 120px;
  transform: rotate(-90deg);
}

.radial-bg {
  fill: none;
  stroke: var(--border-color);
  stroke-width: 10;
}

.radial-fill {
  fill: none;
  stroke: var(--accent-primary);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 283;
  stroke-dashoffset: 283;
  transition: stroke-dashoffset 0.8s ease-out;
}

.radial-percentage {
  font-size: 24px;
  font-weight: 700;
  transform: rotate(90deg);
  transform-origin: center;
  fill: var(--text-primary);
}

/* Tab 4: Profile & Diagnostic History */
.profile-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 20px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-item {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all var(--transition-fast);
}

.history-item:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
}

.history-meta h5 {
  font-size: 15px;
  font-weight: 600;
}

.history-meta p {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Responsive Rules */
@media (max-width: 900px) {
  body {
    height: 100dvh;
    overflow: hidden;
  }

  .app-container {
    flex-direction: column;
    padding: 12px;
    padding-bottom: 0 !important;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    height: auto !important;
  }
  
  .main-workspace {
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }

  .tab-panel.active {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .tab-panel.active:not(#ai-doctor) {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 24px;
  }

  .chat-container {
    height: 100% !important;
    flex: 1;
    min-height: 0;
  }

  .symptom-pills-wrap {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
    max-height: none !important;
    gap: 8px;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .symptom-pills-wrap::-webkit-scrollbar {
    display: none;
  }

  .symptom-pill {
    flex-shrink: 0;
  }
  
  .app-sidebar {
    display: none;
  }
  
  .bottom-nav {
    display: grid;
    position: relative !important;
    bottom: auto !important;
    left: auto !important;
    width: 100% !important;
  }

  /* Version 6.5 Voice Panel Viewport Optimization on Mobile */
  .interactive-doctor-panel {
    padding: 16px 12px !important;
  }

  .doctor-3d-avatar-container {
    width: 180px !important;
    height: 180px !important;
  }

  .voice-controls-bar {
    gap: 20px !important;
  }

  .voice-speech-bubble {
    font-size: 14px !important;
    min-height: 60px !important;
    padding: 0 6px !important;
  }
  
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  
  .dashboard-card.col-2 {
    grid-column: span 1;
  }
  
  .knowledge-grid {
    grid-template-columns: 1fr;
  }
  
  .risk-calc-card {
    grid-column: span 1;
    flex-direction: column;
    gap: 20px;
  }
  
  .risk-calc-interactive {
    width: 100%;
  }
  
  .profile-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  #headerUserName {
    display: none;
  }
  .user-personalization {
    padding: 0;
    background: transparent;
    border: none;
  }
  .user-avatar {
    width: 32px;
    height: 32px;
  }

  .app-header {
    padding: 12px 16px;
  }
  
  .brand-name {
    font-size: 16px;
  }
  
  .chat-history {
    padding: 16px;
  }
  
  .message-bubble {
    max-width: 90%;
  }
}

/* Services tab styling */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
  margin-top: 15px;
}

.service-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: var(--transition-normal);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
}

.service-card:hover {
  transform: translateY(-5px);
  border-color: var(--accent-primary);
  box-shadow: 0 12px 24px rgba(16, 185, 129, 0.08);
}

.service-icon-wrap {
  width: 50px;
  height: 50px;
  background: var(--color-green-50);
  color: var(--accent-primary);
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-green-100);
}

body.dark-mode .service-icon-wrap {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.2);
}

.service-info {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  gap: 8px;
}

.service-info h4 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.service-info p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
  flex-grow: 1;
}

.service-price {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-secondary);
  margin-top: 4px;
}

.booking-section-container {
  margin-top: 40px;
  margin-bottom: 40px;
}

.booking-form-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 800px;
  margin: 0 auto;
  box-shadow: var(--glass-shadow);
}

.booking-header {
  text-align: center;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 16px;
}

.booking-header h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.booking-header p {
  font-size: 14px;
  color: var(--text-secondary);
}

.method-selector-wrap {
  display: flex;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 4px;
  gap: 4px;
  width: fit-content;
}

.method-selector-wrap input[type="radio"] {
  display: none;
}

.method-label {
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: calc(var(--radius-sm) - 2px);
  transition: var(--transition-fast);
  margin: 0;
  user-select: none;
}

.method-selector-wrap input[type="radio"]:checked + .method-label {
  background: var(--accent-primary);
  color: #ffffff;
}

.price-breakdown-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.price-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: var(--text-secondary);
}

.price-row strong {
  color: var(--text-primary);
}

.price-row.total {
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
  margin-top: 4px;
  font-size: 16px;
  font-weight: 700;
}

.price-row.total span {
  color: var(--text-primary);
}

.price-row.total strong {
  color: var(--accent-secondary);
  font-size: 18px;
}

.btn-outline-sm {
  align-self: flex-start;
  background: transparent;
  border: 1px solid var(--accent-primary);
  color: var(--accent-primary);
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-outline-sm:hover {
  background: var(--accent-primary);
  color: #ffffff;
}

/* Floating Hotline FAB */
.floating-hotline {
  position: fixed;
  bottom: 80px; /* Nhấc lên trên thanh bottom nav của mobile */
  right: 24px;
  background: var(--accent-secondary);
  color: #ffffff;
  padding: 12px 18px;
  border-radius: 50px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  z-index: 99;
  transition: transform var(--transition-normal), background var(--transition-fast);
  animation: pulse-green 2s infinite;
}

.floating-hotline:hover {
  background: var(--accent-primary);
  transform: translateY(-3px) scale(1.05);
  color: #ffffff;
}

.floating-hotline svg {
  animation: shake 1.5s infinite;
}

@keyframes shake {
  0% { transform: rotate(0); }
  15% { transform: rotate(15deg); }
  30% { transform: rotate(-15deg); }
  45% { transform: rotate(10deg); }
  60% { transform: rotate(-10deg); }
  75% { transform: rotate(4deg); }
  85% { transform: rotate(-4deg); }
  100% { transform: rotate(0); }
}

@keyframes pulse-green {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    box-shadow: 0 0 0 12px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

@media (min-width: 769px) {
  .floating-hotline {
    bottom: 24px;
  }
}

/* --- Elderly Mode Styling Overrides --- */
body.elderly-mode {
  font-size: 19px !important;
  line-height: 1.7 !important;
}

body.elderly-mode .brand-name {
  font-size: 24px !important;
}

body.elderly-mode p,
body.elderly-mode span,
body.elderly-mode label,
body.elderly-mode li,
body.elderly-mode input,
body.elderly-mode select,
body.elderly-mode textarea,
body.elderly-mode button {
  font-size: 18px !important;
  line-height: 1.6 !important;
}

body.elderly-mode h2 {
  font-size: 28px !important;
}

body.elderly-mode h3 {
  font-size: 24px !important;
}

body.elderly-mode h4 {
  font-size: 22px !important;
}

body.elderly-mode h5 {
  font-size: 20px !important;
}

/* Touch targets: 48px+ for all buttons, inputs, pills */
body.elderly-mode button, 
body.elderly-mode input[type="text"],
body.elderly-mode input[type="number"],
body.elderly-mode input[type="tel"],
body.elderly-mode select,
body.elderly-mode textarea,
body.elderly-mode .form-control {
  min-height: 48px !important;
  padding: 12px 18px !important;
}

body.elderly-mode .symptom-pill {
  min-height: 48px !important;
  display: inline-flex;
  align-items: center;
  padding: 10px 20px !important;
  font-size: 16px !important;
  border-radius: var(--radius-md) !important;
}

body.elderly-mode .message-bubble {
  font-size: 18px !important;
  line-height: 1.7 !important;
  max-width: 85% !important;
  padding: 16px 20px !important;
}

body.elderly-mode .chat-container {
  height: 750px !important;
}

@media (max-width: 600px) {
  body.elderly-mode .chat-container {
    height: 600px !important;
  }
}

body.elderly-mode .sidebar-btn {
  min-height: 48px !important;
  padding: 14px 20px !important;
}

body.elderly-mode .bottom-nav-btn {
  min-height: 52px !important;
  font-size: 13px !important;
}

body.elderly-mode .bottom-nav-btn svg {
  width: 22px !important;
  height: 22px !important;
}

body.elderly-mode .floating-hotline {
  font-size: 16px !important;
  padding: 16px 24px !important;
  border-radius: 50px !important;
}

body.elderly-mode .user-personalization {
  font-size: 16px !important;
  padding: 8px 16px !important;
}

body.elderly-mode .user-avatar {
  width: 28px !important;
  height: 28px !important;
  font-size: 14px !important;
}

/* Toggle button specific styles */
.elderly-toggle-btn {
  background: var(--bg-primary);
  border: 1.5px solid var(--border-color);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  transition: border-color var(--transition-fast), background-color var(--transition-fast), transform var(--transition-fast);
  gap: 6px;
  height: 40px;
}

.elderly-toggle-btn:hover {
  border-color: var(--accent-primary);
  background: var(--accent-light);
  transform: translateY(-1px);
}

.elderly-toggle-btn:active {
  transform: translateY(0);
}

/* When active (elderly mode enabled), color the button slightly */
body.elderly-mode .elderly-toggle-btn {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

body.elderly-mode .elderly-toggle-btn:hover {
  background: var(--accent-secondary);
  color: white;
}

/* Hide/show texts based on mobile view */
.elderly-text-large {
  display: inline;
}

.elderly-text-short {
  display: none;
}

@media (max-width: 600px) {
  .elderly-text-large {
    display: none;
  }
  .elderly-text-short {
    display: inline;
  }
}

/* --- Recovery Timeline Styling --- */
.recovery-timeline {
  position: relative;
  padding-left: 12px;
  margin-top: 8px;
  border-left: 2px solid var(--border-color);
  margin-left: 10px;
}

.timeline-step {
  position: relative;
  margin-bottom: 12px;
  padding-left: 16px;
}

.timeline-step:last-child {
  margin-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: -19px;
  top: 5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-primary);
  border: 2px solid var(--bg-card);
}

.timeline-content {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.5;
}

body.elderly-mode .timeline-content {
  font-size: 17px !important;
  line-height: 1.6 !important;
}

/* --- Product Showcase Section --- */
.product-showcase-container {
  display: flex;
  flex-direction: column;
  gap: 30px;
  margin-top: 20px;
  margin-bottom: 40px;
}

.product-showcase-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.product-showcase-card:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 8px 30px rgba(16, 185, 129, 0.06);
}

.product-showcase-header {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.product-image-container {
  flex-shrink: 0;
  width: 180px;
  height: 180px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #dcfce7; /* Green background requested */
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--color-green-200);
}

.product-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-primary-info {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.product-badge {
  align-self: flex-start;
  background: var(--accent-light);
  color: var(--accent-primary);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 50px;
  text-transform: uppercase;
}

.product-primary-info h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.product-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

.product-meta-prices {
  display: flex;
  gap: 20px;
  margin-top: 4px;
  font-size: 14px;
}

.product-meta-prices strong {
  color: var(--accent-primary);
  font-size: 16px;
}

.product-meta-prices del {
  color: var(--text-muted);
  font-size: 13px;
  margin-left: 4px;
}

.product-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  padding: 16px 0;
}

.product-detail-column h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent-secondary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.product-bullets {
  padding-left: 20px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.product-bullets li {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.regimen-timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.regimen-step {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.regimen-time {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-primary);
  text-transform: uppercase;
}

.regimen-step p {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.4;
}

.product-media-actions {
  display: flex;
  gap: 24px;
  align-items: center;
}

.youtube-embed-container {
  flex-grow: 1;
  max-width: 320px;
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.youtube-embed-container iframe {
  width: 100%;
  height: 100%;
}

.product-action-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
  width: 140px;
}

.product-action-buttons button {
  width: 100%;
  height: 34px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

/* --- Mobile Sticky Hotline Banner --- */
.mobile-hotline-banner {
  display: none;
  background: #16a34a; /* Brand green */
  color: white;
  text-align: center;
  padding: 10px 15px;
  font-size: 15px;
  font-weight: 700;
  position: relative;
  top: auto;
  z-index: auto;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  transition: all var(--transition-fast);
}

.mobile-hotline-banner a {
  color: white;
  text-decoration: none;
  display: block;
  width: 100%;
}

.mobile-hotline-banner a:hover {
  text-decoration: underline;
}

/* --- Print Header & Styling --- */
.print-header {
  display: flex;
  align-items: center;
  gap: 20px;
  border-bottom: 2px solid #16a34a;
  padding-bottom: 12px;
  margin-bottom: 20px;
}

.print-logo {
  width: 60px;
  height: 60px;
  object-fit: contain;
}

.print-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.print-title-wrap h3 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  color: #16a34a;
}

.print-title-wrap p {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
}

/* --- Responsive & Mobile/PWA fixes --- */
@media (max-width: 768px) {
  .print-header {
    gap: 12px;
    padding-bottom: 8px;
    margin-bottom: 12px;
  }
  
  .print-logo {
    width: 45px;
    height: 45px;
  }
  
  .print-title-wrap {
    gap: 2px;
  }
  
  .print-title-wrap h3 {
    font-size: 16px;
  }
  
  .print-title-wrap p {
    font-size: 10.5px;
    line-height: 1.3;
  }

  .floating-hotline {
    display: none !important; /* Hide floating button on mobile to prevent keyboard overlapping */
  }
  
  .mobile-hotline-banner {
    display: block; /* Show sticky banner on mobile */
  }
  
  .product-showcase-header {
    flex-direction: column;
    gap: 16px;
  }
  
  .product-image-container {
    width: 100%;
    height: 200px;
  }
  
  .product-details-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .product-media-actions {
    flex-direction: column;
    gap: 16px;
    align-items: stretch;
  }
  
  .youtube-embed-container {
    max-width: 100%;
  }
  
  .product-action-buttons {
    width: auto;
    flex-direction: row;
    justify-content: flex-start;
  }
  
  .product-action-buttons button {
    width: 130px;
    flex: none;
  }
}

/* Elderly mode adjustments for product showcase */
body.elderly-mode .product-badge {
  font-size: 14px !important;
  padding: 6px 14px !important;
}

body.elderly-mode .product-primary-info h3 {
  font-size: 24px !important;
}

body.elderly-mode .product-desc {
  font-size: 18px !important;
  line-height: 1.6 !important;
}

body.elderly-mode .product-meta-prices {
  font-size: 18px !important;
}

body.elderly-mode .product-meta-prices strong {
  font-size: 22px !important;
}

body.elderly-mode .product-detail-column h4 {
  font-size: 19px !important;
}

body.elderly-mode .product-bullets li {
  font-size: 17px !important;
  line-height: 1.5 !important;
}

body.elderly-mode .regimen-time {
  font-size: 15px !important;
}

body.elderly-mode .regimen-step p {
  font-size: 17px !important;
  line-height: 1.5 !important;
}

body.elderly-mode .product-action-buttons button {
  font-size: 18px !important;
  height: 52px !important;
}

body.elderly-mode .mobile-hotline-banner {
  font-size: 18px !important;
  padding: 14px 15px !important;
}

/* --- Print Styles --- */
@media print {
  /* Hide all interactive elements, navigation, chat inputs, buttons, sidebars */
  body {
    background: white !important;
    color: black !important;
    font-size: 12pt !important;
    line-height: 1.5 !important;
  }
  
  .app-header, 
  .app-sidebar, 
  .bottom-nav, 
  .floating-hotline, 
  .mobile-hotline-banner,
  .quick-symptom-section,
  .chat-input-bar,
  .sidebar-btn,
  .tab-panel:not(.active),
  button, 
  form,
  .nav-actions,
  #themeToggle,
  #elderlyToggle,
  .speech-switch-wrap,
  .logo-header button,
  .dashboard-card,
  .booking-section-container,
  .product-showcase-card,
  .modal-overlay {
    display: none !important;
  }
  
  /* Center and maximize the chat history containing the phác đồ */
  .app-container {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
  }
  
  .app-main {
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    width: 100% !important;
  }
  
  .tab-panel.active {
    display: block !important;
  }
  
  /* Hide all messages in the chat history by default */
  .chat-history > .message-bubble {
    display: none !important;
  }
  
  /* Show only the active/last report bubble in print */
  .chat-history > .message-bubble.printable-report-card {
    display: block !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 14pt !important;
    color: black !important;
    line-height: 1.6 !important;
  }
  
  .medical-report {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
  }
  
  /* Show print header */
  .print-header {
    display: flex !important;
  }
  
  /* Hide actions within the report card for the printout */
  .report-actions {
    display: none !important;
  }
}

/* --- Version 3.3 User Account & AI Avatar Styles --- */

.onboarding-screen {
  animation: fadeIn var(--transition-normal) forwards;
}

.login-options-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}

.google-btn-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 44px;
  width: 100%;
  max-width: 280px;
  margin: 0 auto;
  transition: all var(--transition-fast);
}

.divider-text {
  text-align: center;
  position: relative;
  margin: 8px 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.divider-text::before,
.divider-text::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: var(--border-color);
}

.divider-text::before {
  left: 0;
}

.divider-text::after {
  right: 0;
}

.divider-text span {
  background: var(--bg-secondary);
  padding: 0 8px;
}

.login-footer-text {
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 24px !important;
}

/* Avatar Setup */
.avatar-setup-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding: 16px;
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.form-label-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  align-self: flex-start;
  margin-bottom: 4px;
}

.avatar-preview-container {
  display: flex;
  align-items: center;
  gap: 20px;
  width: 100%;
}

.avatar-preview-circle {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 2.5px solid var(--accent-primary);
  flex-shrink: 0;
}

.avatar-preview-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.avatar-preview-circle span {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-secondary);
}

.avatar-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.btn-avatar-action {
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}

.btn-avatar-action:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: var(--accent-light);
}

/* AI Prompt Container */
.ai-prompt-container {
  width: 100%;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-color);
}

.ai-prompt-input-group {
  display: flex;
  gap: 8px;
}

.ai-prompt-input-group input {
  flex: 1;
  padding: 8px 12px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}

.ai-prompt-input-group button {
  padding: 8px 16px;
  font-size: 13px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.ai-prompt-help {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 6px;
  margin-bottom: 0 !important;
}

/* Avatar Loading Spinner */
.avatar-spinner {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-spinner::after {
  content: "";
  width: 24px;
  height: 24px;
  border: 2.5px solid #ffffff;
  border-top-color: transparent;
  border-radius: 50%;
  animation: setupAvatarSpin 0.8s linear infinite;
}

@keyframes setupAvatarSpin {
  to { transform: rotate(360deg); }
}

/* Edit Avatar overlay on Profile tab */
.profile-avatar-container {
  cursor: pointer;
  overflow: hidden;
}

.avatar-edit-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.profile-avatar-container:hover .avatar-edit-overlay {
  opacity: 1;
}

/* Small button utilities */
.btn-sm {
  padding: 8px 16px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  height: auto !important;
}

/* Dark mode adjustments */
body.dark-mode .avatar-setup-section {
  background: var(--bg-secondary);
  border-color: var(--border-color);
}

body.dark-mode .divider-text span {
  background: var(--bg-secondary);
}

body.dark-mode .btn-avatar-action {
  background: var(--bg-primary);
  border-color: var(--border-color);
}

/* Custom Google Sign-In Button */
.btn-google-signin {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  max-width: 280px;
  padding: 10px 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: var(--text-primary);
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: all var(--transition-fast);
  margin: 0 auto;
}

.btn-google-signin:hover {
  border-color: #cbd5e1;
  background: var(--bg-secondary);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.btn-google-signin svg {
  flex-shrink: 0;
}

body.dark-mode .btn-google-signin {
  background: var(--bg-secondary);
  border-color: var(--border-color);
  color: var(--text-primary);
}

body.dark-mode .btn-google-signin:hover {
  background: var(--bg-tertiary);
  border-color: #475569;
}

/* Version 4.1 UI Styles */
.upload-btn:hover {
  background: var(--accent-primary);
  color: white;
}

.chat-image-attachment {
  max-width: 100%;
  max-height: 200px;
  border-radius: var(--radius-sm);
  margin-top: 8px;
  display: block;
  cursor: pointer;
  border: 1px solid var(--border-color);
  object-fit: cover;
}

/* ---------------------------------------------------- */
/* Version 6.0 1-1 Interactive 3D AI Doctor Styles */
/* ---------------------------------------------------- */

/* Smooth transitions for zoom in / out animation overlay */
#chatHistory,
.quick-symptom-section,
#chatImagePreviewContainer,
.chat-input-bar {
  transition: opacity 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), visibility 0.5s;
  opacity: 1;
  transform: scale(1);
  visibility: visible;
}

.chat-container.voice-mode-active #chatHistory,
.chat-container.voice-mode-active .quick-symptom-section,
.chat-container.voice-mode-active #chatImagePreviewContainer,
.chat-container.voice-mode-active .chat-input-bar {
  opacity: 0;
  transform: scale(1.05); /* Zoom-out background effect */
  visibility: hidden;
  pointer-events: none;
}

.chat-container.voice-mode-active #interactiveDoctorPanel {
  opacity: 1;
  transform: scale(1) translateY(0);
  visibility: visible;
  pointer-events: auto;
}

.interactive-doctor-panel {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
  background: radial-gradient(circle at 50% 30%, rgba(16, 185, 129, 0.12) 0%, #050d09 70%, #010201 100%);
  color: white;
  box-sizing: border-box;
  overflow: hidden;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 30px 24px;
  transition: opacity 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), visibility 0.5s;
  opacity: 0;
  transform: scale(0.9) translateY(20px);
  visibility: hidden;
  pointer-events: none;
}

.interactive-doctor-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 100%;
  max-width: 500px;
  margin: 0 auto;
  position: relative;
  gap: 20px;
  flex: 1;
}

.voice-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 10;
}

.voice-badge {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-primary);
  text-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.voice-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-primary);
  box-shadow: 0 0 8px var(--accent-primary);
  animation: voiceStatusBlink 1.5s infinite ease-in-out;
}

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

.voice-speech-bubble {
  width: 100%;
  max-width: 380px;
  text-align: center;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.55;
  z-index: 10;
  padding: 0 10px;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
}

.doctor-3d-avatar-container {
  width: 250px;
  height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  position: relative;
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.avatar-3d-svg {
  width: 100%;
  height: 100%;
}

/* 3D breathing animation */
.avatar-torso-3d {
  transform-origin: 26px 48px;
  animation: avatarTorsoBreath 3.5s ease-in-out infinite alternate;
}
.avatar-head-3d {
  transform-origin: 26px 27px;
  animation: avatarHeadBreath 3.5s ease-in-out infinite alternate;
}

@keyframes avatarTorsoBreath {
  0% { transform: translateY(0) scaleY(1); }
  100% { transform: translateY(0.5px) scaleY(0.98); }
}
@keyframes avatarHeadBreath {
  0% { transform: translateY(0) scale(1) rotate(-0.5deg); }
  100% { transform: translateY(1.2px) scale(0.99) rotate(0.5deg); }
}

/* Interactive mouth talk animation */
.avatar-mouth-3d {
  transform-origin: 26px 24px;
  transition: transform 0.1s ease, d 0.1s ease;
}
.doctor-3d-avatar-container.speaking .avatar-mouth-3d {
  animation: avatarTalk3D 0.15s ease-in-out infinite alternate;
}
@keyframes avatarTalk3D {
  0% { transform: scaleY(0.4) scaleX(0.85); }
  100% { transform: scaleY(1.8) scaleX(1.1); }
}

.voice-status-wrapper {
  z-index: 10;
  margin-bottom: 5px;
}

.voice-status-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-primary);
  opacity: 0.8;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  text-shadow: 0 0 8px rgba(16, 185, 129, 0.2);
}

/* Symmetrical Voice Controls Bar */
.voice-controls-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  width: 100%;
  max-width: 400px;
  z-index: 10;
  padding-bottom: 10px;
}

.voice-control-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  color: white;
  border: none;
  outline: none;
}

.voice-control-btn svg {
  width: 22px;
  height: 22px;
}

.voice-control-btn.btn-hangup {
  background: rgba(239, 68, 68, 0.15);
  border: 1.5px solid rgba(239, 68, 68, 0.3);
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.1);
  color: #fca5a5;
}

.voice-control-btn.btn-hangup:hover {
  background: rgba(239, 68, 68, 0.9);
  border-color: #ef4444;
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.4);
  transform: translateY(-3px) scale(1.05);
  color: white;
}

.voice-control-btn.btn-speaker {
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  color: #e5e7eb;
}

.voice-control-btn.btn-speaker:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-3px) scale(1.05);
}

.voice-control-btn.btn-speaker.muted {
  background: rgba(156, 163, 175, 0.15);
  border-color: rgba(156, 163, 175, 0.25);
  color: #9ca3af;
}

.voice-mic-indicator {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #059669);
  border: 1.5px solid rgba(16, 185, 129, 0.3);
  box-shadow: 0 0 25px rgba(16, 185, 129, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.3s ease;
  color: white;
}

.voice-mic-indicator svg {
  width: 28px;
  height: 28px;
  z-index: 2;
}

/* Audio waves inside indicator */
.voice-wave-container {
  position: absolute;
  top: -8px;
  left: -8px;
  right: -8px;
  bottom: -8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  z-index: 1;
  pointer-events: none;
}

.voice-wave-container .wave-bar {
  width: 3px;
  height: 4px;
  background: transparent;
  border-radius: 1.5px;
  transition: all 0.2s ease;
  display: none;
}

/* Active breathing when AI is talking or user is talking */
.voice-wave-container.active .wave-bar,
.voice-wave-container.active-listening .wave-bar {
  display: block;
}

.voice-wave-container.active .wave-bar {
  background: var(--accent-primary);
  box-shadow: 0 0 10px var(--accent-primary);
}

.voice-wave-container.active-listening .wave-bar {
  background: #3b82f6;
  box-shadow: 0 0 10px #3b82f6;
}

.voice-wave-container.active .bar-1 { animation: wavePulse 0.6s infinite alternate 0.1s; }
.voice-wave-container.active .bar-2 { animation: wavePulse 0.8s infinite alternate 0.2s; }
.voice-wave-container.active .bar-3 { animation: wavePulse 0.5s infinite alternate 0.3s; }
.voice-wave-container.active .bar-4 { animation: wavePulse 0.7s infinite alternate 0.4s; }
.voice-wave-container.active .bar-5 { animation: wavePulse 0.6s infinite alternate 0.2s; }

.voice-wave-container.active-listening .bar-1 { animation: wavePulse 0.5s infinite alternate 0.2s; }
.voice-wave-container.active-listening .bar-2 { animation: wavePulse 0.7s infinite alternate 0.1s; }
.voice-wave-container.active-listening .bar-3 { animation: wavePulse 0.6s infinite alternate 0.3s; }
.voice-wave-container.active-listening .bar-4 { animation: wavePulse 0.8s infinite alternate 0.2s; }
.voice-wave-container.active-listening .bar-5 { animation: wavePulse 0.5s infinite alternate 0.4s; }

@keyframes wavePulse {
  0% { height: 6px; }
  100% { height: 28px; }
}

/* Glassmorphism updates for cards, reports, headers, modals */
.onboarding-card,
.dashboard-card,
.medical-report,
.app-header,
.bottom-nav,
.quiz-card,
.product-showcase-card {
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  background: var(--glass-bg) !important;
  border: 1px solid var(--glass-border) !important;
  box-shadow: var(--glass-shadow) !important;
}

.dashboard-card, .product-showcase-card, .medical-report {
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal), transform var(--transition-normal);
}

.dashboard-card:hover, .product-showcase-card:hover {
  border-color: rgba(16, 185, 129, 0.4) !important;
  box-shadow: 0 8px 32px 0 rgba(16, 185, 129, 0.12) !important;
  transform: translateY(-2px);
}

/* Version 6.5 Card Entrance Animation & Tab Transitions */
@keyframes cardEntrance {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.dashboard-card,
.medical-report,
.product-showcase-card {
  animation: cardEntrance 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Stagger animations for grid cards */
.dashboard-grid > :nth-child(1) { animation-delay: 0.04s; }
.dashboard-grid > :nth-child(2) { animation-delay: 0.08s; }
.dashboard-grid > :nth-child(3) { animation-delay: 0.12s; }
.dashboard-grid > :nth-child(4) { animation-delay: 0.16s; }
.dashboard-grid > :nth-child(5) { animation-delay: 0.20s; }
.dashboard-grid > :nth-child(6) { animation-delay: 0.24s; }

/* Version 6.5 Hover Pill Transitions */
.symptom-pill {
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  background: var(--glass-bg) !important;
  border: 1px solid var(--glass-border) !important;
  transition: all var(--transition-fast) !important;
}

.symptom-pill:hover {
  border-color: var(--accent-primary) !important;
  color: var(--accent-primary) !important;
  background: var(--accent-light) !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.18);
}

/* Version 6.5 Sidebar Button Active Glass Style */
.sidebar-btn.active {
  background: rgba(16, 185, 129, 0.18) !important;
  border: 1px solid rgba(16, 185, 129, 0.35) !important;
  color: var(--accent-primary) !important;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.08) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Version 6.5 Chat Input Glass Styles */
.chat-input-bar {
  background: var(--glass-bg) !important;
  border-top: 1px solid var(--glass-border) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.chat-input {
  background: var(--glass-bg) !important;
  border: 1.5px solid var(--glass-border) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.chat-input:focus {
  border-color: var(--border-focus) !important;
  background: var(--bg-primary) !important;
  box-shadow: 0 0 0 3px rgba(var(--accent-primary-rgb), 0.15) !important;
}

/* --- Version 6.6: Knowledge Grid Inner & Glassmorphic Article Modal --- */
.knowledge-grid-inner {
  grid-column: span 2;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  animation: cardEntrance 0.4s ease-out forwards;
}

@media (max-width: 900px) {
  .knowledge-grid-inner {
    grid-column: span 1;
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* Article modal specific overrides */
#articleModal {
  z-index: 2000;
  transition: opacity 0.3s ease;
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 10, 5, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  animation: modalFadeIn 0.3s ease;
}

/* Modal Content Card */
.modal-content.glass-card {
  width: 90%;
  max-width: 680px;
  max-height: 85dvh;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  animation: modalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(var(--bg-primary-rgb), 0.3);
}

.modal-category {
  background: var(--accent-primary);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, transform 0.2s ease;
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.modal-close:hover {
  color: var(--danger-color, #ef4444);
  background: rgba(239, 68, 68, 0.1);
  transform: rotate(90deg);
}

.modal-body-scroll {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Image Cover block inside Modal */
.modal-cover-wrap {
  width: 100%;
  height: 240px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--glass-border);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.modal-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-title-text {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.35;
  margin: 4px 0 0 0;
}

.modal-meta-bar {
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 1px dashed var(--glass-border);
  padding-bottom: 12px;
}

/* Markdown Rendering Inside Modal */
.modal-markdown-content {
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.6;
}

.modal-markdown-content h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--accent-secondary);
  margin: 16px 0 8px 0;
}

.modal-markdown-content p {
  margin: 0 0 12px 0;
}

.modal-markdown-content ul {
  margin: 0 0 16px 0;
  padding-left: 20px;
}

.modal-markdown-content li {
  margin-bottom: 6px;
}

.modal-markdown-content strong {
  color: var(--accent-primary);
}

.modal-markdown-content em {
  font-style: italic;
  color: var(--text-secondary);
}

/* Animations */
@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* Scrollbar styling for modal body */
.modal-body-scroll::-webkit-scrollbar {
  width: 6px;
}

.modal-body-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.modal-body-scroll::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: var(--radius-sm);
}

.modal-body-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary);
}

@media (max-width: 600px) {
  .modal-content.glass-card {
    width: 95%;
    max-height: 90dvh;
    border-radius: var(--radius-md);
  }
  .modal-cover-wrap {
    height: 160px;
  }
  .modal-title-text {
    font-size: 18px;
  }
  .modal-body-scroll {
    padding: 16px;
    gap: 12px;
  }
}




