/* File: public/css/app.css — v1.0 — 2026-04-30
   Thème: noir punchy minimaliste, accents rouge/orange "feu" */

/* ---------- RESET ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  touch-action: manipulation;
}
button { font: inherit; cursor: pointer; }
img, svg { display: block; max-width: 100%; }

/* ---------- DESIGN TOKENS ---------- */
:root {
  /* Couleurs */
  --bg: #0a0a0a;
  --bg-elevated: #141414;
  --bg-card: #1a1a1a;
  --bg-input: #0f0f0f;
  --border: #262626;
  --border-strong: #404040;
  --text: #fafafa;
  --text-muted: #a3a3a3;
  --text-dim: #6b6b6b;

  /* Accent (punch) */
  --accent: #ff3b1f;        /* rouge feu */
  --accent-hover: #e62e16;
  --accent-soft: rgba(255, 59, 31, 0.12);
  --accent-2: #ffa00a;      /* orange */
  --success: #22c55e;
  --warning: #facc15;
  --danger: #ef4444;

  /* Typo */
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 2rem;
  --fs-3xl: 2.75rem;

  /* Spacing */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.25rem;
  --sp-6: 1.5rem;
  --sp-8: 2rem;

  /* Layout */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.4);

  /* Safe areas (notch iPhone) */
  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
  --safe-left: env(safe-area-inset-left);
  --safe-right: env(safe-area-inset-right);

  --nav-height: 68px;
  --header-height: 56px;
}

/* ---------- LOADER ---------- */
.app-loading {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  z-index: 9999;
}
.loader { text-align: center; }
.loader-pulse {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--accent);
  margin: 0 auto var(--sp-4);
  animation: pulse 1.2s ease-in-out infinite;
}
.loader-text { color: var(--text-muted); font-size: var(--fs-sm); }
@keyframes pulse {
  0%, 100% { transform: scale(0.8); opacity: 0.6; }
  50% { transform: scale(1); opacity: 1; }
}

/* ---------- APP LAYOUT ---------- */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

.app-header {
  height: var(--header-height);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-header-row {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-4);
  max-width: 720px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-weight: 800;
  letter-spacing: -0.02em;
}
.brand-icon {
  font-size: 1.25rem;
  filter: drop-shadow(0 0 8px var(--accent-soft));
}
.brand-name {
  font-size: var(--fs-base);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sync-indicator {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-xs);
  color: var(--text-muted);
  padding: var(--sp-1) var(--sp-3);
  background: var(--bg-elevated);
  border-radius: 100px;
  border: 1px solid var(--border);
}
.sync-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
}
.sync-dot--pending { background: var(--warning); animation: pulse-dot 1s ease-in-out infinite; }
.sync-dot--error { background: var(--danger); }
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.app-main {
  flex: 1;
  padding: var(--sp-4);
  padding-bottom: calc(var(--nav-height) + var(--sp-4));
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}

.app-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 50;
}

/* ---------- TYPOGRAPHY ---------- */
h1, h2, h3 {
  margin: 0 0 var(--sp-3);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
p { margin: 0 0 var(--sp-3); line-height: 1.55; }
.muted { color: var(--text-muted); }
.dim { color: var(--text-dim); }

.placeholder-screen {
  padding: var(--sp-8) var(--sp-4);
  text-align: center;
}
.placeholder-screen h1 {
  font-size: var(--fs-3xl);
  margin-bottom: var(--sp-3);
}

/* ---------- CARDS ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-5);
  margin-bottom: var(--sp-4);
}

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  border: 0;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: var(--fs-base);
  text-decoration: none;
  transition: transform 0.1s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 4px 16px rgba(255, 59, 31, 0.25);
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border-strong);
}
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-block { width: 100%; }
.btn-lg {
  padding: var(--sp-4) var(--sp-6);
  font-size: var(--fs-lg);
  border-radius: var(--radius-lg);
}

/* ---------- OFFLINE PAGE ---------- */
.offline-page {
  background: var(--bg);
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
}
.offline-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-8);
  max-width: 400px;
  text-align: center;
}
.offline-icon {
  font-size: 3rem;
  margin-bottom: var(--sp-4);
  filter: grayscale(0.3);
}

/* ---------- UTILS ---------- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.text-center { text-align: center; }
.mt-4 { margin-top: var(--sp-4); }
.mb-4 { margin-bottom: var(--sp-4); }

[hidden] { display: none !important; }


/* ---------- NAV BOTTOM ---------- */
.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: var(--sp-2) 0;
  background: transparent;
  border: 0;
  color: var(--text-dim);
  font-size: var(--fs-xs);
  font-weight: 600;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s ease;
  position: relative;
}
.nav-btn:active { transform: scale(0.95); }

.nav-btn--active {
  color: var(--accent);
}
.nav-btn--active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 25%;
  right: 25%;
  height: 2px;
  background: var(--accent);
  border-radius: 0 0 2px 2px;
}

.nav-icon {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.nav-label {
  font-size: 10px;
  letter-spacing: 0.02em;
}

/* ---------- PAGE ---------- */
.page {
  padding-bottom: var(--sp-4);
}
.page > h1 {
  margin-bottom: var(--sp-5);
}

/* ---------- PAGE HEADER ---------- */
.page-header {
  margin-bottom: var(--sp-5);
}
.page-header > p {
  margin-bottom: var(--sp-1);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: var(--fs-xs);
  font-weight: 700;
}
.page-header > h1 {
  font-size: var(--fs-3xl);
  margin: 0;
}

/* ---------- HERO CARD ---------- */
.card--hero {
  background: linear-gradient(135deg, #1a1a1a 0%, #251010 100%);
  border: 1px solid var(--border-strong);
  position: relative;
  overflow: hidden;
}
.card--hero::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 160px;
  height: 160px;
  background: radial-gradient(circle, var(--accent-soft) 0%, transparent 70%);
  pointer-events: none;
}

/* ---------- BADGES ---------- */
.badge {
  display: inline-block;
  padding: 2px var(--sp-2);
  border-radius: 4px;
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--bg-elevated);
  color: var(--text-muted);
}
.badge--phase {
  background: var(--accent-soft);
  color: var(--accent);
}
.badge--mobility { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
.badge--strength { background: rgba(255, 59, 31, 0.15); color: var(--accent); }
.badge--skill { background: rgba(255, 160, 10, 0.15); color: var(--accent-2); }
.badge--default { background: var(--bg-elevated); color: var(--text-muted); }

.session-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-2);
  flex-wrap: wrap;
}

/* ---------- SECTION HEADER ---------- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: var(--sp-6) 0 var(--sp-3);
}
.section-header > h2 { margin: 0; }

/* ---------- EXERCISE CARDS ---------- */
.exercise-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.exercise-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 0;
}

.exercise-card__illustration {
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--border);
}
.exercise-card__illustration svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.exercise-card__placeholder {
  font-size: 2.5rem;
  opacity: 0.5;
}

.exercise-card__body {
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.exercise-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-2);
}
.exercise-card__header h3 {
  margin: 0;
  font-size: var(--fs-base);
  flex: 1;
}
.exercise-card__desc {
  font-size: var(--fs-sm);
  margin: 0;
  line-height: 1.4;
}
.exercise-card__target {
  font-size: var(--fs-sm);
  color: var(--accent);
  font-weight: 700;
  margin: 0;
}

.btn-sm {
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--fs-sm);
  align-self: flex-start;
}

/* ---------- STATS GRID ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-4);
}
.stat-card__label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  margin-bottom: var(--sp-2);
}
.stat-card__value {
  display: flex;
  align-items: baseline;
  gap: 2px;
}
.stat-card__number {
  font-size: var(--fs-2xl);
  font-weight: 800;
  letter-spacing: -0.03em;
}
.stat-card__unit {
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.stat-card__hint {
  font-size: var(--fs-xs);
  margin-top: 2px;
}

/* ---------- CHART PLACEHOLDER ---------- */
.chart-placeholder {
  height: 180px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: var(--sp-3);
}

/* ---------- YOUTUBE MODAL ---------- */
.yt-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  backdrop-filter: blur(4px);
}
.yt-modal__inner {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 800px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.yt-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
}
.yt-modal__title {
  font-weight: 700;
  font-size: var(--fs-base);
}
.yt-modal__close {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  font-size: 1.4rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.yt-modal__close:hover {
  background: var(--bg-elevated);
  color: var(--text);
}
.yt-modal__video {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  background: #000;
}
.yt-modal__video iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}