/* ============================================================
   Health Dashboard — Design System
   ============================================================ */

/* ---------- CSS Custom Properties (Light / Dark) ---------- */
:root {
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Light theme (default) */
  --bg:           #F4F4F4;
  --bg-card:      #FFFFFF;
  --bg-card-alt:  #EDF7F8;
  --accent:       #00BCD4;
  --accent-light: #E0F7FA;
  --text:         #1A1A1A;
  --text-secondary: #5F6368;
  --text-tertiary:  #9AA0A6;
  --border:       #E0E0E0;
  --shadow:       0 2px 12px rgba(0,0,0,.06);
  --shadow-lg:    0 8px 30px rgba(0,0,0,.08);
  --ring-track:   #E8E8E8;
  --nav-bg:       rgba(255,255,255,.85);
  --bottom-nav-bg: rgba(255,255,255,.92);
  --overlay:      rgba(0,0,0,.3);
}

[data-theme="dark"] {
  --bg:           #1E1E1E;
  --bg-card:      #2A2A2A;
  --bg-card-alt:  #332A24;
  --accent:       #FF6B35;
  --accent-light: #3D2A1F;
  --text:         #EAEAEA;
  --text-secondary: #A0A0A0;
  --text-tertiary:  #666666;
  --border:       #3A3A3A;
  --shadow:       0 2px 12px rgba(0,0,0,.25);
  --shadow-lg:    0 8px 30px rgba(0,0,0,.35);
  --ring-track:   #3A3A3A;
  --nav-bg:       rgba(30,30,30,.92);
  --bottom-nav-bg: rgba(30,30,30,.95);
  --overlay:      rgba(0,0,0,.55);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  transition: background .35s, color .35s;
  padding-bottom: 80px;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea { font-family: inherit; }

.container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- TOP NAVBAR ---------- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--nav-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
  transition: background .35s, border-color .35s;
}

.nav-container {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 60px;
}

.nav-brand {
  font-weight: 700;
  font-size: 18px;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 6px;
}

.nav-link {
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all .2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-link:hover,
.nav-link.active {
  color: var(--accent);
  background: var(--accent-light);
}

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

/* Theme toggle */
.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text-secondary);
  transition: all .25s;
}

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

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  padding: 10px;
  transition: background .2s;
}

.hamburger span {
  display: block;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all .3s;
}

.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- MOBILE BOTTOM NAV ---------- */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--bottom-nav-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--border);
  padding: 6px 0 env(safe-area-inset-bottom, 8px);
  justify-content: space-around;
  transition: background .35s;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-tertiary);
  padding: 6px 8px;
  border-radius: 10px;
  transition: all .2s;
}

.bottom-nav-item i { font-size: 18px; }

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

/* ---------- SECTIONS ---------- */
.section {
  padding: 100px 0 40px;
  min-height: 60vh;
}

.section:first-child { padding-top: 100px; }

.section-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title i { color: var(--accent); }

.section-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 28px;
}

/* ---------- HOME — Hero ---------- */
.hero {
  text-align: center;
  padding: 20px 0 10px;
}

.greeting {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.date-display {
  font-size: 15px;
  color: var(--text-secondary);
  margin-top: 6px;
}

.streak-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
  font-size: 15px;
  padding: 8px 20px;
  border-radius: 40px;
  margin: 16px auto 30px;
  width: fit-content;
}

.streak-badge i { font-size: 18px; }

/* Status grid */
.status-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.status-card {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 20px 14px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: all .3s;
}

.status-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.status-icon {
  font-size: 22px;
  color: var(--accent);
  margin-bottom: 10px;
}

.status-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  font-weight: 500;
}

.status-value {
  font-size: 18px;
  font-weight: 700;
}

/* ---------- SUPPLEMENTS ---------- */
.supp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.supp-card {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
  transition: all .3s;
  position: relative;
}

.supp-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.supp-card.checked {
  opacity: .55;
}

.supp-card.checked .supp-name {
  text-decoration: line-through;
}

/* Custom checkbox */
.supp-check {
  position: relative;
  flex-shrink: 0;
  cursor: pointer;
}

.supp-check input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.checkmark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 2px solid var(--border);
  background: var(--bg);
  transition: all .2s;
}

.supp-check input:checked + .checkmark {
  background: var(--accent);
  border-color: var(--accent);
}

.supp-check input:checked + .checkmark::after {
  content: '\f00c';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 13px;
  color: #fff;
}

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

.supp-name {
  font-size: 14px;
  font-weight: 600;
  transition: all .2s;
}

.supp-dose {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ---------- PILL BADGES ---------- */
.pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  white-space: nowrap;
}

.pill.teal   { background: #E1F5EE; color: #0F6E56; }
.pill.purple { background: #EEEDFE; color: #3C3489; }
.pill.amber  { background: #FAEEDA; color: #633806; }
.pill.coral  { background: #FAECE7; color: #712B13; }
.pill.gray   { background: #F1EFE8; color: #444441; }
.pill.blue   { background: #E6F1FB; color: #0C447C; }
.pill.night  { background: #EDE7F6; color: #4527A0; }

[data-theme="dark"] .pill.teal   { background: #153D2E; color: #6EDCAA; }
[data-theme="dark"] .pill.purple { background: #2A2650; color: #B0A8F0; }
[data-theme="dark"] .pill.amber  { background: #3D2A10; color: #F0C060; }
[data-theme="dark"] .pill.coral  { background: #3A1E12; color: #F0A080; }
[data-theme="dark"] .pill.gray   { background: #333330; color: #A0A098; }
[data-theme="dark"] .pill.blue   { background: #152840; color: #70B0E0; }
[data-theme="dark"] .pill.night  { background: #2A2050; color: #B0A0E0; }

/* ---------- PLAN SECTION ---------- */
.plan-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 28px;
}

.plan-tab {
  padding: 10px 22px;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 600;
  border: 2px solid var(--border);
  color: var(--text-secondary);
  background: var(--bg-card);
  transition: all .25s;
}

.plan-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.plan-content { display: none; }
.plan-content.active { display: block; }

/* Timeline */
.tl-section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin: 24px 0 10px;
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.tl-row {
  display: grid;
  grid-template-columns: 82px 1fr;
  align-items: stretch;
}

.tl-time {
  padding: 14px 14px 14px 0;
  text-align: right;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  border-right: 2px solid var(--border);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.tl-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
}

.tl-dot.teal   { background: #1D9E75; }
.tl-dot.purple { background: #534AB7; }
.tl-dot.amber  { background: #BA7517; }
.tl-dot.coral  { background: #993C1D; }
.tl-dot.gray   { background: #888780; }
.tl-dot.blue   { background: #185FA5; }

.tl-body {
  padding: 14px 0 14px 20px;
}

.tl-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tl-title i {
  color: var(--accent);
  width: 18px;
  text-align: center;
}

.tl-detail {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
}

.tl-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

/* Cals summary bar */
.cals-summary {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 18px;
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  box-shadow: var(--shadow);
}

.cal-item { text-align: center; }
.cal-val  { font-size: 17px; font-weight: 700; }
.cal-label { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.cal-sub  { font-size: 10px; color: var(--text-tertiary); }

.plan-note {
  background: var(--bg-card-alt);
  border-left: 3px solid var(--accent);
  border-radius: 0 12px 12px 0;
  padding: 14px 18px;
  margin-top: 18px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ---------- TRACKER SECTION ---------- */
.tracker-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 28px;
}

.day-type-btn {
  padding: 10px 22px;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 600;
  border: 2px solid var(--border);
  color: var(--text-secondary);
  background: var(--bg-card);
  transition: all .25s;
}

.day-type-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.tracker-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.tracker-card {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 24px 18px;
  text-align: center;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  transition: all .3s;
}

.tracker-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.tracker-ring-wrap {
  position: relative;
  width: 140px;
  height: 140px;
}

.ring-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.ring-val {
  display: block;
  font-size: 26px;
  font-weight: 700;
}

.ring-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.tracker-input-group {
  width: 100%;
}

.tracker-input-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}

.input-row {
  display: flex;
  gap: 8px;
}

.input-row input,
.extra-row input[type="number"] {
  flex: 1;
  padding: 10px 14px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  transition: border-color .2s;
  outline: none;
}

.input-row input:focus,
.extra-row input[type="number"]:focus {
  border-color: var(--accent);
}

.input-set-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  transition: opacity .2s;
}

.input-set-btn:hover { opacity: .85; }

.tracker-target {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 6px;
}

/* Extra tracking (trained / sleep) */
.extra-tracking {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 20px 22px;
  margin-top: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.extra-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.extra-row label {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.extra-row label i { color: var(--accent); }

.extra-row input[type="number"] {
  width: 80px;
  flex: unset;
}

/* Toggle switch */
.toggle-switch {
  position: relative;
  width: 52px;
  height: 28px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.slider {
  position: absolute;
  inset: 0;
  border-radius: 28px;
  background: var(--border);
  transition: background .25s;
  cursor: pointer;
}

.slider::before {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  top: 3px;
  left: 3px;
  transition: transform .25s;
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
}

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

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

/* ---------- NOTES SECTION ---------- */
.notes-card {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.notes-card textarea {
  width: 100%;
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color .2s;
}

.notes-card textarea:focus {
  border-color: var(--accent);
}

.notes-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}

.notes-timestamp {
  font-size: 12px;
  color: var(--text-tertiary);
}

.notes-save-btn {
  padding: 10px 22px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: opacity .2s;
}

.notes-save-btn:hover { opacity: .85; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Tablet & below */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .hamburger { display: flex; }

  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--nav-bg);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--border);
    padding: 12px 20px;
    gap: 4px;
    animation: slideDown .25s ease;
  }

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

  .bottom-nav { display: flex; }

  body { padding-bottom: 90px; }

  .status-grid { grid-template-columns: repeat(2, 1fr); }
  .supp-grid   { grid-template-columns: 1fr; }
  .tracker-grid { grid-template-columns: 1fr; }
  .cals-summary { grid-template-columns: repeat(2, 1fr); }

  .greeting { font-size: 26px; }
  .section { padding: 80px 0 30px; }
}

/* Small phones */
@media (max-width: 400px) {
  .plan-toggle,
  .tracker-toggle {
    flex-direction: column;
  }

  .plan-tab,
  .day-type-btn {
    width: 100%;
    text-align: center;
  }

  .cals-summary { grid-template-columns: 1fr 1fr; }
}
