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

.app.loading {
  justify-content: center;
  align-items: center;
  gap: 1rem;
}

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

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

/* Header */
.header {
  background: var(--bg-secondary);
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

.week-selector {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.week-selector button {
  background: var(--bg-card);
  color: var(--text-primary);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font-size: 1.1rem;
  transition: all 0.2s;
}

.week-selector button:hover:not(:disabled) {
  background: var(--accent);
}

.week-selector button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.week-selector span {
  font-weight: 600;
  min-width: 80px;
  text-align: center;
}

/* Main */
.main {
  flex: 1;
  padding: 1rem;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

/* Program Info */
.program-info {
  margin-bottom: 1.5rem;
}

.program-info h2 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--accent);
}

.program-info p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Days List */
.days-list h3 {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.day-card {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
}

.day-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
}

.day-card:active {
  transform: scale(0.98);
}

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

.day-number {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.day-name {
  font-size: 1.1rem;
  font-weight: 600;
}

.day-exercises {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.exercise-tag {
  background: var(--bg-secondary);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.exercise-tag.more {
  background: var(--accent);
  color: white;
}

.day-action {
  text-align: right;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.9rem;
}

/* Workout View */
.workout-header {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

.back-btn {
  background: none;
  color: var(--accent);
  font-size: 0.9rem;
  padding: 0.25rem 0;
}

.header-title h1 {
  font-size: 1.25rem;
}

.header-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Exercise Card */
.exercise-card {
  background: var(--bg-card);
  border-radius: 12px;
  margin-bottom: 0.75rem;
  overflow: hidden;
  border: 1px solid transparent;
  transition: all 0.2s;
}

.exercise-card.expanded {
  border-color: var(--accent);
}

.exercise-header {
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.exercise-info h3 {
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.muscle-group {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.exercise-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
}

.sets-info {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.progress-badge {
  background: var(--bg-secondary);
  padding: 0.2rem 0.5rem;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 600;
}

.progress-badge.complete {
  background: var(--success);
  color: var(--bg-primary);
}

/* Exercise Body */
.exercise-body {
  padding: 0 1rem 1rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.progression-hint {
  background: rgba(233, 69, 96, 0.1);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 0.75rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.progression-hint strong {
  color: var(--accent);
}

/* Sets List */
.sets-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.set-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-secondary);
  border-radius: 8px;
  transition: all 0.2s;
}

.set-row.completed {
  background: rgba(78, 204, 163, 0.15);
  border: 1px solid var(--success);
}

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

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

.weight-input,
.reps-input {
  width: 70px;
  padding: 0.6rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 1rem;
  text-align: center;
}

.weight-input:focus,
.reps-input:focus {
  border-color: var(--accent);
}

.input-separator {
  color: var(--text-secondary);
}

.complete-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 1.25rem;
  transition: all 0.2s;
}

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

.complete-btn.done {
  background: var(--success);
  color: var(--bg-primary);
}

/* Mobile optimizations */
@media (max-width: 480px) {
  .header {
    padding: 0.75rem 1rem;
  }
  
  .header h1 {
    font-size: 1.25rem;
  }
  
  .main {
    padding: 0.75rem;
  }
  
  .weight-input,
  .reps-input {
    width: 60px;
    padding: 0.5rem;
  }
}

/* Safe area for notched phones */
@supports (padding: env(safe-area-inset-bottom)) {
  .main {
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
  }
}
