/* ========= SESSION VIEW ========= */

.session-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-divider);
  padding: var(--space-md) var(--space-base);
}

.session-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
}

.session-header-title {
  font-size: 18px;
  font-weight: 600;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0 var(--space-sm);
}

.session-header-meta {
  display: flex;
  align-items: center;
  gap: var(--space-base);
  font-size: 13px;
  color: var(--text-secondary);
}

.session-clock {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.session-progress-text {
  font-size: 13px;
  color: var(--text-secondary);
}

.session-exercises {
  padding: var(--space-sm) var(--space-base);
  padding-bottom: 160px; /* space for bottom bar + tab bar + margin */
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.session-bottom-bar {
  position: fixed;
  bottom: 56px;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  padding: var(--space-sm) var(--space-base);
  background: var(--bg-surface);
  border-top: 1px solid var(--border-divider);
  display: flex;
  gap: var(--space-sm);
  z-index: 50;
  padding-bottom: calc(var(--space-sm) + env(safe-area-inset-bottom, 0px));
}

.session-bottom-bar .btn { flex: 1; }

/* Exercise Card — Collapsed */
.ex-card {
  background: var(--bg-surface);
  border-radius: var(--radius-card);
  border: 1px solid var(--border-default);
  overflow: hidden;
  transition: border-color 200ms ease;
}

.ex-card.active {
  border-color: var(--border-active);
}

.ex-card.done {
  border-color: rgba(52, 211, 153, 0.3);
}

.ex-card.skipped {
  opacity: 0.5;
}

.ex-card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding-bottom: var(--space-sm);
}

.ex-card-collapsed {
  display: flex;
  align-items: center;
  padding: 0 var(--space-base);
  height: 52px;
  gap: var(--space-base);
  cursor: pointer;
  transition: background 150ms ease;
}

.ex-card-collapsed:hover { background: var(--bg-surface-hover); }

.ex-card-name {
  flex: 1;
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ex-card-collapsed .ex-card-name {
  font-size: 14px;
}

.ex-card.done .ex-card-name {
  color: var(--text-secondary);
}

.ex-card-sets-badge {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ex-card-weight {
  font-size: 13px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Exercise Card — Expanded */
.ex-card-expanded {
  padding: var(--space-base);
}

.ex-card-muscle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.ex-card-history {
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-divider);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.ex-card-history-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 13px;
  color: var(--text-secondary);
}

.ex-card-history-row .hist-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.ex-card-history-row .hist-values {
  font-weight: 600;
  color: var(--text-primary);
}

/* Sets list inside expanded card */
.ex-card-sets {
  margin-top: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.set-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
  border-radius: var(--radius-md);
  min-height: 36px;
  font-variant-numeric: tabular-nums;
}

.set-row-completed {
  cursor: pointer;
  transition: background 100ms ease;
}

.set-row-completed:hover,
.set-row-completed:active { background: var(--bg-surface-hover); }

.set-label {
  font-size: 13px;
  color: var(--text-secondary);
  width: 60px;
  flex-shrink: 0;
}

.set-values {
  font-size: 15px;
  font-weight: 600;
  flex: 1;
}

.set-check {
  color: var(--success);
  font-size: 18px;
}

.set-row-active {
  background: var(--accent-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.set-row-active .set-label {
  width: 100%;
  margin-bottom: -4px;
}

.set-row-active .set-inline-inputs {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
}

.set-inline-stepper {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  height: 44px;
  overflow: hidden;
  flex: 1;
}

.set-inline-stepper:focus-within {
  border-color: var(--border-active);
}

.set-inline-stepper .stepper-btn {
  width: 40px;
  height: 100%;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.set-inline-stepper input {
  width: 48px;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.set-inline-stepper input::-webkit-inner-spin-button,
.set-inline-stepper input::-webkit-outer-spin-button {
  -webkit-appearance: none;
}

.set-inline-unit {
  font-size: 12px;
  color: var(--text-secondary);
  flex-shrink: 0;
  min-width: 20px;
}

.set-inline-x {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.set-row-planned {
  color: var(--text-tertiary);
  font-style: italic;
  font-size: 13px;
}

.ex-card-actions {
  margin-top: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.ex-card-secondary-actions {
  display: flex;
  justify-content: space-between;
}

/* Card progress bar at top */
.ex-card-progress {
  height: 3px;
}

.ex-card-progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 300ms ease;
}

.ex-card-progress-fill.complete {
  background: var(--success);
}

/* ========= HOME VIEW ========= */

.home-view {
  padding: var(--space-xl) var(--space-base);
}

.home-greeting {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: var(--space-xs);
}

.home-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: var(--space-xl);
}

.home-cta {
  padding: var(--space-xl);
  margin-bottom: var(--space-xl);
  text-align: center;
}

.home-cta-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.home-cta-meta {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
}

.home-section {
  margin-bottom: var(--space-xl);
}

.home-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-sm);
}

.home-last-session {
  padding: var(--space-base);
  cursor: pointer;
}

.home-last-session:hover { background: var(--bg-surface-hover); }

.home-week {
  display: flex;
  justify-content: space-between;
  padding: var(--space-base) 0;
}

.home-week-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
}

.home-week-label {
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 500;
}

.home-week-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

.home-week-dot.trained {
  background: var(--success);
  color: var(--bg-primary);
}

.home-week-dot.today {
  border: 2px solid var(--accent);
  color: var(--accent);
}

.home-week-dot.rest {
  background: var(--bg-surface);
  color: var(--text-disabled);
}

/* Resume banner */
.resume-banner {
  background: var(--accent-subtle);
  border: 1px solid rgba(79, 140, 255, 0.3);
  border-radius: var(--radius-card);
  padding: var(--space-base);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  cursor: pointer;
}

.resume-banner:hover { background: rgba(79, 140, 255, 0.18); }

/* ========= PROGRAMS VIEW ========= */

.programs-view {
  padding: var(--space-xl) var(--space-base);
}

.programs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.programs-header h1 {
  font-size: 22px;
  font-weight: 700;
}

.program-card {
  margin-bottom: var(--space-sm);
  cursor: pointer;
}

.program-card .badge { margin-bottom: var(--space-sm); }

.program-card-name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.program-card-meta {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ========= PROGRAM EDITOR ========= */

.editor-view {
  padding: var(--space-xl) var(--space-base);
}

.editor-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.editor-header h1 {
  font-size: 18px;
  font-weight: 600;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workout-tabs {
  display: flex;
  gap: var(--space-sm);
  overflow-x: auto;
  padding-bottom: var(--space-sm);
  margin-bottom: var(--space-base);
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.workout-tabs::-webkit-scrollbar { display: none; }

.workout-tab {
  padding: var(--space-sm) var(--space-base);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid var(--border-default);
  cursor: pointer;
  transition: all 150ms ease;
}

.workout-tab.active {
  background: var(--accent-subtle);
  color: var(--accent-text);
  border-color: var(--accent);
}

.workout-exercise-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-base);
  background: var(--bg-surface);
  border-radius: var(--radius-card);
  border: 1px solid var(--border-default);
  margin-bottom: var(--space-sm);
  cursor: pointer;
}

.workout-exercise-item:hover { background: var(--bg-surface-hover); }

.workout-exercise-order {
  font-size: 13px;
  color: var(--text-tertiary);
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.workout-exercise-info { flex: 1; }

.workout-exercise-name {
  font-size: 15px;
  font-weight: 600;
}

.workout-exercise-params {
  font-size: 13px;
  color: var(--text-secondary);
}

.workout-exercise-actions {
  display: flex;
  gap: var(--space-xs);
}

/* ========= HISTORY VIEW ========= */

.history-view {
  padding: var(--space-xl) var(--space-base);
}

.history-view h1 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: var(--space-lg);
}

.history-card {
  margin-bottom: var(--space-sm);
  cursor: pointer;
}

.history-card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.history-card-meta {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  gap: var(--space-base);
}

/* ========= SESSION DETAIL VIEW ========= */

.session-detail-view {
  padding: var(--space-xl) var(--space-base);
}

.session-detail-header {
  margin-bottom: var(--space-lg);
}

.session-detail-title {
  font-size: 22px;
  font-weight: 700;
}

.session-detail-meta {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: var(--space-xs);
  display: flex;
  gap: var(--space-base);
}

.session-detail-exercise {
  margin-bottom: var(--space-base);
}

.session-detail-ex-name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: var(--space-sm);
}

.session-detail-ex-muscle {
  font-size: 13px;
  color: var(--text-secondary);
}

.session-detail-sets {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.session-detail-set {
  display: flex;
  gap: var(--space-base);
  padding: var(--space-sm) 0;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.session-detail-set-num {
  color: var(--text-tertiary);
  width: 60px;
}

.session-detail-set-values {
  font-weight: 600;
}

/* ========= PROFILE VIEW ========= */

.profile-view {
  padding: var(--space-xl) var(--space-base);
}

.profile-view h1 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: var(--space-lg);
}

.settings-group {
  margin-bottom: var(--space-xl);
}

.settings-group-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-sm);
}

/* ========= SESSION SUMMARY ========= */

.summary-view {
  padding: var(--space-3xl) var(--space-base) var(--space-xl);
  text-align: center;
}

.summary-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: var(--space-sm);
  color: var(--success);
}

.summary-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: var(--space-xl);
}

.summary-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
}

.summary-stat {
  background: var(--bg-surface);
  border-radius: var(--radius-card);
  padding: var(--space-base);
  text-align: center;
}

.summary-stat-value {
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.summary-stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: var(--space-xs);
}

/* ========= LOGIN VIEW ========= */

.login-view {
  padding: var(--space-xl) var(--space-base);
  max-width: 360px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-brand {
  text-align: center;
  margin-bottom: var(--space-2xl);
}

.login-logo {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: var(--accent);
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-base);
}

.login-title {
  font-size: 24px;
  font-weight: 700;
}

.login-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: var(--space-xs);
}
