/* ═══════════════════════════════════════════════════════════
   global-ux.css — splash Mediasite Augmented / MM mediaMetrics
   Injecté globalement via middleware Express avant </head>.

   Principes qualité :
   - fade + mask reveal + scale subtil UNIQUEMENT
   - cubic-bezier(0.22, 0.61, 0.36, 1) ease-out-expo-like
   - transform + opacity seulement (60fps garanti, pas de reflow)
   - typo system-ui fallback (pas de Google Fonts = pas de FOUT)
   - pas de rotate / skew / bounce
   ═══════════════════════════════════════════════════════════ */

#global-splash {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: #0a0f1e;
    color: #f5f7fb;
    opacity: 0;
    animation: gs-bg-in 280ms cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
    /* user-select off pendant splash */
    user-select: none;
    pointer-events: auto;
}

#global-splash.gs-fade-out {
    animation: gs-bg-out 380ms cubic-bezier(0.55, 0, 0.6, 0.4) forwards;
}

/* Background fade in */
@keyframes gs-bg-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes gs-bg-out {
    from { opacity: 1; }
    to   { opacity: 0; }
}

/* Conteneur centré : scale + opacity subtil */
#global-splash .gs-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    transform: scale(0.96);
    opacity: 0;
    animation: gs-inner-in 800ms 120ms cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}

@keyframes gs-inner-in {
    from { transform: scale(0.96); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

/* Titre "Mediasite Augmented" :
   - letter-spacing évolutif 0.4em → 0.08em
   - mask reveal L→R via clip-path inset shrinking */
#global-splash .gs-title {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
                 system-ui, "Helvetica Neue", Arial, sans-serif;
    font-weight: 200;
    font-size: clamp(28px, 5.5vw, 56px);
    letter-spacing: 0.4em;
    color: #f5f7fb;
    white-space: nowrap;
    text-transform: none;
    /* Mask reveal L→R : clip-path inset(0 right% 0 0) */
    clip-path: inset(0 100% 0 0);
    animation:
        gs-title-reveal 900ms 260ms cubic-bezier(0.22, 0.61, 0.36, 1) forwards,
        gs-title-tighten 900ms 260ms cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}

@keyframes gs-title-reveal {
    from { clip-path: inset(0 100% 0 0); }
    to   { clip-path: inset(0 0 0 0); }
}

@keyframes gs-title-tighten {
    from { letter-spacing: 0.4em; }
    to   { letter-spacing: 0.08em; }
}

/* Sous-titre "MM mediaMetrics" :
   - italic weight 400, plus petit
   - fade + translateY léger, décalé 460ms */
#global-splash .gs-sub {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
                 system-ui, "Helvetica Neue", Arial, sans-serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(13px, 1.6vw, 17px);
    letter-spacing: 0.12em;
    color: rgba(245, 247, 251, 0.68);
    opacity: 0;
    transform: translateY(6px);
    animation: gs-sub-in 600ms 720ms cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}

@keyframes gs-sub-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0);  }
}

/* Ligne séparatrice subtile entre title et sub */
#global-splash .gs-divider {
    width: 0;
    height: 1px;
    background: rgba(245, 247, 251, 0.22);
    animation: gs-divider-expand 600ms 720ms cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}

@keyframes gs-divider-expand {
    from { width: 0;   opacity: 0; }
    to   { width: 72px; opacity: 1; }
}

/* Reduce motion : respecte préférence accessibilité */
@media (prefers-reduced-motion: reduce) {
    #global-splash,
    #global-splash .gs-inner,
    #global-splash .gs-title,
    #global-splash .gs-sub,
    #global-splash .gs-divider {
        animation-duration: 0.1ms !important;
    }
}

/* ═══════════════════════════════════════════════════════════
   RBAC CLIENT (2026-05-21) — Hide forbidden links + user-select
   La classe .role-client est ajoutée sur <html> par _buildInjectionForRole.
   Defense-in-depth : le server.js bloque déjà l'accès direct, mais on
   masque visuellement les liens pour éviter erreurs UX.
   ═══════════════════════════════════════════════════════════ */
html.role-client a[href*="/forge"],
html.role-client a[href*="/sync"],
html.role-client a[href*="/backoffice"],
html.role-client a[href*="/security"],
html.role-client a[href*="/versions"],
html.role-client a[href*="/api-modules"],
html.role-client a[href*="/supervision"],
html.role-client a[href*="/session-trends"],
html.role-client a[href*="/video-editor"],
/* 2026-05-27 — /knowledge déverrouillé pour stephane (demande user). Reste display via sidebar. */
html.role-client a[href*="/catalog"],
html.role-client a[href*="/instances"],
html.role-client a[href*="/dashboard.html"] {
    display: none !important;
}

/* Désactive sélection texte intempestive (cosmétique, pas de la sécurité) */
html.role-client {
    -webkit-user-select: text;
    user-select: text;
}
html.role-client img,
html.role-client video {
    -webkit-user-drag: none;
}

/* ═══════════════════════════════════════════════════════════
   RBAC 2026-05-21 — Popup kick "session reprise sur un autre poste"
   Injecté quand /api/user/me renvoie 401 (session kicked ou expirée).
   ═══════════════════════════════════════════════════════════ */
#mm-kick-overlay {
    position: fixed;
    inset: 0;
    background: rgba(8, 12, 24, 0.78);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    z-index: 2147483646;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    animation: mm-kick-fade-in 280ms cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

@keyframes mm-kick-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

#mm-kick-overlay .mm-kick-card {
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    color: #f5f7fb;
    border-radius: 18px;
    padding: 36px 40px 32px;
    max-width: 440px;
    width: 100%;
    box-shadow:
        0 24px 60px -12px rgba(0, 0, 0, 0.55),
        0 0 0 1px rgba(148, 163, 184, 0.15);
    text-align: center;
    transform: translateY(20px) scale(0.96);
    opacity: 0;
    animation: mm-kick-card-in 460ms 80ms cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}

@keyframes mm-kick-card-in {
    from { transform: translateY(20px) scale(0.96); opacity: 0; }
    to   { transform: translateY(0)    scale(1);    opacity: 1; }
}

#mm-kick-overlay .mm-kick-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 18px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #f59e0b 0%, #d97706 60%, #b45309 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px -8px rgba(245, 158, 11, 0.55);
    animation: mm-kick-icon-pulse 2.2s ease-in-out infinite;
}

@keyframes mm-kick-icon-pulse {
    0%, 100% { box-shadow: 0 8px 24px -8px rgba(245, 158, 11, 0.55); }
    50%      { box-shadow: 0 8px 32px -4px rgba(245, 158, 11, 0.85); }
}

#mm-kick-overlay .mm-kick-icon svg {
    width: 28px;
    height: 28px;
    fill: #fff;
}

#mm-kick-overlay .mm-kick-title {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0 0 10px;
    color: #fff;
}

#mm-kick-overlay .mm-kick-msg {
    font-size: 14px;
    line-height: 1.55;
    color: rgba(245, 247, 251, 0.78);
    margin: 0 0 24px;
}

#mm-kick-overlay .mm-kick-msg strong {
    color: #fbbf24;
    font-weight: 600;
}

#mm-kick-overlay .mm-kick-countdown {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.12);
    border: 1px solid rgba(148, 163, 184, 0.22);
    font-size: 13px;
    color: rgba(245, 247, 251, 0.85);
    margin-bottom: 20px;
    letter-spacing: 0.02em;
}

#mm-kick-overlay .mm-kick-countdown b {
    color: #34d399;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    min-width: 14px;
    text-align: center;
}

#mm-kick-overlay .mm-kick-cta {
    display: block;
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    box-shadow: 0 6px 18px -6px rgba(59, 130, 246, 0.55);
    transition: transform 120ms ease, box-shadow 120ms ease;
}

#mm-kick-overlay .mm-kick-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px -6px rgba(59, 130, 246, 0.75);
}

#mm-kick-overlay .mm-kick-cta:active {
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    #mm-kick-overlay,
    #mm-kick-overlay .mm-kick-card,
    #mm-kick-overlay .mm-kick-icon { animation-duration: 0.1ms !important; }
}
