/* StrongHim — Dark theme, mobile-first */

:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface2: #334155;
  --border: #334155;
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --accent: #f97316;
  --success: #22c55e;
  --success-bg: #14532d;
  --warning: #f59e0b;
  --warning-bg: #451a03;
  --error: #ef4444;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --radius: 12px;
  --radius-sm: 8px;
  --nav-height: 64px;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── UTILITIES ── */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); font-size: 14px; }
.text-center { text-align: center; }

/* ── SCREENS ── */
.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; flex-direction: column; }

/* ── AUTH SCREEN ── */
#screen-auth {
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}

.auth-box {
  width: 100%;
  max-width: 400px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}
.auth-logo h1 {
  font-size: 36px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -1px;
}
.auth-logo p {
  color: var(--text-muted);
  font-size: 15px;
  margin-top: 4px;
}

.auth-tabs {
  display: flex;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 24px;
}
.auth-tab {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.auth-tab.active {
  background: var(--primary);
  color: #fff;
}

/* ── FORMS ── */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}
.form-group input {
  width: 100%;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s;
}
.form-group input:focus { border-color: var(--primary); }
.form-group input::placeholder { color: var(--text-muted); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  min-height: 44px;
}
.btn-primary { background: var(--primary); color: #fff; width: 100%; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--surface2); color: var(--text); }
.btn-secondary:hover { background: var(--border); }
.btn-success { background: var(--success); color: #fff; width: 100%; }
.btn-danger { background: var(--error); color: #fff; width: 100%; }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-small { padding: 6px 12px; font-size: 13px; min-height: 32px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── MESSAGES ── */
.msg { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 14px; margin-top: 12px; }
.msg-error { background: #450a0a; color: #fca5a5; border: 1px solid #7f1d1d; }
.msg-success { background: var(--success-bg); color: #86efac; border: 1px solid #166534; }

/* ── SETUP SCREEN ── */
#screen-setup {
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.setup-box {
  width: 100%;
  max-width: 400px;
}
.setup-box h2 { font-size: 24px; font-weight: 700; margin-bottom: 8px; }
.setup-box > p { color: var(--text-muted); margin-bottom: 24px; }

/* ── APP SHELL ── */
#app { display: none; flex-direction: column; min-height: 100vh; }
#app.visible { display: flex; }

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-name {
  font-weight: 700;
  font-size: 18px;
  color: var(--primary);
}
.header-week {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 1px;
}
.btn-logout {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
}

/* ── APP SCREENS ── */
.app-screen { display: none; flex: 1; padding: 16px; overflow-y: auto; padding-bottom: calc(var(--nav-height) + 16px); }
.app-screen.active { display: block; }

/* ── BOTTOM NAV ── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 20;
}
.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  transition: color 0.15s;
  padding: 8px 0;
}
.nav-btn .nav-icon { font-size: 22px; line-height: 1; }
.nav-btn.active { color: var(--primary); }

/* ── HOME SCREEN ── */
.today-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  border-left: 4px solid var(--primary);
}
.today-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.today-icon { font-size: 32px; margin-bottom: 6px; }
.today-name { font-size: 22px; font-weight: 700; margin-bottom: 2px; }
.today-date { color: var(--text-muted); font-size: 14px; margin-bottom: 16px; }
.today-desc { color: var(--text-muted); font-size: 14px; margin-bottom: 16px; line-height: 1.5; }
.today-target {
  background: var(--surface2);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.today-target strong { color: var(--text); display: block; margin-bottom: 2px; }

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 16px;
}
.week-day {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 8px 4px;
  text-align: center;
  font-size: 11px;
}
.week-day .day-abbr { color: var(--text-muted); font-weight: 500; margin-bottom: 4px; }
.week-day .day-icon { font-size: 16px; }
.week-day .day-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--border);
  margin: 4px auto 0;
}
.week-day.done .day-dot { background: var(--success); }
.week-day.today { border: 1px solid var(--primary); }

.section-title { font-size: 13px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 12px; }

/* ── WORKOUT SCREEN ── */
.workout-header { margin-bottom: 16px; }
.workout-back-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 15px;
  cursor: pointer;
  padding: 0 0 8px 0;
}
.workout-title { font-size: 22px; font-weight: 700; }
.workout-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
}
.badge-a { background: #7c3aed; color: #fff; }
.badge-b { background: #0369a1; color: #fff; }
.badge-week { background: var(--surface2); color: var(--text-muted); }

/* ── EXERCISE CARDS ── */
.exercise-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.exercise-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}
.exercise-name { font-size: 17px; font-weight: 700; }
.exercise-muscle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.exercise-position {
  font-size: 11px;
  background: var(--surface2);
  color: var(--text-muted);
  border-radius: 4px;
  padding: 2px 6px;
  margin-top: 4px;
  display: inline-block;
}
.info-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
  margin-left: 8px;
  margin-top: 2px;
}

.exercise-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.meta-chip {
  background: var(--surface2);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 13px;
  color: var(--text-muted);
}
.meta-chip.weight { color: var(--accent); background: rgba(249,115,22,0.1); }

/* Weight entry row (first time) */
.weight-entry-row {
  background: rgba(59,130,246,0.1);
  border: 1px solid rgba(59,130,246,0.3);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 12px;
}
.weight-entry-row label {
  display: block;
  font-size: 13px;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 8px;
}
.weight-entry-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}
.weight-entry-inline input {
  flex: 1;
  padding: 8px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 16px;
  outline: none;
  max-width: 120px;
}
.weight-entry-inline input:focus { border-color: var(--primary); }
.weight-entry-inline span { color: var(--text-muted); font-size: 14px; }

/* Set rows */
.sets-container { display: flex; flex-direction: column; gap: 8px; }

.set-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
}
.set-row.done { border-color: var(--success); background: rgba(34,197,94,0.08); }
.set-row.partial { border-color: var(--warning); background: rgba(245,158,11,0.08); }
.set-row.editing { border-color: var(--primary); }

.set-num {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 40px;
}
.set-status-icon { font-size: 16px; margin-left: auto; flex-shrink: 0; }

.set-inputs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}
.set-input {
  width: 56px;
  padding: 6px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 15px;
  text-align: center;
  outline: none;
}
.set-input:focus { border-color: var(--primary); }
.set-unit { font-size: 13px; color: var(--text-muted); }

.set-logged {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}
.set-logged-reps { font-size: 15px; font-weight: 600; }
.set-logged-weight { font-size: 14px; color: var(--text-muted); }

.set-log-btn {
  padding: 6px 12px;
  background: var(--primary);
  border: none;
  border-radius: 6px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}
.set-log-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.set-edit-btn {
  padding: 5px 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  flex-shrink: 0;
}

/* ── REST TIMER ── */
.rest-timer {
  position: fixed;
  bottom: calc(var(--nav-height) + 12px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 30;
  min-width: 240px;
}
.timer-label { font-size: 13px; color: var(--text-muted); }
.timer-display { font-size: 24px; font-weight: 800; color: var(--primary); }
.timer-skip {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
}

.workout-finish-bar {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ── PROGRESS SCREEN ── */
.progress-select-wrap { margin-bottom: 16px; }
.progress-select-wrap select {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 15px;
  outline: none;
}
.progress-select-wrap select:focus { border-color: var(--primary); }

.progress-table {
  width: 100%;
  border-collapse: collapse;
}
.progress-table th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.progress-table td {
  padding: 10px 0;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.progress-table td:first-child { color: var(--text-muted); }
.progress-table .weight-cell { font-weight: 700; color: var(--accent); }
.progress-empty { color: var(--text-muted); text-align: center; padding: 32px 0; }

.progress-bar-wrap {
  background: var(--surface2);
  border-radius: 4px;
  height: 8px;
  margin-top: 4px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.3s;
}

/* ── SETTINGS SCREEN ── */
.settings-section { margin-bottom: 24px; }
.settings-section h3 { font-size: 14px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 12px; }

.weight-setting-row {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.weight-setting-name { font-size: 14px; font-weight: 600; }
.weight-setting-info { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.weight-setting-right { display: flex; align-items: center; gap: 8px; }
.weight-setting-current { font-size: 15px; font-weight: 700; color: var(--accent); }

.info-card {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.info-card-label { font-size: 14px; color: var(--text-muted); }
.info-card-value { font-size: 14px; font-weight: 600; }

/* ── MODALS ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 40;
  display: flex;
  align-items: flex-end;
  padding: 0;
}
.modal-sheet {
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 20px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-handle {
  width: 40px; height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 16px;
}
.modal-title { font-size: 19px; font-weight: 700; margin-bottom: 4px; }
.modal-muscle { font-size: 14px; color: var(--text-muted); margin-bottom: 16px; }
.modal-equipment {
  background: var(--surface2);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.modal-equipment span { font-weight: 600; color: var(--text); }

.youtube-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #dc2626;
  color: #fff;
  padding: 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 16px;
}

.cues-list { list-style: none; }
.cues-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-muted);
  padding-left: 20px;
  position: relative;
}
.cues-list li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--primary);
}
.cues-list li:last-child { border-bottom: none; }

/* Weight adjust modal */
.adjust-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.adjust-modal-box {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 360px;
}
.adjust-modal-box h3 { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.adjust-modal-box p { font-size: 14px; color: var(--text-muted); margin-bottom: 20px; }
.adjust-modal-actions { display: flex; gap: 8px; margin-top: 16px; }

/* ── NON-RESISTANCE WORKOUT ── */
.cardio-log-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
}
.cardio-log-card h3 { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.cardio-log-card p { color: var(--text-muted); font-size: 14px; margin-bottom: 16px; }
.activity-list { margin-bottom: 16px; }
.activity-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.activity-item::before { content: '•'; color: var(--primary); font-size: 18px; }

/* ── RESPONSIVE (wider screens) ── */
@media (min-width: 600px) {
  .app-screen { max-width: 560px; margin: 0 auto; }
  .auth-box, .setup-box { padding: 32px; background: var(--surface); border-radius: var(--radius); }
  .rest-timer { width: auto; }
}
