/* Teral — base commune (site, inscription, espace de gestion, admin) */
:root {
    --navy: #073565;
    --navy-2: #0b4a8c;
    --navy-900: #04203f;
    --navy-950: #021428;
    --orange: #fa3009;
    --orange-600: #dc2804;
    --orange-50: #fff1ec;
    --orange-100: #ffe0d5;
    --bg: #f6f7fb;
    --card: #ffffff;
    --ink: #0f172a;
    --ink-2: #1e293b;
    --muted: #475569;
    --muted-2: #64748b;
    --line: #e2e8f0;
    --line-2: #eef2f7;
    --success: #16a34a;
    --success-50: #ecfdf3;
    --warning: #d97706;
    --warning-50: #fffbeb;
    --danger: #dc2626;
    --danger-50: #fef2f2;
    --info-50: #eff6ff;

    --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --display: 'Bricolage Grotesque', 'Plus Jakarta Sans', system-ui, sans-serif;

    --r-sm: 8px;
    --r: 12px;
    --r-lg: 18px;
    --r-xl: 26px;

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
    --shadow: 0 4px 14px -4px rgba(15, 23, 42, .10), 0 1px 3px rgba(15, 23, 42, .05);
    --shadow-lg: 0 18px 40px -12px rgba(7, 53, 101, .22), 0 4px 10px -4px rgba(15, 23, 42, .08);
    --shadow-xl: 0 30px 70px -20px rgba(7, 53, 101, .35);
    --ring: 0 0 0 4px rgba(250, 48, 9, .18);
    --ease: cubic-bezier(.22, 1, .36, 1);
    --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.55; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
img, svg, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; letter-spacing: -.02em; color: var(--ink); }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid rgba(250, 48, 9, .55); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--orange-100); color: var(--navy-900); }

svg.lucide, i[data-lucide] { width: 1.15em; height: 1.15em; stroke-width: 2; flex-shrink: 0; display: inline-block; vertical-align: -.18em; }
.brand-ico { display: inline-block; width: 1.15em; height: 1.15em; background: currentColor; -webkit-mask: var(--ico) center / contain no-repeat; mask: var(--ico) center / contain no-repeat; flex-shrink: 0; }

/* ---------- Boutons ---------- */
.btn { --b-bg: var(--card); --b-fg: var(--ink); --b-bd: var(--line);
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 44px; padding: .65rem 1.15rem;
    border-radius: 12px; border: 1px solid var(--b-bd); background: var(--b-bg); color: var(--b-fg); font-weight: 650; font-size: .95rem;
    line-height: 1.2; white-space: nowrap; cursor: pointer; transition: transform .2s var(--ease), box-shadow .2s var(--ease), background .2s, border-color .2s, color .2s; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0) scale(.98); }
.btn[disabled], .btn.is-loading { opacity: .65; pointer-events: none; }
.btn-primary { --b-bg: var(--orange); --b-fg: #fff; --b-bd: var(--orange); box-shadow: 0 8px 20px -8px rgba(250, 48, 9, .6); }
.btn-primary:hover { --b-bg: var(--orange-600); --b-bd: var(--orange-600); box-shadow: 0 12px 26px -10px rgba(250, 48, 9, .7); }
.btn-navy { --b-bg: var(--navy); --b-fg: #fff; --b-bd: var(--navy); }
.btn-navy:hover { --b-bg: var(--navy-2); --b-bd: var(--navy-2); }
.btn-ghost { --b-bg: transparent; --b-bd: transparent; }
.btn-ghost:hover { --b-bg: var(--line-2); box-shadow: none; }
.btn-soft { --b-bg: var(--orange-50); --b-fg: var(--orange-600); --b-bd: transparent; }
.btn-danger { --b-bg: var(--danger-50); --b-fg: var(--danger); --b-bd: #fecaca; }
.btn-white { --b-bg: #fff; --b-fg: var(--navy); --b-bd: #fff; }
.btn-outline-white { --b-bg: rgba(255,255,255,.06); --b-fg: #fff; --b-bd: rgba(255,255,255,.35); }
.btn-outline-white:hover { --b-bg: rgba(255,255,255,.14); }
.btn-sm { min-height: 36px; padding: .4rem .8rem; font-size: .85rem; border-radius: 10px; }
.btn-lg { min-height: 54px; padding: .9rem 1.6rem; font-size: 1.02rem; border-radius: 14px; }
.btn-block { width: 100%; }
.btn-icon { width: 40px; min-height: 40px; padding: 0; }
.btn .spinner { width: 1em; height: 1em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Formulaires ---------- */
.field { display: grid; gap: .4rem; }
.field + .field, .field + .grid-2, .grid-2 + .field, .grid-2 + .grid-2 { margin-top: 1rem; }
.label { font-weight: 650; font-size: .88rem; color: var(--ink-2); display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.label small { font-weight: 500; color: var(--muted-2); }
.hint { font-size: .82rem; color: var(--muted-2); }
.input, .select, .textarea { width: 100%; min-height: 46px; padding: .7rem .9rem; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; font-size: 16px; transition: border-color .2s, box-shadow .2s; }
.input:hover, .select:hover, .textarea:hover { border-color: #cbd5e1; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--orange); box-shadow: var(--ring); }
.textarea { min-height: 96px; resize: vertical; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2364748b' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .8rem center; padding-right: 2.4rem; }
.input-group { display: flex; align-items: stretch; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; overflow: hidden; transition: border-color .2s, box-shadow .2s; }
.input-group:focus-within { border-color: var(--orange); box-shadow: var(--ring); }
.input-group .input { border: 0; box-shadow: none !important; border-radius: 0; }
.input-group .addon { display: flex; align-items: center; padding: 0 .85rem; background: var(--line-2); color: var(--muted); font-size: .9rem; white-space: nowrap; }
.input-icon { position: relative; }
.input-icon > svg, .input-icon > i { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--muted-2); pointer-events: none; }
.input-icon .input { padding-left: 2.6rem; }
.field-error { color: var(--danger); font-size: .82rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* Interrupteur */
.switch { position: relative; display: inline-flex; flex-shrink: 0; width: 46px; height: 26px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: #cbd5e1; transition: background .25s var(--ease); }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.2); transition: transform .3s var(--ease-spring); }
.switch input:checked + span { background: var(--success); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { box-shadow: var(--ring); }

/* Cases à choix illustrées */
.choice { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice-box { display: flex; gap: .9rem; align-items: center; padding: 1rem 1.1rem; border: 2px solid var(--line); border-radius: var(--r-lg); background: #fff; transition: border-color .2s, box-shadow .2s, transform .2s var(--ease); }
.choice:hover .choice-box { border-color: #cbd5e1; transform: translateY(-2px); box-shadow: var(--shadow); }
.choice input:checked + .choice-box { border-color: var(--orange); box-shadow: var(--ring); }
.choice input:focus-visible + .choice-box { box-shadow: var(--ring); }

/* ---------- Cartes & éléments ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: 1.4rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--line-2); }
.card-head h2, .card-head h3 { font-size: 1.02rem; display: flex; align-items: center; gap: .5rem; }
.card-body { padding: 1.4rem; }
.card-foot { padding: 1rem 1.4rem; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: .6rem; background: #fbfcfe; border-radius: 0 0 var(--r-lg) var(--r-lg); }

.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .6rem; border-radius: 99px; font-size: .75rem; font-weight: 700; background: var(--line-2); color: var(--muted); white-space: nowrap; }
.badge-success { background: var(--success-50); color: #15803d; }
.badge-warning { background: var(--warning-50); color: #b45309; }
.badge-danger { background: var(--danger-50); color: #b91c1c; }
.badge-orange { background: var(--orange-50); color: var(--orange-600); }
.badge-navy { background: #e8eff8; color: var(--navy); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }
.dot-live { position: relative; }
.dot-live::after { content: ''; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid currentColor; opacity: 0; animation: ping 1.8s var(--ease) infinite; }
@keyframes ping { 0% { transform: scale(.6); opacity: .8; } 100% { transform: scale(1.8); opacity: 0; } }

.alert { display: flex; gap: .75rem; align-items: flex-start; padding: .9rem 1.05rem; border-radius: var(--r); border: 1px solid; font-size: .92rem; }
.alert > svg, .alert > i { margin-top: .1rem; }
.alert-info { background: var(--info-50); border-color: #bfdbfe; color: #1e3a8a; }
.alert-success { background: var(--success-50); border-color: #bbf7d0; color: #14532d; }
.alert-warning { background: var(--warning-50); border-color: #fde68a; color: #78350f; }
.alert-danger { background: var(--danger-50); border-color: #fecaca; color: #7f1d1d; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.tiny { font-size: .76rem; }
.bold { font-weight: 700; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; } .mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.row { display: flex; align-items: center; gap: .75rem; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.divider { height: 1px; background: var(--line-2); margin: 1.25rem 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; z-index: 1000; bottom: 1.25rem; left: 50%; transform: translateX(-50%); display: grid; gap: .5rem; width: min(420px, calc(100vw - 2rem)); pointer-events: none; }
.toast { display: flex; align-items: center; gap: .7rem; padding: .85rem 1rem; border-radius: 14px; background: var(--navy-950); color: #fff; box-shadow: var(--shadow-xl); font-weight: 550; font-size: .92rem; pointer-events: auto; animation: toastIn .45s var(--ease-spring); }
.toast.is-out { animation: toastOut .3s var(--ease) forwards; }
.toast-ico { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--success); flex-shrink: 0; }
.toast-error .toast-ico { background: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px); } }

/* ---------- Fenêtres modales ---------- */
.modal { position: fixed; inset: 0; z-index: 900; display: grid; place-items: center; padding: 1rem; background: rgba(2, 20, 40, .55); backdrop-filter: blur(6px); opacity: 0; visibility: hidden; transition: opacity .25s, visibility .25s; }
.modal.is-open { opacity: 1; visibility: visible; }
.modal-dialog { width: min(560px, 100%); max-height: calc(100vh - 2rem); overflow: auto; background: #fff; border-radius: 22px; box-shadow: var(--shadow-xl); transform: translateY(18px) scale(.97); transition: transform .35s var(--ease-spring); }
.modal.is-open .modal-dialog { transform: none; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.2rem 1.4rem .4rem; }
.modal-head h3 { font-size: 1.15rem; }
.modal-body { padding: 1rem 1.4rem 1.4rem; }
.modal-foot { display: flex; justify-content: flex-end; gap: .6rem; padding: 0 1.4rem 1.4rem; }
@media (max-width: 640px) {
    .modal { place-items: end center; padding: 0; }
    .modal-dialog { border-radius: 22px 22px 0 0; max-height: 92vh; transform: translateY(100%); }
}

/* Logo */
.logo { display: inline-flex; align-items: center; }
.logo img { height: 34px; width: auto; }

/* Animations d'apparition */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .8s var(--ease), transform .8s var(--ease); transition-delay: var(--d, 0s); }
.reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
    .reveal { opacity: 1; transform: none; }
}
