/* ═══════════════════════════════════════════════════
   SymptomSense — Smart Health Symptom Checker
   Design: Clean clinical with warmth — Navy + Teal + Soft White
   Font: Fraunces (display) + DM Sans (body)
   ═══════════════════════════════════════════════════ */

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

:root {
  --navy:       #0f2b4a;
  --navy-mid:   #1a3e63;
  --teal:       #0ea5a0;
  --teal-light: #14c5be;
  --teal-pale:  #e6f8f8;
  --sky:        #e8f4fd;
  --white:      #ffffff;
  --off-white:  #f7f9fc;
  --border:     #dde7f0;
  --text-main:  #1a2c3d;
  --text-mid:   #4a6278;
  --text-soft:  #8ba4b8;
  --red:        #e53e3e;
  --red-bg:     #fff5f5;
  --orange:     #dd6b20;
  --orange-bg:  #fffaf0;
  --green:      #276749;
  --green-bg:   #f0fff4;
  --green-mid:  #38a169;
  --shadow-sm:  0 1px 3px rgba(15,43,74,.08), 0 1px 2px rgba(15,43,74,.04);
  --shadow-md:  0 4px 16px rgba(15,43,74,.10), 0 2px 6px rgba(15,43,74,.06);
  --shadow-lg:  0 12px 32px rgba(15,43,74,.12), 0 4px 12px rgba(15,43,74,.08);
  --radius-sm:  8px;
  --radius-md:  14px;
  --radius-lg:  20px;
  --transition: 200ms cubic-bezier(.4,0,.2,1);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--off-white);
  color: var(--text-main);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.header {
  background: var(--navy);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(15,43,74,.25);
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--teal), var(--teal-light));
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: white;
  flex-shrink: 0;
}

.logo-text {
  font-family: 'Fraunces', serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: white;
  letter-spacing: -.01em;
}
.logo-text em { color: var(--teal-light); font-style: normal; }

.header-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.8);
  padding: 5px 14px;
  border-radius: 100px;
  font-size: .8rem;
  font-weight: 500;
  letter-spacing: .02em;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  background: var(--teal-light);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .5; transform: scale(.8); }
}

/* ── Hero ────────────────────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-mid) 55%, #1e5080 100%);
  padding: 48px 24px 56px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  right: -80px;
  top: -80px;
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, rgba(14,165,160,.18) 0%, transparent 65%);
  pointer-events: none;
}

.hero::after {
  content: '';
  position: absolute;
  left: 30%;
  bottom: -60px;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(14,165,160,.10) 0%, transparent 65%);
  pointer-events: none;
}

.hero-content {
  max-width: 1280px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.hero-eyebrow {
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--teal-light);
  margin-bottom: 12px;
}

.hero-title {
  font-family: 'Fraunces', serif;
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 500;
  color: white;
  line-height: 1.15;
  margin-bottom: 16px;
}
.hero-title em { color: var(--teal-light); font-style: italic; }

.hero-subtitle {
  font-size: 1rem;
  color: rgba(255,255,255,.7);
  max-width: 520px;
  line-height: 1.65;
}

.hero-disclaimer {
  max-width: 1280px;
  margin: 24px auto 0;
  display: flex;
  align-items: flex-start;
  gap: 7px;
  color: rgba(255,255,255,.45);
  font-size: .78rem;
  position: relative;
  z-index: 1;
}
.hero-disclaimer svg { flex-shrink: 0; margin-top: 2px; }

/* ── Main Layout ─────────────────────────────────────────────────────────── */
.main-layout {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 24px 64px;
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 900px) {
  .main-layout { grid-template-columns: 1fr; }
  .header-badge { display: none; }
}

/* ── Panel Base ──────────────────────────────────────────────────────────── */
.panel {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.panel-header {
  padding: 24px 24px 0;
}

.panel-title {
  font-family: 'Fraunces', serif;
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--navy);
}

.panel-subtitle {
  font-size: .82rem;
  color: var(--text-soft);
  margin-top: 2px;
}

/* ── Symptom Selector Panel ──────────────────────────────────────────────── */
.panel-selector {
  position: sticky;
  top: 80px;
}

.search-wrap {
  position: relative;
  margin: 16px 24px 0;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-soft);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 9px 12px 9px 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: .875rem;
  color: var(--text-main);
  background: var(--off-white);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.search-input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(14,165,160,.12);
}

.symptom-grid {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 12px;
  max-height: 420px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.symptom-grid::-webkit-scrollbar { width: 4px; }
.symptom-grid::-webkit-scrollbar-track { background: transparent; }
.symptom-grid::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.symptom-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-soft);
  font-size: .875rem;
  padding: 20px 12px;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

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

/* Symptom Chip */
.symptom-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  user-select: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: .875rem;
  color: var(--text-main);
}

.symptom-chip:hover { background: var(--off-white); }

.symptom-chip.selected {
  background: var(--teal-pale);
  color: var(--navy);
}

.symptom-chip.emergency { }

.chip-check {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--border);
  border-radius: 5px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  transition: all var(--transition);
  background: white;
}

.symptom-chip.selected .chip-check {
  background: var(--teal);
  border-color: var(--teal);
}

.chip-check-icon {
  opacity: 0;
  transform: scale(.5);
  transition: all var(--transition);
  color: white;
}

.symptom-chip.selected .chip-check-icon {
  opacity: 1;
  transform: scale(1);
}

.chip-label { flex: 1; }

.chip-emergency-badge {
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid rgba(229,62,62,.2);
  padding: 2px 6px;
  border-radius: 100px;
}

.symptom-chip.hidden-chip { display: none; }

/* Selector Footer */
.selector-footer {
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.selected-count {
  font-size: .82rem;
  color: var(--text-soft);
}
.selected-count #selectedCount {
  font-weight: 700;
  color: var(--navy);
  font-size: 1rem;
}

.selector-actions { display: flex; gap: 8px; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  outline: none;
  white-space: nowrap;
}

.btn:disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--teal), var(--teal-light));
  color: white;
  box-shadow: 0 4px 12px rgba(14,165,160,.35);
}
.btn-primary:hover {
  box-shadow: 0 6px 18px rgba(14,165,160,.45);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  background: transparent;
  color: var(--text-mid);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--off-white); color: var(--text-main); }

/* ── Results Panel ───────────────────────────────────────────────────────── */
.panel-results { padding: 0; min-height: 400px; }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 64px 32px;
  gap: 16px;
}

.empty-icon {
  width: 80px;
  height: 80px;
  background: var(--teal-pale);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--teal);
}

.empty-state h3 {
  font-family: 'Fraunces', serif;
  font-size: 1.3rem;
  color: var(--navy);
  font-weight: 500;
}

.empty-state p {
  color: var(--text-mid);
  max-width: 380px;
  font-size: .9rem;
}

.results-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 32px;
  gap: 16px;
  color: var(--text-mid);
  font-size: .9rem;
}

.loading-animation {
  display: flex;
  gap: 8px;
}

.loading-pulse {
  width: 10px;
  height: 10px;
  background: var(--teal);
  border-radius: 50%;
  animation: loadpulse .9s ease-in-out infinite alternate;
}
@keyframes loadpulse { to { transform: scale(.5); opacity: .4; } }

.results-content { padding: 0; }

/* ── Emergency Banner ────────────────────────────────────────────────────── */
.emergency-banner {
  background: var(--red-bg);
  border-bottom: 2px solid var(--red);
  padding: 16px 24px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  animation: slideDown .3s ease;
}

@keyframes slideDown { from { opacity:0; transform: translateY(-8px); } }

.emergency-icon {
  width: 42px;
  height: 42px;
  background: var(--red);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: white;
  flex-shrink: 0;
}

.emergency-text strong {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  color: var(--red);
  margin-bottom: 4px;
}

.emergency-text p {
  font-size: .875rem;
  color: #742a2a;
  line-height: 1.55;
}

/* ── Summary Row ─────────────────────────────────────────────────────────── */
.summary-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--border);
}

.summary-card {
  padding: 20px 24px;
  border-right: 1px solid var(--border);
}
.summary-card:last-child { border-right: none; }

.summary-label {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin-bottom: 4px;
}

.summary-value {
  font-family: 'Fraunces', serif;
  font-size: 1.8rem;
  font-weight: 500;
  color: var(--navy);
  line-height: 1;
}

.severity-value[data-severity="Low"]      { color: var(--green-mid); }
.severity-value[data-severity="Moderate"] { color: var(--orange); }
.severity-value[data-severity="High"]     { color: var(--red); }

/* ── Severity Meter ──────────────────────────────────────────────────────── */
.severity-meter-wrap {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.severity-meter-label {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin-bottom: 12px;
}

.severity-meter {
  position: relative;
}

.severity-track {
  position: relative;
  height: 10px;
  background: linear-gradient(to right, #c6f6d5, #fefcbf, #fed7d7);
  border-radius: 100px;
  border: 1px solid rgba(0,0,0,.06);
}

.severity-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  border-radius: 100px;
  transition: width .8s cubic-bezier(.4,0,.2,1);
  width: 0%;
}

.severity-thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%,-50%);
  width: 18px;
  height: 18px;
  background: white;
  border: 2px solid var(--navy);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: left .8s cubic-bezier(.4,0,.2,1);
  left: 0%;
}

.severity-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
}

.severity-labels span {
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-soft);
}

/* ── Conditions List ─────────────────────────────────────────────────────── */
.conditions-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 20px 24px 8px;
}

.conditions-header h3 {
  font-family: 'Fraunces', serif;
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--navy);
}

.conditions-note {
  font-size: .78rem;
  color: var(--text-soft);
}

.conditions-list {
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── Condition Card ──────────────────────────────────────────────────────── */
.condition-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
  animation: fadeUp .35s ease both;
}

.condition-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
}

.condition-card:nth-child(1) { animation-delay: .05s; }
.condition-card:nth-child(2) { animation-delay: .12s; }
.condition-card:nth-child(3) { animation-delay: .19s; }
.condition-card:nth-child(4) { animation-delay: .26s; }
.condition-card:nth-child(5) { animation-delay: .33s; }

.condition-card-header {
  padding: 16px 20px;
  background: var(--off-white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
}

.condition-rank {
  width: 28px;
  height: 28px;
  background: var(--navy);
  color: white;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: .75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.condition-info { flex: 1; min-width: 0; }

.condition-name {
  font-weight: 700;
  font-size: .95rem;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.condition-tags {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.tag {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 100px;
}

.tag-severity[data-s="Low"]      { background: var(--green-bg);  color: var(--green); border: 1px solid rgba(39,103,73,.2); }
.tag-severity[data-s="Moderate"] { background: var(--orange-bg); color: var(--orange); border: 1px solid rgba(221,107,32,.2); }
.tag-severity[data-s="High"]     { background: var(--red-bg);   color: var(--red); border: 1px solid rgba(229,62,62,.2); }

.tag-matched {
  background: var(--sky);
  color: var(--navy-mid);
  border: 1px solid rgba(15,43,74,.1);
}

/* Probability Ring */
.condition-prob-ring {
  width: 60px;
  height: 60px;
  flex-shrink: 0;
}

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

.circle-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 3;
}

.circle {
  fill: none;
  stroke: var(--teal);
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dasharray .8s cubic-bezier(.4,0,.2,1);
}

.circular-chart .percentage {
  fill: var(--navy);
  font-family: 'DM Sans', sans-serif;
  font-size: 7px;
  font-weight: 700;
  text-anchor: middle;
}

/* Card Body */
.condition-body { padding: 16px 20px; display: flex; flex-direction: column; gap: 14px; }

.condition-description {
  font-size: .875rem;
  color: var(--text-mid);
  line-height: 1.6;
}

.matched-symptoms-wrap { }

.matched-label {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin-bottom: 6px;
}

.matched-pills { display: flex; flex-wrap: wrap; gap: 5px; }

.matched-pill {
  background: var(--teal-pale);
  color: var(--teal);
  font-size: .75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 100px;
  border: 1px solid rgba(14,165,160,.2);
}

/* Self-Care Details */
.self-care-details {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.self-care-summary {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 14px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--navy);
  cursor: pointer;
  list-style: none;
  background: var(--sky);
  transition: background var(--transition);
}
.self-care-summary::-webkit-details-marker { display: none; }
.self-care-summary:hover { background: #ddeef8; }

.self-care-list {
  padding: 12px 14px 12px 28px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.self-care-list li {
  font-size: .83rem;
  color: var(--text-mid);
  line-height: 1.55;
}

/* Doctor Note */
.doctor-note {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  background: #fffbeb;
  border: 1px solid rgba(221,107,32,.2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.doctor-note svg { color: var(--orange); flex-shrink: 0; margin-top: 2px; }

.doctor-note-text {
  font-size: .78rem;
  color: #7b341e;
  line-height: 1.5;
}

/* ── No Match ────────────────────────────────────────────────────────────── */
.no-match {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  padding: 40px 32px;
  color: var(--text-mid);
}
.no-match svg { color: var(--text-soft); }
.no-match p { font-size: .875rem; max-width: 380px; }

/* ── Results Footer Note ─────────────────────────────────────────────────── */
.results-footer-note {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin: 16px 24px 24px;
  padding: 12px 14px;
  background: var(--off-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .77rem;
  color: var(--text-soft);
  line-height: 1.5;
}
.results-footer-note svg { flex-shrink: 0; margin-top: 1px; }

/* ── Footer ──────────────────────────────────────────────────────────────── */
.footer {
  background: var(--navy);
  padding: 20px 24px;
  margin-top: auto;
}

.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px;
  font-size: .78rem;
  color: rgba(255,255,255,.4);
}

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

/* ── Mobile ──────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .hero { padding: 32px 16px 40px; }
  .main-layout { padding: 16px 12px 48px; gap: 16px; }
  .summary-row { grid-template-columns: 1fr 1fr; }
  .summary-card:nth-child(3) { grid-column: 1 / -1; border-right: none; border-top: 1px solid var(--border); }
  .selector-footer { flex-direction: column; align-items: stretch; }
  .selector-actions { justify-content: stretch; }
  .btn { flex: 1; justify-content: center; }
  .condition-card-header { flex-wrap: wrap; }
  .footer-inner { flex-direction: column; align-items: center; text-align: center; }
}

/* ── Animate on results reveal ───────────────────────────────────────────── */
.results-content {
  animation: fadeIn .3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
