/* ============================================================================
   World-Debrid · animations.css
   Système d'animations unifié — Tier 1 → 7 (sauf #11/12/14/15/16 spécifiques)
   Toutes les anims respectent prefers-reduced-motion: reduce.
   ============================================================================ */

/* ----- Bonus globaux (uniformisation) ----- */
html {
    scroll-behavior: smooth;
    accent-color: #6366f1; /* checkboxes/radios/range natifs alignés à l'accent du site */
}
a { text-decoration-skip-ink: auto; }

:root {
    --wd-d-fast:   0.2s;
    --wd-d-base:   0.4s;
    --wd-d-slow:   0.7s;
    --wd-d-loop:   1.6s;
    --wd-ease-snappy:   cubic-bezier(0.2, 0.8, 0.3, 1);
    --wd-ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
    --wd-ease-soft:     cubic-bezier(0.65, 0, 0.45, 1);

    --wd-accent:        var(--accent-primary, #6366f1);
    --wd-accent-hover:  var(--accent-primary-hover, #818cf8);
    --wd-accent-soft:   rgba(99, 102, 241, 0.15);
    --wd-success:       #10b981;
    --wd-error:         #ef4444;
}

/* ============================================================================
   #1 — Stagger reveal des résultats (.result-item dans #responseOutput)
   ============================================================================ */
#responseOutput .result-item {
    opacity: 0;
    transform: translateY(15px);
    animation: wdRowIn 0.5s var(--wd-ease-snappy) forwards;
    animation-delay: calc(var(--wd-i, 0) * 80ms);
}
@keyframes wdRowIn {
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================================================
   #2 — Checkmark SVG draw + pulse ring (.wd-success-icon)
   .wd-success-host neutralise les styles emoji natifs du span hôte
   ============================================================================ */
.wd-success-host {
    background: none !important;
    padding: 0 !important;
    font-size: 0 !important;
    border: none !important;
    width: auto !important;
    height: auto !important;
    line-height: 1 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
}
.wd-success-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--wd-accent-soft);
    border: 1.5px solid var(--wd-success);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    animation: wdSuccessPulse 0.6s var(--wd-ease-snappy);
}
.wd-success-icon::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    border: 1.5px solid var(--wd-success);
    opacity: 0;
    animation: wdSuccessRing 1s ease-out 0.3s;
}
.wd-success-icon svg {
    width: 12px;
    height: 12px;
    stroke: var(--wd-success);
    stroke-width: 4;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.wd-success-icon svg path {
    stroke-dasharray: 60;
    stroke-dashoffset: 60;
    animation: wdDrawCheck 0.5s var(--wd-ease-soft) 0.2s forwards;
}
@keyframes wdSuccessPulse {
    0%   { transform: scale(0.5); opacity: 0; }
    60%  { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}
@keyframes wdSuccessRing {
    0%   { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(1.6); opacity: 0; }
}
@keyframes wdDrawCheck {
    to { stroke-dashoffset: 0; }
}

/* ============================================================================
   #5 — Skeleton shimmer (.wd-skeleton)
   ============================================================================ */
.wd-skeleton {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.04) 0%,
        rgba(255, 255, 255, 0.10) 50%,
        rgba(255, 255, 255, 0.04) 100%
    );
    background-size: 200% 100%;
    animation: wdShimmer 1.4s ease-in-out infinite;
    border-radius: 8px;
    color: transparent !important;
    user-select: none;
    pointer-events: none;
}
.wd-skeleton-line { height: 12px; width: 100%; }
.wd-skeleton-line.short { width: 60%; }
.wd-skeleton-line.medium { width: 80%; }
.wd-skeleton-avatar { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; }
@keyframes wdShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================================================
   #6 — Morph button (loading → success)
   Applied via .wd-btn-morph on existing .btn-primary.

   Loading state is now strongly signalled:
   - Progress fill uses a high-contrast white gradient (was accent-on-accent)
   - Animated shine sweep on top of the fill
   - Rotating spinner icon injected by JS
   - Text swapped to "Débridage en cours" with cycling dots
   - Button pulses with a glow to draw the eye
   ============================================================================ */
.wd-btn-morph {
    position: relative;
    overflow: hidden;
    transition: background var(--wd-d-base) ease,
                box-shadow var(--wd-d-base) ease,
                transform var(--wd-d-base) ease;
}
.wd-btn-morph::before {
    content: '';
    position: absolute;
    inset: 0;
    width: 0%;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.30) 0%,
        rgba(255, 255, 255, 0.18) 100%
    );
    transition: width var(--wd-d-base) var(--wd-ease-standard);
    z-index: 0;
    pointer-events: none;
}
.wd-btn-morph > * { position: relative; z-index: 2; }
.wd-btn-morph.wd-loading {
    cursor: wait;
    animation: wdBtnPulse 1.8s ease-in-out infinite;
}
.wd-btn-morph.wd-loading::before { width: var(--wd-progress, 0%); }
.wd-btn-morph.wd-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 40%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.35) 50%,
        transparent 100%
    );
    transform: translateX(-100%);
    animation: wdBtnShine 1.3s ease-in-out infinite;
    pointer-events: none;
    z-index: 1;
}
@keyframes wdBtnPulse {
    0%, 100% { box-shadow: 0 4px 14px rgba(99, 102, 241, 0.25); }
    50%      { box-shadow: 0 4px 28px rgba(99, 102, 241, 0.70),
                           0 0 0 4px rgba(99, 102, 241, 0.18); }
}
@keyframes wdBtnShine {
    to { transform: translateX(350%); }
}

/* Spinner icon injected by WD.morphButton */
.wd-btn-spinner {
    display: inline-block;
    margin-right: 8px;
    animation: wdSpin 0.7s linear infinite;
}
@keyframes wdSpin {
    to { transform: rotate(360deg); }
}

/* Cycling dots next to the loading label */
.wd-btn-dots {
    display: inline-block;
    width: 1.2em;
    text-align: left;
}
.wd-btn-dots::after {
    content: '';
    animation: wdDots 1.2s steps(4, end) infinite;
}
@keyframes wdDots {
    0%   { content: ''; }
    25%  { content: '.'; }
    50%  { content: '..'; }
    75%  { content: '...'; }
    100% { content: ''; }
}

/* Success state — stop all loading anims, show solid green fill */
.wd-btn-morph.wd-success {
    background: var(--wd-success) !important;
    pointer-events: none;
    animation: none;
}
.wd-btn-morph.wd-success::before {
    width: 100%;
    background: var(--wd-success);
}
.wd-btn-morph.wd-success::after { display: none; }

/* ============================================================================
   #11 — Input focus glow pulsant (override .glass-input:focus)
   ============================================================================ */
.glass-input:focus {
    border-color: var(--wd-accent) !important;
    animation: wdFocusPulse 2s ease-in-out infinite;
}
@keyframes wdFocusPulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.10), 0 0 12px rgba(99, 102, 241, 0.15); }
    50%      { box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18), 0 0 24px rgba(99, 102, 241, 0.35); }
}


/* ============================================================================
   #12 — Theme switch crossfade
   ============================================================================ */
body.theme-transitioning,
body.theme-transitioning * {
    transition:
        background-color 0.8s ease,
        background 0.8s ease,
        color 0.8s ease,
        border-color 0.8s ease,
        box-shadow 0.8s ease,
        fill 0.8s ease,
        stroke 0.8s ease !important;
}

/* ============================================================================
   #14 — Glitch text (Arc theme uniquement)
   ============================================================================ */
[data-theme="arc"] .title.wd-glitch {
    position: relative;
    animation: wdGlitch 0.45s linear;
}
[data-theme="arc"] .title.wd-glitch::before,
[data-theme="arc"] .title.wd-glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
}
[data-theme="arc"] .title.wd-glitch::before {
    color: #ff00ea;
    animation: wdGlitchTop 0.45s linear;
    clip-path: polygon(0 0, 100% 0, 100% 33%, 0 33%);
}
[data-theme="arc"] .title.wd-glitch::after {
    color: #00fff0;
    animation: wdGlitchBot 0.45s linear;
    clip-path: polygon(0 67%, 100% 67%, 100% 100%, 0 100%);
}
@keyframes wdGlitch {
    0%, 100% { transform: translate(0); }
    20% { transform: translate(-2px, 1px); }
    40% { transform: translate(2px, -1px); }
    60% { transform: translate(-1px, -2px); }
    80% { transform: translate(1px, 2px); }
}
@keyframes wdGlitchTop {
    0%, 100% { transform: translate(0); }
    20% { transform: translate(-4px, -1px); }
    40% { transform: translate(3px, 2px); }
    60% { transform: translate(-2px, 1px); }
    80% { transform: translate(2px, -2px); }
}
@keyframes wdGlitchBot {
    0%, 100% { transform: translate(0); }
    20% { transform: translate(4px, 1px); }
    40% { transform: translate(-3px, -2px); }
    60% { transform: translate(2px, -1px); }
    80% { transform: translate(-2px, 2px); }
}

/* ============================================================================
   #15 — Type-on subtitle (Arc theme — applique sur .subtitle.wd-typeon)
   ============================================================================ */
[data-theme="arc"] .subtitle.wd-typeon {
    font-family: var(--font-tech, 'JetBrains Mono', monospace);
    border-right: 2px solid var(--accent-gold, #ECA925);
    padding-right: 4px;
    animation: wdCaret 0.8s step-end infinite;
    white-space: nowrap;
    overflow: hidden;
    display: inline-block;
}
@keyframes wdCaret {
    50% { border-color: transparent; }
}

/* ============================================================================
   #16 — Corner brackets stretch on hover (Arc theme — .glass-card)
   The base brackets (::before, ::after) already exist in styles.css for Arc.
   This adds the hover-stretch behavior + 2 extra corners (top-right, bottom-left)
   ============================================================================ */
[data-theme="arc"] .glass-card {
    transition: box-shadow var(--wd-d-base) ease;
}
[data-theme="arc"] .glass-card .wd-corner-tr,
[data-theme="arc"] .glass-card .wd-corner-bl {
    position: absolute;
    width: 12px;
    height: 12px;
    border-color: var(--accent-gold, #ECA925);
    border-style: solid;
    border-width: 0;
    transition: width 0.35s var(--wd-ease-snappy), height 0.35s var(--wd-ease-snappy);
    pointer-events: none;
}
[data-theme="arc"] .glass-card .wd-corner-tr { top: -1px; right: -1px; border-top-width: 2px; border-right-width: 2px; }
[data-theme="arc"] .glass-card .wd-corner-bl { bottom: -1px; left: -1px; border-bottom-width: 2px; border-left-width: 2px; }
[data-theme="arc"] .glass-card:hover {
    box-shadow: 0 0 30px rgba(236, 169, 37, 0.2);
}
[data-theme="arc"] .glass-card:hover::before,
[data-theme="arc"] .glass-card:hover::after,
[data-theme="arc"] .glass-card:hover .wd-corner-tr,
[data-theme="arc"] .glass-card:hover .wd-corner-bl {
    width: 28px !important;
    height: 28px !important;
}
[data-theme="arc"] .glass-card::before,
[data-theme="arc"] .glass-card::after {
    transition: width 0.35s var(--wd-ease-snappy), height 0.35s var(--wd-ease-snappy) !important;
}

/* ============================================================================
   Bonus C — Entrance fade-in stagger pour les .plan-card (plans.php)
   ============================================================================ */
.plans-grid .plan-card.wd-entrance {
    opacity: 0;
    transform: translateY(20px);
    animation: wdPlanIn 0.6s var(--wd-ease-snappy) forwards;
    animation-delay: calc(var(--wd-i, 0) * 100ms);
}
@keyframes wdPlanIn {
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================================================
   #22 — Title wave hover (per-letter)
   ============================================================================ */
.title.wd-letters {
    display: inline-block;
    /* Each letter is an inline-block via .wd-letter, so the browser can break
       at any letter boundary (e.g. "World-De" / "brid" on narrow viewports).
       Keep the whole title on one line; font-size is already responsive. */
    white-space: nowrap;
}
.title.wd-letters .wd-letter {
    display: inline-block;
    transition: transform var(--wd-d-base) var(--wd-ease-snappy), color 0.3s ease;
    cursor: default;
}
.title.wd-letters .wd-letter.wd-space {
    width: 0.3em;
    pointer-events: none;
}
.title.wd-letters .wd-letter:hover:not(.wd-space) {
    transform: translateY(-12px) scale(1.15);
    color: var(--wd-accent-hover);
}

/* ============================================================================
   #24 — Subtitle multi-language typewriter (purple theme)
   Markup injected by JS:
     <p class="subtitle wd-subtitle-typer">
        <span class="wd-typed">…</span><span class="wd-typer-caret"></span>
        <span class="wd-lang-tag">FR</span>
     </p>
   ============================================================================ */
.subtitle.wd-subtitle-typer {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    min-height: 1.6em;
}
.subtitle.wd-subtitle-typer .wd-typed {
    color: var(--text-primary, #e8e9ed);
    font-weight: 500;
}
.subtitle.wd-subtitle-typer .wd-typer-caret {
    display: inline-block;
    width: 2px;
    height: 1.05em;
    background: var(--wd-accent-hover);
    margin-left: 2px;
    vertical-align: middle;
    animation: wdTyperCaret 0.7s step-end infinite;
}
@keyframes wdTyperCaret {
    50% { background: transparent; }
}

/* ============================================================================
   #25 — Hosters wall wave (.host-item.wd-wave)
   ============================================================================ */
.host-item {
    transition:
        transform 0.4s var(--wd-ease-snappy),
        background 0.4s ease,
        color 0.4s ease,
        border-color 0.4s ease,
        box-shadow 0.4s ease;
    will-change: transform;
}
.host-item.wd-wave {
    transform: translateY(-10px) scale(1.08);
    background: var(--wd-accent) !important;
    color: white !important;
    border-color: var(--wd-accent-hover) !important;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
    z-index: 2;
    position: relative;
}

/* ============================================================================
   #26 — Copy button feedback (.wd-copy-btn)
   ============================================================================ */
.wd-copy-btn {
    position: relative;
    overflow: hidden;
    transition: background var(--wd-d-base) var(--wd-ease-snappy) !important;
}
.wd-copy-btn .wd-copy-default,
.wd-copy-btn .wd-copy-success {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: transform var(--wd-d-base) var(--wd-ease-snappy), opacity var(--wd-d-base) var(--wd-ease-snappy);
}
.wd-copy-btn .wd-copy-success {
    position: absolute;
    inset: 0;
    justify-content: center;
    transform: translateY(100%);
    opacity: 0;
}
.wd-copy-btn.wd-copied {
    background: var(--wd-success) !important;
}
.wd-copy-btn.wd-copied .wd-copy-default { transform: translateY(-100%); opacity: 0; }
.wd-copy-btn.wd-copied .wd-copy-success { transform: translateY(0); opacity: 1; }

/* ============================================================================
   #27 — Toast notifications (.wd-toast in .wd-toast-stack)
   ============================================================================ */
.wd-toast-stack {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
    z-index: 10010; /* au-dessus des modals existants (10000) */
    pointer-events: none;
    max-width: calc(100vw - 40px);
}
.wd-toast {
    background: var(--bg-card, #1a1d2e);
    border: 1px solid var(--border-primary, rgba(255, 255, 255, 0.08));
    border-left: 4px solid var(--wd-accent);
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 260px;
    max-width: 380px;
    animation: wdToastIn 0.45s var(--wd-ease-snappy);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    pointer-events: all;
    color: var(--text-primary, #e8e9ed);
    font-weight: 500;
    font-size: 0.9rem;
}
.wd-toast.wd-toast-success { border-left-color: var(--wd-success); }
.wd-toast.wd-toast-error   { border-left-color: var(--wd-error); }
.wd-toast.wd-toast-warning { border-left-color: #f59e0b; }
.wd-toast .wd-toast-icon { font-size: 1.1rem; flex-shrink: 0; }
.wd-toast.wd-toast-success .wd-toast-icon { color: var(--wd-success); }
.wd-toast.wd-toast-error   .wd-toast-icon { color: var(--wd-error); }
.wd-toast.wd-toast-warning .wd-toast-icon { color: #f59e0b; }
.wd-toast.wd-toast-info    .wd-toast-icon { color: var(--wd-accent-hover); }
.wd-toast .wd-toast-msg { flex: 1; }
.wd-toast.wd-exiting { animation: wdToastOut 0.35s ease-in forwards; }
@keyframes wdToastIn {
    from { transform: translateX(120%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}
@keyframes wdToastOut {
    to { transform: translateX(120%); opacity: 0; }
}

/* ============================================================================
   #28 — Drag & drop torrent zone (.wd-dropzone)
   ============================================================================ */
.wd-dropzone {
    position: relative;
    transition: all 0.3s ease;
    border: 2px dashed transparent;
    border-radius: 12px;
}
.wd-dropzone.wd-dropover {
    border-color: var(--wd-accent);
    background: var(--wd-accent-soft);
    transform: scale(1.01);
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.25), inset 0 0 30px rgba(99, 102, 241, 0.10);
}
.wd-dropzone.wd-dropover .file-upload-label,
.wd-dropzone.wd-dropover label {
    color: var(--wd-accent-hover);
}
.wd-dropzone.wd-dropover::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(99, 102, 241, 0.18), transparent 70%);
    pointer-events: none;
    border-radius: inherit;
    animation: wdDropPulse 1.5s ease-in-out infinite;
}
@keyframes wdDropPulse {
    0%, 100% { opacity: 0.5; }
    50%      { opacity: 1; }
}

/* ============================================================================
   #29 — Animated gradient mesh (.wd-mesh-bg as ::before pseudo on container)
   ============================================================================ */
.wd-mesh-bg {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}
.wd-mesh-bg::before {
    content: '';
    position: absolute;
    inset: -80px;
    z-index: -1;
    background:
        radial-gradient(circle 280px at 20% 30%, #6366f1 0%, transparent 50%),
        radial-gradient(circle 240px at 80% 60%, #ec4899 0%, transparent 50%),
        radial-gradient(circle 260px at 50% 90%, #10b981 0%, transparent 50%),
        radial-gradient(circle 220px at 70% 10%, #f59e0b 0%, transparent 50%);
    filter: blur(60px);
    opacity: 0.35;
    animation: wdMeshDrift 22s ease-in-out infinite;
    pointer-events: none;
}
@keyframes wdMeshDrift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33%      { transform: translate(30px, -20px) scale(1.08); }
    66%      { transform: translate(-25px, 25px) scale(0.95); }
}

/* ============================================================================
   #30 — Cursor halo (.wd-cursor-area)
   ============================================================================ */
.wd-cursor-area {
    position: relative;
}
.wd-cursor-halo {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.5), transparent 70%);
    pointer-events: none;
    transform: translate(-50%, -50%);
    mix-blend-mode: screen;
    z-index: 5;
    opacity: 0;
    transition: opacity var(--wd-d-fast) ease;
}
.wd-cursor-dot {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--wd-accent-hover);
    pointer-events: none;
    transform: translate(-50%, -50%);
    z-index: 6;
    box-shadow: 0 0 10px var(--wd-accent), 0 0 4px white;
    opacity: 0;
    transition: opacity var(--wd-d-fast) ease;
}
.wd-cursor-area.wd-cursor-active .wd-cursor-halo,
.wd-cursor-area.wd-cursor-active .wd-cursor-dot { opacity: 1; }

/* ============================================================================
   #31 — Slot machine counter (.wd-slot)
   ============================================================================ */
.wd-slot {
    display: inline-flex;
    gap: 2px;
    font-variant-numeric: tabular-nums;
}
.wd-slot-digit {
    display: inline-block;
    overflow: hidden;
    height: 1em;
    line-height: 1;
    width: 0.6em;
    text-align: center;
}
.wd-slot-strip {
    display: flex;
    flex-direction: column;
    transition: transform 1.4s var(--wd-ease-snappy);
}
.wd-slot-strip span {
    height: 1em;
    line-height: 1;
    color: inherit;
}

/* ============================================================================
   #32 — Shake on error (apply .wd-shake to any input/element)
   ============================================================================ */
.wd-shake {
    animation: wdShake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
    border-color: var(--wd-error) !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
}
@keyframes wdShake {
    10%, 90% { transform: translateX(-2px); }
    20%, 80% { transform: translateX(4px); }
    30%, 50%, 70% { transform: translateX(-8px); }
    40%, 60% { transform: translateX(8px); }
}

/* ============================================================================
   #33 — Progress steps wizard (.wd-steps)
   ============================================================================ */
.wd-steps {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 480px;
    margin: 16px auto;
}
.wd-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    z-index: 2;
}
.wd-step-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-card, #1a1d2e);
    border: 2px solid var(--border-primary, rgba(255, 255, 255, 0.08));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted, #6b7280);
    font-weight: 700;
    font-size: 0.9rem;
    transition: all 0.5s var(--wd-ease-snappy);
}
.wd-step.wd-active .wd-step-circle {
    background: var(--wd-accent);
    border-color: var(--wd-accent-hover);
    color: white;
    transform: scale(1.15);
    box-shadow: 0 0 0 6px rgba(99, 102, 241, 0.20);
}
.wd-step.wd-done .wd-step-circle {
    background: var(--wd-success);
    border-color: var(--wd-success);
    color: white;
}
.wd-step-label {
    font-size: 0.7rem;
    color: var(--text-muted, #6b7280);
    text-align: center;
    transition: color 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}
.wd-step.wd-active .wd-step-label,
.wd-step.wd-done .wd-step-label { color: var(--text-primary, #e8e9ed); }
.wd-step-line {
    flex: 1;
    height: 2px;
    background: var(--border-primary, rgba(255, 255, 255, 0.08));
    position: relative;
    overflow: hidden;
    margin: 0 -2px 22px;
}
.wd-step-line::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--wd-accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.6s var(--wd-ease-snappy);
}
.wd-step-line.wd-done::after { transform: scaleX(1); }

/* ============================================================================
   Admin surfaces — shared extensions
   (Apply across admin/* pages without touching each file.)
   ============================================================================ */

/* #A1 — Entrance stagger on admin stat grids.
   Works for .stats-grid > .stat-card and .user-stats-grid > .stat-card.
   CSS-only: nth-child delays up to 10. Anything beyond still renders fine,
   just without stagger delay. */
.stats-grid > .stat-card,
.user-stats-grid > .stat-card {
    opacity: 0;
    transform: translateY(12px);
    animation: wdStatCardIn 0.5s var(--wd-ease-snappy) forwards;
}
.stats-grid > .stat-card:nth-child(1),
.user-stats-grid > .stat-card:nth-child(1) { animation-delay: 0ms; }
.stats-grid > .stat-card:nth-child(2),
.user-stats-grid > .stat-card:nth-child(2) { animation-delay: 60ms; }
.stats-grid > .stat-card:nth-child(3),
.user-stats-grid > .stat-card:nth-child(3) { animation-delay: 120ms; }
.stats-grid > .stat-card:nth-child(4),
.user-stats-grid > .stat-card:nth-child(4) { animation-delay: 180ms; }
.stats-grid > .stat-card:nth-child(5),
.user-stats-grid > .stat-card:nth-child(5) { animation-delay: 240ms; }
.stats-grid > .stat-card:nth-child(6),
.user-stats-grid > .stat-card:nth-child(6) { animation-delay: 300ms; }
.stats-grid > .stat-card:nth-child(7),
.user-stats-grid > .stat-card:nth-child(7) { animation-delay: 360ms; }
.stats-grid > .stat-card:nth-child(8),
.user-stats-grid > .stat-card:nth-child(8) { animation-delay: 420ms; }
@keyframes wdStatCardIn {
    to { opacity: 1; transform: translateY(0); }
}

/* #A2 — Admin section hover lift (mirror of plan cards).
   .stat-card:hover is already defined in admin.css; we only touch the
   larger sections + detail cards to avoid regressions. */
.admin-section {
    transition: transform var(--wd-d-base) var(--wd-ease-soft),
                box-shadow var(--wd-d-base) var(--wd-ease-soft),
                border-color var(--wd-d-base) var(--wd-ease-soft);
}
.admin-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25);
    border-color: rgba(99, 102, 241, 0.18);
}
.detail-card {
    transition: transform var(--wd-d-fast) var(--wd-ease-snappy),
                background var(--wd-d-fast) ease;
}
.detail-card:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.06);
}

/* #A3 — Section header icon bounce when the parent section is hovered.
   Small pop on the FontAwesome icon in .section-header h2 i. */
.admin-section .section-header h2 i {
    display: inline-block;
    transition: transform var(--wd-d-base) var(--wd-ease-snappy);
}
.admin-section:hover .section-header h2 i {
    transform: scale(1.15) rotate(-4deg);
}

/* #A4 — Admin table row slide-in highlight.
   .admin-table tbody tr:hover already exists in admin.css; we add a left
   accent border that slides in. */
.admin-table tbody tr {
    position: relative;
    transition: background var(--wd-d-fast) ease;
}
.admin-table tbody tr::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--wd-accent);
    transform: scaleY(0);
    transform-origin: center;
    transition: transform var(--wd-d-fast) var(--wd-ease-snappy);
}
.admin-table tbody tr:hover::before { transform: scaleY(1); }

/* #A5 — Micro-press on primary buttons.
   Covers the main admin / public CTAs without a class change. */
.btn-primary,
.btn-premium-upgrade,
.admin-btn,
button.btn-sm {
    transition: transform var(--wd-d-fast) var(--wd-ease-snappy),
                box-shadow var(--wd-d-fast) ease,
                background var(--wd-d-fast) ease;
}
.btn-primary:active,
.btn-premium-upgrade:active,
.admin-btn:active,
button.btn-sm:active {
    transform: scale(0.97);
}

/* ============================================================================
   Premium badge sparkle — shimmer sweep on premium-flavored surfaces:
     .btn-premium-upgrade         (plans page, account upgrade CTA)
     .auth-btn.premium-highlight  (nav "Offre premium" when user is not premium)
   ============================================================================ */
.btn-premium-upgrade,
.auth-btn.premium-highlight {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}
.btn-premium-upgrade::before,
.auth-btn.premium-highlight::before {
    content: '';
    position: absolute;
    top: 0;
    left: -75%;
    width: 50%;
    height: 100%;
    background: linear-gradient(
        110deg,
        transparent 0%,
        rgba(255, 255, 255, 0.0) 30%,
        rgba(255, 255, 255, 0.35) 50%,
        rgba(255, 255, 255, 0.0) 70%,
        transparent 100%
    );
    transform: skewX(-20deg);
    animation: wdPremiumSparkle 4.5s ease-in-out infinite;
    pointer-events: none;
    z-index: 1;
}
.btn-premium-upgrade > *,
.auth-btn.premium-highlight > * { position: relative; z-index: 2; }
@keyframes wdPremiumSparkle {
    0%, 40%     { left: -75%; }
    65%, 100%   { left: 125%; }
}

/* ============================================================================
   Premium status badge (.usage-status.premium) — soft glow pulse + crown bounce.
   Signals the active premium state without being noisy.
   ============================================================================ */
.usage-status.premium {
    transition: transform var(--wd-d-base) var(--wd-ease-snappy);
}
.usage-status.premium:hover {
    transform: translateY(-1px);
}
.usage-status.premium .status-icon i {
    display: inline-block;
    transition: transform var(--wd-d-base) var(--wd-ease-snappy);
}
.usage-status.premium:hover .status-icon i {
    transform: scale(1.2) rotate(-8deg);
}

/* ============================================================================
   Header elevation on scroll.
   - Public .top-banner is already `position: fixed` in styles.css (with a
     matching body padding-top), so we DON'T touch its positioning — we only
     layer the scroll-shadow on top.
   - Admin .admin-topbar has no sticky/fixed in admin.css, so we promote it
     to sticky here so it stays in view while scrolling long admin pages.
   JS toggles body.wd-header-scrolled past ~8px scroll.
   ============================================================================ */
.top-banner,
.admin-topbar {
    transition: box-shadow var(--wd-d-base) ease,
                backdrop-filter var(--wd-d-base) ease;
}
.admin-topbar {
    position: sticky;
    top: 0;
    z-index: 50;
}
body.wd-header-scrolled .top-banner,
body.wd-header-scrolled .admin-topbar {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(14px);
}

/* ============================================================================
   Polish — 5 micro-animations across the home surface
   ============================================================================ */

/* #P1 — Mode tabs (.toggle-btn): accent underline that scales in on hover,
   plus subtle lift so the tabs feel clickable without competing with the
   .active state. */
.toggle-btn {
    transition: all 0.2s ease,
                transform var(--wd-d-fast) var(--wd-ease-snappy);
}
.toggle-btn::after {
    content: '';
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 6px;
    height: 2px;
    background: var(--wd-accent);
    border-radius: 2px;
    transform: scaleX(0);
    transform-origin: center;
    transition: transform var(--wd-d-base) var(--wd-ease-snappy);
    pointer-events: none;
}
.toggle-btn:hover:not(.active)::after { transform: scaleX(1); }
.toggle-btn:hover:not(.active) { transform: translateY(-1px); }
.toggle-btn.active::after { display: none; }

/* #P2 — Theme toggle icon handoff. When the user flips the switch, the sun
   and moon now rotate + scale as they hand off, instead of a hard opacity
   cut. The positional transition on the thumb was already there. */
.toggle-slider .icon-light,
.toggle-slider .icon-dark {
    transform-origin: center;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.toggle-slider .icon-light { transform: translateY(-50%) rotate(0deg) scale(1); }
.toggle-slider .icon-dark  { transform: translateY(-50%) rotate(-40deg) scale(0.7); }
input:checked+.toggle-slider .icon-light { transform: translateY(-50%) rotate(40deg) scale(0.7); }
input:checked+.toggle-slider .icon-dark  { transform: translateY(-50%) rotate(0deg) scale(1); }

/* #P3 — Hero title subtle breathing. 0.5% scale cycle keeps the brand
   alive without distracting while the user is reading. */
.title.wd-letters {
    animation: wdTitleBreath 6s ease-in-out infinite;
}
@keyframes wdTitleBreath {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.008); }
}

/* #P4 — Referral CTA section: lift at container level + icon pulse + CTA
   shimmer. The hover on the entire card signals "here is the reward". */
.referral-cta-section {
    transition: transform var(--wd-d-base) var(--wd-ease-soft),
                box-shadow var(--wd-d-base) ease;
    isolation: isolate;
}
.referral-cta-section:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 36px rgba(99, 102, 241, 0.18);
}
.referral-cta-section .referral-icon {
    animation: wdReferralPulse 3.5s ease-in-out infinite;
    transform-origin: center;
}
@keyframes wdReferralPulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.06); }
}
/* Shimmer on the inner CTA button (inline style .btn-primary). Same
   sweep as .btn-premium-upgrade but toned down. */
.referral-cta-section .btn-primary {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}
.referral-cta-section .btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -75%;
    width: 50%;
    height: 100%;
    background: linear-gradient(
        110deg,
        transparent 0%,
        rgba(255, 255, 255, 0.22) 50%,
        transparent 100%
    );
    transform: skewX(-20deg);
    animation: wdPremiumSparkle 5s ease-in-out infinite;
    animation-delay: 1.2s;
    pointer-events: none;
    z-index: 1;
}
.referral-cta-section .btn-primary > * { position: relative; z-index: 2; }

/* ============================================================================
   Reduced motion (a11y) — neutralize all heavy animations
   ============================================================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .wd-orbit-ring,
    .wd-mesh-bg::before,
    .wd-skeleton,
    .wd-btn-indeterminate,
    [data-theme="arc"] .subtitle.wd-typeon { animation: none !important; }
    .wd-toast { animation: none !important; }
    .glass-input:focus { animation: none !important; }
}
