/* ============================================================
   Workout Tracker - Dark Gym Style, Mobile-First
   ============================================================ */

:root {
  --bg-primary: #1a1a2e;
  --bg-card: #16213e;
  --bg-elevated: #0f3460;
  --accent: #e94560;
  --accent-hover: #c73652;
  --accent-light: rgba(233, 69, 96, 0.15);
  --text-primary: #f0f0f0;
  --text-secondary: #a0a0b0;
  --text-muted: #606080;
  --border: rgba(255, 255, 255, 0.1);
  --success: #4ade80;
  --warning: #fbbf24;
  --danger: #ef4444;
  --info: #60a5fa;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  --radius: 12px;
  --radius-sm: 8px;
  --nav-height: 64px;
  --header-height: 56px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  overflow-x: hidden;
}

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

/* ============================================================
   Typography
   ============================================================ */

h1, h2, h3, h4 {
  font-weight: 700;
  line-height: 1.2;
}

h1 { font-size: 1.8rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1rem; }

p { margin-bottom: 0.5rem; }
p:last-child { margin-bottom: 0; }

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

/* ============================================================
   Layout
   ============================================================ */

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-content {
  flex: 1;
  padding: 16px;
  padding-bottom: calc(var(--nav-height) + 16px);
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

.page-header {
  background: var(--bg-card);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
  min-height: var(--header-height);
}

.page-header h1 {
  font-size: 1.3rem;
  flex: 1;
}

.page-header .header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ============================================================
   Bottom Navigation
   ============================================================ */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 200;
  safe-area-inset-bottom: env(safe-area-inset-bottom);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 500;
  transition: color 0.2s;
  padding: 8px 4px;
  border: none;
  background: none;
  cursor: pointer;
}

.nav-item svg {
  width: 22px;
  height: 22px;
  stroke-width: 2;
}

.nav-item.active,
.nav-item:hover {
  color: var(--accent);
}

/* ============================================================
   Cards
   ============================================================ */

.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

/* ============================================================
   Buttons
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
}
.btn-secondary:hover { background: rgba(15, 52, 96, 0.8); }

.btn-success {
  background: var(--success);
  color: #1a1a2e;
}
.btn-success:hover { background: #22c55e; }

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover { background: #dc2626; }

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-outline:hover { background: var(--bg-elevated); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px;
  min-height: 36px;
}
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-elevated); }

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
}

.btn-lg {
  min-height: 54px;
  font-size: 1.1rem;
  padding: 14px 24px;
}

.btn-sm {
  min-height: 36px;
  font-size: 0.85rem;
  padding: 6px 12px;
}

.btn-full {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ============================================================
   Stepper (+ / - controls)
   ============================================================ */

.stepper {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}

.stepper-btn {
  width: 48px;
  height: 48px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: none;
  font-size: 1.4rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}

.stepper-btn:active {
  background: var(--accent);
}

.stepper-value {
  flex: 1;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 8px 4px;
  min-width: 60px;
}

.stepper-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  padding: 0 8px;
  white-space: nowrap;
}

/* ============================================================
   Forms
   ============================================================ */

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 1rem;
  padding: 12px 14px;
  min-height: 44px;
  outline: none;
  transition: border-color 0.2s;
}

.form-control:focus {
  border-color: var(--accent);
}

.form-control::placeholder {
  color: var(--text-muted);
}

select.form-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23a0a0b0' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ============================================================
   Login Page
   ============================================================ */

.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg-primary);
}

.login-logo {
  margin-bottom: 32px;
  text-align: center;
}

.login-logo .logo-icon {
  width: 72px;
  height: 72px;
  background: var(--accent);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 2rem;
}

.login-logo h1 {
  font-size: 2rem;
  color: var(--text-primary);
}

.login-logo p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.login-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 28px 24px;
  width: 100%;
  max-width: 380px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.login-tabs {
  display: flex;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 20px;
}

.login-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.login-tab.active {
  background: var(--accent);
  color: white;
}

.error-message {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.875rem;
  margin-bottom: 12px;
  display: none;
}

.error-message.show { display: block; }

.success-message {
  background: rgba(74, 222, 128, 0.15);
  color: var(--success);
  border: 1px solid rgba(74, 222, 128, 0.3);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.875rem;
  margin-bottom: 12px;
  display: none;
}
.success-message.show { display: block; }

/* ============================================================
   Dashboard
   ============================================================ */

.welcome-banner {
  background: linear-gradient(135deg, var(--bg-elevated), var(--bg-card));
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

.welcome-banner h2 {
  font-size: 1.3rem;
  margin-bottom: 4px;
}

.welcome-banner p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.plan-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.plan-card-header {
  background: var(--bg-elevated);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.plan-card-header h3 {
  font-size: 1.1rem;
}

.session-list {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.session-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  color: var(--text-primary);
}

.session-btn:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.session-label {
  display: flex;
  align-items: center;
  gap: 12px;
}

.session-badge {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
}

.session-info h4 {
  font-size: 0.95rem;
  margin-bottom: 2px;
}

.session-info p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin: 0;
}

.session-arrow {
  color: var(--text-muted);
}

/* ============================================================
   Training Page
   ============================================================ */

.training-header {
  background: var(--bg-card);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.training-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.training-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.session-timer {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 1.1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.progress-track {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.progress-track::-webkit-scrollbar { display: none; }

.progress-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.3s;
}

.progress-dot.done { background: var(--success); }
.progress-dot.active { background: var(--accent); }

.exercise-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 12px;
  border: 2px solid var(--accent);
  box-shadow: 0 0 20px rgba(233, 69, 96, 0.15);
}

.exercise-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.exercise-title {
  font-size: 1.3rem;
  font-weight: 700;
  flex: 1;
}

.exercise-info-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: color 0.2s;
}

.exercise-info-btn:hover { color: var(--accent); }

.exercise-meta {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 16px;
}

.sets-grid {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.set-bubble {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.set-bubble.done {
  background: var(--success);
  border-color: var(--success);
  color: #1a1a2e;
}

.set-bubble.active {
  border-color: var(--accent);
  color: var(--accent);
}

.weight-reps-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.control-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.log-set-btn {
  width: 100%;
  padding: 16px;
  font-size: 1.1rem;
  font-weight: 700;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.03em;
}

.log-set-btn:active { transform: scale(0.98); }
.log-set-btn:hover { background: var(--accent-hover); }

/* Rest Timer */
.rest-timer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 46, 0.95);
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* flex-start + auto margins below: centred while it fits, scrollable from
     the TOP when it doesn't (justify-content:center clipped both ends). */
  justify-content: flex-start;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 24px 24px calc(24px + env(safe-area-inset-bottom));
}

.rest-timer-overlay > :first-child { margin-top: auto; }
.rest-timer-overlay > :last-child { margin-bottom: auto; }

.rest-feedback-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 0.85rem;
  cursor: pointer;
  width: 100%;
}

.rest-timer-label {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.rest-timer-display {
  font-size: 6rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 8px;
}

.rest-timer-display.low { color: var(--accent); }

.rest-timer-ring {
  position: relative;
  width: 200px;
  height: 200px;
  margin-bottom: 24px;
}

.rest-timer-ring svg {
  width: 200px;
  height: 200px;
  transform: rotate(-90deg);
}

.rest-timer-ring-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 8;
}

.rest-timer-ring-progress {
  fill: none;
  stroke: var(--accent);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.5s linear;
}

.rest-timer-ring-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.rest-timer-controls {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.rest-duration-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.rest-duration-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
  font-size: 1.3rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.rest-duration-btn:active { background: var(--accent); }

.rest-duration-label {
  font-size: 1rem;
  color: var(--text-secondary);
  text-align: center;
  min-width: 80px;
}

/* Next Exercise Info */
.next-exercise-info {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-top: 16px;
  border: 1px solid var(--border);
  text-align: center;
  max-width: 300px;
}

.next-exercise-info .label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
}

.next-exercise-info .name {
  font-size: 1rem;
  font-weight: 700;
}

/* Completed exercise cards */
.completed-exercise-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 8px;
  border: 1px solid rgba(74, 222, 128, 0.2);
  opacity: 0.7;
}

.completed-exercise-card .ex-name {
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.check-icon {
  color: var(--success);
  font-size: 1.1rem;
}

.completed-sets-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.completed-set-chip {
  background: var(--bg-primary);
  border-radius: 20px;
  padding: 2px 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.bodyweight-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(96, 165, 250, 0.16);
  color: #93c5fd;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  vertical-align: middle;
}

/* End Training */
.end-training-area {
  padding: 16px;
  margin-top: 8px;
}

/* ============================================================
   History Page
   ============================================================ */

.workout-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.2s;
}

.workout-card:hover { border-color: var(--accent); }

.workout-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.workout-date {
  font-weight: 700;
  font-size: 1rem;
}

.workout-badge {
  background: var(--accent);
  color: white;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 0.8rem;
  font-weight: 700;
}

.workout-meta {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.workout-detail {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  display: none;
}

.workout-detail.show { display: block; }

.sets-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin-top: 8px;
}

.sets-table th {
  text-align: left;
  color: var(--text-secondary);
  font-weight: 600;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sets-table td {
  padding: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.sets-table tr:last-child td { border-bottom: none; }

/* ============================================================
   Progress / Charts
   ============================================================ */

.exercise-selector {
  margin-bottom: 16px;
}

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

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.chart-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.chart-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.stat-box {
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}

.stat-box .value {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--accent);
}

.stat-box .label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.progress-session-list {
  display: grid;
  gap: 12px;
}

.progress-session-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 14px 16px;
}

.progress-session-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.progress-session-date {
  font-weight: 700;
}

.progress-session-meta {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.progress-set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.progress-set-row:first-child {
  border-top: none;
  padding-top: 0;
}

.progress-set-row:last-child {
  padding-bottom: 0;
}

.progress-set-label {
  color: var(--text-secondary);
  font-size: 0.85rem;
  min-width: 54px;
}

.progress-set-detail {
  text-align: right;
  font-size: 0.9rem;
}

/* ============================================================
   Plan Editor
   ============================================================ */

.plan-editor-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
}

.plan-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.session-editor {
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
}

.session-editor-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  cursor: pointer;
}

.session-editor-label {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.session-editor-title {
  flex: 1;
  font-weight: 700;
}

.exercise-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  border: 1px solid var(--border);
}

.exercise-item-handle {
  color: var(--text-muted);
  cursor: grab;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px;
}

.exercise-item-handle span {
  display: block;
  width: 16px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
}

.exercise-item-info {
  flex: 1;
  min-width: 0;
}

.exercise-item-name {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.exercise-item-meta {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.exercise-item-actions {
  display: flex;
  gap: 4px;
}

.order-btn {
  width: 32px;
  height: 32px;
  background: var(--bg-elevated);
  border: none;
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.15s;
}

.order-btn:hover { background: var(--accent); color: white; }

.delete-btn {
  width: 32px;
  height: 32px;
  background: rgba(239, 68, 68, 0.15);
  border: none;
  border-radius: 6px;
  color: var(--danger);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.15s;
}

.delete-btn:hover { background: var(--danger); color: white; }

.add-exercise-form {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.add-exercise-form .form-group {
  margin-bottom: 0;
  flex: 1;
  min-width: 120px;
}

/* ============================================================
   Modal / Popup
   ============================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 24px;
  width: 100%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  border-top: 3px solid var(--accent);
}

.modal-overlay.show .modal {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.modal-title {
  font-size: 1.3rem;
  font-weight: 700;
  flex: 1;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}

.modal-close:hover { color: var(--text-primary); }

.muscle-tag {
  display: inline-block;
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid rgba(233, 69, 96, 0.3);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  margin: 2px;
}

.technique-box {
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-top: 12px;
  border-left: 3px solid var(--accent);
}

.technique-box h4 {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.technique-box p {
  font-size: 0.9rem;
  color: var(--text-primary);
  line-height: 1.6;
}

/* ============================================================
   Loading & Empty States
   ============================================================ */

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-muted);
  flex-direction: column;
  gap: 12px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}

.empty-state .icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state h3 {
  margin-bottom: 8px;
  color: var(--text-primary);
}

.empty-state p {
  font-size: 0.9rem;
  margin-bottom: 16px;
}

/* ============================================================
   Utility Classes
   ============================================================ */

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* ============================================================
   Scrollbar
   ============================================================ */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ============================================================
   Animations
   ============================================================ */

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.3s ease forwards;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.pulse {
  animation: pulse 1.5s ease-in-out infinite;
}

/* ============================================================
   Desktop adjustments
   ============================================================ */

@media (min-width: 600px) {
  .page-content {
    padding: 24px;
    padding-bottom: calc(var(--nav-height) + 24px);
  }

  .rest-timer-ring {
    width: 240px;
    height: 240px;
  }

  .rest-timer-ring svg {
    width: 240px;
    height: 240px;
  }
}
