/* =========================================================
   Growth Tracker — style.css
   Dark theme, Duolingo-inspired, mobile-first
   ========================================================= */

/* === TOKENS ================================================ */
:root {
  --bg:          #111111;
  --card:        #1a1a1a;
  --card-2:      #222222;
  --border:      #2a2a2a;
  --border-2:    #3a3a3a;

  --green:       #4ade80;
  --green-dark:  #22c55e;
  --green-dim:   rgba(74, 222, 128, 0.12);
  --green-glow:  rgba(74, 222, 128, 0.25);

  --orange:      #fb923c;
  --orange-dim:  rgba(251, 146, 60, 0.14);

  --red:         #f87171;
  --red-dim:     rgba(248, 113, 113, 0.12);

  --yellow:      #fbbf24;
  --yellow-dim:  rgba(251, 191, 36, 0.12);

  --blue:        #60a5fa;
  --blue-dim:    rgba(96, 165, 250, 0.12);

  --purple:      #a78bfa;
  --purple-dim:  rgba(167, 139, 250, 0.12);

  --text:        #f0f0f0;
  --muted:       #888888;
  --dim:         #444444;

  --nav-h:       68px;
  --r:           14px;
  --r-sm:        8px;
  --r-lg:        20px;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  font-size: 16px;
}

/* === APP SHELL ============================================= */
#app {
  height: 100%;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}

/* === VIEWS ================================================= */
.view {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 0 16px calc(var(--nav-h) + 20px);
  -webkit-overflow-scrolling: touch;
}
.view.active { display: block; }

/* Scrollbar styling */
.view::-webkit-scrollbar { width: 3px; }
.view::-webkit-scrollbar-track { background: transparent; }
.view::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* === BOTTOM NAV ============================================ */
#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: var(--nav-h);
  background: rgba(20, 20, 20, 0.97);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
  padding: 0 4px;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: none;
  background: none;
  color: var(--dim);
  cursor: pointer;
  padding: 8px 0;
  transition: color 0.15s ease;
  border-radius: var(--r-sm);
}
.nav-btn.active  { color: var(--green); }
.nav-btn:active  { opacity: 0.7; }
.nav-icon  { font-size: 22px; line-height: 1; }
.nav-label { font-size: 10px; font-weight: 600; letter-spacing: 0.02em; }

/* === SHARED COMPONENTS ===================================== */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
  margin-bottom: 10px;
}
.card-sm { padding: 12px 14px; }

.page-header {
  padding: 20px 0 8px;
}
.page-title    { font-size: 22px; font-weight: 800; line-height: 1.2; }
.page-subtitle { font-size: 13px; color: var(--muted); margin-top: 3px; }

.section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin: 20px 0 10px;
}

/* === HOME — STREAK HERO ==================================== */
.streak-hero {
  text-align: center;
  padding: 8px 0 16px;
}
.streak-fire {
  font-size: 52px;
  line-height: 1;
  display: block;
  animation: bob 2.5s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-6px); }
}
.streak-zero .streak-fire { filter: grayscale(1) brightness(0.5); animation: none; }

.streak-number {
  font-size: 60px;
  font-weight: 900;
  color: var(--orange);
  line-height: 1;
  display: block;
  letter-spacing: -2px;
}
.streak-zero .streak-number { color: var(--muted); }

.streak-label {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
  display: block;
  font-weight: 500;
}

/* === DAY TYPE BADGE ======================================== */
.badge-row { text-align: center; margin-bottom: 14px; }

.day-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.day-badge.strength { background: var(--green-dim);  color: var(--green);  border: 1px solid rgba(74,222,128,.3);  }
.day-badge.core     { background: var(--blue-dim);   color: var(--blue);   border: 1px solid rgba(96,165,250,.3);  }
.day-badge.cheat    { background: var(--yellow-dim); color: var(--yellow); border: 1px solid rgba(251,191,36,.3); }
.day-badge.rest     { background: var(--purple-dim); color: var(--purple); border: 1px solid rgba(167,139,250,.3); }

/* === QUOTE CARD ============================================ */
.quote-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--green);
  border-radius: var(--r);
  padding: 13px 15px;
  margin-bottom: 14px;
  font-size: 14px;
  font-style: italic;
  color: var(--text);
  line-height: 1.5;
}

/* === STATUS BANNERS ======================================== */
.done-banner {
  background: var(--green-dim);
  border: 1px solid rgba(74, 222, 128, 0.3);
  border-radius: var(--r);
  padding: 14px 16px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.done-banner-text { font-size: 14px; font-weight: 600; color: var(--green); }

.cheat-banner {
  background: var(--yellow-dim);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: var(--r);
  padding: 24px 20px;
  text-align: center;
  margin-bottom: 16px;
}
.cheat-banner-emoji { font-size: 48px; margin-bottom: 8px; }
.cheat-banner-title { font-size: 20px; font-weight: 700; color: var(--yellow); margin-bottom: 4px; }
.cheat-banner-sub   { font-size: 13px; color: var(--muted); }

.streak-broken {
  background: var(--red-dim);
  border: 1px solid rgba(248, 113, 113, 0.3);
  border-radius: var(--r);
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--red);
  text-align: center;
  font-weight: 500;
}

/* === CHECKLIST ITEMS ======================================= */
.check-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, transform 0.08s;
  user-select: none;
}
.check-item:active { transform: scale(0.98); }

.check-item.checked {
  background: var(--green-dim);
  border-color: rgba(74, 222, 128, 0.35);
}
.check-item.checked .check-name { text-decoration: line-through; color: var(--muted); }
.check-item.checked .check-sub  { color: var(--dim); }

.check-box {
  width: 26px;
  height: 26px;
  border: 2px solid var(--border-2);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 700;
  color: #000;
  transition: background 0.12s, border-color 0.12s;
}
.check-item.checked .check-box {
  background: var(--green);
  border-color: var(--green);
}

.check-emoji { font-size: 20px; flex-shrink: 0; }

.check-text  { flex: 1; min-width: 0; }
.check-name  { font-size: 14px; font-weight: 600; line-height: 1.3; }
.check-sub   { font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.3; }

.check-link {
  font-size: 11px;
  font-weight: 600;
  color: var(--blue);
  text-decoration: none;
  padding: 5px 9px;
  border: 1px solid rgba(96, 165, 250, 0.35);
  border-radius: 7px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.12s;
}
.check-link:hover  { background: var(--blue-dim); }
.check-link:active { background: rgba(96,165,250,0.2); }

/* === REMINDERS STRIP ======================================= */
.reminder-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--muted);
}

/* === COMPLETE BUTTON ======================================= */
.complete-btn {
  width: 100%;
  padding: 17px;
  border: none;
  border-radius: var(--r);
  background: var(--green);
  color: #000;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  margin-top: 20px;
  margin-bottom: 16px;
  transition: all 0.15s;
  box-shadow: 0 4px 20px var(--green-glow);
}
.complete-btn:active  { transform: scale(0.97); }
.complete-btn:disabled {
  background: var(--card-2);
  color: var(--dim);
  cursor: not-allowed;
  box-shadow: none;
}
.complete-btn.done {
  background: transparent;
  color: var(--green);
  border: 1px solid rgba(74,222,128,.4);
  box-shadow: none;
  cursor: default;
}
.complete-btn.cheat-btn {
  background: var(--yellow);
  box-shadow: 0 4px 20px rgba(251,191,36,.25);
}

/* === CALENDAR ============================================== */
.cal-month { margin-bottom: 28px; }

.cal-month-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 10px;
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 5px;
}
.cal-weekday {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  padding: 3px 0;
}

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

.cal-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  transition: transform 0.1s;
}
.cal-day.empty        { background: transparent; }
.cal-day.before-start { opacity: 0.18; color: var(--dim); }
.cal-day.future       { color: var(--muted); background: rgba(255,255,255,0.03); }
.cal-day.today        {
  color: var(--text);
  background: rgba(255,255,255,0.06);
  box-shadow: 0 0 0 2px var(--green);
  font-weight: 700;
}
.cal-day.completed    { background: var(--green-dim);  color: var(--green); }
.cal-day.cheat-day    { background: var(--yellow-dim); color: var(--yellow); }
.cal-day.missed       { background: var(--red-dim);    color: var(--red); }

.cal-day.today.completed { box-shadow: 0 0 0 2px var(--green); }

.cal-num  { font-size: 11px; line-height: 1; }
.cal-mark { font-size: 10px; line-height: 1; margin-top: 1px; }

/* === LEGEND ================================================ */
.cal-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
.legend-dot {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
}

/* === VIDEOS ================================================ */
.video-today-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--green);
  margin-bottom: 10px;
}

.video-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
  transition: all 0.15s;
}
.video-card:active { transform: scale(0.98); opacity: 0.85; }
.video-card.highlight {
  border-color: rgba(74, 222, 128, 0.35);
  background: var(--green-dim);
}

.video-thumb {
  width: 46px;
  height: 46px;
  background: var(--blue-dim);
  border: 1px solid rgba(96,165,250,.25);
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.video-card.highlight .video-thumb {
  background: var(--green-dim);
  border-color: rgba(74,222,128,.25);
}

.video-info   { flex: 1; min-width: 0; }
.video-title  { font-size: 14px; font-weight: 600; margin-bottom: 3px; line-height: 1.3; }
.video-creator { font-size: 12px; color: var(--muted); }
.video-arrow  { color: var(--muted); font-size: 20px; flex-shrink: 0; }
.video-card:hover .video-arrow { color: var(--green); }

.week-day-section { margin-bottom: 22px; }
.week-day-header  {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.week-day-name { font-size: 15px; font-weight: 700; }
.week-day-type {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  font-weight: 600;
}

/* === STATS ================================================= */
.progress-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px;
  margin-bottom: 10px;
}
.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}
.progress-title { font-size: 14px; font-weight: 600; }
.progress-pct   { font-size: 22px; font-weight: 800; color: var(--green); }

.progress-bar  {
  height: 10px;
  background: var(--card-2);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green-dark), var(--green));
  border-radius: 999px;
  transition: width 0.6s ease;
  min-width: 4px;
}
.progress-dates {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px 12px;
  text-align: center;
}
.stat-value { font-size: 30px; font-weight: 800; line-height: 1; margin-bottom: 5px; }
.stat-label { font-size: 11px; color: var(--muted); font-weight: 600; }

.milestone-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}
.milestone {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 6px;
  text-align: center;
}
.milestone.unlocked {
  border-color: rgba(74,222,128,.35);
  background: var(--green-dim);
}
.milestone-icon { font-size: 20px; margin-bottom: 4px; }
.milestone-days { font-size: 10px; font-weight: 700; color: var(--muted); line-height: 1.2; }
.milestone.unlocked .milestone-days { color: var(--green); }

/* === SETTINGS ============================================== */
.setting-group { margin-bottom: 26px; }
.setting-group-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 8px;
}
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 16px;
  margin-bottom: 6px;
}
.setting-info { flex: 1; padding-right: 12px; }
.setting-label { font-size: 14px; font-weight: 500; }
.setting-desc  { font-size: 12px; color: var(--muted); margin-top: 2px; }
.setting-control { flex-shrink: 0; }

select.ctrl-select {
  background: var(--card-2);
  border: 1px solid var(--border-2);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

input[type="time"].ctrl-time {
  background: var(--card-2);
  border: 1px solid var(--border-2);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  width: 100px;
  color-scheme: dark;
}

.toggle {
  position: relative;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--card-2);
  border: 1px solid var(--border-2);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.toggle-thumb {
  position: absolute;
  top: 50%;
  left: 4px;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  background: var(--muted);
  border-radius: 50%;
  transition: left 0.2s, background 0.2s;
  pointer-events: none;
}
.toggle input:checked ~ .toggle-track { background: var(--green-dim); border-color: rgba(74,222,128,.4); }
.toggle input:checked ~ .toggle-thumb { left: 24px; background: var(--green); }

.btn-green {
  width: 100%;
  padding: 14px;
  border: 1px solid rgba(74,222,128,.4);
  border-radius: var(--r);
  background: var(--green-dim);
  color: var(--green);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  margin-bottom: 8px;
}
.btn-green:active { transform: scale(0.98); background: rgba(74,222,128,.2); }

.btn-danger {
  width: 100%;
  padding: 14px;
  border: 1px solid rgba(248,113,113,.35);
  border-radius: var(--r);
  background: transparent;
  color: var(--red);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  margin-bottom: 8px;
}
.btn-danger:active { background: var(--red-dim); transform: scale(0.98); }

/* === CELEBRATION OVERLAY =================================== */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.overlay.hidden { display: none; }

.cel-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 40px 28px 32px;
  text-align: center;
  width: min(360px, 92vw);
  position: relative;
  overflow: hidden;
}
.cel-particles { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }

.cel-emoji  { font-size: 64px; display: block; margin-bottom: 10px; }
.cel-title  { font-size: 28px; font-weight: 800; margin-bottom: 6px; }
.cel-streak {
  font-size: 18px;
  font-weight: 700;
  color: var(--orange);
  margin-bottom: 8px;
}
.cel-msg   {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 28px;
  line-height: 1.5;
}
.cel-btn {
  background: var(--green);
  color: #000;
  border: none;
  border-radius: var(--r);
  padding: 15px 36px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.12s;
  box-shadow: 0 4px 16px var(--green-glow);
}
.cel-btn:active { transform: scale(0.96); }

.confetti-particle {
  position: absolute;
  border-radius: 2px;
  animation: confetti-fall 1.8s ease-out forwards;
}
@keyframes confetti-fall {
  0%   { opacity: 1; transform: translateY(-10px) rotate(0deg); }
  100% { opacity: 0; transform: translateY(240px) rotate(600deg); }
}

/* === SLEEP CARD ============================================ */
.sleep-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 22px;
  text-align: center;
  margin-bottom: 10px;
}
.sleep-card .s-icon  { font-size: 36px; margin-bottom: 8px; }
.sleep-card .s-title { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.sleep-card .s-sub   { font-size: 13px; color: var(--muted); line-height: 1.5; }

/* === MISC ================================================== */
.spacer { height: 24px; }

.info-note {
  font-size: 12px;
  color: var(--muted);
  padding: 0 2px;
  line-height: 1.6;
  margin-top: 4px;
}
