/* ── Design tokens ───────────────────────────────────────────────── */
:root {
  --primary:      #4f46e5;
  --primary-dark: #4338ca;
  --primary-soft: rgba(79, 70, 229, .10);
  --accent:       #f97316;
  --bg:           #f5f6f9;
  --surface:      #ffffff;
  --surface-2:    #eef0f5;
  --border:       #e4e7ee;
  --text:         #11131c;
  --text-muted:   #677084;
  --ok:           #16a34a;
  --warn:         #f59e0b;
  --danger:       #e11d48;
  --shadow-sm:    0 1px 2px rgba(17, 19, 28, .04), 0 1px 3px rgba(17, 19, 28, .06);
  --shadow-md:    0 10px 25px -8px rgba(17, 19, 28, .12), 0 4px 10px -6px rgba(17, 19, 28, .08);
  --shadow-lg:    0 24px 48px -16px rgba(17, 19, 28, .22);
  --ring:         0 0 0 3px rgba(79, 70, 229, .28);
  --radius-sm:    8px;
  --radius:       12px;
  --radius-lg:    18px;
  --transition:   .18s ease;
  --max-width:    1180px;
  --header-h:     64px;
  --font:         'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

[data-theme="dark"] {
  --primary:      #7c83ff;
  --primary-dark: #6366f1;
  --primary-soft: rgba(124, 131, 255, .16);
  --bg:           #0c0e15;
  --surface:      #151926;
  --surface-2:    #1d2230;
  --border:       #2a3142;
  --text:         #e8eaf1;
  --text-muted:   #98a1b5;
  --shadow-sm:    0 1px 2px rgba(0,0,0,.4);
  --shadow-md:    0 12px 28px -8px rgba(0,0,0,.55);
  --shadow-lg:    0 24px 48px -16px rgba(0,0,0,.6);
  --ring:         0 0 0 3px rgba(124, 131, 255, .35);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; overflow-x: hidden; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  font-size: 15.5px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font: inherit; border: none; background: none; color: inherit; }
input, select, textarea { font: inherit; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }
::selection { background: var(--primary-soft); }

/* ── Header ──────────────────────────────────────────────────────── */
.header {
  position: sticky; top: 0; z-index: 100;
  height: var(--header-h);
  background: var(--surface);   /* pas de backdrop-filter : il casse le menu coulissant fixed sur iOS */
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.header-inner {
  max-width: var(--max-width); margin: 0 auto; padding: 0 1.25rem;
  height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.logo { display: flex; align-items: center; gap: .5rem; font-size: 1.25rem; font-weight: 800;
  color: var(--text); letter-spacing: -.02em; }
.logo-icon { font-size: 1.4rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text; background-clip: text; }
.nav { display: flex; gap: .1rem; align-items: center; }
.nav-link {
  padding: .45rem .62rem; border-radius: var(--radius-sm); font-size: .89rem; font-weight: 600;
  color: var(--text-muted); transition: background var(--transition), color var(--transition);
  display: inline-flex; align-items: center; white-space: nowrap;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active { background: var(--primary-soft); color: var(--primary); }
.admin-active { color: var(--ok) !important; }
.icon-btn {
  width: 38px; height: 38px; border-radius: var(--radius-sm); font-size: 1.1rem;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-muted); transition: background var(--transition);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
/* Bouton hamburger (mobile) */
.nav-toggle { display: none; width: 42px; height: 42px; border-radius: var(--radius-sm);
  align-items: center; justify-content: center; font-size: 1.4rem; color: var(--text); }
.nav-toggle:hover { background: var(--surface-2); }
.nav-backdrop { display: none; position: fixed; inset: var(--header-h) 0 0 0; z-index: 99;
  background: rgba(0,0,0,.4); }
.nav-backdrop.show { display: block; }

@media (max-width: 1024px) {
  .nav-toggle { display: inline-flex; order: 3; }
  .nav {
    position: fixed; top: var(--header-h); right: 0; bottom: 0;
    width: min(80vw, 320px); z-index: 100;
    flex-direction: column; align-items: stretch; gap: .2rem;
    background: var(--surface); border-left: 1px solid var(--border);
    padding: 1rem; box-shadow: var(--shadow-lg); overflow-y: auto;
    transform: translateX(105%); transition: transform .26s cubic-bezier(.4,0,.2,1);
  }
  .nav.open { transform: none; }
  .nav-link, .nav .icon-btn, .nav #admin-btn, .nav #new-session-btn {
    width: 100%; justify-content: flex-start; padding: .7rem .9rem; font-size: 1rem;
  }
  .nav .icon-btn { width: 100%; }
  .nav-sep { width: 100%; height: 1px; align-self: auto; margin: .5rem 0; }
  .account, .account-chip { width: 100%; }
  .account-chip { border-radius: var(--radius); }
  .account-menu { position: static; box-shadow: none; border: none; padding: 0; margin-top: .3rem; min-width: 0; }
}

/* ── Views & container ───────────────────────────────────────────── */
.view { display: none; padding: 1.75rem 0 4rem; animation: viewIn .25s ease; }
.view.active { display: block; }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 1.25rem; }
.section-title { font-size: clamp(1.4rem, 4vw, 1.7rem); font-weight: 800; letter-spacing: -.02em; margin-bottom: 1rem; }
.subsection-title { font-size: 1.1rem; font-weight: 700; letter-spacing: -.01em; margin: 1.5rem 0 .75rem; }
.view-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.2rem; gap: 1rem; flex-wrap: wrap; }

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .6rem 1.15rem; border-radius: var(--radius-sm); font-size: .9rem; font-weight: 700;
  letter-spacing: .005em; transition: background var(--transition), color var(--transition),
  transform .12s ease, box-shadow var(--transition);
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 16px -6px var(--primary); }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 10px 22px -8px var(--primary); }
.btn-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface-2); border-color: color-mix(in srgb, var(--text-muted) 35%, var(--border)); }
.btn-danger { background: var(--danger); color: #fff; box-shadow: 0 6px 16px -6px var(--danger); }
.btn-danger:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn-sm { padding: .35rem .7rem; font-size: .8rem; }

/* ── Inputs ──────────────────────────────────────────────────────── */
.input {
  width: 100%; padding: .65rem .85rem; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.input::placeholder { color: color-mix(in srgb, var(--text-muted) 75%, transparent); }
.input:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.textarea { resize: vertical; }
.error-text { color: var(--danger); font-size: .9rem; margin: .5rem 0; font-weight: 600; }

/* ── Recherche & filtres ─────────────────────────────────────────── */
.search-row { display: flex; gap: .6rem; margin-bottom: 1rem; }
.search-row .input { flex: 1; }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.2rem; align-items: center; }
.chip {
  padding: .45rem .8rem; border-radius: 20px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-muted); font-size: .85rem; font-weight: 600;
}
.chip.select { border-radius: 20px; }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.chip.ghost { background: transparent; }
.results-count { color: var(--text-muted); font-size: .9rem; margin-bottom: 1rem; }

/* ── Grille de séances ───────────────────────────────────────────── */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 1.1rem; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow-sm); cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  position: relative;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--primary) 30%, var(--border)); }
.card-img { width: 100%; height: 150px; object-fit: cover; }
.card-img-placeholder {
  width: 100%; height: 132px; display: flex; align-items: center; justify-content: center;
  font-size: 2.6rem; color: #fff; position: relative;
  background:
    radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--primary) 75%, #000) 0%, transparent 55%),
    linear-gradient(135deg, var(--primary), var(--primary-dark));
}
.card-img-placeholder::after { content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.14) 1px, transparent 1px);
  background-size: 14px 14px; opacity: .5; }
.card-body { padding: 1rem 1.1rem 1.1rem; }
.card-title { font-size: 1.05rem; font-weight: 700; letter-spacing: -.01em; margin-bottom: .5rem; line-height: 1.3; }
.card-meta { display: flex; flex-wrap: wrap; gap: .4rem; }
.tag {
  font-size: .72rem; font-weight: 700; padding: .22rem .6rem; border-radius: 20px;
  background: var(--surface-2); color: var(--text-muted);
}
.tag.group { background: color-mix(in srgb, var(--primary) 15%, transparent); color: var(--primary); }
.tag.diff-facile    { background: #dcfce7; color: #166534; }
.tag.diff-moyen     { background: #fef9c3; color: #854d0e; }
.tag.diff-difficile { background: #fee2e2; color: #991b1b; }
.fav-star {
  position: absolute; top: .6rem; right: .6rem; width: 34px; height: 34px;
  border-radius: 50%; background: rgba(0,0,0,.45); color: #fff; font-size: 1rem;
  display: flex; align-items: center; justify-content: center; z-index: 2;
}
.fav-star.on { color: #fbbf24; }

/* ── Pagination ──────────────────────────────────────────────────── */
.pagination { display: flex; gap: .4rem; justify-content: center; margin-top: 2rem; flex-wrap: wrap; }
.pagination button {
  min-width: 38px; padding: .4rem .7rem; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-weight: 600;
}
.pagination button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination button:disabled { opacity: .4; cursor: default; }

/* ── Détail séance ───────────────────────────────────────────────── */
.detail-hero {
  width: 100%; height: 260px; object-fit: cover; border-radius: var(--radius-lg); margin: 1rem 0;
}
.detail-hero-placeholder {
  width: 100%; height: 180px; border-radius: var(--radius-lg); margin: 1rem 0;
  display: flex; align-items: center; justify-content: center; font-size: 3.5rem; color: #fff;
  background:
    radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--primary) 75%, #000) 0%, transparent 55%),
    linear-gradient(135deg, var(--primary), var(--primary-dark));
}
.detail-title { font-size: clamp(1.5rem, 5vw, 2rem); font-weight: 800; letter-spacing: -.025em; line-height: 1.2; }
.detail-meta { display: flex; flex-wrap: wrap; gap: .5rem; margin: .8rem 0; }
.detail-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1rem 0 1.5rem; }
.detail-desc { color: var(--text-muted); margin-bottom: 1rem; }
.ex-table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.ex-table th, .ex-table td { padding: .65rem .8rem; text-align: left; border-bottom: 1px solid var(--border); font-size: .9rem; }
.ex-table th { background: var(--surface-2); font-weight: 700; }
.ex-table tr:last-child td { border-bottom: none; }
.ex-table .ex-name { font-weight: 600; }
.coaching-box {
  background: color-mix(in srgb, var(--accent) 10%, transparent); border-left: 3px solid var(--accent);
  padding: 1rem; border-radius: var(--radius); margin-top: 1.5rem; white-space: pre-wrap;
}

/* ── Formulaire ──────────────────────────────────────────────────── */
.form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.5rem; margin-top: 1rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-field { display: flex; flex-direction: column; gap: .35rem; }
.form-field > span { font-size: .85rem; font-weight: 600; color: var(--text-muted); }
.span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; gap: .6rem; margin-top: 1.2rem; }

/* Éditeur d'exercices */
.exercise-editor { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.ex-head, .ex-row {
  display: grid; grid-template-columns: 2.2fr .7fr .9fr .9fr 1fr .9fr 40px; gap: .5rem; align-items: center;
}
.ex-head { font-size: .78rem; font-weight: 700; color: var(--text-muted); margin-bottom: .5rem; }
.ex-row { margin-bottom: .5rem; }
.ex-row .input { padding: .4rem .5rem; }
.ex-del { color: var(--danger); font-size: 1.1rem; width: 36px; height: 36px; border-radius: 8px; }
.ex-del:hover { background: var(--surface-2); }

/* ── OCR ─────────────────────────────────────────────────────────── */
.ocr-section { background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); padding: 1.2rem; margin: 1rem 0; }
.ocr-section-title { font-weight: 700; margin-bottom: .3rem; }
.ocr-hint { color: var(--text-muted); font-size: .85rem; margin-bottom: .8rem; }
.ocr-section input[type=file] { margin-bottom: .6rem; }

/* ── Programme hebdo ─────────────────────────────────────────────── */
.week-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; }
.day-col { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem; min-height: 120px; }
.day-name { font-weight: 700; margin-bottom: .6rem; text-align: center; font-size: .9rem; }
.day-col.today { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.prog-card { background: var(--surface-2); border-radius: 8px; padding: .5rem; margin-bottom: .5rem; font-size: .82rem; cursor: pointer; position: relative; }
.prog-card .pc-title { font-weight: 700; }
.prog-card .pc-meta { color: var(--text-muted); font-size: .75rem; }
.prog-del { position: absolute; top: 2px; right: 4px; color: var(--danger); font-size: .9rem; }
.day-empty { color: var(--text-muted); font-size: .8rem; text-align: center; padding: 1rem 0; }

/* ── Journal ─────────────────────────────────────────────────────── */
.journal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.progression-panel, .logs-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.2rem; }
.chart { display: flex; align-items: flex-end; gap: .4rem; height: 180px; margin: 1rem 0; padding-top: 1rem; border-bottom: 2px solid var(--border); }
.bar { flex: 1; background: linear-gradient(var(--primary), var(--primary-dark)); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.bar span { position: absolute; top: -1.1rem; left: 50%; transform: translateX(-50%); font-size: .7rem; color: var(--text-muted); white-space: nowrap; }
.bar small { position: absolute; bottom: -1.3rem; left: 50%; transform: translateX(-50%); font-size: .62rem; color: var(--text-muted); white-space: nowrap; }
.progression-stats { color: var(--text-muted); font-size: .85rem; margin-top: 1.5rem; }
.log-item { border-bottom: 1px solid var(--border); padding: .7rem 0; }
.log-item:last-child { border: none; }
.log-item .li-title { font-weight: 700; }
.log-item .li-meta { color: var(--text-muted); font-size: .8rem; }
.log-sets-head, .log-set-row { display: grid; grid-template-columns: 2fr .7fr .8fr 1fr .7fr 40px; gap: .4rem; align-items: center; }
.log-sets-head { font-size: .75rem; font-weight: 700; color: var(--text-muted); margin: .5rem 0; }
.log-set-row { margin-bottom: .4rem; }
.log-set-row .input { padding: .35rem .45rem; }

/* ── Mode guidé ──────────────────────────────────────────────────── */
.guided-overlay { position: fixed; inset: 0; z-index: 300; background: var(--surface-2); display: flex; align-items: center; justify-content: center; }
.guided-inner { width: 100%; max-width: 600px; padding: 1.5rem; text-align: center; }
.guided-exit { position: absolute; top: 1rem; right: 1rem; font-size: 1.5rem; color: var(--text-muted); width: 44px; height: 44px; }
.guided-progress { color: var(--text-muted); font-weight: 600; margin-bottom: 1rem; }
.guided-body { background: var(--surface); border-radius: var(--radius-lg); padding: 2rem; box-shadow: var(--shadow-md); margin-bottom: 1.5rem; }
.guided-exname { font-size: 2rem; font-weight: 800; margin-bottom: 1rem; }
.guided-stats { display: flex; justify-content: center; gap: 1.5rem; flex-wrap: wrap; }
.guided-stat { text-align: center; }
.guided-stat .gs-val { font-size: 1.8rem; font-weight: 800; color: var(--primary); }
.guided-stat .gs-lbl { font-size: .8rem; color: var(--text-muted); }
.guided-exnotes { margin-top: 1rem; color: var(--text-muted); font-style: italic; }
.guided-nav { display: flex; gap: 1rem; justify-content: center; }
.guided-nav .btn { flex: 1; max-width: 200px; justify-content: center; }
.guided-timer { background: var(--surface); border-radius: var(--radius-lg); padding: 1.5rem; margin-bottom: 1.5rem; box-shadow: var(--shadow-md); }
.timer-label { color: var(--text-muted); font-weight: 600; }
.timer-value { font-size: 3rem; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.timer-actions { display: flex; gap: .6rem; justify-content: center; }

/* ── Login ───────────────────────────────────────────────────────── */
.login-page { position: fixed; inset: 0; z-index: 400; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.login-card { background: var(--surface); border-radius: var(--radius-lg); padding: 2rem; width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: .8rem; }
.login-card h2 { font-size: 1.3rem; }

/* ── Modal ───────────────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 350; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; padding: 1rem; overflow-y: auto; }
.modal-card { background: var(--surface); border-radius: var(--radius-lg); padding: 1.5rem; width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: .8rem; }
.modal-lg { max-width: 640px; }

/* ── Toast ───────────────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 500; display: flex; flex-direction: column; gap: .6rem; }
.toast { padding: .8rem 1.2rem; border-radius: 8px; color: #fff; box-shadow: var(--shadow-md); font-weight: 600; animation: slidein .2s ease; }
.toast.success { background: var(--ok); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--primary); }
@keyframes slidein { from { transform: translateX(100%); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── États vides & loader ────────────────────────────────────────── */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); grid-column: 1 / -1; }
.empty-icon { font-size: 3rem; margin-bottom: .5rem; }
.loader { width: 40px; height: 40px; border: 4px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; margin: 3rem auto; grid-column: 1 / -1; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Comptes : login hint, athlètes, invitations ─────────────────── */
.login-hint { color: var(--text-muted); font-size: .85rem; text-align: center; margin-top: .5rem; }

.athletes-list { display: flex; flex-direction: column; gap: .75rem; }
.athlete-card { display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1rem 1.2rem; box-shadow: var(--shadow-sm); }
.athlete-card.inactive { opacity: .55; }
.ac-name { font-weight: 600; }
.ac-meta { color: var(--text-muted); font-size: .85rem; margin-top: .15rem; }
.ac-actions { display: flex; gap: .5rem; flex-shrink: 0; }

.invitations-list { display: flex; flex-direction: column; gap: .5rem; }
.invite-item { display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .7rem 1rem; }

/* ── Éditeur de blocs (formulaire) ───────────────────────────────── */
#blocs-editor { display: flex; flex-direction: column; gap: 1rem; margin-bottom: .75rem; }
.bloc-card { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1rem; background: var(--surface-2); }
.bloc-head { display: grid; grid-template-columns: 150px 1fr 130px auto; gap: .5rem; align-items: center; }
.bloc-params { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; margin: .75rem 0; }
.bloc-params .bp { display: flex; flex-direction: column; gap: .2rem; font-size: .78rem; color: var(--text-muted); }
.bloc-params .bp input { width: 110px; }
.bloc-duration { margin-left: auto; font-weight: 600; color: var(--primary); align-self: center; }
.bloc-ex { display: flex; flex-direction: column; gap: .4rem; margin-bottom: .5rem; }
.bloc-ex-row { display: grid; grid-template-columns: 1.6fr auto 1fr; gap: .4rem; align-items: center; }
.bloc-ex-row .adv { display: none; }
.bloc-card.is-strength .bloc-ex-row { grid-template-columns: 1.4fr auto 70px 70px 90px 1fr auto; }
.bloc-card.is-strength .bloc-ex-row .adv { display: block; }
.bx-uni { display: flex; align-items: center; gap: .25rem; font-size: .75rem; color: var(--text-muted); white-space: nowrap; }
.form-total-duration { margin: .75rem 0 0; font-size: .95rem; }
.form-total-duration strong { color: var(--primary); }

/* ── Détail : blocs par phase ────────────────────────────────────── */
.blocs-detail { margin: 1rem 0; }
.phase-title { font-size: 1.05rem; margin: 1.2rem 0 .5rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.bloc-detail { border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: var(--radius); padding: .8rem 1rem; margin-bottom: .75rem; background: var(--surface); }
.bloc-detail-head { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: baseline; margin-bottom: .5rem; }
.bloc-detail-label { font-weight: 700; font-size: 1.05rem; }
.bloc-detail-badge { color: var(--text-muted); font-size: .85rem; }
.bloc-ex-list { margin: 0; padding-left: 1.3rem; display: flex; flex-direction: column; gap: .3rem; }
.bloc-ex-list .bx-li-name { font-weight: 500; }
.bx-meta { color: var(--text-muted); font-size: .85rem; }
.bx-note { color: var(--text-muted); font-style: italic; }
.tag.mini { padding: 0 .35rem; font-size: .7rem; }
.bloc-note { margin-top: .5rem; color: var(--text-muted); font-size: .85rem; }

/* ── Bibliothèque ────────────────────────────────────────────────── */
.library-list { display: flex; flex-direction: column; gap: .6rem; }
.lib-card { display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem 1rem; }

/* ── Minuteur d'intervalle pro ───────────────────────────────────── */
.guided-phase { font-size: 1.05rem; opacity: .85; margin-bottom: .5rem; text-align: center; }
.guided-timer-big { font-size: clamp(3.5rem, 18vw, 8rem); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; text-align: center; }
.guided-next-up { margin-top: .75rem; opacity: .8; text-align: center; }
.guided-exmeta { font-size: 1rem; opacity: .8; margin-top: .35rem; }
.guided-controls { display: flex; gap: .5rem; justify-content: center; margin-top: 1.5rem; flex-wrap: wrap; }
.guided-bar { height: 6px; background: rgba(255,255,255,.25); border-radius: 3px; margin-top: 1.5rem; overflow: hidden; }
#guided-bar-fill { height: 100%; width: 0; background: #fff; transition: width .3s linear; }
#guided-overlay.phase-work { background: linear-gradient(160deg, #16a34a, #15803d); color: #fff; }
#guided-overlay.phase-rest { background: linear-gradient(160deg, #dc2626, #b91c1c); color: #fff; }
#guided-overlay.phase-work .btn-ghost, #guided-overlay.phase-rest .btn-ghost { color: #fff; border-color: rgba(255,255,255,.5); }

/* ── Lot 4 : templates, partage ──────────────────────────────────── */
.bloc-card-foot { display: flex; gap: .5rem; flex-wrap: wrap; }
.bloc-add-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.shared-note { color: var(--text-muted); font-size: .9rem; margin: -.25rem 0 .5rem; }

/* ── Impression / PDF ────────────────────────────────────────────── */
@media print {
  .header, .nav, #pagination, .detail-actions, .no-print, #toast-container,
  .detail-hero, .detail-hero-placeholder { display: none !important; }
  .view { display: none !important; }
  #view-detail.view { display: block !important; }
  body, .container { background: #fff; color: #000; }
  .bloc-detail { break-inside: avoid; border-color: #999; }
  .detail-title { margin-top: 0; }
  a[href]:after { content: ""; }
}

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
  .journal-grid { grid-template-columns: 1fr; }
  .ex-head { display: none; }
  .ex-row { grid-template-columns: 1fr 1fr; }
  .header-inner { flex-direction: column; height: auto; padding: .6rem 1rem; gap: .5rem; }
  .header { height: auto; }
  .athlete-card { flex-direction: column; align-items: flex-start; }
  .invite-item { flex-direction: column; align-items: flex-start; }
  .bloc-head { grid-template-columns: 1fr 1fr; }
  .bloc-ex-row, .bloc-card.is-strength .bloc-ex-row { grid-template-columns: 1fr 1fr; }
  .lib-card { flex-direction: column; align-items: flex-start; }
}

/* ── Aide / FAQ ──────────────────────────────────────────────────── */
.container-narrow { max-width: 760px; }
.faq-intro { color: var(--text-muted); margin-bottom: 1.2rem; }
.faq-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: .6rem; overflow: hidden; box-shadow: var(--shadow-sm); }
.faq-item > summary { cursor: pointer; padding: .9rem 1.1rem; font-weight: 600; list-style: none;
  display: flex; justify-content: space-between; align-items: center; }
.faq-item > summary::-webkit-details-marker { display: none; }
.faq-item > summary::after { content: '▾'; color: var(--text-muted); transition: transform var(--transition); }
.faq-item[open] > summary::after { transform: rotate(180deg); }
.faq-item[open] > summary { border-bottom: 1px solid var(--border); }
.faq-body { padding: .9rem 1.1rem; color: var(--text); line-height: 1.55; }
.faq-body ul { margin: .3rem 0 .3rem 1.1rem; display: flex; flex-direction: column; gap: .35rem; }
.faq-body p { margin: .4rem 0; }

/* ── Boucle progrès : indice de charge ───────────────────────────── */
.ls-hint { grid-column: 1 / -1; font-size: .8rem; color: var(--text-muted); padding: .1rem .2rem 0; }
.ls-hint strong { color: var(--primary); }

/* ── Volume par muscle + plateau ─────────────────────────────────── */
.mv-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 1rem 1.2rem; margin-bottom: 1.2rem; box-shadow: var(--shadow-sm); }
.mv-row { display: grid; grid-template-columns: 130px 1fr auto; gap: .75rem; align-items: center; margin: .4rem 0; }
.mv-name { font-weight: 600; font-size: .9rem; }
.mv-bar { background: var(--surface-2); border-radius: 6px; height: 14px; overflow: hidden; }
.mv-fill { height: 100%; border-radius: 6px; transition: width .3s ease; }
.mv-fill.low { background: #f59e0b; } .mv-fill.mid { background: #3b82f6; }
.mv-fill.opt { background: #16a34a; } .mv-fill.high { background: #dc2626; }
.mv-val { font-size: .82rem; color: var(--text-muted); white-space: nowrap; }
.mv-status { font-weight: 700; }
.mv-status.low { color: #f59e0b; } .mv-status.mid { color: #3b82f6; }
.mv-status.opt { color: #16a34a; } .mv-status.high { color: #dc2626; }
.mv-legend { font-size: .8rem; color: var(--text-muted); margin-top: .6rem; }
.plateau-warn { margin-top: .6rem; padding: .6rem .8rem; background: rgba(245,158,11,.12);
  border-left: 3px solid #f59e0b; border-radius: 6px; font-size: .85rem; }
@media (max-width: 720px) { .mv-row { grid-template-columns: 95px 1fr; } .mv-val { grid-column: 1 / -1; } }

/* ── Séance du jour (PWA / accueil) ──────────────────────────────── */
.today-card { background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; border-radius: var(--radius-lg); padding: 1rem 1.2rem; margin-bottom: 1rem; box-shadow: var(--shadow-md); }
.today-head { font-weight: 700; font-size: 1.05rem; margin-bottom: .6rem; }
.today-list { display: flex; flex-wrap: wrap; gap: .5rem; }
.today-card .today-go { background: #fff; color: var(--primary); border: none; }
.today-card .today-notif { color: #fff; border-color: rgba(255,255,255,.6); margin-top: .6rem; }

/* ── Fiches d'exercices (clic sur un exercice) ───────────────────── */
.bloc-ex-list .bx-li-name {
  font-weight: 600; color: var(--text); padding: 0; background: none; border: none;
  border-bottom: 1px dashed color-mix(in srgb, var(--primary) 50%, transparent);
  cursor: pointer; transition: color var(--transition);
}
.bloc-ex-list .bx-li-name:hover { color: var(--primary); }
.exinfo-cues { line-height: 1.6; }
#exinfo-muscles { margin: .2rem 0 .4rem; }
.guided-cues { margin-top: .9rem; font-size: 1rem; font-weight: 500; opacity: .9;
  max-width: 460px; margin-inline: auto; line-height: 1.5; }

/* ── Rôle créateur ───────────────────────────────────────────────── */
.athlete-card .creator-on { color: var(--primary); background: var(--primary-soft);
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); }

/* ── Système d'icônes SVG ────────────────────────────────────────── */
.ic { width: 1.15em; height: 1.15em; flex: none; }
.nav-link { gap: .42rem; }
.nav-link .ic { width: 1.05rem; height: 1.05rem; opacity: .9; }
.nav-link.active .ic { opacity: 1; }
.icon-btn .ic { width: 1.25rem; height: 1.25rem; }
.nav-toggle .ic { width: 1.4rem; height: 1.4rem; }
.btn .ic { width: 1.1rem; height: 1.1rem; }

/* Séparateur dans la barre */
.nav-sep { width: 1px; align-self: stretch; margin: .4rem .35rem; background: var(--border); }

/* Puce compte (avatar + nom) + menu déroulant */
.account { position: relative; }
.account-menu { min-width: 220px; }
.account-chip {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .28rem .7rem .28rem .32rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); font-weight: 600; color: var(--text);
  transition: background var(--transition), border-color var(--transition);
}
.account-chip:hover { background: var(--surface-2); }
.account-chip .avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-2); color: var(--text-muted); font-size: .78rem; font-weight: 800; letter-spacing: .02em;
}
.account-chip.logged .avatar { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; }
.account-chip .avatar .ic { width: 1.05rem; height: 1.05rem; }
.account-chip .admin-text { font-size: .88rem; }
/* Desktop étroit : avatar seul pour éviter de pousser la barre */
@media (min-width: 1025px) and (max-width: 1240px) {
  .account-chip .admin-text { display: none; }
  .account-chip { padding: .28rem; }
}

/* Bouton uniquement icône + favori actif */
.btn.icon-only { padding: .55rem; }
.btn.fav-on { color: #f59e0b; border-color: color-mix(in srgb, #f59e0b 45%, var(--border)); }
.btn.fav-on .ic { fill: #f59e0b; stroke: #f59e0b; }
.hero-ic { width: 60px; height: 60px; opacity: .9; }
.card-ph-ic { width: 46px; height: 46px; opacity: .92; }
.prog-select { max-width: 200px; }

/* Menu « ⋯ Plus » (page détail) */
.more-wrap { position: relative; }
.more-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; min-width: 215px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: .35rem; display: flex; flex-direction: column;
}
.more-menu[hidden] { display: none; }
.mm-item {
  display: flex; align-items: center; gap: .65rem; padding: .55rem .7rem; border-radius: var(--radius-sm);
  font-size: .9rem; font-weight: 600; color: var(--text); text-align: left; width: 100%;
}
.mm-item:hover { background: var(--surface-2); }
.mm-item .ic { width: 1.05rem; height: 1.05rem; color: var(--text-muted); }
.mm-item.danger, .mm-item.danger .ic { color: var(--danger); }

/* ── Écran de séance guidée (lecteur) ────────────────────────────── */
.guided-controls { gap: 1rem; margin-top: 1.75rem; align-items: center; }
.g-ctrl {
  width: 58px; height: 58px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.16); color: #fff; font-weight: 800; font-size: .9rem;
  transition: background .15s ease, transform .1s ease;
}
.g-ctrl:hover { background: rgba(255,255,255,.3); }
.g-ctrl:active { transform: scale(.92); }
.g-ctrl .ic { width: 26px; height: 26px; }
.g-main { width: 78px; height: 78px; background: #fff; color: #16223a; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.g-main .ic { width: 30px; height: 30px; }
.guided-timer-big .ic { width: clamp(70px, 16vw, 104px); height: clamp(70px, 16vw, 104px); opacity: .95; }
.g-target { font-size: clamp(2.8rem, 13vw, 5.5rem); font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.g-sub { display: block; font-size: 1rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; opacity: .8; margin-top: .2rem; }
.g-dumb { width: clamp(60px, 13vw, 92px); height: clamp(60px, 13vw, 92px); opacity: .9; }

/* ── Écran « Préparer ta séance » ────────────────────────────────── */
.rest-chips { display: flex; gap: .5rem; flex-wrap: wrap; }
.rest-chips button { padding: .5rem .95rem; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); font-weight: 700; color: var(--text-muted); transition: all var(--transition); }
.rest-chips button:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.rest-chips button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.prep-charge-row { display: grid; grid-template-columns: 1fr 120px; gap: .7rem; align-items: center; margin-top: .5rem; }
.prep-charge-row span { font-size: .9rem; font-weight: 600; }
#prep-charges { margin: .4rem 0 .2rem; }

/* ════════════ Refonte design (auth, vignettes, hero, skeletons) ════ */

/* ── Page d'authentification (vitrine) ───────────────────────────── */
.login-page {
  background:
    radial-gradient(1100px 560px at 8% -8%, color-mix(in srgb, var(--primary) 60%, transparent), transparent 60%),
    radial-gradient(900px 520px at 112% 112%, color-mix(in srgb, var(--accent) 45%, transparent), transparent 55%),
    linear-gradient(165deg, #1b1f3a 0%, #0b0f1e 100%);
}
.login-card { max-width: 400px; padding: 2.2rem 2rem; box-shadow: var(--shadow-lg); border: 1px solid var(--border); gap: .8rem; }
.auth-brand { text-align: center; margin-bottom: .3rem; }
.auth-logo { font-size: 2.4rem; line-height: 1; }
.auth-name { font-size: 1.55rem; font-weight: 800; letter-spacing: -.02em; margin-top: .1rem; }
.auth-tagline { color: var(--text-muted); font-size: .9rem; margin-top: .15rem; }
.auth-sub { text-align: center; font-weight: 700; color: var(--text-muted); margin-bottom: .3rem; }
.login-card .form-actions { flex-direction: column; gap: .55rem; margin-top: .3rem; }
.login-card .form-actions .btn { width: 100%; }

/* ── Vignettes colorées par type de séance ───────────────────────── */
.card-img-placeholder, .detail-hero-placeholder { --c1: var(--primary); --c2: var(--primary-dark); }
.card-img-placeholder {
  background:
    radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--c1) 80%, #000), transparent 55%),
    linear-gradient(135deg, var(--c1), var(--c2));
}
.detail-hero-placeholder {
  height: 132px;
  background:
    radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--c1) 80%, #000), transparent 55%),
    linear-gradient(135deg, var(--c1), var(--c2));
}
.type-cardio       { --c1: #fb923c; --c2: #ea580c; }
.type-force        { --c1: #6366f1; --c2: #4338ca; }
.type-hypertrophie { --c1: #f472b6; --c2: #db2777; }
.type-endurance    { --c1: #22d3ee; --c2: #0891b2; }
.type-mobilite     { --c1: #34d399; --c2: #059669; }
.type-none         { --c1: #64748b; --c2: #334155; }

/* ── Tableau de bord d'accueil (hero) ────────────────────────────── */
.hero { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff;
  border-radius: var(--radius-lg); padding: 1.2rem 1.4rem; margin-bottom: 1.2rem; box-shadow: var(--shadow-md); }
.hero-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.hero-hello { font-size: 1.35rem; font-weight: 800; letter-spacing: -.01em; }
.hero-stat { display: flex; align-items: center; gap: .5rem; background: rgba(255,255,255,.16);
  padding: .4rem .8rem; border-radius: 999px; white-space: nowrap; }
.hero-stat .hs-n { font-size: 1.5rem; font-weight: 800; line-height: 1; }
.hero-stat .hs-l { font-size: .72rem; opacity: .9; line-height: 1.1; }
.hero-today { margin-top: 1rem; }
.hero-today-label { font-weight: 700; opacity: .92; margin-bottom: .5rem; }
.hero-today-list { display: flex; flex-wrap: wrap; gap: .5rem; }
.hero .today-go { background: #fff; color: var(--primary); border: none; box-shadow: var(--shadow-sm); }
.hero .today-notif { background: rgba(255,255,255,.16); color: #fff; border: 1px solid rgba(255,255,255,.4); }

/* ── Skeletons de chargement ─────────────────────────────────────── */
.skeleton-card { pointer-events: none; }
.sk { background: linear-gradient(90deg, var(--surface-2) 25%, color-mix(in srgb, var(--surface-2) 55%, var(--border)) 37%, var(--surface-2) 63%);
  background-size: 400% 100%; animation: shimmer 1.3s ease infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -135% 0; } }
.sk-img { height: 132px; border-radius: 0; }
.sk-line { height: 14px; margin: .55rem 0; }
.sk-line.short { width: 55%; }

@media (max-width: 560px) {
  .hero-row { flex-direction: column; align-items: flex-start; gap: .6rem; }
  .hero-hello { font-size: 1.2rem; }
}
#guided-overlay .guided-exit { color: rgba(255,255,255,.85); }
#guided-overlay .guided-exit:hover { color: #fff; }
.guided-exit .ic { width: 24px; height: 24px; }
.guided-progress { letter-spacing: .01em; }
.guided-phase { text-transform: uppercase; letter-spacing: .06em; font-size: .85rem; font-weight: 700; opacity: .9; }

/* ── Barre d'onglets (mobile) ────────────────────────────────────── */
.tabbar { display: none; }
.tabbar .tab .ic { width: 1.4rem; height: 1.4rem; }
@media (max-width: 720px) {
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 95;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    -webkit-backdrop-filter: saturate(180%) blur(14px); backdrop-filter: saturate(180%) blur(14px);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .tabbar .tab {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: .5rem 0 .55rem; font-size: .68rem; font-weight: 700; color: var(--text-muted);
    transition: color var(--transition);
  }
  .tabbar .tab .tab-i { font-size: 1.3rem; line-height: 1; }
  .tabbar .tab.active { color: var(--primary); }
  .tabbar .tab:active { transform: scale(.94); }
  body { padding-bottom: 66px; }
  .nav-toggle { display: none !important; }   /* remplacé par le « Menu » du bas */
  .nav { bottom: 58px; }                       /* le menu coulissant s'arrête au-dessus de la barre */
  .nav-sep { width: 100%; height: 1px; align-self: auto; margin: .5rem 0; }
  .nav .account-chip, .nav #admin-btn { width: 100%; justify-content: flex-start; border-radius: var(--radius); }
}

/* ── Finitions responsives ───────────────────────────────────────── */
@media (max-width: 560px) {
  .container { padding: 0 1rem; }
  .grid { grid-template-columns: 1fr; gap: .9rem; }
  .search-row { flex-direction: column; }
  .detail-actions .btn { flex: 1 1 auto; }
  .bloc-detail-head { gap: .25rem .6rem; }
}
