/* style.css — Bloom */
:root {
  --bg: #1a1620;
  --bg-soft: #241f2c;
  --surface: rgba(255,255,255,0.04);
  --surface-2: rgba(255,255,255,0.06);
  --text: #f5ecf0;
  --text-soft: #c4b5c2;
  --text-dim: #8a7d8c;
  --rose: #e0919f;
  --rose-soft: #d4869a;
  --lavender: #c4b5d9;
  --sage: #a8c4a2;
  --gold: #e8c87a;
  --warn: #e8a87c;
  --danger: #d97b8a;
  --ring-track: rgba(255,255,255,0.08);
  --grid: rgba(255,255,255,0.05);
  --border: rgba(255,255,255,0.08);
  --shadow: 0 8px 32px rgba(0,0,0,0.25);
}

:root[data-theme="light"], :root.light {
  --bg: #faf3f4;
  --bg-soft: #fff;
  --surface: rgba(0,0,0,0.03);
  --surface-2: rgba(0,0,0,0.05);
  --text: #4a3b47;
  --text-soft: #7a6b75;
  --text-dim: #a89aa3;
  --rose: #c8707f;
  --rose-soft: #d4869a;
  --lavender: #9b86bf;
  --sage: #7fa379;
  --gold: #c9a55c;
  --ring-track: rgba(0,0,0,0.08);
  --grid: rgba(0,0,0,0.06);
  --border: rgba(0,0,0,0.08);
  --shadow: 0 8px 32px rgba(180,120,140,0.12);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #faf3f4;
    --bg-soft: #fff;
    --surface: rgba(0,0,0,0.03);
    --surface-2: rgba(0,0,0,0.05);
    --text: #4a3b47;
    --text-soft: #7a6b75;
    --text-dim: #a89aa3;
    --rose: #c8707f;
    --lavender: #9b86bf;
    --sage: #7fa379;
    --ring-track: rgba(0,0,0,0.08);
    --grid: rgba(0,0,0,0.06);
    --border: rgba(0,0,0,0.08);
    --shadow: 0 8px 32px rgba(180,120,140,0.12);
  }
}

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

html, body {
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: 'Cormorant Garamond', Georgia, serif; font-weight: 600; }

/* Ambient background — CSS-only gradient fallback */
.ambient {
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none;
  transition: opacity 0.6s;
}
.ambient-fallback {
  background:
    radial-gradient(ellipse at 20% 30%, rgba(224,145,159,0.3), transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(196,181,217,0.25), transparent 50%),
    radial-gradient(ellipse at 50% 100%, rgba(168,196,162,0.2), transparent 60%);
  opacity: 0.5;
}
:root[data-theme="light"] .ambient-fallback, :root.light .ambient-fallback {
  opacity: 0.7;
}

/* Onboarding */
.onboarding {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--bg) 0%, var(--bg-soft) 100%);
  padding: 20px; overflow-y: auto;
}
.onboard-card {
  max-width: 460px; width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px; padding: 36px 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}
.onboard-progress {
  display: flex; justify-content: center; gap: 8px; margin-bottom: 24px;
}
.prog-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--surface-2); transition: 0.3s;
}
.prog-dot.active { background: var(--rose); width: 24px; border-radius: 4px; }

.onboard-illustration { text-align: center; margin-bottom: 16px; color: var(--rose); }
.bloom-logo { width: 110px; height: auto; }
.onboard-title {
  font-size: 28px; text-align: center; color: var(--text); margin-bottom: 8px;
}
.onboard-sub {
  text-align: center; color: var(--text-soft); font-size: 14px; margin-bottom: 20px;
}
.privacy-badge {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--surface-2); color: var(--sage);
  padding: 8px 16px; border-radius: 20px; font-size: 13px; font-weight: 600;
  margin: 0 auto 24px; width: fit-content;
}

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field.full { grid-column: 1/-1; }
.field span { font-size: 12px; color: var(--text-soft); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.field input, .field select {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 14px; color: var(--text); font-size: 16px; font-family: inherit;
  min-height: 44px; transition: 0.2s;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--rose); }

.quick-options { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.chip {
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-soft); padding: 8px 14px; border-radius: 18px;
  font-size: 13px; cursor: pointer; font-family: inherit; transition: 0.2s; min-height: 36px;
}
.chip:hover { background: var(--rose); color: #fff; border-color: var(--rose); }

.temp-toggle { display: flex; gap: 8px; margin-bottom: 16px; }
.chip-toggle {
  flex: 1; background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-soft); padding: 12px; border-radius: 14px; cursor: pointer;
  font-family: inherit; font-size: 14px; font-weight: 600; transition: 0.2s; min-height: 44px;
}
.chip-toggle.active { background: var(--rose); color: #fff; border-color: var(--rose); }

.temp-preview-list { margin-top: 12px; }
.temp-prev { font-size: 13px; color: var(--text-soft); padding: 4px 0; }

.onboard-nav { display: flex; justify-content: space-between; margin-top: 24px; gap: 12px; }

.btn-primary {
  background: linear-gradient(135deg, var(--rose), var(--rose-soft));
  color: #fff; border: none; padding: 14px 24px; border-radius: 14px;
  font-size: 15px; font-weight: 700; cursor: pointer; font-family: inherit;
  min-height: 44px; transition: 0.2s; box-shadow: 0 4px 14px rgba(224,145,159,0.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(224,145,159,0.4); }
.btn-ghost {
  background: transparent; color: var(--text-soft); border: 1px solid var(--border);
  padding: 14px 20px; border-radius: 14px; font-size: 15px; cursor: pointer; font-family: inherit; min-height: 44px;
}
.btn-ghost:hover { background: var(--surface-2); }
.btn-soft {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit; min-height: 44px;
}
.btn-soft:hover { background: var(--surface); border-color: var(--rose); }
.btn-danger {
  background: transparent; color: var(--danger); border: 1px solid var(--danger);
  padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit; min-height: 44px;
}
.btn-danger:hover { background: var(--danger); color: #fff; }

/* App */
.app { position: relative; z-index: 1; max-width: 820px; margin: 0 auto; min-height: 100vh; padding-bottom: 40px; }
.hidden { display: none !important; }

.app-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; background: rgba(26,22,32,0.85); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border); flex-wrap: wrap; gap: 12px;
}
:root[data-theme="light"] .app-header, :root.light .app-header { background: rgba(250,243,244,0.9); }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 36px; height: 30px; color: var(--rose); }
.brand-name { font-family: 'Cormorant Garamond', serif; font-size: 24px; font-weight: 700; color: var(--text); }

.nav-tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.nav-tabs::-webkit-scrollbar { display: none; }
.nav-tab {
  background: transparent; border: none; color: var(--text-soft);
  padding: 10px 14px; border-radius: 12px; font-size: 14px; font-weight: 600;
  cursor: pointer; font-family: inherit; white-space: nowrap; transition: 0.2s; min-height: 44px;
}
.nav-tab.active { background: var(--rose); color: #fff; }
.nav-tab:hover:not(.active) { background: var(--surface-2); color: var(--text); }

.app-main { padding: 20px; }
.view { display: none; animation: fade 0.3s; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Today */
.hero-card {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  background: linear-gradient(135deg, rgba(224,145,159,0.15), rgba(196,181,217,0.12));
  border: 1px solid var(--border); border-radius: 24px; padding: 28px; margin-bottom: 20px;
}
.day-label { font-size: 13px; color: var(--text-soft); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; }
.hero-text h1 { font-size: 26px; color: var(--text); margin-bottom: 6px; line-height: 1.2; }
.hero-sub { font-size: 14px; color: var(--text-soft); max-width: 340px; }

.cycle-ring { flex-shrink: 0; }
.ring-num { font-family: 'Cormorant Garamond', serif; font-size: 30px; font-weight: 700; fill: var(--text); }
.ring-lbl { font-size: 11px; fill: var(--text-soft); text-transform: uppercase; letter-spacing: 1px; font-family: 'Nunito', sans-serif; }

.card-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px;
}
.info-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 18px; text-align: center;
}
.info-icon { font-size: 24px; margin-bottom: 6px; }
.info-card h3 { font-size: 13px; color: var(--text-soft); font-family: 'Nunito', sans-serif; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; margin-bottom: 6px; }
.info-card .big { font-size: 20px; font-weight: 700; color: var(--text); font-family: 'Cormorant Garamond', serif; }
.info-card .muted { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

.log-section { margin-bottom: 20px; }
.log-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 20px;
}
.log-card h3 { font-size: 18px; margin-bottom: 16px; color: var(--text); }
.log-row { display: flex; gap: 12px; align-items: end; margin-bottom: 14px; flex-wrap: wrap; }
.log-field { display: flex; flex-direction: column; gap: 4px; }
.log-field.grow { flex: 1; min-width: 160px; }
.log-field span { font-size: 12px; color: var(--text-soft); font-weight: 600; }
.log-field input, .log-field select {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 12px; color: var(--text); font-size: 15px; font-family: inherit; min-height: 44px;
}
.log-field input:focus, .log-field select:focus { outline: none; border-color: var(--rose); }

.symptoms, .mood-row { margin-top: 16px; }
.sym-label { font-size: 12px; color: var(--text-soft); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; display: block; margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sym-chip, .mood-chip {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-soft);
  padding: 7px 12px; border-radius: 16px; font-size: 13px; cursor: pointer; font-family: inherit; transition: 0.15s; min-height: 32px;
}
.sym-chip:hover, .mood-chip:hover { border-color: var(--rose); }
.sym-chip.active { background: var(--rose); color: #fff; border-color: var(--rose); }
.mood-chip.active { background: var(--lavender); color: #fff; border-color: var(--lavender); }

/* Calendar */
.cal-header { display: flex; align-items: center; justify-content: center; gap: 20px; margin-bottom: 16px; }
.cal-header h2 { font-size: 24px; color: var(--text); }
.cal-nav-btn {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  width: 40px; height: 40px; border-radius: 12px; font-size: 22px; cursor: pointer; font-family: inherit;
  display: flex; align-items: center; justify-content: center;
}
.cal-nav-btn:hover { background: var(--rose); color: #fff; border-color: var(--rose); }

.cal-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-bottom: 16px; font-size: 12px; color: var(--text-soft); }
.leg { display: flex; align-items: center; gap: 5px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.period { background: var(--rose); }
.dot.predicted { background: transparent; border: 2px dashed var(--rose-soft); }
.dot.ovulation { background: var(--lavender); }
.dot.fertile { background: var(--sage); opacity: 0.5; }
.dot.today-dot { background: var(--gold); }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-grid.cal-days { gap: 6px; }
#cal-weekdays span { text-align: center; font-size: 12px; color: var(--text-dim); font-weight: 600; padding: 8px 0; text-transform: uppercase; }
.cal-cell {
  aspect-ratio: 1; border-radius: 12px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; position: relative; cursor: pointer;
  background: var(--surface); border: 1px solid transparent; transition: 0.15s; font-size: 14px;
}
.cal-cell.empty { background: transparent; cursor: default; }
.cal-cell:hover:not(.empty) { border-color: var(--rose); transform: scale(1.03); }
.cal-cell.today { border-color: var(--gold); border-width: 2px; }
.cal-cell.period { background: var(--rose); color: #fff; }
.cal-cell.predicted { background: rgba(212,134,154,0.15); border: 2px dashed var(--rose-soft); }
.cal-cell.ovulation { background: var(--lavender); color: #fff; }
.cal-cell.fertile { background: rgba(168,196,162,0.2); }
.cal-day-num { font-weight: 600; }
.cal-emoji { position: absolute; bottom: 3px; font-size: 8px; color: var(--lavender); }
.flow-mark { position: absolute; top: 4px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--rose); }
.flow-spotting { opacity: 0.4; } .flow-light { opacity: 0.6; } .flow-medium { opacity: 0.85; } .flow-heavy { opacity: 1; box-shadow: 0 0 4px var(--rose); }

.cal-note { text-align: center; margin-top: 16px; font-size: 13px; color: var(--text-soft); }

/* Chart */
.chart-card, .outlier-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 22px; margin-bottom: 16px;
}
.chart-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 4px; }
.chart-head h2 { font-size: 22px; color: var(--text); }
.chart-toggle { display: flex; gap: 4px; }
.chart-toggle .chip-toggle { padding: 8px 14px; font-size: 13px; min-height: 36px; flex: none; }
.chart-sub { font-size: 13px; color: var(--text-soft); margin-bottom: 16px; }
.chart-canvas-wrap { position: relative; height: 280px; margin-bottom: 16px; }

.phase-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px,1fr)); gap: 10px; }
.phase-stat {
  background: var(--surface-2); border-radius: 12px; padding: 12px; text-align: center;
}
.ph-label { font-size: 11px; color: var(--text-soft); text-transform: uppercase; letter-spacing: 0.5px; display: block; margin-bottom: 4px; }
.ph-val { font-size: 18px; font-weight: 700; color: var(--text); font-family: 'Cormorant Garamond', serif; }
.ph-val.good { color: var(--sage); }
.ph-val.warn { color: var(--warn); }

.chart-hint { font-size: 13px; color: var(--text-soft); text-align: center; padding: 12px; }

.outlier-row {
  display: flex; gap: 14px; align-items: flex-start; padding: 14px;
  border-radius: 14px; margin-top: 12px; background: var(--surface-2);
}
.outlier-row.ok { border-left: 3px solid var(--sage); }
.outlier-row.warn { border-left: 3px solid var(--warn); }
.outlier-row.neutral { border-left: 3px solid var(--text-dim); }
.ol-icon {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
  background: var(--surface); color: var(--text); font-size: 16px;
}
.outlier-row.ok .ol-icon { background: var(--sage); color: #fff; }
.outlier-row.warn .ol-icon { background: var(--warn); color: #fff; }
.ol-detail { font-size: 13px; color: var(--text-soft); margin-top: 2px; }

/* Insights */
.insight-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 22px; margin-bottom: 16px;
}
.insight-card h2 { font-size: 22px; color: var(--text); margin-bottom: 12px; }
.insight-sub { font-size: 13px; color: var(--text-soft); margin-bottom: 16px; }
.insight-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr)); gap: 12px; margin-bottom: 8px; }
.insight-tile {
  background: var(--surface-2); border-radius: 16px; padding: 16px; text-align: center;
}
.it-icon { font-size: 22px; margin-bottom: 4px; }
.it-val { font-size: 24px; font-weight: 700; color: var(--text); font-family: 'Cormorant Garamond', serif; line-height: 1.1; }
.it-label { font-size: 11px; color: var(--text-soft); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 4px; }
.it-sub { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

.note {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px;
  border-radius: 14px; margin-bottom: 10px; background: var(--surface-2);
}
.note.ok { border-left: 3px solid var(--sage); }
.note.warn { border-left: 3px solid var(--warn); }
.note.info { border-left: 3px solid var(--lavender); }
.note-icon {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px;
  background: var(--surface); color: var(--text);
}
.note.ok .note-icon { background: var(--sage); color: #fff; }
.note.warn .note-icon { background: var(--warn); color: #fff; }
.note.info .note-icon { background: var(--lavender); color: #fff; }
.note p { font-size: 14px; color: var(--text-soft); line-height: 1.5; }

.hist-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.hist-row:last-child { border-bottom: none; }
.hist-date { font-size: 14px; color: var(--text); font-weight: 600; }
.hist-meta { display: flex; gap: 10px; align-items: center; }
.hist-int { font-size: 13px; color: var(--text-soft); background: var(--surface-2); padding: 4px 10px; border-radius: 12px; }
.hist-int.first { color: var(--text-dim); }
.hist-dev { font-size: 12px; color: var(--sage); }
.hist-dev.off { color: var(--warn); }

/* Settings */
.privacy-box {
  background: var(--surface-2); border-radius: 14px; padding: 16px; margin-bottom: 16px;
}
.privacy-box p { font-size: 14px; color: var(--text-soft); margin-bottom: 8px; }
.privacy-box p:last-child { margin-bottom: 0; }
.privacy-box strong { color: var(--text); }

.data-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.file-label { display: inline-flex; align-items: center; cursor: pointer; }

/* Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 12px 24px; border-radius: 24px;
  font-size: 14px; font-weight: 600; z-index: 200; box-shadow: var(--shadow);
  animation: toastIn 0.3s;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* Responsive */
@media (max-width: 600px) {
  .hero-card { flex-direction: column; text-align: center; padding: 22px; }
  .hero-text { order: 1; }
  .cycle-ring { order: 2; }
  .form-grid { grid-template-columns: 1fr; }
  .app-header { padding: 12px; }
  .brand-name { font-size: 22px; }
  .nav-tab { padding: 8px 10px; font-size: 13px; }
  .app-main { padding: 14px; }
  .hero-text h1 { font-size: 22px; }
  .onboard-card { padding: 24px 18px; }
  .cal-cell { font-size: 12px; }
  .chart-canvas-wrap { height: 220px; }
}

