/* ============================================
   Components
   ============================================ */

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  box-shadow: var(--shadow-card);
}

.card-glow {
  background: linear-gradient(135deg, var(--bg-card) 0%, rgba(229, 9, 20, 0.04) 100%);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-xl);
  padding: var(--space-lg);
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}
.card-glow::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -30%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none;
  opacity: 0.4;
}

.card-title {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
}

/* Buttons */
.btn-primary {
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  min-height: 48px;
}
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled {
  background: var(--text-muted);
  cursor: not-allowed;
}

.btn-secondary {
  width: 100%;
  padding: 12px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  min-height: 44px;
}
.btn-secondary:active { background: var(--bg-card-hover); }
.btn-secondary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-danger {
  padding: 12px 20px;
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  min-height: 44px;
}

.btn-icon-sm {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px 8px;
  min-width: 32px;
  min-height: 32px;
}
.btn-icon-sm:hover { color: var(--danger); }

/* Progress Bars */
.progress-bar-container {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  overflow: hidden;
  margin-top: var(--space-sm);
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #ff4757);
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.mini-bar-container {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  overflow: hidden;
  margin-top: var(--space-sm);
}

.mini-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Tags */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 500;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  margin: 2px;
}
.tag-chest { background: rgba(229, 9, 20, 0.15); color: #ff6b7a; }
.tag-back { background: rgba(52, 152, 219, 0.15); color: #5dade2; }
.tag-legs { background: rgba(46, 204, 113, 0.15); color: #58d68d; }
.tag-shoulders { background: rgba(241, 196, 15, 0.15); color: #f4d03f; }
.tag-arms { background: rgba(155, 89, 182, 0.15); color: #bb8fce; }
.tag-cardio { background: rgba(230, 126, 34, 0.15); color: #eb984e; }

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--bg-secondary);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: var(--space-lg);
  padding-bottom: calc(var(--space-lg) + var(--safe-bottom));
}

.modal-content h3 {
  margin-bottom: var(--space-lg);
}

.modal-actions {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}
.modal-actions .btn-secondary,
.modal-actions .btn-danger {
  flex: 1;
}

/* Toggle */
.toggle-label {
  display: flex !important;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}
.toggle-label input { display: none; }
.toggle-slider {
  width: 44px;
  height: 24px;
  background: var(--text-muted);
  border-radius: 12px;
  position: relative;
  transition: background 0.2s;
}
.toggle-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}
.toggle-label input:checked + .toggle-slider {
  background: var(--accent);
}
.toggle-label input:checked + .toggle-slider::after {
  transform: translateX(20px);
}

/* Toast */
.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 20px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  box-shadow: var(--shadow-elevated);
  z-index: var(--z-toast);
  animation: toastIn 0.3s ease;
}

/* Section header */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}
.section-header h2 {
  font-size: 1rem;
}

/* Workout list item */
.workout-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: var(--space-sm);
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.workout-item:active { background: var(--bg-card-hover); }

.workout-item-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.workout-date {
  font-size: 0.9rem;
  font-weight: 600;
}

.workout-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.workout-sets-count {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.workout-item-right {
  color: var(--text-tertiary);
  font-size: 1.2rem;
}

/* Exercise items */
.exercise-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: var(--space-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.exercise-item-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.exercise-item-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.exercise-item-meta {
  display: flex;
  gap: var(--space-sm);
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.exercise-item-right {
  display: flex;
  gap: var(--space-sm);
}

.exercise-inactive { opacity: 0.45; }

/* Filter bar */
.filter-bar {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.filter-btn {
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 36px;
}
.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* RPE badge */
.rpe-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}
.rpe-low { background: rgba(46, 204, 113, 0.15); color: #58d68d; }
.rpe-mid { background: rgba(241, 196, 15, 0.15); color: #f4d03f; }
.rpe-high { background: rgba(229, 9, 20, 0.15); color: #ff6b7a; }

/* PR Overlay */
.pr-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
}

.pr-content {
  text-align: center;
  padding: var(--space-2xl);
}

.pr-icon {
  font-size: 4rem;
  margin-bottom: var(--space-md);
}

.pr-title {
  font-family: var(--font-display);
  font-size: 3rem;
  letter-spacing: 4px;
  color: var(--accent);
  margin-bottom: var(--space-sm);
  text-shadow: 0 0 40px var(--accent-glow);
}

.pr-message {
  font-size: 1.1rem;
  color: var(--text-primary);
  margin-bottom: var(--space-lg);
}

.pr-content .btn-primary {
  width: auto;
  padding: 12px 40px;
}
