/* ============================================
   SağlıkYön – Design System
   Dark/Light Mode, Glassmorphism, Animations
   ============================================ */

/* ── CSS Custom Properties ── */
:root {
  --font: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  
  /* Light Theme */
  --bg-primary: #eef4f8;
  --bg-secondary: #ffffff;
  --bg-glass: rgba(255,255,255,0.75);
  --bg-card: #ffffff;
  --text-primary: #102033;
  --text-secondary: #555;
  --text-muted: #888;
  --border: rgba(0,0,0,0.08);
  --border-hover: rgba(29,78,216,0.25);
  
  --accent: #1d4ed8;
  --accent-dark: #1e40af;
  --accent-light: rgba(29,78,216,0.1);
  --accent-glow: rgba(29,78,216,0.2);
  --gradient: linear-gradient(135deg, #1d4ed8 0%, #0f766e 100%);
  --gradient-warm: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
  
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-md: 0 8px 32px rgba(0,0,0,0.08);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.12);
  --shadow-glow: 0 0 40px var(--accent-glow);
  
  --transition: 0.3s cubic-bezier(0.4,0,0.2,1);
}

/* Dark Theme */
[data-theme="dark"] {
  --bg-primary: #0f0f1a;
  --bg-secondary: #1a1a2e;
  --bg-glass: rgba(26,26,46,0.85);
  --bg-card: #1e1e35;
  --text-primary: #e8e8f0;
  --text-secondary: #a0a0b8;
  --text-muted: #666680;
  --border: rgba(255,255,255,0.06);
  --border-hover: rgba(29,78,216,0.35);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 8px 32px rgba(0,0,0,0.4);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.5);
}

/* ── Reset & Base ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  transition: background var(--transition), color var(--transition);
  -webkit-font-smoothing: antialiased;
}

/* Background gradient orb */
body::before {
  content: '';
  position: fixed;
  top: -30%;
  right: -20%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(29,78,216,0.16) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  bottom: -20%;
  left: -15%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(15,118,110,0.12) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}

/* ── Theme Toggle ── */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  cursor: pointer;
  font-size: 1.3rem;
  z-index: 1000;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}
.theme-toggle:hover { transform: scale(1.1); border-color: var(--accent); box-shadow: var(--shadow-glow); }

/* ── Welcome Modal ── */
.welcome-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.4s;
  padding: 20px;
}
.welcome-overlay.hidden { display: none !important; }
.welcome-modal {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 50px 40px;
  max-width: 520px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: slideUp 0.5s cubic-bezier(0.16,1,0.3,1);
}
.welcome-glow {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 60% 40%, rgba(29,78,216,0.08) 0%, transparent 50%);
  pointer-events: none;
}
.welcome-badge {
  display: inline-block;
  background: var(--accent-light);
  color: var(--accent);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 20px;
  letter-spacing: 0.5px;
}
.welcome-title {
  font-size: 2.8rem;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
}
.welcome-logo-icon { -webkit-text-fill-color: initial; }
.welcome-subtitle { color: var(--text-secondary); font-size: 1.05rem; margin-bottom: 30px; line-height: 1.7; }
.welcome-features { display: flex; justify-content: center; gap: 30px; margin-bottom: 30px; }
.welcome-feature { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.feature-icon-circle {
  width: 56px; height: 56px;
  border-radius: 16px;
  background: var(--accent-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  transition: all var(--transition);
}
.welcome-feature:hover .feature-icon-circle { transform: translateY(-4px); box-shadow: var(--shadow-glow); }
.welcome-feature span:last-child { font-size: 0.85rem; color: var(--text-secondary); font-weight: 500; }
.welcome-disclaimer {
  background: var(--accent-light);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 25px;
}
.welcome-start-btn {
  background: var(--gradient);
  color: white;
  border: none;
  padding: 16px 48px;
  border-radius: var(--radius-md);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex; align-items: center; gap: 8px;
}
.welcome-start-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 25px var(--accent-glow); }

/* ── App Container ── */
.app-container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 30px 20px;
  position: relative;
  z-index: 1;
}

/* ── Header ── */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding: 24px 30px;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.app-logo { display: flex; align-items: center; gap: 10px; font-size: 1.8rem; font-weight: 800; }
.logo-icon { font-size: 2rem; }
.logo-text { background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.app-tagline { font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; }
.header-right { display: flex; gap: 8px; }

/* ── Hero ── */
.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.9fr);
  gap: 20px;
  margin-bottom: 20px;
}
.hero-copy,
.hero-side-card {
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.hero-copy {
  position: relative;
  padding: 34px;
  overflow: hidden;
}
.hero-copy::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient);
}
.hero-kicker {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 18px;
}
.hero-title {
  font-size: clamp(2rem, 4vw, 3.15rem);
  line-height: 1.08;
  letter-spacing: -0.04em;
  margin-bottom: 16px;
  max-width: 12ch;
}
.hero-desc {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 64ch;
}
.hero-trust {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 24px;
}
.hero-trust-card {
  padding: 16px;
  border-radius: 16px;
  background: rgba(255,255,255,0.65);
  border: 1px solid rgba(29,78,216,0.08);
}
.hero-trust-card strong {
  display: block;
  font-size: 0.92rem;
  margin-bottom: 6px;
}
.hero-trust-card span {
  color: var(--text-secondary);
  font-size: 0.86rem;
}
.hero-side-card {
  padding: 26px 24px;
}
.hero-side-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
}
.hero-side-title {
  font-size: 1.35rem;
  line-height: 1.2;
  margin-bottom: 10px;
}
.hero-side-intro {
  color: var(--text-secondary);
  font-size: 0.92rem;
  margin-bottom: 18px;
}
.hero-side-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.hero-side-item {
  padding: 15px 16px;
  background: var(--bg-card);
  border-radius: 16px;
  border: 1px solid var(--border);
}
.hero-side-item strong {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 4px;
}
.hero-side-item p {
  color: var(--text-secondary);
  font-size: 0.87rem;
}

/* ── Buttons ── */
.btn-primary {
  width: 100%;
  padding: 16px;
  background: var(--gradient);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 25px var(--accent-glow); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.btn-secondary.is-active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}
.btn-sm { padding: 8px 14px; font-size: 0.8rem; }
.btn-icon-only { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-muted); padding: 4px; }
.btn-icon-only:hover { color: var(--text-primary); }

/* ── Sections ── */
.section {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 30px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
  animation: fadeIn 0.4s;
}
.section:hover { border-color: var(--border-hover); box-shadow: var(--shadow-md); }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
}
.section-title {
  font-size: 1.3rem; font-weight: 700; margin-bottom: 8px;
  display: flex; align-items: center; gap: 10px;
}
.section-icon { font-size: 1.4rem; }
.section-desc { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 20px; }
.section-head .section-desc { margin-bottom: 0; }
.section-pill {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 700;
}

/* ── Info Banner ── */
.info-banner {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  background: var(--accent-light);
  border: 1px solid rgba(29,78,216,0.15);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 18px 24px;
  margin-bottom: 20px;
  animation: fadeIn 0.5s;
}
.banner-icon { font-size: 1.5rem; flex-shrink: 0; }
.banner-text { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.6; }
.banner-highlight { color: var(--accent); font-weight: 600; }

.intake-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.82fr) minmax(0, 1.18fr);
  gap: 20px;
  align-items: start;
}
.intake-grid .section {
  margin-bottom: 0;
  height: 100%;
}

/* ── Body Map ── */
.body-map-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
  padding: 20px;
  min-height: 400px;
}
#bodyMapSVG {
  max-width: 220px;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.1));
}
.body-part {
  fill: var(--bg-card);
  stroke: var(--text-muted);
  stroke-width: 1.5;
  cursor: pointer;
  transition: all 0.25s ease;
}
.body-part:hover { fill: var(--accent); stroke: var(--accent-dark); filter: brightness(1.1); }
.body-part.active { fill: var(--accent-dark); stroke: var(--accent); stroke-width: 3; }

/* Popup */
#popupContainer { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; }
.symptom-popup {
  position: absolute;
  background: var(--bg-card);
  border: 2px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: var(--shadow-md);
  min-width: 180px;
  max-width: 220px;
  pointer-events: all;
  animation: popupFadeIn 0.25s;
  z-index: 100;
}
.popup-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px; padding-bottom: 8px; border-bottom: 2px solid var(--accent);
}
.popup-title { font-weight: 700; font-size: 0.9rem; color: var(--text-primary); text-transform: uppercase; }
.popup-close {
  background: none; border: none; font-size: 1.2rem; cursor: pointer;
  color: var(--text-muted); width: auto; padding: 2px 6px; margin: 0;
}
.popup-close:hover { color: var(--danger); }
.problem-card { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 6px; overflow: hidden; }
.problem-title {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; cursor: pointer; font-size: 0.85rem; font-weight: 500;
  transition: background var(--transition);
  color: var(--text-primary);
}
.problem-title:hover { background: var(--accent-light); }
.problem-arrow { transition: transform var(--transition); font-size: 0.8rem; }
.problem-card.expanded .problem-arrow { transform: rotate(90deg); }
.problem-details { display: none; padding: 6px 12px 10px; }
.problem-card.expanded .problem-details { display: block; }
.popup-options { display: block; }
.detail-option {
  padding: 6px 10px; margin: 3px 0; border-radius: 6px; font-size: 0.8rem;
  cursor: pointer; transition: all var(--transition); border: 1px solid transparent;
  color: var(--text-primary);
}
.detail-option:hover { background: var(--accent-light); border-color: var(--accent); }
.detail-option.selected { background: var(--accent); color: white; border-color: var(--accent); }
.popup-submit {
  width: 100%; padding: 8px; margin-top: 8px; background: var(--gradient);
  color: white; border: none; border-radius: var(--radius-sm);
  font-size: 0.85rem; font-weight: 600; cursor: pointer;
}
.popup-submit:hover { opacity: 0.9; }
.selection-counter { text-align: center; font-size: 0.75rem; color: var(--text-muted); margin-top: 6px; display: block; }

/* ── Textarea ── */
.textarea-container { position: relative; }
.textarea-container textarea {
  width: 100%;
  padding: 18px 60px 18px 18px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-family: var(--font);
  background: var(--bg-card);
  color: var(--text-primary);
  resize: vertical;
  transition: all var(--transition);
  line-height: 1.6;
}
.textarea-container textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-glow); }
.textarea-container textarea::placeholder { color: var(--text-muted); }

.voice-btn {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg-card);
  font-size: 1.2rem;
  cursor: pointer;
  transition: all var(--transition);
  display: flex; align-items: center; justify-content: center;
  padding: 0;
}
.voice-btn:hover { border-color: var(--accent); background: var(--accent-light); transform: scale(1.1); }
.voice-btn.listening {
  border-color: var(--danger);
  background: rgba(239,68,68,0.1);
  animation: voicePulse 1.5s infinite;
}

.input-meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.char-counter { font-size: 0.8rem; color: var(--text-muted); }
.voice-status { font-size: 0.85rem; color: var(--accent); font-weight: 500; }
.voice-status.error { color: var(--danger); }
.rate-limit-status {
  flex: 1;
  min-width: 190px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.rate-limit-status.is-warning {
  color: var(--warning);
  font-weight: 600;
}
.example-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
.example-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
}

.btn-analyze { margin-top: 16px; }

/* ── Loading ── */
.loading-container {
  text-align: center;
  padding: 50px 30px;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  margin-bottom: 20px;
}
.loading-animation { position: relative; width: 80px; height: 80px; margin: 0 auto 24px; }
.pulse-ring {
  position: absolute; inset: 0;
  border: 3px solid var(--accent);
  border-radius: 50%;
  animation: pulseRing 1.5s ease-out infinite;
}
.delay-1 { animation-delay: 0.3s; }
.delay-2 { animation-delay: 0.6s; }
.loading-icon { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 2rem; }
.loading-text { font-size: 1.1rem; font-weight: 600; color: var(--text-primary); margin-bottom: 15px; }

.loading-steps {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.loading-steps .step {
  font-size: 0.85rem;
  color: var(--text-muted);
  opacity: 0;
  animation: fadeIn 0.5s forwards;
}

.loading-steps .step.active {
  color: var(--accent);
  font-weight: 600;
  opacity: 1;
}

/* ── Error ── */
.error-container {
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.2);
  border-left: 4px solid var(--danger);
  padding: 20px 24px;
  border-radius: var(--radius-md);
  color: var(--danger);
  margin-bottom: 20px;
  animation: shake 0.5s;
  font-weight: 500;
}

/* ── Result ── */
.result-container { margin-bottom: 20px; animation: fadeIn 0.5s; display: flex; flex-direction: column; gap: 16px;}

/* Emergency */
.emergency-card {
  background: rgba(239,68,68,0.08);
  border: 2px solid var(--danger);
  padding: 30px;
  border-radius: var(--radius-lg);
  text-align: center;
  animation: emergencyPulse 2s infinite;
}
.emergency-card h2 { color: var(--danger); font-size: 1.8rem; margin-bottom: 12px; }
.emergency-card p { color: var(--text-primary); font-size: 1.1rem; margin-bottom: 20px; }
.emergency-call {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--danger); color: white; text-decoration: none;
  padding: 16px 40px; border-radius: var(--radius-md);
  font-size: 1.2rem; font-weight: 700; transition: all var(--transition);
}
.emergency-call:hover { transform: scale(1.05); box-shadow: 0 8px 25px rgba(239,68,68,0.3); }

/* Department Result */
.dept-card {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border: 2px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 35px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}
.dept-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: var(--gradient);
}
.dept-label { font-size: 0.85rem; color: var(--accent); font-weight: 600; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
.dept-name { font-size: 2rem; font-weight: 800; margin-bottom: 12px; color: var(--text-primary); display: flex; align-items: center; gap: 12px; }
.dept-icon { font-size: 2.2rem; }
.confidence-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 16px; border-radius: 20px; font-size: 0.85rem; font-weight: 600;
}
.confidence-high { background: rgba(16,185,129,0.1); color: var(--success); border: 1px solid rgba(16,185,129,0.2); }
.confidence-medium { background: rgba(245,158,11,0.1); color: var(--warning); border: 1px solid rgba(245,158,11,0.2); }
.confidence-low { background: rgba(239,68,68,0.1); color: var(--danger); border: 1px solid rgba(239,68,68,0.2); }
.care-banner {
  margin-top: 16px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-card);
}
.care-banner-title { font-size: 0.92rem; font-weight: 700; margin-bottom: 6px; }
.care-banner-text { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.5; }
.care-routine { border-color: rgba(16,185,129,0.25); background: rgba(16,185,129,0.08); }
.care-routine .care-banner-title { color: var(--success); }
.care-soon { border-color: rgba(245,158,11,0.25); background: rgba(245,158,11,0.08); }
.care-soon .care-banner-title { color: var(--warning); }
.care-urgent { border-color: rgba(239,68,68,0.25); background: rgba(239,68,68,0.08); }
.care-urgent .care-banner-title { color: var(--danger); }
.reasoning-box {
  margin-top: 16px; padding: 16px 20px;
  background: var(--accent-light); border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm); font-size: 0.95rem; color: var(--text-secondary); line-height: 1.6;
}

/* Matched Symptoms */
.matched-symptoms {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px;
}
.symptom-tag {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--accent-light); color: var(--accent);
  padding: 6px 14px; border-radius: 20px; font-size: 0.8rem; font-weight: 500;
  border: 1px solid rgba(29,78,216,0.2);
}

/* MHRS Button */
.mhrs-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 16px;
  background: var(--success); color: white; text-decoration: none;
  border-radius: var(--radius-md); font-size: 1.05rem; font-weight: 700;
  transition: all var(--transition);
}
.mhrs-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(16,185,129,0.3); }

/* Alternatives */
.alt-section { }
.alt-title { font-size: 0.9rem; color: var(--text-muted); font-weight: 600; margin-bottom: 10px; }
.alt-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.alt-tag {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-card); border: 1.5px solid var(--border);
  padding: 10px 18px; border-radius: var(--radius-xl); font-size: 0.9rem; font-weight: 500;
  transition: all var(--transition); cursor: default; color: var(--text-primary);
}
.alt-tag:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }

/* Note */
.note-box {
  background: rgba(245,158,11,0.08); border-left: 4px solid var(--warning);
  padding: 14px 20px; border-radius: var(--radius-sm);
  font-size: 0.9rem; color: var(--text-secondary);
}

/* Doctor Note Button */
.doctor-note-btn {
  width: 100%; padding: 14px;
  background: var(--bg-card); border: 2px solid var(--border);
  color: var(--text-primary); border-radius: var(--radius-md);
  font-size: 0.95rem; font-weight: 600; cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font);
}
.doctor-note-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Family Doctor Card */
.family-card {
  background: rgba(16,185,129,0.06);
  border: 2px solid var(--success);
  border-radius: var(--radius-lg);
  padding: 30px; text-align: center;
}
.family-card h3 { color: var(--success); font-size: 1.3rem; margin-bottom: 12px; }
.family-card p {color: var(--text-primary);}
.family-benefits { display: flex; justify-content: center; gap: 20px; margin: 16px 0; }
.benefit-item {
  background: rgba(16,185,129,0.08); padding: 10px 16px;
  border-radius: var(--radius-sm); font-size: 0.85rem; font-weight: 500; color: var(--success);
}

/* Chat (Follow-up Questions) */
.chat-container {
  background: var(--bg-glass); backdrop-filter: blur(12px);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden;
}
.chat-header {
  background: var(--gradient); color: white;
  padding: 20px 24px;
}
.chat-header h3 { font-size: 1.1rem; font-weight: 700; margin: 0; }
.chat-hint { font-size: 0.85rem; opacity: 0.8; margin-top: 4px; }
.chat-messages { padding: 20px 24px; max-height: 400px; overflow-y: auto; }
.chat-message { display: flex; gap: 12px; margin-bottom: 16px; animation: fadeIn 0.3s; }
.ai-message { justify-content: flex-start; }
.user-message { justify-content: flex-end; }
.message-avatar { font-size: 1.5rem; flex-shrink: 0; }
.message-content {
  background: var(--bg-card); border: 1px solid var(--border);
  padding: 14px 18px; border-radius: var(--radius-md);
  max-width: 80%; font-size: 0.95rem; color: var(--text-primary);
}
.user-message .message-content { background: var(--accent); color: white; border-color: var(--accent); }
.message-buttons { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.chat-btn {
  padding: 10px 24px; border-radius: var(--radius-sm); font-weight: 600;
  font-size: 0.9rem; cursor: pointer; transition: all var(--transition);
  border: 2px solid; width: auto; margin: 0;
  font-family: var(--font);
}
.chat-btn-yes { background: rgba(16,185,129,0.1); border-color: var(--success); color: var(--success); }
.chat-btn-yes:hover { background: var(--success); color: white; }
.chat-btn-no { background: rgba(239,68,68,0.1); border-color: var(--danger); color: var(--danger); }
.chat-btn-no:hover { background: var(--danger); color: white; }
.chat-btn-skip { background: rgba(156,163,175,0.1); border-color: #9ca3af; color: #6b7280; }
.chat-btn-skip:hover { background: #9ca3af; color: white; }
.chat-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.chat-btn.selected { color: white; }
.chat-btn-yes.selected { background: var(--success); }
.chat-btn-no.selected { background: var(--danger); }
.chat-btn-skip.selected { background: #9ca3af; }

/* Feedback */
.feedback-section { margin-top: 20px; text-align: center; }
.feedback-question { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 10px; }
.feedback-btns { display: flex; justify-content: center; gap: 12px; }
.feedback-btn {
  padding: 10px 24px; border-radius: var(--radius-sm);
  background: var(--bg-card); border: 1.5px solid var(--border);
  font-size: 0.9rem; cursor: pointer; transition: all var(--transition);
  font-family: var(--font); width: auto; margin: 0; color: var(--text-primary);
}
.feedback-btn:hover { border-color: var(--accent); }
.feedback-btn.selected { background: var(--accent); color: white; border-color: var(--accent); }

/* ── History Panel ── */
.history-panel {
  background: var(--bg-glass); backdrop-filter: blur(12px);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 24px; margin-bottom: 20px; animation: slideDown 0.3s;
}
.history-panel.hidden { display: none !important; }
.history-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.history-header h3 { font-size: 1.1rem; color: var(--text-primary); margin: 0;}
.history-list { max-height: 300px; overflow-y: auto; margin-bottom: 16px;}
.history-item {
  padding: 12px 16px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin-bottom: 8px;
  cursor: pointer; transition: all var(--transition);
}
.history-item:hover { border-color: var(--accent); background: var(--accent-light); }
.history-symptom { font-size: 0.9rem; font-weight: 500; margin-bottom: 4px; color: var(--text-primary); }
.history-meta { display: flex; justify-content: space-between; gap: 12px; }
.history-dept { font-size: 0.8rem; color: var(--accent); }
.history-date { font-size: 0.75rem; color: var(--text-muted); display: block; margin-top: 4px; }
.history-empty { color: var(--text-muted); font-style: italic; text-align: center; padding: 20px; }

/* ── Stats Badge ── */
.stats-badge {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    display: flex;
    align-items: baseline;
    gap: 6px;
    box-shadow: var(--shadow-sm);
    z-index: 100;
}
.stats-count { font-weight: 800; color: var(--accent); font-size: 1.1rem; }
.stats-label { color: var(--text-muted); font-size: 0.8rem; }

/* ── Footer ── */
.app-footer {
  text-align: center;
  padding: 30px 20px;
  margin-top: 20px;
  border-top: 1px solid var(--border);
}
.footer-disclaimer { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 8px; }
.footer-tech { font-size: 0.8rem; color: var(--accent); font-weight: 500; margin-bottom: 8px; }
.footer-links { font-size: 0.8rem; color: var(--text-muted); }
.footer-links a { color: var(--text-primary); text-decoration: none; }
.footer-links a:hover { text-decoration: underline; color: var(--accent); }
.footer-links .separator { margin: 0 8px; }

/* ── Elderly Mode ── */
body.elderly-mode { font-size: 1.3rem; }
body.elderly-mode .app-logo { font-size: 2.5rem; }
body.elderly-mode .app-tagline { font-size: 1rem; }
body.elderly-mode textarea, body.elderly-mode .btn-primary { font-size: 1.4rem !important; padding: 22px !important; }
body.elderly-mode .dept-name { font-size: 2.5rem; }
body.elderly-mode .section-title { font-size: 1.6rem; }
body.elderly-mode .mhrs-btn { font-size: 1.4rem; padding: 20px; }
body.elderly-mode .btn-secondary { font-size: 1.1rem; padding: 12px 20px; }
body.elderly-mode .footer-disclaimer { font-size: 1.1rem; }

/* ── Animations ── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
@keyframes popupFadeIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }
@keyframes pulseRing { 0% { transform: scale(0.5); opacity: 1; } 100% { transform: scale(1.5); opacity: 0; } }
@keyframes voicePulse { 0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.4); } 50% { box-shadow: 0 0 0 12px rgba(239,68,68,0); } }
@keyframes emergencyPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.2); } 50% { box-shadow: 0 0 30px rgba(239,68,68,0.15); } }

/* ── Utility ── */
.hidden { display: none !important; }

/* ── Responsive ── */
@media (max-width: 960px) {
  .hero-panel,
  .intake-grid,
  .hero-trust { grid-template-columns: 1fr; }
  .hero-title { max-width: none; }
  .section-head { flex-direction: column; }
}

@media (max-width: 640px) {
  .app-container { padding: 16px 12px; }
  .app-header { flex-direction: column; gap: 16px; padding: 20px; text-align: center; }
  .hero-copy,
  .hero-side-card { padding: 22px; }
  .hero-title { font-size: 2.1rem; }
  .header-right { width: 100%; justify-content: center; }
  .section { padding: 20px; }
  .welcome-modal { padding: 30px 20px; }
  .welcome-title { font-size: 2rem; }
  .welcome-features { gap: 16px; flex-direction: column; }
  .dept-name { font-size: 1.4rem; }
  .theme-toggle { top: 12px; right: 12px; width: 40px; height: 40px; }
  .stats-badge { bottom: 10px; right: 10px; }
  .message-content { max-width: 90%; }
  .history-meta { flex-direction: column; gap: 4px; }
}
