/* ═══════════════════════════════════════════════════════════
   AI Symptom Checker — style.css  v2 (Enhanced)
   "Clinical Calm" Design System
   Fonts: DM Sans (body) + Fraunces (display)
   FOR EDUCATIONAL PURPOSES ONLY
═══════════════════════════════════════════════════════════ */

/* ── GOOGLE FONTS ─────────────────────────────────────────── */
@import url("https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=Fraunces:ital,opsz,wght@0,9..144,600;1,9..144,600&display=swap");

/* ── DESIGN TOKENS (Light) ───────────────────────────────── */
:root {
  --teal-50: #f0fdfa;
  --teal-100: #ccfbf1;
  --teal-300: #5eead4;
  --teal-500: #14b8a6;
  --teal-600: #0d9488;
  --teal-700: #0f766e;
  --teal-800: #115e59;
  --amber-50: #fffbeb;
  --amber-400: #fbbf24;
  --amber-500: #f59e0b;
  --amber-600: #d97706;
  --red-50: #fef2f2;
  --red-100: #fee2e2;
  --red-400: #f87171;
  --red-500: #ef4444;
  --red-600: #dc2626;
  --red-700: #b91c1c;
  --green-50: #f0fdf4;
  --green-400: #4ade80;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  /* Semantic tokens */
  --bg: #f4f7f9;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --border: #e2e8f0;
  --text-primary: var(--gray-900);
  --text-secondary: var(--gray-600);
  --text-muted: var(--gray-400);
  --accent: var(--teal-600);
  --accent-hover: var(--teal-700);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.07), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── DARK MODE TOKENS ────────────────────────────────────── */
[data-theme="dark"] {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-alt: #263447;
  --border: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: var(--teal-400);
  --accent-hover: var(--teal-300);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.5);
}

/* ── RESET & BASE ────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  scroll-behavior: smooth;
  font-size: 16px;
}
body {
  font-family: "DM Sans", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
  transition:
    background 0.3s,
    color 0.3s;
}
img,
svg {
  display: block;
  max-width: 100%;
}
button {
  cursor: pointer;
  border: none;
  font: inherit;
}
input,
select,
textarea {
  font: inherit;
}
a {
  color: inherit;
}

/* ── SCREEN SYSTEM ──────────────────────────────────────── */
main {
  flex: 1;
}
.screen {
  display: none;
  padding: 24px 16px 40px;
  max-width: 800px;
  margin: 0 auto;
  animation: fadeIn 0.35s ease;
}
.screen.active {
  display: block;
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ── HEADER ─────────────────────────────────────────────── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 200;
}
.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.header-logo {
  font-size: 1.5rem;
}
.header-title {
  font-family: "Fraunces", serif;
  font-size: 1.1rem;
  color: var(--accent);
  font-weight: 600;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.btn-icon {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  transition: var(--transition);
}
.btn-icon:hover {
  background: var(--teal-50);
  color: var(--accent);
  border-color: var(--accent);
}
[data-theme="dark"] .btn-icon:hover {
  background: var(--surface-alt);
}
.btn-icon-label {
  display: none;
}
@media (min-width: 520px) {
  .btn-icon-label {
    display: inline;
  }
}
.lang-toggle {
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  transition: var(--transition);
}
.lang-toggle:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

/* ── EMERGENCY ALERT PANEL ──────────────────────────────── */
.emergency-alert-panel {
  background: linear-gradient(135deg, #b91c1c, #dc2626);
  color: #fff;
  padding: 16px 20px;
  position: sticky;
  top: 60px;
  z-index: 190;
  animation: shake 0.4s ease;
}
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-6px);
  }
  40% {
    transform: translateX(6px);
  }
  60% {
    transform: translateX(-4px);
  }
  80% {
    transform: translateX(4px);
  }
}
.emergency-alert-inner {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.emergency-alert-icon {
  font-size: 2rem;
  flex-shrink: 0;
}
.emergency-alert-body {
  flex: 1;
  min-width: 200px;
}
.emergency-alert-title {
  font-size: 1rem;
  font-weight: 700;
  display: block;
  margin-bottom: 4px;
}
.emergency-alert-msg {
  font-size: 0.85rem;
  opacity: 0.92;
  line-height: 1.4;
}
.btn-emergency-call {
  display: inline-block;
  background: #fff;
  color: var(--red-700);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-weight: 700;
  font-size: 0.85rem;
  text-decoration: none;
  white-space: nowrap;
  transition: var(--transition);
}
.btn-emergency-call:hover {
  background: var(--red-50);
  transform: scale(1.04);
}

/* ── HISTORY PANEL (Drawer) ─────────────────────────────── */
.history-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 300;
}
.history-overlay.open {
  display: block;
}
.history-panel {
  position: fixed;
  top: 0;
  right: -360px;
  width: 340px;
  max-width: 90vw;
  height: 100vh;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  z-index: 400;
  display: flex;
  flex-direction: column;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}
.history-panel.open {
  right: 0;
}
.history-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
}
.history-panel-title {
  font-size: 1rem;
  font-weight: 600;
}
.history-panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-history-clear {
  font-size: 0.78rem;
  color: var(--red-600);
  background: var(--red-50);
  border: 1px solid var(--red-100);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  transition: var(--transition);
}
.btn-history-clear:hover {
  background: var(--red-100);
}
.history-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.history-empty {
  color: var(--text-muted);
  font-size: 0.88rem;
  text-align: center;
  margin-top: 32px;
}
.history-item {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  transition: var(--transition);
  cursor: pointer;
}
.history-item:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.history-item-date {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.history-item-symptoms {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.history-item-conditions {
  font-size: 0.82rem;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 8px;
}
.btn-history-reopen {
  font-size: 0.78rem;
  color: var(--accent);
  background: var(--teal-50);
  border: 1px solid var(--teal-100);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  transition: var(--transition);
}
[data-theme="dark"] .btn-history-reopen {
  background: var(--surface);
  border-color: var(--border);
}
.btn-history-reopen:hover {
  background: var(--teal-100);
}

/* ── DISEASE INFO MODAL ─────────────────────────────────── */
.disease-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}
.disease-modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 580px;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: scaleIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
.disease-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, var(--teal-50), var(--surface));
}
[data-theme="dark"] .disease-modal-header {
  background: var(--surface-alt);
}
.disease-modal-icon {
  font-size: 1.8rem;
}
.disease-modal-title {
  flex: 1;
  font-family: "Fraunces", serif;
  font-size: 1.15rem;
  color: var(--accent);
}
.disease-modal-close {
  background: var(--gray-100);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 0.82rem;
  transition: var(--transition);
}
[data-theme="dark"] .disease-modal-close {
  background: var(--surface-alt);
  color: var(--text-secondary);
}
.disease-modal-close:hover {
  background: var(--red-50);
  color: var(--red-600);
}
.disease-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.disease-section {
}
.disease-section-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 6px;
}
.disease-section-text {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ── HOME SCREEN ────────────────────────────────────────── */
.home-hero {
  text-align: center;
  padding: 48px 20px 36px;
}
.home-icon-wrap {
  font-size: 3.5rem;
  margin-bottom: 16px;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
}
.home-title {
  font-family: "Fraunces", serif;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  line-height: 1.15;
  color: var(--text-primary);
  margin-bottom: 12px;
}
.home-title em {
  color: var(--accent);
  font-style: normal;
}
.home-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  max-width: 500px;
  margin-inline: auto;
}
.home-tagline {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 28px;
}
.btn-start {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, var(--teal-600), var(--teal-700));
  color: #fff;
  border-radius: 50px;
  padding: 14px 32px;
  font-size: 1rem;
  font-weight: 600;
  box-shadow: 0 4px 20px rgba(13, 148, 136, 0.35);
  transition: var(--transition);
  margin-bottom: 28px;
}
.btn-start:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(13, 148, 136, 0.45);
}
.btn-start:active {
  transform: translateY(0);
}
.btn-start-arrow {
  font-size: 1.1rem;
  transition: transform 0.2s;
}
.btn-start:hover .btn-start-arrow {
  transform: translateX(4px);
}
.trust-badges {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}
.badge {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}
.badge-icon {
  font-size: 0.95rem;
}
.how-it-works {
  margin-bottom: 24px;
}
.section-heading {
  font-family: "Fraunces", serif;
  font-size: 1.35rem;
  text-align: center;
  margin-bottom: 20px;
  color: var(--text-primary);
}
.steps-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}
.step-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  text-align: center;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.step-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}
.step-number {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal-500), var(--teal-700));
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
}
.step-title {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 6px;
}
.step-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}
.home-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  transition: var(--transition);
}
.feature-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.feature-icon {
  font-size: 1.6rem;
  margin-bottom: 8px;
}
.feature-title {
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 4px;
}
.feature-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.4;
}
.disclaimer-section {
  display: flex;
  gap: 14px;
  background: var(--amber-50);
  border: 1px solid var(--amber-400);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  margin-top: 8px;
  align-items: flex-start;
}
[data-theme="dark"] .disclaimer-section {
  background: #2d2008;
  border-color: #713f12;
}
.disclaimer-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}
.disclaimer-heading {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 4px;
  color: var(--amber-600);
}
.disclaimer-text {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.reveal {
  animation: fadeIn 0.5s ease;
}

/* ── FORM SCREEN ────────────────────────────────────────── */
.form-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  padding: 28px 24px;
  max-width: 700px;
  margin: 0 auto;
}
.form-title {
  font-family: "Fraunces", serif;
  font-size: 1.5rem;
  color: var(--accent);
  margin-bottom: 24px;
  text-align: center;
}
.form-section-group {
  margin-bottom: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  background: var(--surface-alt);
}
.form-section-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 14px;
}
.form-section {
  margin-bottom: 16px;
}
.form-section:last-child {
  margin-bottom: 0;
}
.form-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 7px;
}
.form-required {
  color: var(--red-500);
  font-weight: 700;
  font-size: 0.8rem;
}
.form-input,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: var(--transition);
  outline: none;
}
.form-input:focus,
.form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}
.form-textarea {
  resize: vertical;
  min-height: 90px;
  line-height: 1.5;
}
.vital-signs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

/* Gender */
.gender-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.gender-option {
  display: none;
}
.gender-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1.5px solid var(--border);
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  background: var(--surface);
}
.gender-label:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.gender-option:checked + .gender-label {
  border-color: var(--accent);
  background: var(--teal-50);
  color: var(--accent);
  font-weight: 600;
}
[data-theme="dark"] .gender-option:checked + .gender-label {
  background: var(--surface-alt);
}
.g-icon {
  font-size: 1rem;
}

/* Category tabs */
.category-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.cat-tab {
  padding: 5px 12px;
  border-radius: 50px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  transition: var(--transition);
}
.cat-tab:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.cat-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Symptom search */
.symptom-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}
.symptom-search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  font-size: 0.95rem;
  pointer-events: none;
}
.symptom-search-input {
  flex: 1;
  padding: 10px 14px 10px 36px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition);
}
.symptom-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}
.btn-voice {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 9px 14px;
  background: var(--surface-alt);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  transition: var(--transition);
  flex-shrink: 0;
}
.btn-voice:hover {
  border-color: var(--teal-500);
  color: var(--accent);
  background: var(--teal-50);
}
.btn-voice.listening {
  background: var(--red-50);
  border-color: var(--red-400);
  color: var(--red-600);
  animation: voicePulse 1s ease-in-out infinite;
}
@keyframes voicePulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.3);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
  }
}

/* Symptom grid */
.symptom-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
  padding: 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--teal-300) transparent;
}
.symptom-grid::-webkit-scrollbar {
  width: 4px;
}
.symptom-grid::-webkit-scrollbar-thumb {
  background: var(--teal-300);
  border-radius: 4px;
}
.symptom-item {
  display: none;
}
.symptom-item.visible {
  display: block;
}
.symptom-label {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--surface);
  transition: var(--transition);
  user-select: none;
}
.symptom-label:hover {
  border-color: var(--teal-300);
  background: var(--teal-50);
  color: var(--teal-700);
}
[data-theme="dark"] .symptom-label:hover {
  background: var(--surface-alt);
}
.symptom-checkbox {
  display: none;
}
.symptom-checkbox:checked + .symptom-label {
  border-color: var(--accent);
  background: linear-gradient(135deg, var(--teal-50), var(--teal-100));
  color: var(--teal-700);
  font-weight: 600;
}
[data-theme="dark"] .symptom-checkbox:checked + .symptom-label {
  background: var(--surface-alt);
  color: var(--teal-300);
}
.symptom-check-icon {
  font-size: 0.9rem;
  flex-shrink: 0;
}
.symptom-count {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 6px;
  text-align: right;
}

/* Severity selector (injected per-symptom) */
.severity-tag-wrap {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.severity-tag-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-right: 4px;
}
.severity-option-btn {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 50px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}
.severity-option-btn.mild.active {
  background: #d1fae5;
  border-color: #059669;
  color: #065f46;
}
.severity-option-btn.moderate.active {
  background: #fef3c7;
  border-color: #d97706;
  color: #92400e;
}
.severity-option-btn.severe.active {
  background: #fee2e2;
  border-color: #dc2626;
  color: #7f1d1d;
}
[data-theme="dark"] .severity-option-btn.mild.active {
  background: #064e3b;
  color: #6ee7b7;
}
[data-theme="dark"] .severity-option-btn.moderate.active {
  background: #78350f;
  color: #fcd34d;
}
[data-theme="dark"] .severity-option-btn.severe.active {
  background: #7f1d1d;
  color: #fca5a5;
}

/* Actions */
.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.btn-check {
  flex: 1;
  min-width: 150px;
  background: linear-gradient(135deg, var(--teal-600), var(--teal-700));
  color: #fff;
  border-radius: var(--radius-md);
  padding: 13px 20px;
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
  transition: var(--transition);
  box-shadow: 0 4px 14px rgba(13, 148, 136, 0.3);
}
.btn-check:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(13, 148, 136, 0.4);
}
.btn-reset {
  padding: 13px 18px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 600;
  transition: var(--transition);
}
.btn-reset:hover {
  background: var(--red-50);
  border-color: var(--red-400);
  color: var(--red-600);
}

/* ── LOADING OVERLAY ────────────────────────────────────── */
.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  z-index: 600;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  backdrop-filter: blur(4px);
}
.loading-overlay.active {
  display: flex;
}
.loading-spinner {
  width: 52px;
  height: 52px;
  border: 4px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--teal-400);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.loading-text {
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
}
.loading-dots::after {
  content: "";
  animation: dots 1.2s steps(4, end) infinite;
}
@keyframes dots {
  0% {
    content: "";
  }
  25% {
    content: ".";
  }
  50% {
    content: "..";
  }
  75% {
    content: "...";
  }
  100% {
    content: "";
  }
}
.progress-steps {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: min(340px, 88vw);
}
.progress-step {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.45);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  transition:
    color 0.3s,
    background 0.3s;
}
.progress-step.active {
  color: #fff;
  background: rgba(20, 184, 166, 0.2);
  font-weight: 600;
}
.progress-step.done {
  color: var(--teal-300);
}
.progress-bar-wrap {
  width: min(340px, 88vw);
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--teal-400);
  border-radius: 4px;
  width: 0%;
  transition: width 0.4s ease;
}

/* ── RESULTS SCREEN ─────────────────────────────────────── */
.result-header {
  text-align: center;
  margin-bottom: 20px;
}
.result-title {
  font-family: "Fraunces", serif;
  font-size: 1.5rem;
  color: var(--accent);
  margin-bottom: 6px;
}
.result-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
}
.disclaimer-banner {
  background: var(--amber-50);
  border: 1px solid var(--amber-400);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  font-size: 0.8rem;
  color: var(--amber-600);
  margin-bottom: 18px;
  line-height: 1.5;
}
[data-theme="dark"] .disclaimer-banner {
  background: #2d2008;
  border-color: #713f12;
  color: #fcd34d;
}

/* Risk card */
.risk-level-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.3s;
}
.risk-level-card.risk-low {
  border-color: var(--green-400);
  background: var(--green-50);
}
.risk-level-card.risk-medium {
  border-color: var(--amber-400);
  background: var(--amber-50);
}
.risk-level-card.risk-high {
  border-color: var(--red-400);
  background: var(--red-50);
}
[data-theme="dark"] .risk-level-card.risk-low {
  background: #052e16;
}
[data-theme="dark"] .risk-level-card.risk-medium {
  background: #2d2008;
}
[data-theme="dark"] .risk-level-card.risk-high {
  background: #450a0a;
}
.risk-icon {
  font-size: 2rem;
}
.risk-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.risk-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Info summary + symptom tags */
.info-summary {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.info-item {
  font-size: 0.82rem;
}
.info-label {
  color: var(--text-muted);
  margin-right: 4px;
}
.info-value {
  font-weight: 600;
  color: var(--text-primary);
}
.reported-symptoms {
  margin-bottom: 18px;
}
.section-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.symptom-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.symptom-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--teal-50);
  border: 1px solid var(--teal-100);
  color: var(--teal-700);
  border-radius: 50px;
  padding: 4px 12px;
  font-size: 0.78rem;
  font-weight: 600;
}
[data-theme="dark"] .symptom-tag {
  background: var(--surface-alt);
  border-color: var(--border);
  color: var(--teal-300);
}
.severity-badge-mild {
  background: #d1fae5;
  color: #065f46;
  border-radius: 50px;
  padding: 1px 7px;
  font-size: 0.68rem;
  font-weight: 700;
}
.severity-badge-moderate {
  background: #fef3c7;
  color: #92400e;
  border-radius: 50px;
  padding: 1px 7px;
  font-size: 0.68rem;
  font-weight: 700;
}
.severity-badge-severe {
  background: #fee2e2;
  color: #7f1d1d;
  border-radius: 50px;
  padding: 1px 7px;
  font-size: 0.68rem;
  font-weight: 700;
}

/* Condition cards */
.conditions-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}
.condition-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.condition-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.condition-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 4px 0 0 4px;
}
.condition-card.sev-low::before {
  background: var(--green-500);
}
.condition-card.sev-medium::before {
  background: var(--amber-500);
}
.condition-card.sev-high::before {
  background: var(--red-500);
}
.condition-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.condition-name {
  font-weight: 700;
  font-size: 0.95rem;
  flex: 1;
}
.confidence-wrap {
  text-align: right;
  flex-shrink: 0;
}
.confidence-pct {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent);
}
.confidence-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  display: block;
}
.confidence-bar-track {
  height: 5px;
  background: var(--gray-200);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 8px;
}
[data-theme="dark"] .confidence-bar-track {
  background: var(--surface-alt);
}
.confidence-bar-fill {
  height: 100%;
  border-radius: 5px;
  background: linear-gradient(90deg, var(--teal-400), var(--teal-600));
  transition: width 0.8s ease;
}
.condition-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.sev-badge {
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 50px;
  padding: 2px 10px;
}
.sev-badge.low {
  background: #d1fae5;
  color: #065f46;
}
.sev-badge.medium {
  background: #fef3c7;
  color: #92400e;
}
.sev-badge.high {
  background: #fee2e2;
  color: #7f1d1d;
}
[data-theme="dark"] .sev-badge.low {
  background: #052e16;
  color: #86efac;
}
[data-theme="dark"] .sev-badge.medium {
  background: #2d2008;
  color: #fcd34d;
}
[data-theme="dark"] .sev-badge.high {
  background: #450a0a;
  color: #fca5a5;
}
.btn-learn-more {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--accent);
  background: var(--teal-50);
  border: 1px solid var(--teal-100);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-weight: 600;
  transition: var(--transition);
}
[data-theme="dark"] .btn-learn-more {
  background: var(--surface-alt);
  border-color: var(--border);
}
.btn-learn-more:hover {
  background: var(--teal-100);
  transform: translateY(-1px);
}

/* Advice cards */
.advice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.advice-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.advice-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.advice-card-home {
  border-top: 3px solid var(--green-500);
}
.advice-card-doctor {
  border-top: 3px solid var(--amber-500);
}
.advice-card-emergency {
  border-top: 3px solid var(--red-500);
}
.advice-icon {
  font-size: 1.5rem;
  margin-bottom: 8px;
  display: block;
}
.advice-title {
  font-weight: 700;
  font-size: 0.88rem;
  margin-bottom: 8px;
  color: var(--text-primary);
}
.advice-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Medicines */
.medicines-section {
  margin-bottom: 20px;
}
.medicines-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.medicines-disclaimer {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  font-style: italic;
}
.medicines-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.medicine-tag {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 5px;
}
.medicine-tag::before {
  content: "💊";
  font-size: 0.8rem;
}

/* Health tips */
.health-tips {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  margin-bottom: 22px;
}
.tips-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 10px;
}
.tips-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.tips-list li {
  font-size: 0.82rem;
  color: var(--text-secondary);
  padding-left: 20px;
  position: relative;
  line-height: 1.5;
}
.tips-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--green-500);
  font-weight: 700;
}
.result-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.btn-again {
  flex: 1;
  min-width: 140px;
  background: linear-gradient(135deg, var(--teal-600), var(--teal-700));
  color: #fff;
  border-radius: var(--radius-md);
  padding: 12px 18px;
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
  transition: var(--transition);
}
.btn-again:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(13, 148, 136, 0.3);
}
.btn-download,
.btn-back-home {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  transition: var(--transition);
}
.btn-download:hover {
  background: var(--teal-50);
  border-color: var(--accent);
  color: var(--accent);
}
.btn-back-home:hover {
  background: var(--gray-50);
  border-color: var(--gray-400);
}

/* ── TOAST ──────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 80px;
  right: 16px;
  z-index: 700;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--gray-800);
  color: #fff;
  border-radius: var(--radius-md);
  padding: 10px 18px;
  font-size: 0.82rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: slideUp 0.3s ease;
  max-width: 280px;
}
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ── FOOTER ─────────────────────────────────────────────── */
.app-footer {
  text-align: center;
  padding: 16px;
  font-size: 0.74rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

/* ── AI ASSISTANT WIDGET ────────────────────────────────── */
.ai-assistant-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 250;
}
.ai-chat-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  background: linear-gradient(135deg, var(--teal-600), var(--teal-800));
  color: #fff;
  border-radius: 50px;
  padding: 10px 18px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 4px 18px rgba(13, 148, 136, 0.4);
  transition: var(--transition);
}
.ai-chat-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(13, 148, 136, 0.5);
}
.ai-chat-icon {
  font-size: 1.1rem;
}
.ai-chat-window {
  display: none;
  position: absolute;
  bottom: 52px;
  right: 0;
  width: min(340px, 90vw);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  animation: scaleIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.ai-chat-window.open {
  display: flex;
  flex-direction: column;
}
.ai-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: linear-gradient(135deg, var(--teal-600), var(--teal-800));
  color: #fff;
}
.ai-chat-title {
  font-weight: 700;
  font-size: 0.9rem;
}
.ai-chat-close {
  color: rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-size: 0.8rem;
}
.ai-chat-close:hover {
  background: rgba(255, 255, 255, 0.3);
}
.ai-chat-messages {
  flex: 1;
  height: 240px;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
}
.ai-message {
  background: var(--surface-alt);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-primary);
  max-width: 92%;
  align-self: flex-start;
  border: 1px solid var(--border);
}
.ai-message.user-msg {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--teal-600), var(--teal-700));
  color: #fff;
  border: none;
}
.ai-message.welcome {
  font-style: italic;
  color: var(--text-secondary);
}
.ai-typing {
  color: var(--text-muted);
  font-size: 0.77rem;
  font-style: italic;
  padding: 4px 12px;
}
.ai-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 6px 10px;
  border-top: 1px solid var(--border);
}
.quick-reply-btn {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 50px;
  border: 1px solid var(--teal-300);
  color: var(--teal-700);
  background: var(--teal-50);
  transition: var(--transition);
}
[data-theme="dark"] .quick-reply-btn {
  background: var(--surface-alt);
  color: var(--teal-300);
  border-color: var(--border);
}
.quick-reply-btn:hover {
  background: var(--teal-100);
}
.ai-chat-input-wrap {
  display: flex;
  border-top: 1px solid var(--border);
  padding: 8px;
  gap: 6px;
}
.ai-chat-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 0.82rem;
  background: var(--surface-alt);
  color: var(--text-primary);
  outline: none;
}
.ai-chat-input:focus {
  border-color: var(--accent);
}
.ai-chat-send {
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  transition: var(--transition);
}
.ai-chat-send:hover {
  background: var(--accent-hover);
}

/* ── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 600px) {
  .app-header {
    padding: 0 12px;
  }
  .header-title {
    font-size: 0.92rem;
  }
  .form-card {
    padding: 18px 14px;
  }
  .symptom-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
  .advice-grid {
    grid-template-columns: 1fr;
  }
  .history-panel {
    width: 100%;
    max-width: 100%;
  }
  .home-title {
    font-size: 1.8rem;
  }
  .btn-check {
    font-size: 0.88rem;
  }
}
@media (max-width: 400px) {
  .symptom-grid {
    grid-template-columns: 1fr 1fr;
  }
  .category-tabs {
    gap: 4px;
  }
  .cat-tab {
    font-size: 0.72rem;
    padding: 4px 9px;
  }
}

/* ── ACCESSIBILITY ───────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
