/* ──────────────────────────────────────────────
   HEALTH TRACKER — matches question-bank theme
   ────────────────────────────────────────────── */

:root {
  --bg: #fafafa;
  --bg-alt: #f0f0f0;
  --surface: #ffffff;
  --border: #e0e0e0;
  --text: #1a1a1a;
  --text-muted: #666666;
  --primary: #101010;

  --accent-normal: #10b981;
  --accent-over: #ef4444;
  --accent-under: #3b82f6;
  --accent-warning: #f59e0b;

  --transition: 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --hover-shadow: 0 20px 40px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] {
  --bg: #0a0a0a;
  --bg-alt: #121212;
  --surface: #161616;
  --border: #262626;
  --text: #f0f0f0;
  --text-muted: #a0a0a0;
  --primary: #ffffff;
  --hover-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

html::-webkit-scrollbar {
  display: none;
}

body {
  background: var(--bg);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  line-height: 1.6;
  transition: background-color var(--transition), color var(--transition);
  overflow-x: hidden;
}

/* ──────────── LAYOUT ──────────── */
.container {
  width: 100%;
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 32px;
}

/* ──────────── TOP BAR ──────────── */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 0;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 2000;
}

.back-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  height: 40px;
  padding: 0 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: all var(--transition);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.back-link:hover {
  color: var(--text);
}

.theme-btn-header {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all var(--transition);
}

.theme-btn-header:hover {
  color: var(--text);
  background: var(--bg-alt);
}

[data-theme="dark"] .icon-moon {
  display: none;
}

[data-theme="light"] .icon-sun {
  display: none;
}

/* ──────────── HERO ──────────── */
.hero {
  padding: 120px 0 48px;
}

.section-label {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.hero-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(2.4rem, 5vw, 3.4rem);
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 20px;
  letter-spacing: -0.02em;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 620px;
  line-height: 1.75;
  margin-bottom: 40px;
}

/* Quick Stats Pills */
.quick-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.stat-pill {
  display: flex;
  flex-direction: column;
  padding: 14px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  min-width: 120px;
  box-shadow: var(--hover-shadow);
  transition: transform var(--transition);
}

.stat-pill:hover {
  transform: translateY(-2px);
}

.stat-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.stat-val {
  font-size: 1.25rem;
  font-weight: 700;
}

.accent-text {
  color: var(--accent-warning);
}

.accent-green {
  color: var(--accent-normal);
}

.val-normal {
  color: var(--accent-normal);
}

.val-over {
  color: var(--accent-over);
}

.val-warn {
  color: var(--accent-warning);
}

/* ──────────── CONTENT SECTIONS ──────────── */
.content-section {
  padding: 48px 0;
}

.section-heading {
  margin-bottom: 24px;
}

.section-h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: 4px;
}

/* ──────────── HISTORY TRIO (top charts) ──────────── */
.history-trio {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 12px;
}

.history-chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--hover-shadow);
  transition: transform var(--transition);
}

.history-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.history-icon {
  font-size: 1.2rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  flex-shrink: 0;
}

.history-card-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 1px;
}

.history-card-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.history-delta {
  margin-left: auto;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 100px;
}

.delta-good {
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-normal);
}

.delta-bad {
  background: rgba(239, 68, 68, 0.1);
  color: var(--accent-over);
}

.chart-canvas-wrap {
  position: relative;
  height: 140px;
}

/* ──────────── DASHBOARD GRID ──────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 40px;
}

.grid-col-main,
.grid-col-side {
  display: flex;
  flex-direction: column;
}

/* ──────────── CARD ──────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 40px;
  box-shadow: var(--hover-shadow);
}

/* ──────────── DATA TABLE ──────────── */
.data-table {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.table-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.table-header {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--border);
  padding-bottom: 10px;
}

.total-row {
  border-bottom: none;
  background: var(--bg-alt);
  padding: 14px 12px;
  border-radius: 8px;
  margin-top: 8px;
  margin-left: -12px;
  margin-right: -12px;
}

.desc-title {
  display: block;
  font-weight: 500;
  font-size: 0.92rem;
}

.desc-sub {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.col-val {
  font-size: 1.05rem;
  font-weight: 600;
}

.col-range {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ──────────── BAR CHARTS (Muscle/Obesity) ──────────── */
.bar-chart-container {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.chart-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chart-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.chart-label {
  font-size: 0.9rem;
  font-weight: 500;
}

.chart-label small {
  color: var(--text-muted);
  font-size: 0.78rem;
  margin-left: 4px;
}

.unit {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.chart-val {
  font-weight: 700;
  font-size: 1rem;
}

.chart-track-wrapper {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Zone labels above bar */
.track-zone-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  color: var(--text-muted);
  padding: 0 2px;
}

/* The bar track */
.chart-track {
  height: 14px;
  background: var(--bg-alt);
  border-radius: 7px;
  position: relative;
  display: flex;
  overflow: hidden;
}

.track-zone {
  flex: 1;
  height: 100%;
}

.zone-under {
  background: rgba(59, 130, 246, 0.12);
}

.zone-normal {
  background: rgba(16, 185, 129, 0.15);
}

.zone-over {
  background: rgba(239, 68, 68, 0.12);
}

.chart-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  border-radius: 7px;
  width: 0;
  transition: width 1.1s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
}

.chart-bar::after {
  content: attr(data-val);
  font-size: 0.65rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}

.bar-normal {
  background: linear-gradient(90deg, #34d399, #10b981);
}

.bar-over {
  background: linear-gradient(90deg, #f87171, #ef4444);
}

.bar-under {
  background: linear-gradient(90deg, #60a5fa, #3b82f6);
}

/* ──────────── GOAL ARC ──────────── */
.goal-arc-container {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

.goal-arc-svg {
  width: 100%;
  max-width: 220px;
  overflow: visible;
}

.arc-bg {
  stroke: var(--border);
}

.arc-fill {
  stroke: var(--accent-normal);
  stroke-dasharray: 0, 100;
  transition: stroke-dasharray 1.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.arc-pct {
  fill: var(--text);
  font-size: 16px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
}

.arc-label {
  fill: var(--text-muted);
  font-size: 6.5px;
  font-family: 'Inter', sans-serif;
}

/* Arc Legend */
.arc-legend {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 8px;
}

.arc-leg-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.arc-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.arc-dot-fill {
  background: var(--accent-normal);
}

.arc-dot-remain {
  background: var(--border);
  border: 1px solid var(--text-muted);
}

/* ──────────── CONTROL LIST ──────────── */
.control-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.control-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.control-list li:last-child {
  border-bottom: none;
}

.control-list li span {
  color: var(--text-muted);
}

/* ──────────── OBESITY EVAL ──────────── */
.eval-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.eval-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.eval-label {
  font-weight: 500;
  font-size: 0.9rem;
}

.eval-badge {
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 0.78rem;
  font-weight: 600;
}

.badge-warning {
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent-warning);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.12);
  color: var(--accent-over);
}

/* ──────────── RATIO BLOCKS ──────────── */
.ratio-block {
  margin-top: 20px;
}

.ratio-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.ratio-name {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.ratio-value {
  font-size: 0.95rem;
  font-weight: 700;
}

.ratio-track {
  height: 10px;
  background: var(--bg-alt);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 6px;
}

.ratio-fill {
  height: 100%;
  border-radius: 5px;
  width: 0;
  transition: width 1.1s cubic-bezier(0.16, 1, 0.3, 1);
}

.ratio-scale {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* ──────────── RESEARCH PARAMS ──────────── */
.research-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.research-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}

.research-list li:last-child {
  border-bottom: none;
}

.r-info {
  display: flex;
  flex-direction: column;
}

.r-info span {
  font-weight: 500;
}

.r-info small {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ──────────── SEGMENTAL BODY ──────────── */
.segmental-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.seg-body-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: center;
}

.seg-body-icon {
  font-size: 2.2rem;
  text-align: center;
  line-height: 1;
  filter: grayscale(0.3);
}

.seg-body-gap {
  /* placeholder so grid stays symmetric for legs row */
  width: 48px;
}

.seg-trunk-row {
  display: flex;
  justify-content: center;
  padding: 4px 0;
}

.seg-trunk-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 10px;
  padding: 12px 8px;
  width: 45%;
}

.seg-trunk-label .seg-zone {
  color: var(--text-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex: 1;
}

.seg-trunk-label .seg-kg {
  font-size: 1rem;
  font-weight: 700;
}

.seg-trunk-label .seg-status {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent-over);
}

.seg-item-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 8px;
  border-radius: 10px;
  gap: 2px;
  text-align: center;
}

.seg-bad {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.seg-good {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.seg-zone {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.seg-kg {
  font-size: 1rem;
  font-weight: 700;
}

.seg-status {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent-over);
}

/* ──────────── ANIMATIONS ──────────── */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.55s var(--ease-out), transform 0.55s var(--ease-out);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ──────────── FOOTER ──────────── */
.footer {
  margin-top: 40px;
  border-top: 1px solid var(--border);
  padding: 24px 0;
}

.footer .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ──────────── RESPONSIVE ──────────── */
@media (max-width: 900px) {
  .history-trio {
    grid-template-columns: 1fr;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .container {
    padding: 0 20px;
  }

  .table-row {
    grid-template-columns: 1fr auto;
  }

  .col-range {
    display: none;
  }

  .quick-stats {
    gap: 8px;
  }

  .stat-pill {
    min-width: 100px;
  }

  .footer .container {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
}

/* ──────────── DOCTOR CARD (PREMIUM) ──────────── */
.doctor-card {
  position: relative;
  overflow: hidden;
  padding: 32px 24px;
  background: linear-gradient(145deg, var(--surface) 0%, rgba(16, 185, 129, 0.05) 100%);
  border: 1px solid rgba(16, 185, 129, 0.2);
  display: flex;
  flex-direction: column;
  min-height: 185px;
}

.doctor-content {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  filter: blur(10px);
  width: 100%;
  height: 100%;
  transition: filter 0.4s ease;
  user-select: none;
}

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

.doctor-title {
  font-size: 0.85rem;
  color: var(--accent-normal);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.badge-verified {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-normal);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 12px;
}

.doc-body {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: auto;
}

.doctor-img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  background-color: var(--border);
  border: 3px solid var(--surface);
}

.doctor-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.doctor-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.doctor-loc {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.blur-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  /* very light */
  backdrop-filter: blur(2px);
}

[data-theme="dark"] .blur-overlay {
  background: rgba(0, 0, 0, 0.2);
}

.blur-msg {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  padding: 12px 20px;
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.lock-icon {
  color: var(--text-muted);
}