/* =============================================================
   Tracker — fit.gharibyan.com
   Design notes:
   - Layered backgrounds (5 levels) for depth
   - Active states use both color AND elevation/border accent
   - Generous touch targets (44px+ on mobile)
   - Soft radii, real shadows, no flat panels
   ============================================================= */

:root {
  /* Surfaces — 5 levels of depth */
  --bg:        #0a0a0c;
  --surface-0: #131318;
  --surface-1: #1a1a21;
  --surface-2: #22222b;
  --surface-3: #2c2c37;

  /* Ink */
  --ink:       #f4f2e8;
  --ink-mid:   #b5b3a8;
  --ink-dim:   #7d7b73;
  --ink-faint: #4a4946;

  /* Accents */
  --accent:      #ff4d1c;     /* primary action / active */
  --accent-soft: #ff4d1c33;   /* glow */
  --accent-2:    #ffd60a;     /* prescription / mobility */
  --good:        #5dd39e;
  --good-soft:   #5dd39e33;
  --bad:         #e35d6a;

  /* Lines */
  --line:      #2a2a35;
  --line-soft: #1f1f28;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.5), 0 1px 2px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.6), 0 2px 6px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 0 1px var(--accent), 0 4px 16px var(--accent-soft);
  --shadow-glow-good: 0 0 0 1px var(--good), 0 4px 16px var(--good-soft);

  /* Radii */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;
}

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

html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Archivo', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Atmospheric background */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image:
    repeating-linear-gradient(0deg, transparent 0 2px, rgba(255,255,255,0.012) 2px 3px),
    radial-gradient(ellipse at 15% 0%, rgba(255,77,28,0.10), transparent 55%),
    radial-gradient(ellipse at 90% 100%, rgba(255,214,10,0.05), transparent 55%);
  pointer-events: none;
  z-index: 0;
}

.wrap {
  position: relative; z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 100px;
}

/* =========================================================
   HEADER
   ========================================================= */
header {
  border-bottom: 1px solid var(--line);
  padding-bottom: 24px;
  margin-bottom: 24px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: end;
}

.brand {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(48px, 9vw, 96px);
  line-height: 0.85;
  letter-spacing: -0.02em;
}
.brand .slash { color: var(--accent); }
.brand .num   { color: var(--ink-dim); font-size: 0.7em; }

.meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  text-align: right;
  color: var(--ink-dim);
  line-height: 1.7;
}
.meta .live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--good-soft);
  color: var(--good);
  font-weight: 700;
  letter-spacing: 0.06em;
}
.meta .live::before {
  content: '';
  width: 6px; height: 6px;
  background: var(--good);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--good);
  animation: pulse 1.6s ease-in-out infinite;
}
.meta .live.offline {
  background: rgba(227,93,106,0.15);
  color: var(--bad);
}
.meta .live.offline::before {
  background: var(--bad);
  box-shadow: 0 0 8px var(--bad);
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* =========================================================
   PHASE SWITCHER
   ========================================================= */
.phase-switch {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  padding: 6px;
  background: var(--surface-0);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,0.03);
}
.phase-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--ink-dim);
  padding: 14px 16px;
  cursor: pointer;
  font-family: 'Archivo', sans-serif;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 12px;
  transition: all 0.18s ease;
  text-align: left;
  border-radius: var(--r-sm);
  position: relative;
}
.phase-btn:hover {
  color: var(--ink);
  background: var(--surface-1);
}
.phase-btn.active {
  background: var(--surface-2);
  color: var(--ink);
  box-shadow: var(--shadow-md), inset 0 0 0 1px var(--accent);
}
.phase-btn.active::before {
  content: '';
  position: absolute;
  left: 8px; right: 8px; bottom: 4px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}
.phase-btn .label {
  display: block;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 20px;
  line-height: 1;
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}
.phase-btn.active .label { color: var(--accent); }
.phase-btn .sub {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  opacity: 0.7;
  letter-spacing: 0.1em;
}

/* =========================================================
   STATS
   ========================================================= */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 24px;
}
.stat {
  background: linear-gradient(180deg, var(--surface-1) 0%, var(--surface-0) 100%);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.stat::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
}
.stat .label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--ink-dim);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.stat .value {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 36px;
  line-height: 1;
  margin-top: 6px;
  color: var(--ink);
}
.stat .value.accent { color: var(--accent); }

/* =========================================================
   WEEK PILLS
   ========================================================= */
.week-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.week-bar > label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink-dim);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.week-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
}
.week-pill {
  background: var(--surface-1);
  border: 1px solid var(--line);
  color: var(--ink-dim);
  padding: 8px 14px;
  cursor: pointer;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--r-sm);
  transition: all 0.15s ease;
  min-width: 44px;
  text-align: center;
}
.week-pill:hover {
  color: var(--ink);
  background: var(--surface-2);
  border-color: var(--ink-faint);
}
.week-pill.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  box-shadow: var(--shadow-md), 0 0 16px var(--accent-soft);
  transform: translateY(-1px);
}

/* =========================================================
   WARNING BANNERS
   ========================================================= */
.warn {
  background: linear-gradient(180deg, rgba(255,77,28,0.10) 0%, rgba(255,77,28,0.04) 100%);
  border: 1px solid rgba(255,77,28,0.35);
  border-left: 3px solid var(--accent);
  padding: 14px 18px;
  margin-bottom: 24px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--ink-mid);
  border-radius: var(--r-sm);
}
.warn strong { color: var(--accent); }
.warn.phase2 {
  background: linear-gradient(180deg, rgba(93,211,158,0.08) 0%, rgba(93,211,158,0.03) 100%);
  border-color: rgba(93,211,158,0.35);
  border-left-color: var(--good);
}
.warn.phase2 strong { color: var(--good); }

/* =========================================================
   MOBILITY
   ========================================================= */
.mobility {
  background: linear-gradient(135deg, var(--surface-1) 0%, var(--surface-0) 100%);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent-2);
  padding: 16px 20px;
  margin-bottom: 28px;
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-sm);
}
.mobility-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 22px;
  color: var(--accent-2);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}
.mobility-list {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--ink-dim);
  line-height: 1.9;
}
.mobility-list span { color: var(--ink); font-weight: 500; }

/* =========================================================
   DAY TABS — the part that needed the most work
   ========================================================= */
.days {
  display: flex;
  gap: 6px;
  margin-bottom: 24px;
  padding: 6px;
  background: var(--surface-0);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,0.03);
  overflow-x: auto;
  scrollbar-width: none;
}
.days::-webkit-scrollbar { display: none; }
.day-btn {
  flex: 1;
  min-width: 110px;
  background: transparent;
  border: none;
  color: var(--ink-dim);
  padding: 14px 12px;
  cursor: pointer;
  font-family: 'Archivo', sans-serif;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 12px;
  transition: all 0.18s ease;
  position: relative;
  border-radius: var(--r-sm);
  text-align: center;
}
.day-btn:hover {
  color: var(--ink);
  background: var(--surface-1);
}
.day-btn.active {
  background: var(--accent);
  color: var(--bg);
  box-shadow: var(--shadow-md), 0 0 20px var(--accent-soft);
  transform: translateY(-1px);
}
.day-btn .num {
  display: block;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 24px;
  line-height: 1;
  margin-bottom: 4px;
  opacity: 0.85;
}
.day-btn.active .num { opacity: 1; }
.day-btn.done::after {
  content: '✓';
  position: absolute;
  top: 6px; right: 8px;
  color: var(--good);
  font-size: 12px;
  font-weight: 900;
  width: 16px; height: 16px;
  background: var(--good-soft);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.day-btn.active.done::after {
  background: rgba(0,0,0,0.25);
  color: var(--bg);
}

/* =========================================================
   SESSION HEADER
   ========================================================= */
.session-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  gap: 8px;
}
.session-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 44px;
  letter-spacing: -0.01em;
  line-height: 1;
}
.session-title .tag {
  display: inline-block;
  color: var(--accent);
  font-size: 0.45em;
  margin-right: 12px;
  vertical-align: middle;
  background: var(--accent-soft);
  padding: 4px 10px;
  border-radius: var(--r-sm);
  letter-spacing: 0.1em;
}
.session-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink-dim);
  letter-spacing: 0.05em;
}

/* =========================================================
   EXERCISE CARDS
   ========================================================= */
.exercise {
  background: var(--surface-1);
  border: 1px solid var(--line);
  margin-bottom: 12px;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  overflow: hidden;
}
.exercise:hover { border-color: var(--ink-faint); }
.exercise.complete {
  border-color: var(--good);
  background: linear-gradient(180deg, rgba(93,211,158,0.06) 0%, var(--surface-1) 100%);
  box-shadow: var(--shadow-sm), 0 0 0 1px var(--good-soft);
}
.exercise.open {
  background: var(--surface-2);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}

.ex-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px 18px;
  cursor: pointer;
  gap: 12px;
  user-select: none;
}
.ex-head:hover .ex-name { color: var(--accent); }
.ex-name {
  font-family: 'Archivo', sans-serif;
  font-weight: 900;
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 1.3;
  transition: color 0.15s ease;
}
.exercise.complete .ex-name { color: var(--good); }
.exercise.open .ex-name { color: var(--accent); }

.ex-prescription {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--accent-2);
  margin-top: 6px;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.ex-toggle {
  font-family: 'JetBrains Mono', monospace;
  color: var(--ink-dim);
  font-size: 18px;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  transition: all 0.15s ease;
  font-weight: 900;
}
.exercise.open .ex-toggle {
  background: var(--accent);
  color: var(--bg);
  transform: rotate(45deg);
}

.ex-body {
  display: none;
  padding: 0 18px 18px;
  border-top: 1px solid var(--line);
}
.exercise.open .ex-body { display: block; }

.ex-cue {
  font-size: 13px;
  color: var(--ink-mid);
  line-height: 1.6;
  padding: 14px 0;
  border-bottom: 1px dashed var(--line);
}
.ex-cue strong { color: var(--ink); font-weight: 600; }

.ex-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--accent);
  text-decoration: none;
  background: var(--accent-soft);
  padding: 6px 12px;
  border-radius: var(--r-sm);
  letter-spacing: 0.05em;
  transition: all 0.15s ease;
  font-weight: 700;
}
.ex-link:hover {
  background: var(--accent);
  color: var(--bg);
}

/* =========================================================
   SETS GRID
   ========================================================= */
.sets {
  display: grid;
  grid-template-columns: 32px 1fr 1fr 56px;
  gap: 8px;
  align-items: center;
  margin-top: 16px;
}
.sets-head {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: var(--ink-dim);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
}
.sets input {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--ink);
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  padding: 10px 12px;
  width: 100%;
  border-radius: var(--r-sm);
  -moz-appearance: textfield;
  transition: all 0.15s ease;
}
.sets input::-webkit-outer-spin-button,
.sets input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.sets input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface-1);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.set-num {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 22px;
  color: var(--ink-dim);
  text-align: center;
}
.set-check {
  width: 32px; height: 32px;
  border: 2px solid var(--line);
  background: var(--bg);
  cursor: pointer;
  margin: 0 auto;
  display: block;
  position: relative;
  border-radius: var(--r-sm);
  transition: all 0.15s ease;
}
.set-check:hover { border-color: var(--accent); }
.set-check.checked {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-soft);
}
.set-check.checked::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bg);
  font-weight: 900;
  font-size: 18px;
}

/* =========================================================
   BUTTONS
   ========================================================= */
.complete-bar {
  display: flex;
  gap: 10px;
  margin-top: 28px;
  flex-wrap: wrap;
}
.btn {
  flex: 1;
  min-width: 140px;
  background: var(--ink);
  color: var(--bg);
  border: none;
  padding: 16px 20px;
  font-family: 'Archivo', sans-serif;
  font-weight: 900;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.18s ease;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
}
.btn:hover {
  background: var(--accent);
  color: var(--ink);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.btn:active { transform: translateY(0); }
.btn.secondary {
  background: var(--surface-1);
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn.secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--surface-2);
}
.btn.danger:hover {
  background: var(--bad);
  color: var(--ink);
  border-color: var(--bad);
}

/* Compact button used in header, week bar */
.btn-compact {
  flex: 0;
  min-width: auto;
  padding: 8px 14px;
  font-size: 11px;
  letter-spacing: 0.08em;
}

/* =========================================================
   SETUP PANEL
   ========================================================= */
.setup {
  background: var(--surface-1);
  border: 1px solid var(--accent);
  border-radius: var(--r-md);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-md), 0 0 0 4px var(--accent-soft);
}
.setup h3 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 28px;
  color: var(--accent);
  margin-bottom: 12px;
  letter-spacing: 0.02em;
}
.setup p {
  font-size: 13px;
  color: var(--ink-mid);
  margin-bottom: 14px;
  line-height: 1.6;
}
.setup input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 12px 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  margin-bottom: 8px;
  border-radius: var(--r-sm);
  transition: all 0.15s ease;
}
.setup input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.setup .row { display: flex; gap: 10px; flex-wrap: wrap; }
.setup .row > * { flex: 1; min-width: 200px; }

/* =========================================================
   MODAL
   ========================================================= */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
  animation: fadein 0.2s ease;
}
.modal-bg.show { display: flex; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface-1);
  border: 1px solid var(--accent);
  border-radius: var(--r-lg);
  padding: 28px;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-lg), 0 0 0 4px var(--accent-soft);
  animation: slideup 0.25s cubic-bezier(.2,1.2,.3,1);
}
@keyframes slideup { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal h3 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 30px;
  color: var(--accent);
  margin-bottom: 12px;
  letter-spacing: 0.02em;
}
.modal p {
  color: var(--ink-mid);
  font-size: 13px;
  margin-bottom: 18px;
  line-height: 1.6;
}
.modal input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
  margin-bottom: 14px;
  border-radius: var(--r-sm);
  text-align: center;
}
.modal input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.modal-row { display: flex; gap: 10px; }

/* =========================================================
   TOAST
   ========================================================= */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(140%);
  background: var(--good);
  color: var(--bg);
  padding: 14px 24px;
  font-family: 'Archivo', sans-serif;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 13px;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg), 0 0 0 4px var(--good-soft);
  transition: transform 0.4s cubic-bezier(.6,-0.3,.3,1.5);
  z-index: 300;
  max-width: 90vw;
  text-align: center;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.bad {
  background: var(--bad);
  box-shadow: var(--shadow-lg), 0 0 0 4px rgba(227,93,106,0.2);
}

/* =========================================================
   FOOTER
   ========================================================= */
footer {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--ink-dim);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  letter-spacing: 0.08em;
}
footer a {
  color: var(--ink-dim);
  text-decoration: none;
  border-bottom: 1px dashed var(--ink-dim);
  transition: color 0.15s ease;
}
footer a:hover { color: var(--accent); border-color: var(--accent); }

/* =========================================================
   MOBILE
   ========================================================= */
@media (max-width: 640px) {
  .wrap { padding: 16px 14px 100px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .session-title { font-size: 32px; }
  .day-btn { min-width: 78px; font-size: 10px; padding: 12px 6px; }
  .day-btn .num { font-size: 20px; }
  .phase-btn { padding: 12px; }
  .phase-btn .label { font-size: 18px; }
  .phase-btn .sub { font-size: 8px; }
  .stat .value { font-size: 30px; }
  .meta { font-size: 10px; }
  .ex-name { font-size: 14px; }
  .complete-bar .btn { min-width: calc(50% - 5px); font-size: 12px; padding: 14px 12px; }
}
