/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #4f46e5;
  --primary-dark: #4338ca;
  --secondary-color: #64748b;
  --success-color: #22c55e;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --background: #ffffff;
  --surface: #f8fafc;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --border-color: #e2e8f0;
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --input-background: #ffffff;
  --modal-background: #ffffff;
  --card-background: #ffffff;
}

/* Dark Mode Theme */
[data-theme="dark"] {
  --primary-color: #818cf8;
  --primary-dark: #6366f1;
  --secondary-color: #94a3b8;
  --success-color: #4ade80;
  --warning-color: #fbbf24;
  --danger-color: #f87171;
  --background: #0f172a;
  --surface: #1e293b;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --border-color: #334155;
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.3), 0 1px 2px -1px rgb(0 0 0 / 0.3);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3), 0 4px 6px -4px rgb(0 0 0 / 0.3);
  --input-background: #1e293b;
  --modal-background: #1e293b;
  --card-background: #1e293b;
}

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

/* Layout */
#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.screen {
  flex: 1;
  padding: 1rem;
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.container {
  max-width: 600px;
  margin: 0 auto;
}

/* Typography */
h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.subtitle {
  font-size: 1.125rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 44px;
  min-width: 44px;
  -webkit-tap-highlight-color: transparent;
}

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

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

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

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

.btn-secondary:hover {
  background-color: var(--border-color);
}

.btn-large {
  width: 100%;
  padding: 1rem;
  font-size: 1.125rem;
}

.btn-text {
  background: none;
  color: var(--text-secondary);
  padding: 0.5rem;
  margin-top: 0.5rem;
}

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

/* RPE Buttons */
.rpe-buttons {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.btn-rpe {
  flex: 1;
  padding: 1.5rem 1rem;
  font-size: 1.125rem;
}

.btn-easy {
  background-color: var(--success-color);
  color: white;
}

.btn-easy:hover {
  background-color: #16a34a;
}

.btn-medium {
  background-color: var(--warning-color);
  color: white;
}

.btn-medium:hover {
  background-color: #d97706;
}

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

.btn-hard:hover {
  background-color: #dc2626;
}

/* Forms */
form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

label {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
  display: block;
}

input[type="text"],
input[type="number"],
input[type="password"],
input[type="email"] {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 2px solid var(--border-color);
  border-radius: 0.5rem;
  background-color: var(--background);
  color: var(--text-primary);
  transition: all 0.2s ease;
  min-height: 44px;
}

input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.form-group {
  margin-bottom: 1rem;
}

.set-form {
  background-color: var(--surface);
  padding: 1.5rem;
  border-radius: 0.75rem;
  margin: 1.5rem 0;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

/* Workout Card */
.workout-card {
  background-color: var(--surface);
  padding: 2rem;
  border-radius: 0.75rem;
  box-shadow: var(--shadow);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.workout-card h2 {
  margin-bottom: 0;
}

.workout-name {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--primary-color);
  margin: 0;
}

/* Import Program Card */
.import-program-card {
  background-color: var(--surface);
  padding: 2rem;
  border-radius: 0.75rem;
  box-shadow: var(--shadow);
  text-align: center;
}

.import-program-card h3 {
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.import-program-card p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

.import-program-card form {
  margin: 1.5rem 0;
}

.help-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 1.5rem;
}

.help-text a {
  color: var(--primary-color);
  text-decoration: none;
}

.help-text a:hover {
  text-decoration: underline;
}

/* Workout Screen */
.workout-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.set-counter {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.video-container {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  margin-bottom: 1.5rem;
  border-radius: 0.75rem;
  overflow: hidden;
  background-color: #000;
  transition: padding-bottom 0.3s ease, margin-bottom 0.3s ease;
}

.video-container.collapsed {
  padding-bottom: 0;
  margin-bottom: 0.5rem;
  height: 3rem;
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
}

.video-container.collapsed iframe {
  display: none;
}

.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

#toggle-video-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 10;
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
  transition: background-color 0.2s;
}

#toggle-video-btn:hover {
  background-color: rgba(0, 0, 0, 0.9);
}

.video-container.collapsed #toggle-video-btn {
  position: static;
  background-color: transparent;
  color: var(--text-primary);
  width: 100%;
  text-align: left;
  padding: 0.75rem 1rem;
  border-radius: 0;
}

.video-container.collapsed #toggle-video-btn:hover {
  background-color: var(--hover-color);
}

.exercise-target {
  text-align: center;
  font-size: 1.125rem;
  font-weight: 600;
  padding: 1rem;
  background-color: var(--surface);
  border-radius: 0.5rem;
  margin-bottom: 1.5rem;
}

/* Exercise Notes */
.exercise-notes {
  padding: 1rem;
  background-color: var(--info-background, #e3f2fd);
  border-left: 4px solid var(--info-color, #2196f3);
  border-radius: 0.5rem;
  margin-bottom: 1.5rem;
}

.exercise-notes .notes-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.exercise-notes .notes-content {
  font-size: 1rem;
  color: var(--text-primary);
  line-height: 1.5;
  margin: 0;
  white-space: pre-wrap;
}

/* Sets Table */
.sets-table {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 1.5rem 0;
}

/* Set Row - Base Styles */
.set-row {
  background: var(--surface);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 60px;
  transition: all 0.2s ease;
}

/* Set Row Header (Set number + status) */
.set-row-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.set-number {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
  min-width: 50px;
}

.set-checkmark {
  color: var(--success-color);
  font-size: 1.125rem;
  font-weight: bold;
}

/* Set Row Inputs Container */
.set-row-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  align-items: start;
}

/* Set Row Input Group */
.set-input-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.set-input-group label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  height: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
}

.set-input-group input {
  width: 100%;
  height: 44px;
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 1rem;
  text-align: center;
  background: var(--input-background);
  color: var(--text-primary);
  transition: border-color 0.2s, background-color 0.2s;
}

.set-input-group input:focus {
  outline: none;
  border-color: var(--primary-color);
  background-color: var(--input-background);
}

.set-input-group input::placeholder {
  color: #9ca3af;
  font-size: 0.875rem;
}

/* RPE Input with Help Button */
.rpe-input-wrapper {
  position: relative;
}

/* RPE label with help button wrapper */
.rpe-label-wrapper {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 16px;
  margin-bottom: 4px;
}

.rpe-label-wrapper label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1;
  height: auto;
  margin: 0;
  padding: 0;
  display: inline;
}

.rpe-help-btn {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--info-color, #2196f3);
  color: white;
  border: none;
  font-size: 0.625rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
  flex-shrink: 0;
  padding: 0;
}

.rpe-help-btn:hover {
  background: var(--primary-color);
}

/* Set Row Actions */
.set-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.set-row-actions .btn {
  flex: 1;
  height: 48px;
  font-size: 0.9375rem;
  font-weight: 600;
}

.set-row-actions .btn-text {
  flex: 0;
  height: 48px;
  padding: 0 16px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Set Row - Empty State (not started) */
.set-row.empty {
  background: var(--surface);
  border-color: var(--border-color);
}

.set-row.empty .set-number {
  color: var(--text-secondary);
}

/* Set Row - Active State (currently logging) */
.set-row.active {
  background: var(--card-background);
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.set-row.active .set-number {
  color: var(--primary-color);
}

/* Subtle pulse animation for active row */
@keyframes pulse-border {
  0%, 100% {
    border-color: var(--primary-color);
  }
  50% {
    border-color: rgba(79, 70, 229, 0.6);
  }
}

.set-row.active {
  animation: pulse-border 2s ease-in-out infinite;
}

/* Set Row - Completed State */
.set-row.completed {
  background: var(--surface);
  border-color: var(--border-color);
}

.set-row.completed .set-number {
  color: var(--text-secondary);
  font-weight: 500;
}

/* Checkmark for completed sets */
.set-checkmark {
  font-size: 1rem;
  color: var(--success-color);
  margin-right: 6px;
}

/* Completed Set Data Display */
.set-data-display {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 12px;
  background: transparent;
  border-radius: 6px;
  font-size: 0.9375rem;
  color: #6b7280;
}

.set-data-item {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.set-data-value {
  font-weight: 600;
  color: #374151;
  font-size: 1rem;
}

.set-data-unit {
  font-size: 0.875rem;
  color: #9ca3af;
  font-weight: 400;
}

/* Edit Button */
.set-edit-btn {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  padding: 0;
  border-radius: 4px;
  background: transparent;
  border: none;
  color: #9ca3af;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.set-edit-btn:hover {
  background: var(--surface);
  color: var(--text-primary);
}

/* Set Row - Editing State (completed set being edited) */
.set-row.editing {
  background: var(--card-background);
  border-color: var(--warning-color);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

.set-row.editing .set-number {
  color: var(--warning-color);
}

/* RPE Guide Overlay */
#rpe-guide {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--modal-background);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  z-index: 1000;
  max-width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

.rpe-guide-title {
  font-weight: 600;
  font-size: 1.125rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

#rpe-guide .btn {
  margin-top: 1rem;
  width: 100%;
}

/* Backdrop for RPE Guide */
#rpe-guide-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  display: none;
}

#rpe-guide-backdrop.active {
  display: block;
}

/* Timer */
#rest-timer {
  background-color: var(--surface);
  padding: 2rem;
  border-radius: 0.75rem;
  text-align: center;
  margin: 2rem 0;
  box-shadow: var(--shadow);
}

.timer-label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.timer-display {
  font-size: 3rem;
  font-weight: 700;
  color: var(--primary-color);
  font-variant-numeric: tabular-nums;
  margin-bottom: 1rem;
}

.timer-progress {
  width: 100%;
  height: 8px;
  background-color: var(--border-color);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 1rem;
}

#timer-progress-bar {
  height: 100%;
  background-color: var(--primary-color);
  transition: width 1s linear;
}

/* RPE Rating */
#rpe-rating {
  background-color: var(--surface);
  padding: 2rem;
  border-radius: 0.75rem;
  margin: 2rem 0;
  text-align: center;
}

/* Program Overview */
.program-overview-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.program-day-card {
  background-color: var(--surface);
  padding: 1.5rem;
  border-radius: 0.75rem;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid transparent;
}

.program-day-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-color);
  transform: translateY(-2px);
}

.program-day-card.current-day {
  border-color: var(--primary-color);
  background: linear-gradient(135deg, var(--surface) 0%, rgba(79, 70, 229, 0.05) 100%);
}

.program-day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.program-day-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.program-day-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  background-color: var(--primary-color);
  color: white;
}

.program-exercise-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.program-exercise-item {
  font-size: 0.875rem;
  color: var(--text-secondary);
  padding-left: 1.5rem;
  position: relative;
}

.program-exercise-item::before {
  content: '•';
  position: absolute;
  left: 0.5rem;
  color: var(--primary-color);
  font-weight: bold;
}

.program-exercise-count {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
  font-style: italic;
}

/* History */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* History Stats Dashboard */
.history-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: linear-gradient(135deg, var(--surface) 0%, rgba(79, 70, 229, 0.05) 100%);
  padding: 1.5rem;
  border-radius: 0.75rem;
  box-shadow: var(--shadow);
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.stat-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.history-item {
  background-color: var(--surface);
  padding: 1.5rem;
  border-radius: 0.75rem;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all 0.2s ease;
}

.history-item:hover {
  box-shadow: var(--shadow-lg);
}

.history-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.history-workout-name {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.history-date {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.history-summary {
  color: var(--text-secondary);
  font-size: 0.875rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.history-stat {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.history-stat-label {
  font-weight: 500;
  color: var(--text-primary);
}

.history-item-details {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.exercise-summary {
  margin-bottom: 0.75rem;
  padding: 0.75rem;
  background-color: rgba(79, 70, 229, 0.03);
  border-radius: 0.5rem;
  border-left: 3px solid var(--border-color);
}

.exercise-summary-name {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.exercise-summary-sets {
  font-size: 0.875rem;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.set-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.progression-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.progression-up {
  background-color: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

.progression-down {
  background-color: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.progression-same {
  background-color: rgba(107, 114, 128, 0.1);
  color: #6b7280;
}

.rpe-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.rpe-easy {
  background-color: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

.rpe-medium {
  background-color: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

.rpe-hard {
  background-color: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.rpe-advanced {
  background-color: rgba(79, 70, 229, 0.1);
  color: var(--primary-color);
}

.pr-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #78350f;
}

/* Messages */
#no-program-message,
#no-history-message {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
  font-size: 1.125rem;
}

/* Loading Overlay */
#loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: white;
  z-index: 1000;
}

#loading-overlay p {
  margin: 0;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

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

/* RPE Guide */
.btn-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-left: 0.5rem;
  padding: 0;
  border: 2px solid var(--primary-color);
  border-radius: 50%;
  background-color: transparent;
  color: var(--primary-color);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

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

.rpe-guide {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background-color: rgba(79, 70, 229, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  font-size: 0.875rem;
}

.rpe-guide-item {
  padding: 0.25rem 0;
  color: var(--text-secondary);
}

.rpe-guide-item strong {
  color: var(--primary-color);
  font-weight: 600;
}

/* Toast Notification */
.toast-notification {
  position: fixed;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--primary-color);
  color: white;
  padding: 1rem 2rem;
  border-radius: 0.5rem;
  box-shadow: var(--shadow-lg);
  max-width: 90%;
  text-align: center;
  z-index: 1002;
  transition: top 0.3s ease-in-out;
}

.toast-notification.show {
  top: 1rem;
}

.toast-notification p {
  margin: 0;
  font-weight: 500;
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1001;
}

.modal-content {
  background-color: var(--surface);
  padding: 2rem;
  border-radius: 0.75rem;
  box-shadow: var(--shadow-lg);
  max-width: 90%;
  width: 400px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-content h2 {
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

.menu-options {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.form-input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  font-size: 1rem;
  background-color: var(--background);
  color: var(--text-primary);
  transition: border-color 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.form-actions {
  display: flex;
  gap: 1rem;
  flex-direction: column;
}

.btn-outline {
  background-color: transparent;
  border: 2px solid var(--border-color);
  color: var(--text-primary);
}

.btn-outline:hover {
  background-color: rgba(0, 0, 0, 0.05);
  border-color: var(--text-secondary);
}

/* Responsive Design */
@media (max-width: 480px) {
  h1 {
    font-size: 1.75rem;
  }

  h2 {
    font-size: 1.25rem;
  }

  .rpe-buttons {
    flex-direction: column;
  }

  .btn-rpe {
    width: 100%;
  }

  .timer-display {
    font-size: 2.5rem;
  }
}

/* Onboarding Specific */
#onboarding-screen .container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 80vh;
}

.app-title {
  font-size: 3rem;
  text-align: center;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

/* Utility Classes */
.text-center {
  text-align: center;
}

.mt-1 {
  margin-top: 1rem;
}

.mb-1 {
  margin-bottom: 1rem;
}

.hidden {
  display: none !important;
}

/* Workout Preview Screen */
.exercise-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
}

.exercise-item {
  background-color: var(--surface);
  padding: 1.5rem;
  border-radius: 0.75rem;
  box-shadow: var(--shadow);
  transition: all 0.2s ease;
}

.exercise-item:hover {
  box-shadow: var(--shadow-lg);
}

.exercise-item.exercise-completed {
  opacity: 0.6;
  background-color: var(--surface);
}

.exercise-item.exercise-current {
  border: 2px solid var(--primary-color);
  background-color: rgba(79, 70, 229, 0.05);
}

.exercise-info {
  flex: 1;
}

.exercise-item-name {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.exercise-status {
  font-size: 1rem;
  color: var(--primary-color);
}

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

.logged-sets {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background-color: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
}

.logged-sets-header {
  font-size: 0.75rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}

.logged-set {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-top: 1px solid var(--border-color);
}

.logged-set:first-of-type {
  border-top: none;
}

.logged-set-data {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.9375rem;
  color: #6b7280;
}

.logged-set-item {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.logged-set-value {
  font-weight: 600;
  color: #374151;
  font-size: 1rem;
}

.logged-set-unit {
  font-size: 0.875rem;
  color: #9ca3af;
}

.logged-set-checkmark {
  font-size: 1rem;
  color: var(--success-color);
  margin-right: 6px;
}

.btn-edit-set {
  background: transparent;
  border: none;
  padding: 0.25rem;
  cursor: pointer;
  color: #9ca3af;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.25rem;
  transition: all 0.2s;
}

.btn-edit-set:hover {
  background-color: var(--surface);
  color: var(--text-primary);
}

.btn-edit-set:active {
  transform: scale(0.95);
}

.btn-edit-set svg {
  width: 14px;
  height: 14px;
}

.preview-actions {
  margin-top: 2rem;
}

/* View Exercises Button in Workout Screen */
#view-exercises-btn {
  margin-top: 1.5rem;
  background-color: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
}

#view-exercises-btn:hover {
  background-color: var(--surface);
  color: var(--text-primary);
  border-color: var(--primary-color);
}

#view-exercises-btn:active {
  transform: scale(0.98);
}

/* Exercise Progress Indicator */
.exercise-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin: 1rem 0 1.5rem;
  padding: 0.75rem;
  background-color: var(--surface);
  border-radius: 0.5rem;
}

.progress-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.progress-dots {
  display: flex;
  gap: 0.375rem;
  align-items: center;
}

.progress-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--border-color);
  transition: all 0.2s ease;
  position: relative;
}

.progress-dot.completed {
  background-color: var(--success-color);
  box-shadow: 0 0 4px rgba(34, 197, 94, 0.4);
}

.progress-dot.completed::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 8px;
  font-weight: bold;
  line-height: 1;
}

.progress-dot.current {
  background-color: var(--primary-color);
  animation: pulse 2s ease-in-out infinite;
  box-shadow: 0 0 8px rgba(79, 70, 229, 0.6);
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.2);
    opacity: 0.8;
  }
}

/* ============================================
   RTS Integration Styles
   ============================================ */

/* RTS Section on Home Screen */
.rts-section {
  margin-top: 3rem;
  padding: 2rem;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.05) 0%, rgba(79, 70, 229, 0.02) 100%);
  border-radius: 0.75rem;
  border: 2px solid rgba(79, 70, 229, 0.15);
}

.rts-section h2 {
  margin-bottom: 1.5rem;
  color: var(--primary-color);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.rts-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

/* RTS Config Screen */
.rts-config-section {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
}

.rts-config-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.rts-config-section h2 {
  font-size: 1.25rem;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.rts-config-section .help-text {
  margin-top: 0.75rem;
  margin-bottom: 0;
}

/* RTS Password Modal */
#rts-password-modal .modal-content {
  max-width: 450px;
}

#rts-password-modal h2 {
  color: var(--primary-color);
  margin-bottom: 0.5rem;
  font-size: 1.75rem;
}

#rts-password-modal p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

#rts-password-input {
  padding: 1rem 1.25rem;
  font-size: 1.05rem;
  border: 2px solid var(--border-color);
  border-radius: 0.625rem;
  background-color: var(--surface-color);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  letter-spacing: 0.05em;
}

#rts-password-input::placeholder {
  letter-spacing: normal;
  color: var(--text-tertiary);
  opacity: 0.6;
}

#rts-password-input:focus {
  border-color: var(--primary-color);
  background-color: var(--background);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

#rts-password-input:hover:not(:focus) {
  border-color: rgba(79, 70, 229, 0.3);
}

/* RTS Credentials Screen */
.screen-header {
  position: sticky;
  top: 0;
  background-color: var(--background);
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 1rem;
  z-index: 100;
}

.screen-header h1 {
  margin: 0;
  flex: 1;
}

.back-btn {
  background: none;
  border: none;
  color: var(--primary-color);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  transition: all 0.2s;
  min-height: 44px;
  min-width: 44px;
}

.back-btn:hover {
  color: var(--primary-dark);
  transform: translateX(-2px);
}

.back-btn:active {
  transform: translateX(-4px);
}

.screen-content {
  padding: 1rem;
  padding-top: 0;
}

/* Info Box */
.info-box {
  background-color: rgba(79, 70, 229, 0.05);
  border: 1px solid rgba(79, 70, 229, 0.2);
  border-radius: 0.5rem;
  padding: 1.5rem;
}

.info-box h3 {
  margin-bottom: 0.75rem;
  color: var(--primary-color);
  font-size: 1rem;
}

.info-box p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 0.5rem;
}

.info-box p:last-child {
  margin-bottom: 0;
}

/* Error and Success Messages */
.error-message,
.success-message {
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  margin-top: 1rem;
}

.error-message {
  background-color: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.success-message {
  background-color: rgba(34, 197, 94, 0.1);
  color: #16a34a;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

/* Inline Spinner (for button loading states) */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-left: 0.5rem;
}

/* Import Program Card */
.import-program-card {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.05) 0%, rgba(245, 158, 11, 0.02) 100%);
  border: 2px solid rgba(245, 158, 11, 0.2);
  border-radius: 0.75rem;
  padding: 2rem;
  text-align: center;
  margin-top: 2rem;
}

.import-program-card h3 {
  color: var(--warning-color);
  margin-bottom: 1rem;
}

.import-program-card p {
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Responsive RTS Buttons */
@media (min-width: 600px) {
  .rts-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
  }

  .rts-buttons button:first-child {
    grid-column: 1 / -1;
  }
}

/* ============================================ */
/* RTS Calendar Styles */
/* ============================================ */

/* Calendar Container */
.rts-calendar {
  background: var(--surface-color);
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Calendar Header */
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border-color);
}

.calendar-month {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

/* Calendar Weekdays */
.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.calendar-weekday {
  text-align: center;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 0.5rem;
}

/* Calendar Grid */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.5rem;
}

/* Calendar Day Cells */
.calendar-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  border-radius: 0.5rem;
  border: 2px solid transparent;
  background: rgba(0, 0, 0, 0.02);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.calendar-day.empty {
  background: transparent;
  cursor: default;
}

.calendar-day:not(.empty):hover {
  background: rgba(79, 70, 229, 0.05);
  border-color: rgba(79, 70, 229, 0.2);
  transform: translateY(-2px);
}

.calendar-day.today {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.1) 0%, rgba(79, 70, 229, 0.05) 100%);
  border-color: var(--primary-color);
}

.calendar-day.past {
  opacity: 0.5;
}

.calendar-day.has-workout {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.1) 0%, rgba(34, 197, 94, 0.05) 100%);
  border-color: rgba(34, 197, 94, 0.3);
  font-weight: 600;
}

.calendar-day.has-workout:hover {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.2) 0%, rgba(34, 197, 94, 0.1) 100%);
  border-color: rgba(34, 197, 94, 0.5);
}

.calendar-day.today.has-workout {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.2) 0%, rgba(34, 197, 94, 0.1) 100%);
  border: 2px solid var(--primary-color);
}

/* Day Number */
.day-number {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-primary);
}

/* Workout Indicator Dot */
.workout-indicator {
  font-size: 1.5rem;
  line-height: 0.5;
  color: #16a34a;
  margin-top: 0.25rem;
}

/* Calendar Footer */
.calendar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 2px solid var(--border-color);
  gap: 1rem;
  flex-wrap: wrap;
}

/* Calendar Legend */
.calendar-legend {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.legend-dot {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 2px solid transparent;
}

.legend-dot.has-workout {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.2) 0%, rgba(34, 197, 94, 0.1) 100%);
  border-color: rgba(34, 197, 94, 0.5);
}

.legend-dot.today {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.2) 0%, rgba(79, 70, 229, 0.1) 100%);
  border-color: var(--primary-color);
}

/* Calendar Loading State */
.calendar-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  gap: 1rem;
}

.calendar-loading .spinner {
  width: 48px;
  height: 48px;
  border-width: 4px;
  border-color: rgba(79, 70, 229, 0.2);
  border-top-color: var(--primary-color);
}

.calendar-loading p {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* Calendar Error State */
.calendar-error {
  text-align: center;
  padding: 3rem 2rem;
}

.calendar-error .error-message {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background-color: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 0.5rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  .rts-calendar {
    padding: 1rem;
  }

  .calendar-header {
    margin-bottom: 1rem;
  }

  .calendar-month {
    font-size: 1.25rem;
  }

  .calendar-weekday {
    font-size: 0.75rem;
    padding: 0.25rem;
  }

  .calendar-grid {
    gap: 0.25rem;
  }

  .calendar-day {
    padding: 0.25rem;
  }

  .day-number {
    font-size: 0.875rem;
  }

  .workout-indicator {
    font-size: 1.25rem;
  }

  .calendar-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .calendar-legend {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .calendar-weekday {
    font-size: 0.625rem;
  }

  .day-number {
    font-size: 0.75rem;
  }

  .legend-item {
    font-size: 0.75rem;
  }
}

/* ============================================
   Results Screen Styles
   ============================================ */

#results-screen {
  background: linear-gradient(180deg, var(--surface) 0%, var(--background) 100%);
  min-height: 100vh;
}

.results-header {
  text-align: center;
  padding: 2rem 0 1.5rem;
}

.results-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--success-color) 0%, #16a34a 100%);
  color: white;
  margin-bottom: 1.5rem;
  box-shadow: 0 8px 24px rgba(34, 197, 94, 0.3);
  animation: scaleIn 0.5s ease-out;
}

@keyframes scaleIn {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.results-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.results-subtitle {
  font-size: 1.125rem;
  color: var(--text-secondary);
  margin: 0;
}

.results-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin: 2rem 0;
}

.results-stat-card {
  background: var(--card-background);
  border-radius: 1rem;
  padding: 1.5rem 1rem;
  text-align: center;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: fadeInUp 0.5s ease-out backwards;
}

.results-stat-card:nth-child(1) { animation-delay: 0.1s; }
.results-stat-card:nth-child(2) { animation-delay: 0.2s; }
.results-stat-card:nth-child(3) { animation-delay: 0.3s; }
.results-stat-card:nth-child(4) { animation-delay: 0.4s; }

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

.results-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.results-stat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border-color);
  color: var(--primary-color);
  margin-bottom: 0.75rem;
}

.results-stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
  line-height: 1.2;
}

.results-stat-label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

.results-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 2rem;
  animation: fadeInUp 0.5s ease-out 0.5s backwards;
}

.results-actions .btn {
  border-radius: 0.75rem;
}

/* Responsive adjustments for results screen */
@media (min-width: 480px) {
  .results-stats {
    gap: 1.25rem;
  }

  .results-stat-card {
    padding: 1.75rem 1.25rem;
  }

  .results-stat-value {
    font-size: 2rem;
  }
}

@media (max-width: 360px) {
  .results-stat-card {
    padding: 1rem 0.75rem;
  }

  .results-stat-value {
    font-size: 1.5rem;
  }

  .results-stat-icon {
    width: 40px;
    height: 40px;
  }

  .results-stat-icon svg {
    width: 20px;
    height: 20px;
  }
}
