/* Mobile-first, clean, soft pastel palette. Large rounded buttons.
   The current set and SIGUIENTE are the most prominent elements;
   COMPLETAR SESIÓN is visually separated with a distinct accent color. */

:root {
  --bg: #eef2f5;
  --surface: #ffffff;
  --text: #2c3641;
  --muted: #7a8794;
  --primary: #7c9db3;        /* soft blue-grey, main action */
  --primary-dark: #5f7f95;
  --complete: #5aa572;       /* soft green, distinct accent for completing */
  --complete-dark: #4c9061;
  --border: #dce3e9;
  --shadow: 0 2px 8px rgba(44, 54, 65, 0.08);
  --radius: 18px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 18px;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}

#app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
}

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar h1 {
  font-size: 1.1rem;
  margin: 0;
  font-weight: 600;
}

.link-btn {
  background: none;
  border: none;
  color: var(--primary-dark);
  font-size: 1rem;
  padding: 6px 4px;
  cursor: pointer;
}

/* ---------- layout ---------- */

.screen {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.screen.center {
  min-height: 70vh;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.hint {
  color: var(--muted);
  font-size: 0.95rem;
}

.progress {
  text-align: center;
  color: var(--muted);
  font-size: 1rem;
}
.progress strong { color: var(--text); }

/* ---------- exercise blocks + series rows ---------- */

.exercise-block { padding: 14px 16px; }

/* Prominent Push / Pull / Full Body banner at the top of the tracker. */
.workout-banner {
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 1.3rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.02em;
  box-shadow: var(--shadow);
}

.exercise-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.exercise-name {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
}

/* Main-lift vs accessory tag. */
.ex-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}
.ex-badge-main {
  color: #fff;
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

/* 5/3/1 week/cycle/TM line, or the accessory rep-range target. */
.ex-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 0.85rem;
  margin: 6px 0 10px;
}
.tm-edit {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.tm-input {
  width: 52px;
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px 4px;
  -moz-appearance: textfield;
}
.tm-input:focus {
  outline: none;
  border-color: var(--primary);
}

/* The 5/3/1 prescription (e.g. 65%×5) shown inside a main-lift series label. */
.set-target {
  color: var(--primary-dark);
  font-weight: 700;
}

/* Header row + series rows share one grid so Peso/Reps line up as columns.
   Columns: label | weight stepper | reps stepper | finish | trash. */
.series-head-row,
.series-row {
  display: grid;
  grid-template-columns: 1fr 92px 80px 24px 24px;
  align-items: center;
  gap: 5px;
}

.series-head-row { padding-bottom: 4px; }

.col-head {
  text-align: center;
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.series-row {
  padding: 6px 2px;
  border-top: 1px solid var(--border);
  border-radius: 8px;
  transition: background 0.15s ease;
}

/* A finished series is tinted green and its editors are locked. */
.series-row.finished {
  background: rgba(90, 165, 114, 0.16);
}
.series-row.finished .mini-input {
  background: transparent;
  border-color: transparent;
}
.series-row.finished .btn-mini,
.series-row.finished .mini-input:disabled {
  opacity: 0.5;
}

.series-num {
  font-weight: 600;
  color: var(--text);
  font-size: 0.92rem;
}

.mini-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.mini-val {
  font-size: 1.02rem;
  font-weight: 700;
  min-width: 26px;
  text-align: center;
}

/* Editable weight field. */
.mini-input {
  width: 38px;
  font-size: 1.02rem;
  font-weight: 700;
  text-align: center;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px 2px;
  -moz-appearance: textfield;
}
.mini-input:focus {
  outline: none;
  border-color: var(--primary);
}

/* Finish / trashcan icon buttons at the end of a series row. */
.icon-btn-finish,
.icon-btn-trash {
  width: 24px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  border-radius: 6px;
  justify-self: center;
}
.icon-btn-trash:active {
  background: var(--bg);
  color: #c0574e;
}
.icon-btn-finish:active {
  background: var(--bg);
  color: var(--complete);
}
/* When the series is finished, the check reads as active (green + filled). */
.icon-btn-finish.active {
  color: #fff;
  background: var(--complete);
}

/* "Add another series" button, subtle, at the end of each exercise block. */
.btn-add {
  width: 100%;
  margin-top: 12px;
  padding: 9px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary-dark);
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: 12px;
}
.btn-add:active { background: #e3e9ee; }

/* Small steppers: about the height of the "Serie x/y" text. */
.btn-mini {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 0.95rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

/* ---------- buttons ---------- */

.btn {
  font-family: inherit;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease, opacity 0.15s ease;
  font-weight: 600;
}
.btn:active { transform: scale(0.97); }

.btn-round {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  font-size: 2rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  line-height: 1;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:active { background: var(--primary-dark); }

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-huge {
  font-size: 1.4rem;
  padding: 22px 32px;
  width: 100%;
  max-width: 340px;
}

/* COMPLETAR SESIÓN: separated, distinct accent to avoid accidental taps. */
.btn-complete {
  background: var(--complete);
  color: #fff;
  font-size: 1.1rem;
  padding: 18px;
  width: 100%;
  margin-top: 24px;
}
.btn-complete:active { background: var(--complete-dark); }

/* ---------- history ---------- */

.history-status {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.hist-session { padding: 18px 20px; }

.hist-date {
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 12px;
}

.hist-exercise {
  padding: 8px 0;
  border-top: 1px solid var(--border);
}
.hist-exercise:first-of-type { border-top: none; }

.hist-ex-name { font-weight: 600; }

/* Body-weight card at the top of Historial. */
.bw-card { padding: 18px 20px; }
.bw-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.bw-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-top: 1px solid var(--border);
}
.bw-row:first-child { border-top: none; }
.bw-value { font-weight: 600; }
.bw-pending { color: var(--muted); font-size: 0.85rem; }
.bw-btn {
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  font-size: 1rem;
}
.hist-ex-data { color: var(--muted); font-size: 0.95rem; }

/* ---------- past-workout swipe view (read-only) ---------- */

.past-hint {
  text-align: center;
  margin: 0;
}

.past-ex {
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.past-ex:first-child { border-top: none; padding-top: 0; }

.past-ex-name {
  font-weight: 600;
  margin-bottom: 4px;
}

.past-series {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.95rem;
  padding: 2px 0;
}
.past-series span:last-child {
  color: var(--text);
  font-weight: 600;
}

/* ---------- swipe navigation slide-in ---------- */

@keyframes slide-from-left {
  from { transform: translateX(-24px); opacity: 0.35; }
  to   { transform: translateX(0);     opacity: 1; }
}
@keyframes slide-from-right {
  from { transform: translateX(24px); opacity: 0.35; }
  to   { transform: translateX(0);    opacity: 1; }
}
.screen.slide-from-left { animation: slide-from-left 0.18s ease-out; }
.screen.slide-from-right { animation: slide-from-right 0.18s ease-out; }
