/* Adirexia · Prépa CAPESA — charte « académique raffinée »
   Bleu marine et bleu ciel Adirexia, fond ivoire, filets dorés, titres en serif. */
:root {
  --ink: #0b1733;
  --navy: #002060;
  --navy-2: #0a2f7a;
  --sky: #0099ff;
  --sky-soft: #e6f4ff;
  --ivory: #f7f4ec;
  --paper: #fffdf8;
  --line: #e5dfd1;
  --gold: #b08d57;
  --muted: #5d6680;
  --ok: #1f7a5a;
  --serif: "Fraunces", "Georgia", serif;
  --sans: "Inter", "Segoe UI", system-ui, sans-serif;
  /* compatibilité avec les anciennes classes */
  --adx-navy: var(--navy);
  --adx-navy-2: var(--navy-2);
  --adx-gold: var(--sky);
}

body { background: var(--ivory); color: var(--ink); font-family: var(--sans); display: flex; flex-direction: column; min-height: 100vh; -webkit-font-smoothing: antialiased; }
main { flex: 1; }
a { color: var(--navy-2); text-underline-offset: 3px; }
a:hover { color: var(--sky); }
h1, h2, h3, .adx-serif { font-family: var(--serif); font-optical-sizing: auto; letter-spacing: -.01em; }
h1 { font-weight: 600; }
::selection { background: var(--sky); color: #fff; }

/* ---------- Navigation ---------- */
.adx-nav { background: var(--paper); border-bottom: 1px solid var(--line); box-shadow: 0 1px 0 rgba(176,141,87,.35); }
.adx-nav .nav-link { color: var(--ink); font-weight: 500; font-size: .95rem; padding: .5rem .8rem !important; }
.adx-nav .nav-link:hover, .adx-nav .nav-link.active { color: var(--sky); }
.adx-nav .navbar-toggler { border-color: var(--line); }
.adx-nav .navbar-toggler-icon { filter: invert(1) brightness(.2); }
.adx-brand { display: flex; align-items: baseline; gap: .55rem; text-decoration: none; }
.adx-logo { font-family: var(--serif); font-weight: 700; font-size: 1.45rem; color: var(--navy); letter-spacing: -.02em; }
.adx-logo b { color: var(--sky); }
.adx-logo-sub { font-size: .68rem; letter-spacing: .22em; text-transform: uppercase; color: var(--gold); font-weight: 600; }
.adx-admin-link { color: var(--gold) !important; }
.adx-sim-banner { background: #fff4d6; color: #6b4e00; text-align: center; font-size: .85rem; padding: .3rem; }

/* ---------- Boutons ---------- */
.btn { border-radius: 999px; font-weight: 600; padding: .55rem 1.25rem; }
.btn-sm { padding: .3rem .85rem; }
.btn-adx { background: var(--navy); color: #fff; border: 1px solid var(--navy); }
.btn-adx:hover { background: var(--navy-2); color: #fff; }
.btn-adx-gold { background: var(--sky); color: #fff; border: 1px solid var(--sky); }
.btn-adx-gold:hover { background: #007fd6; border-color: #007fd6; color: #fff; }
.btn-outline-adx { border: 1px solid var(--navy); color: var(--navy); background: transparent; }
.btn-outline-adx:hover { background: var(--navy); color: #fff; }
.btn-ghost { color: var(--navy); background: transparent; border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--navy); color: var(--navy); }

/* ---------- Éléments de mise en page ---------- */
.adx-eyebrow { color: var(--gold); text-transform: uppercase; letter-spacing: .22em; font-size: .72rem; font-weight: 700; margin-bottom: .6rem; }
.adx-section-title { font-family: var(--serif); font-weight: 600; color: var(--navy); }
.adx-rule { width: 56px; height: 2px; background: var(--gold); border: 0; opacity: 1; margin: .9rem 0 1.4rem; }
.adx-lead { color: var(--muted); font-size: 1.08rem; max-width: 62ch; }
.adx-panel { background: var(--paper); border-radius: 18px; padding: 2rem; border: 1px solid var(--line); }
.adx-card { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 1.5rem; height: 100%; transition: transform .18s, box-shadow .18s, border-color .18s; }
a.adx-card { display: block; color: inherit; text-decoration: none; }
a.adx-card:hover { transform: translateY(-3px); box-shadow: 0 14px 34px rgba(0,32,96,.10); border-color: #d6cdb8; }

/* ---------- Accueil ---------- */
.adx-hero { background: radial-gradient(1200px 500px at 85% -10%, rgba(0,153,255,.28), transparent 60%), linear-gradient(160deg, var(--navy) 0%, var(--ink) 100%); color: #fff; padding: 5rem 0 4.5rem; position: relative; overflow: hidden; }
.adx-hero::after { content: "∑  ∫  ∂  λ  π  ∞  ≡  ⊕  ∀  ∃"; position: absolute; right: -2rem; bottom: -1.2rem; font-family: var(--serif); font-size: 7rem; letter-spacing: .4em; color: rgba(255,255,255,.04); white-space: nowrap; pointer-events: none; }
.adx-hero h1 { font-size: clamp(2.3rem, 5.2vw, 3.9rem); font-weight: 600; line-height: 1.06; }
.adx-hero h1 em { font-style: italic; color: #7cc8ff; }
.adx-hero .adx-eyebrow { color: #e0c48f; }
.adx-hero .lead { color: rgba(255,255,255,.82); max-width: 54ch; }
.adx-hero .btn-outline-light { border-radius: 999px; }
.adx-stats { display: flex; flex-wrap: wrap; gap: 2.2rem; margin-top: 2.6rem; padding-top: 1.6rem; border-top: 1px solid rgba(255,255,255,.14); }
.adx-stats div { font-size: .82rem; color: rgba(255,255,255,.7); }
.adx-stats strong { display: block; font-family: var(--serif); font-size: 2rem; font-weight: 600; color: #fff; line-height: 1.1; }

/* Les trois tomes, dessinés en CSS */
.adx-tomes { display: flex; justify-content: center; align-items: flex-end; gap: 1.1rem; perspective: 1200px; }
.adx-tome { width: 150px; aspect-ratio: 7 / 10; border-radius: 4px 10px 10px 4px; background: linear-gradient(90deg, var(--sky) 0 46%, var(--navy) 46% 100%); position: relative; box-shadow: -10px 22px 40px rgba(0,0,0,.45), inset 6px 0 0 rgba(0,0,0,.18); transform: rotateY(-14deg); transition: transform .3s; text-decoration: none; }
.adx-tome:nth-child(2) { transform: rotateY(-14deg) translateY(-18px); }
.adx-tome:hover { transform: rotateY(-4deg) translateY(-10px); }
.adx-tome .t-card { position: absolute; inset: 12% 8% 18% 12%; background: #fff; border-radius: 2px; padding: .55rem .6rem; display: flex; flex-direction: column; }
.adx-tome .t-brand { font-family: var(--serif); font-weight: 700; color: var(--navy); font-size: .7rem; }
.adx-tome .t-band { background: var(--navy); color: #fff; margin: .45rem -.6rem 0 -.9rem; padding: .45rem .6rem .5rem .9rem; font-family: var(--serif); font-weight: 600; font-size: .82rem; line-height: 1.05; }
.adx-tome .t-num { margin-top: auto; align-self: flex-end; font-family: var(--serif); font-weight: 700; font-size: 2.2rem; color: var(--sky); line-height: 1; }
.adx-tome .t-ed { position: absolute; bottom: 6%; left: 14%; font-size: .5rem; letter-spacing: .18em; color: rgba(255,255,255,.75); text-transform: uppercase; }

.adx-steps { counter-reset: step; }
.adx-step { position: relative; padding-left: 3.4rem; }
.adx-step::before { counter-increment: step; content: counter(step, decimal-leading-zero); position: absolute; left: 0; top: -.2rem; font-family: var(--serif); font-size: 2rem; font-weight: 600; color: var(--gold); }
.adx-year-chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.adx-year-chips a { border: 1px solid var(--line); background: var(--paper); border-radius: 999px; padding: .35rem .9rem; color: var(--navy); text-decoration: none; font-weight: 600; font-variant-numeric: tabular-nums; }
.adx-year-chips a:hover { border-color: var(--sky); color: var(--sky); }

/* ---------- Cartes livres ---------- */
.adx-book-card { display: block; text-decoration: none; color: inherit; }
.adx-cover { aspect-ratio: 7 / 10; background: #fff; border-radius: 6px; overflow: hidden; box-shadow: 0 10px 28px rgba(0,32,96,.14); transition: transform .18s; border: 1px solid var(--line); }
.adx-book-card:hover .adx-cover { transform: translateY(-4px); }
.adx-cover img { width: 100%; height: 100%; object-fit: cover; user-select: none; }
.adx-cover-placeholder { height: 100%; display: flex; align-items: center; justify-content: center; text-align: center; padding: 1rem; background: linear-gradient(90deg, var(--sky) 0 40%, var(--navy) 40%); color: #fff; font-family: var(--serif); font-weight: 600; }
.adx-cover-lg { max-width: 300px; }
.adx-book-title { font-family: var(--serif); font-weight: 600; font-size: 1.05rem; margin-top: .7rem; line-height: 1.25; color: var(--ink); }
.adx-book-meta { font-size: .85rem; color: var(--muted); }
.adx-badge { background: var(--sky-soft); color: var(--navy); text-decoration: none; font-weight: 600; border-radius: 999px; padding: .35em .8em; }
.adx-prose { max-width: 70ch; white-space: pre-line; }
.adx-toc { columns: 2; max-width: 800px; }
@media (max-width: 576px) { .adx-toc { columns: 1; } }

/* ---------- Niveaux d'accès ---------- */
.adx-level { display: inline-flex; align-items: center; gap: .3rem; font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; border-radius: 999px; padding: .22rem .6rem; white-space: nowrap; }
.adx-level-0 { background: #e5f4ee; color: var(--ok); }
.adx-level-1 { background: var(--sky-soft); color: #006bb3; }
.adx-level-2 { background: var(--navy); color: #e8cf9e; }

/* ---------- Espace Prépa ---------- */
.adx-page-head { padding: 3rem 0 1.5rem; }
.adx-page-head h1 { font-size: clamp(2rem, 4vw, 2.9rem); color: var(--navy); }
.adx-subject { position: relative; overflow: hidden; }
.adx-subject .s-num { position: absolute; right: 1.2rem; top: .4rem; font-family: var(--serif); font-weight: 700; font-size: 4.5rem; color: var(--sky); opacity: .16; line-height: 1; }
.adx-subject h3 { color: var(--navy); font-size: 1.45rem; }
.adx-subject ul { list-style: none; padding: 0; margin: 1rem 0 0; color: var(--muted); font-size: .92rem; }
.adx-subject li { padding: .3rem 0; border-top: 1px dashed var(--line); display: flex; justify-content: space-between; }
.adx-subject li b { color: var(--ink); font-variant-numeric: tabular-nums; }
.adx-tabs { position: sticky; top: 0; z-index: 5; background: rgba(247,244,236,.94); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); margin-bottom: 2rem; }
.adx-tabs a { display: inline-block; padding: .9rem 1rem; color: var(--muted); font-weight: 600; text-decoration: none; border-bottom: 2px solid transparent; }
.adx-tabs a:hover { color: var(--navy); border-bottom-color: var(--gold); }
.adx-block { scroll-margin-top: 4.5rem; margin-bottom: 3.2rem; }
.adx-block h2 { color: var(--navy); font-size: 1.7rem; }
.adx-list { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.adx-row { display: flex; align-items: center; gap: 1rem; padding: .9rem 1.2rem; border-top: 1px solid var(--line); color: inherit; text-decoration: none; }
.adx-row:first-child { border-top: 0; }
a.adx-row:hover { background: #fbf8f1; }
.adx-row .r-num { font-family: var(--serif); font-weight: 600; color: var(--gold); min-width: 2.2rem; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.adx-row .r-title { flex: 1; font-weight: 500; }
.adx-row .r-meta { color: var(--muted); font-size: .82rem; white-space: nowrap; }
.adx-row .r-lock { color: var(--muted); }
.adx-row.is-locked .r-title { color: var(--muted); }
.adx-row .r-links { display: flex; gap: .4rem; flex-wrap: wrap; justify-content: flex-end; }
.adx-chip { border: 1px solid var(--line); border-radius: 999px; padding: .25rem .75rem; font-size: .82rem; font-weight: 600; color: var(--navy); text-decoration: none; background: #fff; white-space: nowrap; }
.adx-chip:hover { border-color: var(--sky); color: var(--sky); }
.adx-chip.is-locked { color: var(--muted); background: transparent; }
.adx-annales th { font-family: var(--serif); color: var(--navy); font-weight: 600; }
.adx-annales td, .adx-annales th { padding: .85rem 1rem; vertical-align: middle; }
.adx-annales .a-year { font-family: var(--serif); font-size: 1.35rem; font-weight: 600; color: var(--navy); }
.adx-legend { display: flex; flex-wrap: wrap; gap: 1rem 1.6rem; align-items: center; color: var(--muted); font-size: .88rem; }

/* ---------- Formules ---------- */
.adx-plan { position: relative; background: var(--paper); border-radius: 20px; padding: 2.2rem 1.7rem; height: 100%; border: 1px solid var(--line); display: flex; flex-direction: column; }
.adx-plan .btn { margin-top: auto; }
.adx-plan-featured { border: 1px solid var(--navy); box-shadow: 0 18px 40px rgba(0,32,96,.14); }
.adx-plan-badge { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #e8cf9e; font-weight: 700; font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; padding: .3rem .9rem; border-radius: 999px; }
.adx-plan h3 { font-family: var(--serif); font-weight: 600; color: var(--navy); }
.adx-price { font-family: var(--serif); font-size: 2.3rem; font-weight: 600; color: var(--ink); }
.adx-duration { color: var(--muted); }
.adx-plan-list { list-style: none; padding-left: 0; margin-bottom: 1.6rem; }
.adx-plan-list li { padding: .35rem 0 .35rem 1.6rem; position: relative; }
.adx-plan-list li::before { content: "\F26E"; font-family: "bootstrap-icons"; position: absolute; left: 0; color: var(--sky); }
.adx-plan-list li.is-off { color: #a8aec0; }
.adx-plan-list li.is-off::before { content: "\F62A"; color: #c3c8d4; }

/* ---------- Panneaux divers ---------- */
.adx-sub-pill { padding: .5rem 1rem; border-radius: 999px; font-weight: 600; }
.adx-sub-ok { background: #e3f4ea; color: #1b6b3a; }
.adx-progress { width: 120px; height: 6px; }
.adx-progress .progress-bar { background: var(--sky); }

/* ---------- Pied de page ---------- */
.adx-footer { background: var(--ink); color: rgba(255,255,255,.7); padding: 3rem 0 1.6rem; font-size: .9rem; border-top: 3px solid var(--gold); }
.adx-footer a { color: rgba(255,255,255,.85); text-decoration: none; }
.adx-footer a:hover { color: #fff; }
.adx-footer h6 { color: #e8cf9e; font-size: .72rem; letter-spacing: .2em; text-transform: uppercase; margin-bottom: .9rem; }
.adx-footer .f-logo { font-family: var(--serif); font-size: 1.6rem; font-weight: 700; color: #fff; }
.adx-footer .f-logo b { color: var(--sky); }
.adx-footer ul { list-style: none; padding: 0; margin: 0; }
.adx-footer li { padding: .2rem 0; }
.adx-footer .f-bottom { border-top: 1px solid rgba(255,255,255,.1); margin-top: 2rem; padding-top: 1.2rem; font-size: .8rem; }

/* ---------- Lecteur ---------- */
.adx-reader-body { background: #1d2230; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.adx-reader-main { flex: 1; display: flex; }
.adx-reader { flex: 1; display: flex; flex-direction: column; height: calc(100vh - 62px); }
.adx-reader-bar { display: flex; align-items: center; gap: .75rem; padding: .5rem 1rem; background: var(--ink); color: #fff; }
.adx-reader-bar .btn { border-radius: 8px; }
.adx-reader-title { flex: 1; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--serif); }
.adx-reader-kicker { font-family: var(--sans); font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: #e0c48f; margin-right: .6rem; }
.adx-reader-controls { display: flex; gap: .4rem; }
.adx-reader-stage { flex: 1; min-height: 0; overflow: auto; text-align: center; position: relative; padding: 0; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.adx-reader-nav { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .6rem 1rem; background: var(--ink); color: #fff; }
.adx-reader-nav .btn { border-radius: 8px; }
.adx-page-indicator input { width: 4.5rem; text-align: center; border-radius: 6px; border: none; padding: .2rem; }

.adx-track { display: flex; gap: 1rem; padding: 1rem; }
.adx-slot { position: relative; flex: 0 0 auto; background: #fff; box-shadow: 0 6px 24px rgba(0,0,0,.45); aspect-ratio: var(--ratio, 1 / 1.414); }
.adx-slot img { display: block; width: 100%; height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.adx-slot-placeholder { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 1rem; color: #6c7580; font-size: .95rem; }
.adx-slot-locked { background: linear-gradient(160deg, #fffdf8, #f1ece0); }
.adx-lock { display: flex; flex-direction: column; align-items: center; gap: .8rem; max-width: 320px; color: var(--ink); }
.adx-lock i { font-size: 2rem; color: var(--gold); }
.adx-lock p { margin: 0; font-family: var(--serif); font-size: 1.05rem; }

.adx-mode-vertical .adx-reader-stage { overflow-y: auto; overflow-x: auto; }
.adx-mode-vertical .adx-track { flex-direction: column; align-items: center; }
.adx-mode-vertical .adx-slot { width: min(calc(var(--adx-zoom, 1) * 100%), calc(var(--adx-zoom, 1) * 900px)); scroll-margin-top: 1rem; }
.adx-mode-horizontal .adx-reader-stage { overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; }
.adx-mode-horizontal .adx-track { height: 100%; align-items: stretch; padding: 0; gap: 0; }
.adx-mode-horizontal .adx-slot { width: 100%; min-width: 100%; height: 100%; aspect-ratio: auto; background: transparent; box-shadow: none; scroll-snap-align: start; overflow: auto; padding: 1rem; }
.adx-mode-horizontal .adx-slot img { height: auto; max-height: 100%; width: auto; max-width: 100%; margin: 0 auto; background: #fff; box-shadow: 0 6px 24px rgba(0,0,0,.45); }
.adx-mode-horizontal.adx-zoomed .adx-reader-stage { scroll-snap-type: none; }
.adx-mode-horizontal.adx-zoomed .adx-slot img { max-height: none; max-width: none; width: calc(var(--adx-zoom, 1) * 100%); }
.adx-mode-horizontal .adx-slot-placeholder { inset: 1rem; background: #fff; }

.adx-shield { display: none; position: absolute; inset: 0; z-index: 5; align-items: center; justify-content: center; text-align: center; padding: 2rem; color: #fff; font-weight: 600; background: rgba(11,23,51,.88); cursor: pointer; }
.adx-shielded .adx-shield { display: flex; position: fixed; }
.adx-shielded .adx-track { filter: blur(28px); }
@media print { body { display: none !important; } }

/* ---------- Administration ---------- */
.adx-stat { background: var(--paper); border-radius: 14px; padding: 1.2rem; border: 1px solid var(--line); height: 100%; }
.adx-stat .value { font-family: var(--serif); font-size: 1.8rem; font-weight: 600; color: var(--navy); }
.adx-stat .label { color: var(--muted); font-size: .9rem; }
.adx-admin-nav .nav-link { color: var(--navy); border-radius: 999px; }
.adx-admin-nav .nav-link.active { background: var(--navy); color: #fff; }
.adx-print-admin { background: #f3efe5; border-radius: 12px; padding: 1rem 1rem .25rem; }

/* ---------- Paiement Wave ---------- */
.adx-wave-box { display: flex; align-items: center; gap: 1.5rem; background: var(--sky-soft); border: 1px solid #b9e0fb; border-radius: 16px; padding: 1rem 1.25rem; flex-wrap: wrap; }
.adx-wave-qr { width: 170px; height: 170px; object-fit: contain; background: #fff; border-radius: 10px; padding: 6px; }
.btn-adx-wave { background: #1dc8ff; color: #04243a; font-weight: 700; border: none; }
.btn-adx-wave:hover { background: #10a9dc; color: #fff; }
.adx-wave-guide { background: #fff; border: 1px dashed #1dc8ff; border-radius: 14px; padding: 1rem 1.25rem; }
.adx-wave-guide ol { padding-left: 1.2rem; }

/* ---------- Avis ---------- */
.adx-stars { color: #d9a63a; white-space: nowrap; }
.adx-review { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: .9rem 1.1rem; margin-bottom: .75rem; }
.adx-star-input { display: inline-flex; flex-direction: row-reverse; gap: .2rem; font-size: 1.6rem; }
.adx-star-input input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.adx-star-input label { color: #cfd5dc; cursor: pointer; }
.adx-star-input input:checked ~ label, .adx-star-input label:hover, .adx-star-input label:hover ~ label { color: #d9a63a; }
.adx-star-input input:focus-visible + label { outline: 2px solid var(--navy-2); border-radius: 4px; }

/* ---------- Livres imprimés ---------- */
.adx-print-tag { font-size: .8rem; color: var(--ok); margin-top: .2rem; }
.adx-print-box { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; background: #eef7f2; border: 1px solid #cfe7da; border-radius: 16px; padding: 1rem 1.25rem; }
.adx-print-band, .adx-print-hero { background: var(--paper); border: 1px solid var(--line); border-radius: 20px; padding: 2rem; }
.adx-print-item { display: flex; gap: 1rem; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 1rem; height: 100%; }
.adx-print-cover { width: 110px; flex: 0 0 110px; }
.adx-legal h2 { margin-top: 1.5rem; color: var(--navy); }

/* ---------- Formulaires ---------- */
.form-control, .form-select { border-radius: 10px; border-color: var(--line); background-color: #fff; }
.form-control:focus, .form-select:focus { border-color: var(--sky); box-shadow: 0 0 0 .2rem rgba(0,153,255,.15); }
.table { --bs-table-bg: transparent; }
.alert { border-radius: 14px; }

@media (max-width: 991px) {
  .adx-hero { padding: 3.5rem 0; }
  .adx-tomes { margin-top: 2.5rem; }
  .adx-tome { width: 108px; }
  .adx-tome .t-band { font-size: .62rem; }
  .adx-tome .t-num { font-size: 1.6rem; }
}
