:root {
  --bg: #f5f5f5;
  --surface: #ffffff;
  --text: #1a1a1a;
  --text-muted: #666;
  --accent: #2563eb;
  --accent-light: #dbeafe;
  --success: #16a34a;
  --success-light: #dcfce7;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --border: #e5e7eb;
  --radius: 10px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.container { max-width: 900px; margin: 0 auto; padding: 0 20px; }

/* Navigation */
nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

nav .container {
  display: flex;
  align-items: center;
  gap: 24px;
}

nav .logo {
  font-weight: 700;
  font-size: 18px;
  color: var(--accent);
  text-decoration: none;
}

nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.15s;
}

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

/* Header */
.page-header {
  padding: 32px 0 16px;
}

.page-header h1 {
  font-size: 28px;
  font-weight: 700;
}

.page-header .subtitle {
  color: var(--text-muted);
  font-size: 15px;
  margin-top: 4px;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-phase { background: var(--accent-light); color: var(--accent); }
.badge-rest { background: var(--success-light); color: var(--success); }
.badge-recovery { background: var(--warning-light); color: var(--warning); }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.card h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-muted);
}

/* Treadmill segments */
.segments { width: 100%; border-collapse: collapse; }

.segments th {
  text-align: left;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 6px 12px;
  border-bottom: 2px solid var(--border);
}

.segments td {
  padding: 8px 12px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

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

.segments .seg-type { font-weight: 500; }
.segments .seg-jog { color: var(--accent); font-weight: 600; }
.segments .seg-run, .segments .seg-sprint { color: #dc2626; font-weight: 600; }

/* Exercise list */
.exercise-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.exercise-item:last-child { border-bottom: none; }

.exercise-img {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  border-radius: 8px;
  background: var(--accent-light);
  padding: 4px;
  object-fit: contain;
}

.exercise-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.exercise-info { flex: 1; }

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

.exercise-meta {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 2px;
}

.exercise-cues {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 6px;
  padding-left: 16px;
}

.exercise-cues li { margin-bottom: 2px; }

/* Video recommendations */
.video-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.video-item:last-child { border-bottom: none; }

.video-item a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.video-item a:hover { text-decoration: underline; }

.video-meta {
  color: var(--text-muted);
  font-size: 13px;
}

.video-fallback {
  background: var(--accent-light);
  padding: 16px;
  border-radius: 8px;
  text-align: center;
}

.video-fallback a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

/* Week grid */
.week-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

.day-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.day-card.today { border-color: var(--accent); border-width: 2px; }
.day-card.rest { opacity: 0.6; }

.day-card h3 {
  font-size: 14px;
  text-transform: capitalize;
  margin-bottom: 8px;
}

.day-card .day-type {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.day-card .day-treadmill,
.day-card .day-strength {
  font-size: 13px;
  margin-bottom: 4px;
}

.day-card .day-treadmill strong,
.day-card .day-strength strong {
  color: var(--accent);
}

/* Full plan view */
.phase-section { margin-bottom: 32px; }

.phase-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  cursor: pointer;
}

.phase-header h2 { margin-bottom: 0; }

.weeks-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.week-link {
  display: block;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  font-weight: 500;
  transition: border-color 0.15s;
}

.week-link:hover { border-color: var(--accent); }
.week-link.current { border-color: var(--accent); background: var(--accent-light); }

/* Exercise library */
.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.filter-bar input, .filter-bar select {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: var(--surface);
}

.filter-bar input { flex: 1; min-width: 200px; }

/* Video filter form */
.filter-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 24px;
}

.filter-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 10px;
}

.filter-row:last-child { margin-bottom: 0; }

.filter-form input, .filter-form select {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  background: white;
}

.filter-search { flex: 1; min-width: 200px; }

.filter-sort-group {
  display: flex;
  gap: 0;
  align-items: center;
}

.filter-sort-group select {
  border-radius: 8px 0 0 8px;
  border-right: none;
}

.filter-dir-btn {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 0 8px 8px 0;
  background: white;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1;
}

.filter-dir-btn:hover { background: var(--bg); color: var(--text); }

.filter-range {
  display: flex;
  gap: 4px;
  align-items: center;
  font-size: 13px;
}

.filter-range label {
  font-weight: 600;
  font-size: 12px;
  color: var(--text-muted);
  margin-right: 2px;
  white-space: nowrap;
}

.filter-range input {
  width: 70px;
  min-width: 70px;
  text-align: center;
  flex: 0 0 auto;
}

.filter-range span { color: var(--text-muted); }

.filter-unit {
  font-size: 11px;
  color: var(--text-muted);
  min-width: 28px;
}

.filter-advanced {
  margin-bottom: 10px;
}

.filter-advanced summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
  user-select: none;
}

.filter-advanced summary:hover { text-decoration: underline; }

.filter-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

/* Video stats row */
.video-stats {
  display: flex;
  gap: 12px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.video-stat {
  font-size: 12px;
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
}

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

.exercise-card-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 12px;
}

.exercise-img-large {
  width: 100px;
  height: 100px;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--accent-light);
  padding: 6px;
  object-fit: contain;
}

.exercise-card h3 { font-size: 16px; margin-bottom: 8px; }

.muscle-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.muscle-tag {
  padding: 2px 8px;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

/* Setup form */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}

.btn {
  display: inline-block;
  padding: 10px 24px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s;
}

.btn:hover { opacity: 0.9; }

/* Week nav */
.week-nav {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.week-nav a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

/* Responsive */
@media (max-width: 600px) {
  .week-grid { grid-template-columns: 1fr; }
  .page-header h1 { font-size: 22px; }
  nav .container { gap: 16px; flex-wrap: wrap; }
  .exercise-img { width: 48px; height: 48px; }
  .exercise-img-large { width: 72px; height: 72px; }
}

/* Kinomap video */
.kinomap-card h2 { color: var(--accent); }

.kinomap-featured {
  background: var(--accent-light);
  border-radius: 8px;
  padding: 16px;
}

.kinomap-title {
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 6px;
}

.kinomap-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 13px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.kinomap-actions {
  display: flex;
  gap: 10px;
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.btn-outline:hover { background: var(--accent-light); }

.badge-diff-easy { background: var(--success-light); color: var(--success); }
.badge-diff-medium { background: var(--accent-light); color: var(--accent); }
.badge-diff-hard { background: var(--warning-light); color: var(--warning); }
.badge-diff-expert { background: #fce7f3; color: #be185d; }

.kinomap-next { margin-top: 10px; }

.kinomap-part-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
  margin-bottom: 4px;
}

.kinomap-inline {
  margin-top: 4px;
  font-size: 12px;
}

.kinomap-inline a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.kinomap-inline a:hover { text-decoration: underline; }

.kinomap-inline-meta {
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

/* Alternates */
.kinomap-alternates {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.kinomap-alternates h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.kinomap-alt-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.kinomap-alt-item:last-child { border-bottom: none; }

.kinomap-alt-info { flex: 1; }

.kinomap-alt-info a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
}

.kinomap-alt-info a:hover { text-decoration: underline; }

.kinomap-alt-meta {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Video catalog */
.video-catalog-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.video-catalog-item:last-child { border-bottom: none; }

.video-catalog-main { flex: 1; }

.video-catalog-title {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
}

.video-catalog-title:hover { text-decoration: underline; }

.video-assignments {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-muted);
}

.video-catalog-actions {
  flex-shrink: 0;
}

/* Rest day */
.rest-message {
  text-align: center;
  padding: 48px 0;
  color: var(--text-muted);
}

.rest-message h2 {
  font-size: 24px;
  margin-bottom: 8px;
  justify-content: center;
}

/* Video action buttons */
.btn-success {
  background: var(--success);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 14px;
  transition: opacity 0.15s;
}

.btn-success:hover { opacity: 0.85; }

.btn-dismiss {
  background: #fee2e2;
  color: #dc2626;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  padding: 8px 12px;
  transition: opacity 0.15s;
}

.btn-dismiss:hover { background: #fecaca; }

/* Small icon buttons for alternates */
.btn-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s;
  flex-shrink: 0;
}

.btn-icon:hover { opacity: 0.75; }

.btn-icon-success {
  background: var(--success-light);
  color: var(--success);
}

.btn-icon-danger {
  background: #fee2e2;
  color: #dc2626;
}

/* Completed video state */
.kinomap-completed {
  border-left: 4px solid var(--success);
  opacity: 0.7;
}

.badge-completed {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: var(--success-light);
  color: var(--success);
}

/* Day completion - dashboard */
.btn-complete-day {
  display: block;
  width: 100%;
  padding: 14px;
  background: var(--success);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 16px;
  transition: opacity 0.15s;
}

.btn-complete-day:hover { opacity: 0.9; }

.btn-complete-day-sm {
  display: inline-block;
  width: auto;
  padding: 6px 14px;
  font-size: 13px;
  margin-bottom: 0;
}

.day-complete-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--success-light);
  border: 1px solid var(--success);
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.day-complete-bar-sm {
  display: inline-flex;
  padding: 6px 14px;
  margin-bottom: 0;
  gap: 12px;
}

.day-complete-label {
  font-weight: 600;
  color: var(--success);
  font-size: 15px;
}

.day-complete-bar-sm .day-complete-label {
  font-size: 13px;
}

.day-complete-undo {
  background: none;
  border: 1px solid var(--success);
  color: var(--success);
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 500;
}

.day-complete-undo:hover { background: white; }

.btn-undo-sm {
  background: none;
  border: 1px solid var(--text-muted);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 11px;
  cursor: pointer;
  font-weight: 500;
}
.btn-undo-sm:hover { background: var(--bg); color: var(--text); border-color: var(--text); }

/* Day card completion - week grid */
.day-card.done {
  border-left: 4px solid var(--success);
}

.badge-done {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  background: var(--success);
  color: white;
  vertical-align: middle;
  margin-left: 4px;
}

/* Card header row for detail sections */
.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.card-header-row h2 {
  margin-bottom: 0;
}

.card-done {
  border-left: 4px solid var(--success);
  background: var(--success-light);
}

/* Full plan progress */
.progress-bar-container {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  margin-top: 12px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--success);
  border-radius: 4px;
  transition: width 0.3s ease;
  min-width: 0;
}

.week-link.week-done {
  border-color: var(--success);
  background: var(--success-light);
}

.week-progress {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.week-link.week-done .week-progress {
  color: var(--success);
  font-weight: 600;
}
