/* ============================================================
   ST LAB — app.css
   Variables, reset, utilitaires transverses (front + admin)
   Chargé en premier partout (avant front.css ou admin.css)

   Référence : CLAUDE.md L233-260, UX.md palette officielle
   ============================================================ */

/* ============================================================
   Police Cubic — utilisée par le wordmark "Lab" du logo.
   Auto-hébergée pour garantir la cohérence visuelle quel que
   soit le contexte (PDF lead-magnet, emails, mode hors-ligne).
   WOFF2 prioritaire (3x plus léger), TTF en fallback.
   ============================================================ */
@font-face {
    font-family: 'Cubic';
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url('/assets/fonts/cubic.woff2') format('woff2'),
         url('/assets/fonts/cubic.ttf') format('truetype');
}

:root {
    /* ============== Palette ST Lab ============== */
    --c-blue-900:    #050B15;
    --c-blue-800:    #0A2540;
    --c-blue-700:    #0F3155;
    --c-blue-600:    #1a3a6b;
    --c-blue-500:    #2a5393;

    --c-orange-500:  #FF7A00;
    --c-orange-400:  #FF9233;
    --c-orange-300:  #FFB366;
    --c-orange-200:  #FFD199;

    --c-white:       #FFFFFF;
    --c-off-white:   #F5F6F8;
    --c-ivory:       #FAF7F2;
    --c-grey-100:    #E4E6EA;
    --c-grey-300:    #C0C5D0;
    --c-grey-400:    #8892A8;
    --c-grey-500:    #64748B;
    --c-grey-600:    #5A657A;
    --c-grey-800:    #2A3245;
    --c-black:       #000000;

    /* ============== Glass surfaces (fond sombre) ============== */
    --glass-weak:           rgba(255, 255, 255, 0.03);
    --glass-mid:            rgba(255, 255, 255, 0.06);
    --glass-strong:         rgba(255, 255, 255, 0.10);
    --glass-border:         rgba(255, 255, 255, 0.08);
    --glass-border-strong:  rgba(255, 255, 255, 0.14);

    /* ============== Sémantiques (flash, badges) ============== */
    --c-success:  #10B981;
    --c-error:    #DC2626;
    --c-warning:  #D97706;
    --c-info:     #2563EB;

    /* ============== Typographie ============== */
    --ff-display: 'Bricolage Grotesque', 'Helvetica Neue', sans-serif;
    --ff-serif:   'Fraunces', 'Georgia', serif;
    --ff-body:    'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
    --ff-mono:    'JetBrains Mono', 'Courier New', monospace;

    /* ============== Échelle responsive ============== */
    --fs-xs:      clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
    --fs-sm:      clamp(0.875rem, 0.8rem + 0.375vw, 1rem);
    --fs-base:    clamp(1rem, 0.9rem + 0.5vw, 1.125rem);
    --fs-md:      clamp(1.125rem, 1rem + 0.625vw, 1.375rem);
    --fs-lg:      clamp(1.5rem, 1.25rem + 1.25vw, 2rem);
    --fs-xl:      clamp(2rem, 1.5rem + 2.5vw, 3.5rem);
    --fs-2xl:     clamp(2.75rem, 2rem + 3.75vw, 5rem);

    /* ============== Espacements ============== */
    --sp-xs:  0.5rem;
    --sp-sm:  1rem;
    --sp-md:  2rem;
    --sp-lg:  4rem;
    --sp-xl:  6rem;
    --sp-2xl: 9rem;

    /* ============== Easings ============== */
    --e-out:     cubic-bezier(0.16, 1, 0.3, 1);
    --e-in-out:  cubic-bezier(0.65, 0, 0.35, 1);
    --e-elastic: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    --e-spring:  cubic-bezier(0.22, 1, 0.36, 1);

    /* ============== Layout ============== */
    --max-width: 1560px;
    --radius-sm:  6px;
    --radius-md:  10px;
    --radius-lg:  16px;
    --radius-xl:  24px;
    --radius-pill: 999px;

    /* ============== Shadows ============== */
    --shadow-sm:  0 2px 8px rgba(5, 11, 21, 0.10);
    --shadow-md:  0 8px 24px rgba(5, 11, 21, 0.18);
    --shadow-lg:  0 16px 48px rgba(5, 11, 21, 0.32);
    --shadow-glow: 0 8px 24px -8px rgba(255, 122, 0, 0.45);
}

/* ============================================================
   Utilitaires transverses
   ============================================================ */

/* Masquer un élément (utilisé par flash data, overlay loader, etc.) */
.stl-hidden {
    display: none !important;
}

/* Visually hidden (a11y — lu par lecteurs d'écran, invisible) */
.stl-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============================================================
   Reset minimal complémentaire
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

img, picture, video, canvas, svg {
    display: block;
    max-width: 100%;
}

button, input, select, textarea {
    font: inherit;
    color: inherit;
}

/* iOS zoom-fix obligatoire — UX.md L287 */
input, textarea, select {
    font-size: 16px;
}

/* ============================================================
   Focus visible — a11y partout
   ============================================================ */
:focus-visible {
    outline: 2px solid var(--c-orange-500);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ============================================================
   prefers-reduced-motion — désactive animations partout
   UX.md L277
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* =============================================================
   #BOUTONS SIGNATURE ST LAB  —  « Forge »
   ─────────────────────────────────────────────────────────────
   Système unique. À utiliser PARTOUT (front + admin), sans exception.
   Migré depuis front.css vers app.css car utilisé sur les pages admin
   standalone (login, forgot password, verify code, reset).
   Marqueurs signature non-négociables :
     1. Trace orbite (point orange parcourt le contour au hover)
     2. Double-trait (bordure ext + intérieure 2px gap)
     3. Shimmer glissant + arrow qui décolle (45°)
     4. Press 3D au :active (translate + shadow inversée)
   ─────────────────────────────────────────────────────────────
   Variants : --primary | --ghost | --icon
   Modifiers : --block | --lg | --sm
   États : :hover, :focus-visible, :active, [disabled], [data-loading]
   ============================================================= */

.stl-btn {
    --stl-btn-bg:        rgba(255, 255, 255, 0.06);
    --stl-btn-bg-hover:  var(--c-orange-500);
    --stl-btn-fg:        var(--c-white);
    --stl-btn-fg-hover:  var(--c-white);
    --stl-btn-border:    rgba(255, 255, 255, 0.18);
    --stl-btn-border-hover: var(--c-orange-500);
    --stl-btn-trace:     var(--c-orange-500);
    --stl-btn-shadow:    0 8px 24px -10px rgba(255, 122, 0, 0.35);
    --stl-btn-px:        1.5rem;
    --stl-btn-py:        0.95rem;
    --stl-btn-fs:        0.9375rem;
    --stl-btn-radius:    8px;

    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
    min-height: 48px;
    padding: var(--stl-btn-py) var(--stl-btn-px);
    border: 1px solid var(--stl-btn-border);
    border-radius: var(--stl-btn-radius);
    background: var(--stl-btn-bg);
    color: var(--stl-btn-fg);

    font-family: var(--ff-display);
    font-size: var(--stl-btn-fs);
    font-weight: 600;
    letter-spacing: -0.005em;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;

    cursor: pointer;
    user-select: none;
    isolation: isolate;
    overflow: hidden;
    transition:
        background-color 0.4s var(--e-out),
        border-color    0.4s var(--e-out),
        color           0.3s var(--e-out),
        transform       0.18s var(--e-spring),
        box-shadow      0.4s var(--e-out),
        letter-spacing  0.4s var(--e-out);
    will-change: transform;
    -webkit-tap-highlight-color: transparent;
}

.stl-btn::before {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: calc(var(--stl-btn-radius) - 3px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    pointer-events: none;
    z-index: 0;
    transition: border-color 0.4s var(--e-out), inset 0.3s var(--e-out);
}

.stl-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        100deg,
        transparent 30%,
        rgba(255, 255, 255, 0.22) 50%,
        transparent 70%
    );
    transform: translateX(-110%);
    transition: transform 0.85s var(--e-out);
    pointer-events: none;
    z-index: 1;
}

.stl-btn__label,
.stl-btn__arrow {
    position: relative;
    z-index: 2;
}

.stl-btn__arrow {
    display: inline-flex;
    width: 16px;
    height: 16px;
    transition:
        transform 0.4s var(--e-spring),
        opacity 0.3s var(--e-out);
}

.stl-btn__arrow svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
    fill: none;
}

.stl-btn__dot {
    position: relative;
    z-index: 2;
    width: 8px;
    height: 8px;
    background: var(--c-orange-500);
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(255, 122, 0, 0.6);
    animation: stl-btn-dot 2s var(--e-in-out) infinite;
}

@keyframes stl-btn-dot {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 122, 0, 0.6); }
    50%      { box-shadow: 0 0 0 8px rgba(255, 122, 0, 0); }
}

.stl-btn__trace {
    position: absolute;
    width: 6px;
    height: 6px;
    background: var(--stl-btn-trace);
    border-radius: 50%;
    box-shadow: 0 0 12px var(--stl-btn-trace), 0 0 4px var(--stl-btn-trace);
    offset-path: inset(0 round var(--stl-btn-radius));
    offset-distance: 0%;
    opacity: 0;
    pointer-events: none;
    z-index: 3;
    transition: opacity 0.25s var(--e-out);
}

.stl-btn:hover {
    color: var(--stl-btn-fg-hover);
    background: var(--stl-btn-bg-hover);
    border-color: var(--stl-btn-border-hover);
    letter-spacing: 0.005em;
    box-shadow: var(--stl-btn-shadow);
}

.stl-btn:hover::before {
    border-color: rgba(255, 255, 255, 0.18);
}

.stl-btn:hover::after {
    transform: translateX(110%);
}

.stl-btn:hover .stl-btn__trace {
    opacity: 1;
    animation: stl-btn-orbit 1.6s linear infinite;
}

.stl-btn:hover .stl-btn__arrow {
    transform: translateX(4px) translateY(-1px) rotate(-45deg);
}

@keyframes stl-btn-orbit {
    to { offset-distance: 100%; }
}

.stl-btn:focus-visible {
    outline: none;
    box-shadow:
        0 0 0 2px var(--c-blue-900),
        0 0 0 4px var(--c-orange-500),
        var(--stl-btn-shadow);
}

.stl-btn:active {
    transform: translateY(1px) scale(0.98);
    transition-duration: 0.08s;
    box-shadow:
        inset 0 2px 4px rgba(0, 0, 0, 0.2),
        var(--stl-btn-shadow);
}

.stl-btn[disabled],
.stl-btn[aria-disabled="true"] {
    cursor: not-allowed;
    opacity: 0.45;
    pointer-events: none;
}

.stl-btn[data-loading="true"] {
    pointer-events: none;
    color: transparent;
}

.stl-btn[data-loading="true"]::before {
    content: '';
    position: absolute;
    inset: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    color: var(--stl-btn-fg);
    animation: stl-btn-spin 0.8s linear infinite;
    border-top-color: var(--c-orange-500);
}

@keyframes stl-btn-spin {
    to { transform: rotate(360deg); }
}

.stl-btn--primary {
    --stl-btn-bg:           var(--c-orange-500);
    --stl-btn-bg-hover:     var(--c-orange-400);
    --stl-btn-fg:           var(--c-white);
    --stl-btn-fg-hover:     var(--c-blue-900);
    --stl-btn-border:       var(--c-orange-500);
    --stl-btn-border-hover: var(--c-orange-400);
    --stl-btn-trace:        var(--c-white);
    --stl-btn-shadow:       0 12px 36px -10px rgba(255, 122, 0, 0.55);
    font-weight: 700;
}

.stl-btn--primary::before {
    border-color: rgba(255, 255, 255, 0.22);
}

.stl-btn--primary:hover::before {
    border-color: rgba(10, 11, 21, 0.25);
}

.stl-btn--ghost {
    --stl-btn-bg:           transparent;
    --stl-btn-bg-hover:     transparent;
    --stl-btn-fg:           var(--c-white);
    --stl-btn-fg-hover:     var(--c-orange-500);
    --stl-btn-border:       rgba(255, 255, 255, 0.22);
    --stl-btn-border-hover: var(--c-orange-500);
    --stl-btn-shadow:       none;
    font-weight: 500;
}

.stl-btn--ghost::after {
    display: none;
}

.stl-btn--ghost:hover {
    box-shadow: 0 0 0 1px var(--c-orange-500), 0 8px 24px -12px rgba(255, 122, 0, 0.35);
}

.stl-btn--icon {
    width: 48px;
    height: 48px;
    min-height: 48px;
    padding: 0;
    --stl-btn-radius: 10px;
}

.stl-btn--icon .stl-btn__arrow {
    width: 18px;
    height: 18px;
}

.stl-btn--icon:hover .stl-btn__arrow {
    transform: rotate(-45deg) scale(1.1);
}

.stl-btn--block {
    display: flex;
    width: 100%;
}

.stl-btn--lg {
    --stl-btn-px: 2rem;
    --stl-btn-py: 1.15rem;
    --stl-btn-fs: 1.0625rem;
    min-height: 56px;
    gap: 0.9rem;
}

.stl-btn--lg .stl-btn__arrow {
    width: 18px;
    height: 18px;
}

.stl-btn--sm {
    --stl-btn-px: 1.1rem;
    --stl-btn-py: 0.65rem;
    --stl-btn-fs: 0.825rem;
    min-height: 44px;                /* UX.md L372 — corrigé : touch target ≥ 44 px */
    gap: 0.5rem;
}

.stl-btn--sm .stl-btn__arrow {
    width: 13px;
    height: 13px;
}

@media (prefers-reduced-motion: reduce) {
    .stl-btn,
    .stl-btn::after,
    .stl-btn__arrow,
    .stl-btn__dot,
    .stl-btn__trace {
        animation: none !important;
        transition-duration: 0.01ms !important;
    }
    .stl-btn:hover .stl-btn__trace { opacity: 0; }
}

@media (max-width: 480px) {
    .stl-btn {
        --stl-btn-px: 1.25rem;
        --stl-btn-fs: 0.9rem;
    }
}

/* =============================================================
   #SWITCH SIGNATURE ST LAB  —  Toggle iOS-style
   ─────────────────────────────────────────────────────────────
   Composant unique partout (front + admin). Inspiré du form-switch
   Bootstrap mais auto-suffisant (pas de dépendance Bootstrap).
   Pattern HTML (toujours via _partials/switch.html.twig) :

   <label class="stl-switch [stl-switch--card] [stl-switch--compact] [stl-switch--light]">
       <input type="checkbox" name="..." {checked}>
       <span class="stl-switch__track" aria-hidden="true"></span>
       <span class="stl-switch__label">Texte</span>
       [<span class="stl-switch__hint">Description optionnelle</span>]
   </label>

   Variants :
     --card    : encadré avec fond léger + label/hint en pile (cabinet's .toggle-wrapper)
     --compact : taille réduite (pour les tables, multi-colonnes)
     --light   : adapte les couleurs pour fond clair (frontend public)
   ============================================================= */

.stl-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    cursor: pointer;
    min-height: 44px;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.stl-switch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 1px;
    height: 1px;
}

.stl-switch__track {
    width: 42px;
    height: 24px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    position: relative;
    flex-shrink: 0;
    transition: background 0.18s var(--e-out), border-color 0.18s var(--e-out), box-shadow 0.18s var(--e-out);
}

.stl-switch__track::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s var(--e-spring);
}

.stl-switch input:checked ~ .stl-switch__track,
.stl-switch input:checked + .stl-switch__track {
    background: var(--c-orange-500);
    border-color: var(--c-orange-500);
    box-shadow: 0 0 0 2px rgba(255, 122, 0, 0.20);
}

.stl-switch input:checked ~ .stl-switch__track::after,
.stl-switch input:checked + .stl-switch__track::after {
    transform: translateX(18px);
}

.stl-switch input:focus-visible ~ .stl-switch__track,
.stl-switch input:focus-visible + .stl-switch__track {
    box-shadow: 0 0 0 3px rgba(255, 122, 0, 0.35);
}

.stl-switch input:disabled ~ .stl-switch__track,
.stl-switch input:disabled + .stl-switch__track {
    opacity: 0.4;
    cursor: not-allowed;
}

.stl-switch__label {
    font-size: 0.92rem;
    font-weight: 500;
    color: #fff;
    line-height: 1.4;
}

.stl-switch__hint {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.78rem;
    color: var(--c-grey-300, #94a3b8);
    line-height: 1.45;
}

/* === Variant --card : encadré (cabinet .toggle-wrapper) ===
   Dispose le track à droite, label + hint à gauche en pile.
*/
.stl-switch--card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1.1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    width: 100%;
}

.stl-switch--card .stl-switch__label {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.stl-switch--card .stl-switch__track {
    order: 2;
}

/* === Variant --compact : taille réduite (tables, multi-colonnes) === */
.stl-switch--compact {
    min-height: 32px;
    gap: 0.5rem;
}

.stl-switch--compact .stl-switch__track {
    width: 34px;
    height: 20px;
}

.stl-switch--compact .stl-switch__track::after {
    width: 14px;
    height: 14px;
    top: 2px;
    left: 2px;
}

.stl-switch--compact input:checked ~ .stl-switch__track::after,
.stl-switch--compact input:checked + .stl-switch__track::after {
    transform: translateX(14px);
}

.stl-switch--compact .stl-switch__label {
    font-size: 0.82rem;
}

/* === Variant --light : palette adaptée fond clair (frontend public) === */
.stl-switch--light .stl-switch__track {
    background: var(--c-grey-200, #E2E8F0);
    border-color: var(--c-grey-200, #E2E8F0);
}

.stl-switch--light .stl-switch__label {
    color: var(--c-blue-800, #0A2540);
}

.stl-switch--light .stl-switch__hint {
    color: var(--c-grey-500, #64748B);
}

.stl-switch--light.stl-switch--card {
    background: #fff;
    border: 1px solid var(--c-grey-200, #E2E8F0);
}

@media (prefers-reduced-motion: reduce) {
    .stl-switch__track,
    .stl-switch__track::after {
        transition: none !important;
    }
}
