/* =====================================================
   Programme Sport — Thème sombre, sobre, mobile-first
   ===================================================== */

:root {
  --bg: #0e0e0e;
  --bg-elev: #161616;
  --bg-elev-2: #1d1d1d;
  --border: #2a2a2a;
  --text: #e5e5e5;
  --muted: #8a8a8a;
  --accent: #4ade80;
  --accent-soft: rgba(74, 222, 128, 0.12);
  --step: #fbbf24;
  --goal: #fb923c;
  --danger: #f87171;
  --velo: #60a5fa;
  --marche: #a78bfa;
  --mix: #f472b6;
  --repos: #6b7280;
  --serif: Georgia, 'Times New Roman', serif;
  --mono: 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.01em; }

/* ----- Hero ----- */
.hero {
  text-align: center;
  padding: 2rem 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.hero h1 {
  margin: 0 0 0.5rem;
  font-size: 1.8rem;
}
.hero .accent { color: var(--accent); }
.hero .sub {
  margin: 0.4rem 0;
  color: var(--muted);
  font-size: 0.92rem;
}
.hero .sub strong { color: var(--text); }
.hero .sub .step { color: var(--step); }
.hero .sub .goal { color: var(--goal); }
.hero .reminder {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.hero .reminder strong { color: var(--accent); }

/* ----- Stats ----- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  padding: 1rem;
  max-width: 800px;
  margin: 0 auto;
}
.stat {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem 0.4rem;
  text-align: center;
}
.stat-label {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.3rem;
}
.stat-value {
  font-family: var(--mono);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
}
.stat-total {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 400;
}

/* ----- Progress global ----- */
.progress-wrap {
  max-width: 800px;
  margin: 0 auto 1rem;
  padding: 0 1rem;
}
.progress-bar {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  height: 10px;
  border-radius: 6px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #22c55e);
  width: 0%;
  transition: width 0.4s ease;
}

/* ----- Main ----- */
main {
  max-width: 800px;
  margin: 0 auto;
  padding: 1rem;
}
.block {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1rem;
}
.block h2 {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}
.block h2 .muted { color: var(--muted); font-size: 0.85rem; font-family: var(--mono); font-weight: 400; }
.muted { color: var(--muted); }
.warn {
  background: rgba(251, 191, 36, 0.08);
  border-left: 3px solid var(--step);
  padding: 0.5rem 0.75rem;
  margin: 0 0 1rem;
  font-size: 0.85rem;
  color: #fde68a;
  border-radius: 4px;
}

/* ----- Phases & semaines ----- */
.phase { margin-bottom: 1rem; }
.phase-title {
  font-family: var(--serif);
  font-size: 1rem;
  color: var(--accent);
  margin: 0.5rem 0;
  padding: 0.4rem 0.6rem;
  background: var(--accent-soft);
  border-radius: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.phase-title .count {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
}
.week {
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 0.5rem;
  overflow: hidden;
}
.week-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.8rem;
  background: var(--bg-elev-2);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.week-header:hover { background: #232323; }
.week-header strong { font-family: var(--serif); }
.week-header .week-meta {
  font-size: 0.78rem;
  color: var(--muted);
  font-family: var(--mono);
}
.week-header .chevron {
  display: inline-block;
  transition: transform 0.2s;
  margin-right: 0.4rem;
  color: var(--muted);
}
.week.open .week-header .chevron { transform: rotate(90deg); }
.week-body { display: none; padding: 0.3rem 0; }
.week.open .week-body { display: block; }

.day {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.8rem;
  border-top: 1px solid var(--border);
}
.day:first-child { border-top: none; }
.day input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  min-width: 22px;
  border: 2px solid var(--border);
  border-radius: 5px;
  background: var(--bg);
  cursor: pointer;
  position: relative;
  transition: all 0.15s;
}
.day input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.day input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #0e0e0e;
  font-weight: bold;
  font-size: 14px;
}
.day-name {
  width: 36px;
  font-weight: 600;
  color: var(--muted);
  font-size: 0.85rem;
}
.day-desc {
  flex: 1;
  font-size: 0.85rem;
}
.day.checked .day-desc { color: var(--muted); text-decoration: line-through; }
.badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-velo { background: rgba(96, 165, 250, 0.15); color: var(--velo); }
.badge-marche { background: rgba(167, 139, 250, 0.15); color: var(--marche); }
.badge-mix { background: rgba(244, 114, 182, 0.15); color: var(--mix); }
.badge-repos { background: rgba(107, 114, 128, 0.18); color: var(--repos); }

/* ----- Abdos ----- */
.abdos-week {
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 0.5rem;
  padding: 0.5rem 0.7rem;
}
.abdos-week-title {
  font-family: var(--serif);
  font-size: 0.92rem;
  color: var(--accent);
  margin-bottom: 0.3rem;
}
.abdos-day {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0;
  border-top: 1px solid var(--border);
}
.abdos-day:first-of-type { border-top: none; }
.abdos-day input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  min-width: 22px;
  border: 2px solid var(--border);
  border-radius: 5px;
  background: var(--bg);
  cursor: pointer;
  position: relative;
}
.abdos-day input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.abdos-day input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  color: #0e0e0e;
  font-weight: bold;
  font-size: 14px;
}
.abdos-day .label { flex: 1; font-size: 0.85rem; }
.abdos-day.checked .label { color: var(--muted); text-decoration: line-through; }
.btn-detail {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-detail:hover { border-color: var(--accent); background: var(--accent-soft); }

/* ----- Poids ----- */
.weights-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}
.weight-cell {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem;
  text-align: center;
}
.weight-cell label {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.weight-cell input {
  width: 100%;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.95rem;
  text-align: center;
  padding: 0.35rem;
  -moz-appearance: textfield;
}
.weight-cell input::-webkit-outer-spin-button,
.weight-cell input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.weight-cell input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg);
}
.weight-cell.saved input { border-color: var(--accent); }

.weights-summary {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-around;
  padding: 0.75rem;
  background: var(--bg);
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 0.85rem;
}
.weights-summary > div { text-align: center; }
.weights-summary .label {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.2rem;
}
.weights-summary .value { font-weight: 700; font-size: 1.05rem; }
.delta-down { color: var(--accent); }
.delta-up   { color: var(--danger); }
.delta-zero { color: var(--muted); }

/* ----- Chart ----- */
.chart-wrap {
  position: relative;
  height: 300px;
  background: var(--bg);
  border-radius: 6px;
  padding: 0.5rem;
}

/* ----- Reset ----- */
.danger-zone { text-align: center; }
.btn-danger {
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-danger:hover { background: var(--danger); color: #0e0e0e; }

/* ----- Modal ----- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.18s ease;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  position: relative;
  animation: slideUp 0.22s ease;
}
.modal-content {
  overflow-y: auto;
  max-height: 90vh;
  padding: 1.5rem 1.25rem;
}
.modal-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.8rem;
  cursor: pointer;
  line-height: 1;
  z-index: 2;
  width: 36px;
  height: 36px;
  border-radius: 6px;
}
.modal-close:hover { background: var(--bg-elev-2); color: var(--text); }
.modal h2 { margin-top: 0; color: var(--accent); }
.modal h3 {
  margin: 1.2rem 0 0.4rem;
  color: var(--accent);
  font-size: 1rem;
}
.modal p { font-size: 0.88rem; line-height: 1.6; }
.modal strong { color: var(--text); }

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

/* ----- Footer ----- */
footer {
  text-align: center;
  padding: 1.5rem 1rem 2rem;
  color: var(--muted);
}

/* ----- Mobile ----- */
@media (max-width: 480px) {
  .hero h1 { font-size: 1.5rem; }
  .hero .sub { font-size: 0.8rem; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat-value { font-size: 1.1rem; }
  .weights-grid { grid-template-columns: repeat(2, 1fr); }
  .day { padding: 0.5rem 0.6rem; gap: 0.5rem; }
  .day-name { width: 32px; font-size: 0.78rem; }
  .day-desc { font-size: 0.78rem; }
  .badge { font-size: 0.6rem; }
  .block { padding: 0.75rem; }
  .modal-content { padding: 1.25rem 1rem; }
  .chart-wrap { height: 260px; }
}

@media (max-width: 360px) {
  .day-desc { font-size: 0.74rem; }
}
