/* Baby Hub — shared styles (v2, fertility-first) */

:root {
  /* Rose / plum — primary brand */
  --rose-50:  #fdf2f6;
  --rose-100: #fbe0ec;
  --rose-200: #f6bdd5;
  --rose-300: #ee8fb5;
  --rose-400: #e15f93;
  --rose-500: #d13d78;
  --rose-600: #b02a61;
  --rose-700: #8a2050;
  --rose-800: #5f1637;

  /* Teal — fertile / ovulation (go signal) */
  --teal-50:  #e6f7f2;
  --teal-100: #b8ebde;
  --teal-300: #5dcaa5;
  --teal-400: #1d9e75;
  --teal-500: #14855f;
  --teal-600: #0f6e56;

  /* Amber — peak / alerts */
  --amber-50:  #fdf3e0;
  --amber-300: #f2c063;
  --amber-400: #ef9f27;
  --amber-600: #99630b;

  /* Plum accent for period days */
  --plum-50:  #f3edfa;
  --plum-300: #c4a4e8;
  --plum-500: #8b5cc4;
  --plum-600: #6d3fa8;

  --text:       #1c1a1e;
  --text-2:     #6b6570;
  --text-3:     #9c96a1;
  --border:     rgba(30,20,40,0.08);
  --border-med: rgba(30,20,40,0.14);
  --surface:    #ffffff;
  --surface-1:  #faf7fa;
  --surface-2:  #f2edf2;
  --page-bg:    #f7f3f7;

  --radius:     10px;
  --radius-lg:  16px;
  --radius-xl:  22px;
  --shadow-sm:  0 1px 2px rgba(30,20,40,0.04), 0 1px 3px rgba(30,20,40,0.06);
  --shadow-md:  0 2px 8px rgba(30,20,40,0.06), 0 4px 16px rgba(30,20,40,0.04);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text:       #ece8ef;
    --text-2:     #a8a2ae;
    --text-3:     #726c78;
    --border:     rgba(255,255,255,0.08);
    --border-med: rgba(255,255,255,0.14);
    --surface:    #201d24;
    --surface-1:  #262229;
    --surface-2:  #2e2932;
    --page-bg:    #1a171d;
    --rose-50:    #2b1a24;
    --teal-50:    #12281f;
    --amber-50:   #2a2012;
    --plum-50:    #221a2e;
    --shadow-sm:  0 1px 2px rgba(0,0,0,0.3);
    --shadow-md:  0 4px 16px rgba(0,0,0,0.35);
  }
}

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

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--page-bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Auth screen ─────────────────────────────── */
#auth-screen {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 100vh; gap: 1.75rem; padding: 2rem;
  background: radial-gradient(circle at 50% 30%, var(--rose-50), var(--page-bg) 70%);
}
.auth-logo {
  width: 72px; height: 72px; border-radius: 50%;
  background: linear-gradient(135deg, var(--rose-400), var(--plum-500));
  display: flex; align-items: center; justify-content: center;
  font-size: 34px; box-shadow: var(--shadow-md);
}
.auth-title { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; text-align: center; }
.auth-sub   { font-size: 15px; color: var(--text-2); text-align: center; margin-top: 4px; }

/* ── App shell ───────────────────────────────── */
#app { display: none; flex-direction: column; min-height: 100vh; }
#app.visible { display: flex; }

.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.875rem 1.25rem;
  background: var(--surface);
  border-bottom: 0.5px solid var(--border-med);
}
.sticky-top { position: sticky; top: 0; z-index: 10; }
.app-logo { display: flex; align-items: center; gap: 11px; }
.logo-dot {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--rose-400), var(--plum-500));
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; flex-shrink: 0;
}
.app-title { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.app-sub   { font-size: 12px; color: var(--text-2); }

.phase-badge {
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
  padding: 4px 11px; border-radius: 20px;
  background: var(--rose-50); color: var(--rose-600);
}
.phase-badge.pregnant { background: var(--teal-50); color: var(--teal-600); }
.phase-badge.newborn  { background: var(--plum-50); color: var(--plum-600); }

/* ── Nav tabs ────────────────────────────────── */
.nav-tabs {
  display: flex; background: var(--surface);
  border-bottom: 0.5px solid var(--border-med);
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  padding: 0 0.5rem;
  position: sticky; top: 59px; z-index: 9;
}
.nav-tab {
  flex-shrink: 0; padding: 0.75rem 1rem;
  font-size: 13.5px; color: var(--text-2); cursor: pointer;
  border: none; background: none; text-decoration: none;
  border-bottom: 2.5px solid transparent; margin-bottom: -0.5px;
  transition: color 0.15s; font-family: inherit; font-weight: 500;
}
.nav-tab:hover { color: var(--text); }
.nav-tab.active { color: var(--rose-600); border-bottom-color: var(--rose-500); }

/* ── Main content ────────────────────────────── */
.main { flex: 1; padding: 1.25rem; max-width: 560px; margin: 0 auto; width: 100%; }

/* ── Cards ───────────────────────────────────── */
.card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.125rem 1.25rem;
  margin-bottom: 0.875rem;
  box-shadow: var(--shadow-sm);
}
.card-title {
  font-size: 12px; font-weight: 600; color: var(--text-2);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 0.875rem;
  display: flex; align-items: center; gap: 6px;
}

/* ── Cycle wheel (hero) ──────────────────────── */
.wheel-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.5rem 1.25rem 1.25rem;
  margin-bottom: 0.875rem;
  box-shadow: var(--shadow-md);
  text-align: center;
}
.wheel-wrap { position: relative; width: 260px; height: 260px; margin: 0 auto; }
.wheel-center {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center;
  width: 150px;
}
.wheel-phase-label {
  font-size: 12px; font-weight: 600; letter-spacing: 0.05em;
  text-transform: uppercase; margin-bottom: 2px;
}
.wheel-day-num { font-size: 52px; font-weight: 700; line-height: 1; letter-spacing: -0.03em; }
.wheel-day-cap { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.wheel-status  {
  font-size: 13px; font-weight: 600; margin-top: 10px;
  padding: 5px 14px; border-radius: 20px;
}
.wheel-status.fertile { background: var(--teal-50); color: var(--teal-600); }
.wheel-status.ovulation { background: var(--amber-50); color: var(--amber-600); }
.wheel-status.period { background: var(--rose-50); color: var(--rose-600); }
.wheel-status.low { background: var(--surface-2); color: var(--text-2); }

.wheel-legend {
  display: flex; justify-content: center; gap: 16px;
  margin-top: 1.25rem; flex-wrap: wrap;
}
.wheel-legend span { font-size: 11.5px; color: var(--text-2); display: flex; align-items: center; gap: 5px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

/* ── Insight strip ───────────────────────────── */
.insight {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 0.875rem 1rem; border-radius: var(--radius);
  margin-bottom: 0.875rem; font-size: 13.5px;
  border: 0.5px solid var(--border-med); background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.insight.fertile { background: var(--teal-50); border-color: var(--teal-300); }
.insight.ovulation { background: var(--amber-50); border-color: var(--amber-300); }
.insight-icon {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 17px;
  background: var(--surface); box-shadow: var(--shadow-sm);
}
.insight-body .i-title { font-weight: 600; margin-bottom: 2px; }
.insight-body .i-sub { font-size: 12.5px; color: var(--text-2); line-height: 1.45; }
.insight.fertile .i-sub, .insight.ovulation .i-sub { color: inherit; opacity: 0.82; }

/* ── Stats row ───────────────────────────────── */
.stats-row {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 9px; margin-bottom: 0.875rem;
}
.stat {
  background: var(--surface); border: 0.5px solid var(--border);
  border-radius: var(--radius); padding: 0.875rem;
  box-shadow: var(--shadow-sm); text-align: center;
}
.stat-label { font-size: 10.5px; color: var(--text-2); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.stat-val   { font-size: 26px; font-weight: 700; color: var(--text); line-height: 1; letter-spacing: -0.02em; }
.stat-sub   { font-size: 11px; color: var(--text-3); margin-top: 3px; }

/* ── List rows ───────────────────────────────── */
.row-list { display: flex; flex-direction: column; }
.row-item {
  display: flex; align-items: center; gap: 12px;
  padding: 0.75rem 0; border-bottom: 0.5px solid var(--border);
  cursor: pointer; transition: opacity 0.12s;
}
.row-item:last-child { border-bottom: none; }
.row-item:active { opacity: 0.6; }
.row-icon {
  width: 38px; height: 38px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 18px;
}
.row-icon.rose  { background: var(--rose-50); }
.row-icon.teal  { background: var(--teal-50); }
.row-icon.amber { background: var(--amber-50); }
.row-icon.plum  { background: var(--plum-50); }
.row-label { flex: 1; font-size: 14px; font-weight: 500; }
.row-sub   { font-size: 12px; color: var(--text-2); margin-top: 1px; }
.row-right { font-size: 13px; color: var(--text); text-align: right; font-weight: 500; }
.row-right.muted { color: var(--text-3); font-weight: 400; }

/* ── Cycle strip (linear day view) ───────────── */
.cycle-strip { display: flex; gap: 4px; margin-top: 0.25rem; justify-content: space-between; }
.cycle-day {
  flex: 1; aspect-ratio: 1; max-width: 34px; border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 11px; color: var(--text-3); background: var(--surface-1);
  position: relative;
}
.cycle-day .cd-dow { font-size: 8px; opacity: 0.7; margin-bottom: 1px; }
.cycle-day.fertile { background: var(--teal-50);  color: var(--teal-600); font-weight: 600; }
.cycle-day.ov      { background: var(--amber-400); color: #fff; font-weight: 700; }
.cycle-day.period  { background: var(--rose-100); color: var(--rose-700); }
.cycle-day.today   { outline: 2px solid var(--rose-500); outline-offset: 1px; }

/* ── Forms ───────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-label { font-size: 13px; color: var(--text); margin-bottom: 6px; display: block; font-weight: 500; }
.form-hint  { font-size: 11.5px; color: var(--text-3); margin-top: 5px; line-height: 1.4; }

input[type="date"], input[type="number"], input[type="text"], select, textarea {
  width: 100%; padding: 0.625rem 0.875rem;
  border: 0.5px solid var(--border-med); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  font-size: 15px; font-family: inherit; appearance: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--rose-400);
  box-shadow: 0 0 0 3px var(--rose-50);
}

/* Chip selectors */
.chip-row { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  padding: 0.5rem 0.875rem; border-radius: 22px;
  border: 0.5px solid var(--border-med);
  background: var(--surface); color: var(--text-2);
  font-size: 13px; cursor: pointer; text-align: center;
  transition: all 0.13s; font-family: inherit; font-weight: 500;
  display: flex; align-items: center; gap: 5px;
}
.chip:hover { border-color: var(--rose-300); }
.chip.selected { background: var(--rose-500); color: #fff; border-color: var(--rose-500); }
.chip.selected.teal { background: var(--teal-400); border-color: var(--teal-400); }
.chip.selected.amber { background: var(--amber-400); border-color: var(--amber-400); }

/* Fertility scale chips (CM) get a gradient hint */
.chip-scale { display: flex; gap: 6px; }
.chip-scale .chip { flex: 1; justify-content: center; padding: 0.5rem 0.4rem; font-size: 12px; }

/* ── Buttons ─────────────────────────────────── */
.btn {
  padding: 0.75rem 1.25rem; border-radius: var(--radius);
  border: 0.5px solid var(--border-med);
  background: var(--surface); color: var(--text);
  font-size: 14.5px; font-family: inherit; font-weight: 600;
  cursor: pointer; transition: all 0.15s; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
}
.btn:hover { background: var(--surface-2); }
.btn-primary {
  background: linear-gradient(135deg, var(--rose-500), var(--rose-600));
  color: #fff; border: none;
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-block { width: 100%; }
.btn-sm { padding: 0.5rem 1rem; font-size: 13px; }
.btn-row { display: flex; gap: 9px; margin-top: 0.25rem; }
.back-btn {
  width: 34px; height: 34px; border-radius: 10px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border: 0.5px solid var(--border-med); background: var(--surface);
  cursor: pointer; font-size: 17px; color: var(--text-2);
}

.btn-google {
  display: flex; align-items: center; gap: 11px;
  padding: 0.875rem 1.75rem; border-radius: var(--radius);
  border: 0.5px solid var(--border-med);
  background: var(--surface); color: var(--text);
  font-size: 15px; font-family: inherit; font-weight: 600;
  cursor: pointer; transition: all 0.15s; box-shadow: var(--shadow-sm);
}
.btn-google:hover { box-shadow: var(--shadow-md); }

/* ── Empty / loading ─────────────────────────── */
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--text-2); }
.empty-icon {
  width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 1rem;
  background: var(--rose-50); display: flex; align-items: center; justify-content: center;
  font-size: 30px;
}
.empty-title { font-size: 17px; font-weight: 600; color: var(--text); margin-bottom: 0.375rem; }
.empty p { font-size: 14px; max-width: 280px; margin: 0 auto 1.25rem; }
.loading { text-align: center; padding: 3rem; color: var(--text-3); font-size: 14px; }

.signout-btn {
  font-size: 12px; color: var(--text-3); background: none;
  border: none; cursor: pointer; padding: 0; font-family: inherit;
}
.signout-btn:hover { color: var(--text-2); }

.save-toast {
  font-size: 13px; color: var(--teal-500); font-weight: 600;
  display: flex; align-items: center; gap: 4px;
}

@media (max-width: 420px) {
  .main { padding: 1rem; }
  .app-header { padding: 0.75rem 1rem; }
  .wheel-wrap { width: 240px; height: 240px; }
}
