/* public/style.css */
:root {
  --bg:       #0a0a0a;
  --surface:  #0f0f0f;
  --surface2: #161616;
  --border:   #1e1e1e;
  --teal:     #00D2BE;
  --teal-dim: #00D2BE33;
  --silver:   #C0C0C0;
  --text:     #e8e8e8;
  --muted:    #666;
  --muted2:   #555;
  --danger:   #f38ba8;
  --warn:     #f9e2af;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  min-height: 100dvh;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  background: var(--surface);
  padding: .75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--teal-dim);
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--teal);
  letter-spacing: -.5px;
  text-decoration: none;
}

.header-meta { font-size: .75rem; color: var(--muted); }

/* Main content */
.main { padding: .75rem; flex: 1; display: flex; flex-direction: column; gap: .6rem; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .85rem 1rem;
}

.card--accent { border-color: var(--teal); }
.card--warn   { border-color: #f9e2af55; }

/* Labels */
.label {
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}

.label--teal  { color: var(--teal); }
.label--warn  { color: var(--warn); }

/* Buttons */
.btn {
  display: block;
  width: 100%;
  padding: .6rem 1rem;
  border-radius: 10px;
  font-size: .9rem;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  border: none;
  text-decoration: none;
}

.btn--primary { background: var(--teal); color: #0a0a0a; }
.btn--ghost   { background: var(--surface2); color: var(--text); }

/* Inputs */
.input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: .5rem .75rem;
  font-size: .95rem;
  width: 100%;
}

.input:focus { outline: none; border-color: var(--teal); }

.input--small { font-size: .85rem; text-align: center; padding: .4rem .5rem; }

/* Stats row */
.stats { display: flex; gap: .5rem; }
.stat {
  flex: 1;
  background: var(--surface2);
  border-radius: 8px;
  padding: .4rem;
  text-align: center;
}
.stat__label { font-size: .7rem; color: var(--muted2); }
.stat__value { font-size: .95rem; font-weight: 700; color: var(--teal); margin-top: .1rem; }
.stat__value--silver { color: var(--silver); }

/* Nav row */
.nav-row { display: flex; gap: .4rem; }
.nav-item {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .6rem .4rem;
  text-align: center;
  text-decoration: none;
  color: var(--muted);
  font-size: .65rem;
}
.nav-item__icon { font-size: 1.1rem; display: block; margin-bottom: .2rem; }

/* Exercise cards */
.exercise-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .75rem;
}
.exercise-card--active  { border-color: var(--teal); }
.exercise-card--done    { opacity: .5; }

.exercise-name { font-size: .95rem; font-weight: 700; color: var(--text); }
.exercise-meta { font-size: .75rem; color: var(--muted); margin-top: .15rem; }

/* Set rows */
.set-row {
  background: var(--surface2);
  border-radius: 8px;
  padding: .45rem .75rem;
  font-size: .8rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-top: .35rem;
}
.set-row--done    { color: var(--muted); }
.set-row--upcoming{ opacity: .5; }
.set-row__label   { width: 3rem; color: var(--muted2); flex-shrink: 0; }
.set-row__target  { flex: 1; color: var(--muted); }
.set-row__result  { color: var(--teal); font-weight: 600; }
.set-row__check   { color: var(--teal); }

/* Active set form */
.set-form {
  background: var(--bg);
  border: 1px solid var(--teal);
  border-radius: 8px;
  padding: .6rem .75rem;
  margin-top: .35rem;
}
.set-form__header {
  display: flex;
  justify-content: space-between;
  margin-bottom: .45rem;
}
.set-form__title { font-size: .8rem; font-weight: 600; color: var(--teal); }
.set-form__prev  { font-size: .7rem; color: var(--warn); }
.set-form__inputs { display: flex; gap: .5rem; align-items: flex-end; }
.set-form__field { flex: 1; }
.set-form__field-label { font-size: .65rem; color: var(--muted2); margin-bottom: .2rem; }
.set-form__x { color: var(--muted); font-size: .8rem; padding-bottom: .6rem; }

/* Progress bar */
.progress-bar-wrap { background: var(--surface2); border-radius: 99px; height: 4px; margin-top: .5rem; }
.progress-bar { background: var(--teal); height: 4px; border-radius: 99px; transition: width .3s; }
.progress-label { font-size: .7rem; color: var(--muted2); margin-top: .25rem; }

/* Streak badge */
.streak { font-size: 1.4rem; font-weight: 800; color: var(--silver); }

/* Suggestion card */
.suggestion-icon { font-size: 1rem; color: var(--teal); margin-right: .4rem; }

/* Login form */
.login-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2rem 1.5rem;
  gap: 1rem;
}
.login-title { font-size: 1.4rem; font-weight: 800; color: var(--teal); }
.login-sub   { font-size: .85rem; color: var(--muted); }
.form-group  { display: flex; flex-direction: column; gap: .4rem; }
.form-label  { font-size: .8rem; color: var(--muted); }

/* Muscle group rows */
.muscle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface2);
  border-radius: 8px;
  padding: .45rem .65rem;
  font-size: .8rem;
}
.muscle-row__left  { display: flex; align-items: center; gap: .4rem; min-width: 7rem; }
.muscle-row__icon  { font-size: .9rem; }
.muscle-row__name  { font-weight: 600; color: var(--text); }
.muscle-row__stats { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.muscle-row__vol   { color: var(--teal); font-weight: 700; min-width: 5rem; text-align: right; }
.muscle-row__sets  { color: var(--muted); min-width: 3.5rem; text-align: right; }
.muscle-row__date  { color: var(--muted2); font-size: .7rem; min-width: 4.5rem; text-align: right; }

/* HTMX loading indicator */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline; }

/* ─── Keyframes ──────────────────────────────────────────────── */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes popIn {
  0%   { opacity: 0; transform: scale(.92); }
  60%  { transform: scale(1.03); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--teal-dim); }
  50%       { box-shadow: 0 0 0 4px var(--teal-dim); }
}

@keyframes progressShimmer {
  0%   { background-position: -200% center; }
  100% { background-position:  200% center; }
}

/* ─── Page entrance — staggered cards ───────────────────────── */
.main > * {
  animation: slideUp .35s cubic-bezier(.22,.68,0,1.2) both;
}
.main > *:nth-child(1)  { animation-delay: .04s; }
.main > *:nth-child(2)  { animation-delay: .09s; }
.main > *:nth-child(3)  { animation-delay: .14s; }
.main > *:nth-child(4)  { animation-delay: .19s; }
.main > *:nth-child(5)  { animation-delay: .24s; }
.main > *:nth-child(6)  { animation-delay: .28s; }
.main > *:nth-child(7)  { animation-delay: .32s; }
.main > *:nth-child(8)  { animation-delay: .36s; }

/* ─── Exercise card active glow ─────────────────────────────── */
.exercise-card {
  transition: border-color .2s, box-shadow .2s;
}
.exercise-card--active {
  box-shadow: 0 0 0 1px var(--teal-dim), 0 4px 20px #00D2BE18;
}

/* ─── Active set form slide-in ──────────────────────────────── */
.set-form {
  animation: slideUp .25s cubic-bezier(.22,.68,0,1.2) both;
}

/* ─── Completed set row pop ─────────────────────────────────── */
.set-row--done {
  animation: popIn .28s cubic-bezier(.22,.68,0,1.2) both;
}

/* ─── Button press feedback ─────────────────────────────────── */
.btn {
  transition: transform .1s, opacity .1s, box-shadow .15s;
}
.btn:active {
  transform: scale(.97);
  opacity: .88;
}
.btn--primary:hover {
  box-shadow: 0 0 16px #00D2BE44;
}

/* ─── Input focus glow ──────────────────────────────────────── */
.input {
  transition: border-color .18s, box-shadow .18s;
}
.input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-dim);
}

/* ─── Progress bar shimmer ──────────────────────────────────── */
.progress-bar {
  background: linear-gradient(
    90deg,
    var(--teal) 0%,
    #00ffe8 50%,
    var(--teal) 100%
  );
  background-size: 200% auto;
  animation: progressShimmer 2.4s linear infinite;
  transition: width .4s cubic-bezier(.4,0,.2,1);
}

/* ─── HTMX swap fade ─────────────────────────────────────────── */
.htmx-added {
  animation: fadeIn .2s ease both;
}
.htmx-swapping {
  opacity: 0;
  transition: opacity .15s ease;
}
