/* ============================================================
   StrongLifts 5×5 — Teal & Gray theme
   ============================================================ */

@font-face {
  font-family: 'Russo One';
  src: url('/static/fonts/RussoOne-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg:          #1c1c1e;
  --bg2:         #2c2c2e;
  --bg3:         #3a3a3c;
  --accent:      #00b4a0;
  --accent2:     #5ac8c8;
  --text:        #f2f2f7;
  --text-muted:  #8e8e93;
  --success:     #30d158;
  --warning:     #ffd60a;
  --danger:      #ff453a;
  --border:      #3a3a3c;
  --card-bg:     #2c2c2e;
  --bubble-empty:  #3a3a3c;
  --bubble-filled: #00b4a0;
  --bubble-active: #00b4a0;
  --font: -apple-system, 'Segoe UI', system-ui, sans-serif;
  --radius: 12px;
  --radius-sm: 8px;
  --nav-height: 64px;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom));
}

/* ---- Layout ---- */
#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px 0;
  min-height: 100vh;
}

/* ---- Typography ---- */
h1 { font-size: 1.8rem; font-weight: 700; }
h2 { font-size: 1.2rem; font-weight: 600; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn:active { transform: scale(0.97); opacity: 0.9; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary  { background: var(--accent); color: #fff; }
.btn-export   { background: #4a8fa8; color: #fff; }
.btn-secondary { background: var(--bg3); color: var(--text); }
.btn-ghost    { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-warning  { background: var(--warning); color: #000; }
.btn-danger   { background: var(--danger); color: #fff; }

.btn-full { width: 100%; display: flex; }
.btn-xl   { padding: 18px 24px; font-size: 1.2rem; }
.btn-sm   { padding: 8px 14px; font-size: 0.85rem; }

.btn-row  { display: flex; gap: 10px; margin-top: 10px; }

/* ---- Cards ---- */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 16px;
  margin-bottom: 16px;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

/* ---- Page Header ---- */
.page-header {
  margin-bottom: 20px;
  padding-top: 8px;
}
.page-header p { color: var(--text-muted); margin-top: 4px; }

/* ---- App Header & Title ---- */
.app-header { text-align: center; padding: 16px 0 12px; }
.app-title {
  font-size: 2.2rem;
  color: var(--accent2);
  font-family: 'Russo One', sans-serif;
  letter-spacing: 0.03em;
  text-decoration: none;
  display: inline-block;
}
.app-title:hover { opacity: 0.85; }

/* ---- Status Banner ---- */
.status-banner {
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 1rem;
  font-weight: 500;
  background: var(--bg2);
  border: 1px solid var(--border);
  min-height: 48px;
  display: flex;
  align-items: center;
}
.status-banner.status-ok     { border-color: var(--success); background: rgba(48,209,88,0.12); }
.status-banner.status-done   { border-color: var(--accent2); background: rgba(90,200,200,0.08); }
.status-banner.status-warn   { border-color: var(--warning); background: rgba(255,214,10,0.12); }
.status-banner.status-rest   { border-color: var(--border); background: var(--bg2); }
.status-banner.status-missed { border-color: var(--danger); background: rgba(255,69,58,0.12); }

/* ---- Workout Badge ---- */
.workout-badge {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 1rem;
}
.workout-badge-sm {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 0.8rem;
}
.workout-label { color: var(--text); font-size: 1rem; }

/* ---- Exercise List (home) ---- */
.exercise-list { display: flex; flex-direction: column; gap: 10px; }
.exercise-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.exercise-row:last-child { border-bottom: none; }
.exercise-name { font-size: 1.15rem; color: var(--text); }
.exercise-weight { font-size: 1.4rem; font-weight: 700; color: var(--text); }

/* ---- CTA Section ---- */
.cta-section { margin-top: 8px; margin-bottom: 20px; }

/* ---- Resume Banner ---- */
.resume-banner {
  background: rgba(245,166,35,0.15);
  border: 1px solid var(--warning);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
}
.resume-banner p { margin-bottom: 6px; }

/* ---- Bottom Navigation ---- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--bg2);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  gap: 2px;
  -webkit-tap-highlight-color: transparent;
}
.nav-item.active { color: var(--accent2); }
.nav-icon { font-size: 1.4rem; }
.nav-label { font-size: 0.7rem; }

/* ---- Sync Banner ---- */
.sync-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--warning);
  color: #000;
  text-align: center;
  padding: 8px;
  font-weight: 600;
  z-index: 200;
}
.sync-banner.hidden { display: none; }

/* ---- Login Page ---- */
.login-page { background: var(--bg); }
.login-container {
  max-width: 360px;
  margin: 0 auto;
  padding: 60px 24px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.login-logo img { border-radius: 20px; }
.login-title { font-size: 1.8rem; text-align: center; }
.login-subtitle { color: var(--text-muted); text-align: center; font-size: 0.9rem; }
.login-form { width: 100%; display: flex; flex-direction: column; gap: 14px; }
.error-box {
  background: rgba(233,69,96,0.15);
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.9rem;
  color: var(--danger);
  width: 100%;
  text-align: center;
}

/* ---- Form Elements ---- */
.form-group { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.form-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.form-row:last-child { border-bottom: none; }
.form-label { font-size: 0.95rem; color: var(--text-muted); }
label { font-size: 0.9rem; color: var(--text-muted); }
.form-input {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 14px;
  font-size: 1rem;
  width: 100%;
  -webkit-appearance: none;
}
.form-input:focus { outline: none; border-color: var(--accent2); }
.form-input-sm { width: 90px; text-align: right; }

/* ---- Workout Page ---- */
.workout-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 0 0 80px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 16px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.crumb {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
}
.crumb-active { color: var(--text); background: var(--border); }
.crumb-done { color: var(--success); }
.crumb-sep { color: var(--text-muted); }

.exercise-header {
  text-align: center;
  padding: 28px 16px 16px;
}
.exercise-name-large {
  font-size: 1.6rem;
  font-weight: 700;
  text-transform: capitalize;
  margin-bottom: 8px;
}
.exercise-weight-large {
  font-size: 3rem;
  font-weight: 800;
  color: var(--accent2);
}

/* ---- Set Bubbles ---- */
.set-bubbles {
  display: flex;
  justify-content: center;
  gap: 14px;
  padding: 16px;
  flex-wrap: wrap;
}
.bubble {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid var(--bubble-empty);
  background: var(--bubble-empty);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  position: relative;
}
.bubble-empty   { color: var(--text-muted); }
.bubble-active  { border-color: var(--accent); box-shadow: 0 0 12px rgba(0,180,160,0.4); }
.bubble-filled  { background: var(--bubble-filled); border-color: var(--bubble-filled); color: #fff; }
.bubble-partial { background: var(--warning); border-color: var(--warning); color: #000; }
.bubble-locked  { opacity: 0.3; cursor: default; }

.set-status {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  min-height: 20px;
  margin-bottom: 4px;
}

/* ---- Timer ---- */
.timer-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
  gap: 12px;
}
.timer-ring-wrap {
  position: relative;
  width: 140px;
  height: 140px;
}
.timer-ring {
  width: 140px;
  height: 140px;
  transform: rotate(-90deg);
}
.timer-bg { fill: none; stroke: var(--border); stroke-width: 8; }
.timer-progress {
  fill: none;
  stroke: var(--accent2);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear, stroke 0.3s;
}
.timer-display {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text);
}
.timer-section.hidden { display: none; }

/* ---- Rep Picker ---- */
.rep-picker-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 300;
}
.rep-picker-overlay.hidden { display: none; }
.rep-picker {
  background: var(--bg2);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 24px 20px;
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.rep-picker-title { font-size: 1.1rem; font-weight: 600; text-align: center; }
.rep-buttons {
  display: flex;
  justify-content: space-around;
  gap: 8px;
}
.rep-btn {
  flex: 1;
  padding: 16px 8px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
}
.rep-btn-success {
  border-color: var(--success);
  color: var(--success);
}
.rep-btn:active { transform: scale(0.95); }

/* ---- Workout Footer ---- */
.workout-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 10px 16px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  z-index: 100;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
}
#next-exercise-btn { flex: 1; }

/* ---- Summary Page ---- */
.summary-page { padding-bottom: 16px; }
.workout-meta { color: var(--text-muted); margin-top: 6px; }
.summary-table-wrap { overflow-x: auto; margin-bottom: 20px; }
.summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.summary-table th, .summary-table td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.summary-table th { color: var(--text-muted); font-weight: 600; }
.prog-cell { font-size: 0.85rem; }
.prog-progress { color: var(--success); }
.prog-repeat   { color: var(--text-muted); }
.prog-deload   { color: var(--warning); }
.summary-actions { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.unsynced-warning {
  background: rgba(245,166,35,0.15);
  border: 1px solid var(--warning);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 0.9rem;
  color: var(--warning);
}
.unsynced-warning.hidden { display: none; }
.back-link { margin-top: 8px; text-align: center; display: flex; justify-content: center; }

/* ---- History Page ---- */
.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-row {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
}
.history-summary {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  gap: 10px;
}
.history-meta { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.history-date { font-size: 0.95rem; color: var(--text); font-weight: 500; }
.history-weights { flex: 1; font-size: 0.9rem; color: var(--text); }
.history-chevron { color: var(--text-muted); font-size: 1.2rem; flex-shrink: 0; }
.history-detail { padding: 0 16px 14px; }
.history-detail.hidden { display: none; }
.detail-table { width: 100%; font-size: 0.85rem; border-collapse: collapse; }
.detail-table th, .detail-table td {
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.detail-table th { color: var(--text-muted); }
.reps-ok { color: var(--success); font-weight: 700; }
.reps-fail { color: var(--danger); font-weight: 700; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state p { margin-bottom: 16px; }

/* ---- Settings Page ---- */
.settings-section {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.settings-heading { margin-bottom: 12px; font-size: 1rem; }
.day-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.day-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text);
}
.day-label input[type="checkbox"] { accent-color: var(--accent2); }
.save-msg {
  background: rgba(78,204,163,0.15);
  border: 1px solid var(--success);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 14px;
  color: var(--success);
  font-weight: 600;
}
.save-msg.hidden { display: none; }

/* ---- Utilities ---- */
.hidden { display: none !important; }
