@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-color: #f4f7f6;
    --text-main: #2d3436;
    --text-muted: #636e72;
    
    --orange-primary: #ff7e5f;
    --orange-secondary: #feb47b;

    /* Variables dynamiques (redéfinies par JS ou HTML) */
    --role-color-primary: var(--orange-primary);
    --role-color-secondary: var(--orange-secondary);

    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-border: rgba(255, 255, 255, 0.8);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    --glass-glow: 0 0 20px rgba(0, 0, 0, 0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Poppins', sans-serif; }

body { background-color: var(--bg-color); color: var(--text-main); overflow-x: hidden; position: relative; min-height: 100vh; }

.background-blobs { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: -1; overflow: hidden; }
.blob { position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.5; animation: float 12s infinite ease-in-out alternate; }
.blob-1 { top: -10%; left: -10%; width: 50vw; height: 50vw; min-width: 300px; min-height: 300px; background: var(--role-color-primary); }
.blob-2 { bottom: -20%; right: -10%; width: 60vw; height: 60vw; min-width: 400px; min-height: 400px; background: var(--role-color-secondary); animation-delay: -6s; }
.blob-3 { top: 40%; left: 40%; width: 30vw; height: 30vw; min-width: 200px; background: #fff; filter: blur(60px); animation-delay: -3s; }

@keyframes float { 0% { transform: translate(0, 0) scale(1) rotate(0deg); } 100% { transform: translate(50px, 50px) scale(1.1) rotate(10deg); } }

.glass-panel { background: linear-gradient(135deg, rgba(255,255,255,0.8) 0%, rgba(255,255,255,0.4) 100%); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow); border-radius: 20px; }

.btn-primary { background: linear-gradient(135deg, var(--role-color-primary), var(--role-color-secondary)); color: white; padding: 10px 24px; border-radius: 50px; text-decoration: none; font-weight: 600; border: none; cursor: pointer; transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); display: inline-flex; align-items: center; gap: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); }
.btn-primary:hover { transform: translateY(-3px) scale(1.02); box-shadow: 0 10px 25px rgba(0,0,0,0.2); }

header { margin: 20px; padding: 20px 40px; border-radius: 50px; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 20px; z-index: 100; transition: all 0.3s ease; }
.logo { font-size: 24px; font-weight: 700; color: var(--text-main); display: flex; align-items: center; gap: 10px; }
.logo i { color: var(--role-color-primary); }

.reveal { opacity: 0; transform: translateY(40px); transition: all 0.8s cubic-bezier(0.25, 1, 0.5, 1); }
.reveal.visible { opacity: 1; transform: translateY(0); }

.overlay-bg { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.5); backdrop-filter: blur(8px); z-index: 998; opacity: 0; visibility: hidden; transition: all 0.4s ease; }
.overlay-bg.active { opacity: 1; visibility: visible; }

.cmd-modal { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -40%) scale(0.9); width: 90%; max-width: 600px; max-height: 85vh; overflow-y: auto; background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(20px); border: 1px solid var(--glass-border); border-radius: 25px; box-shadow: 0 25px 50px rgba(0,0,0,0.3); z-index: 1000; opacity: 0; visibility: hidden; transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); padding: 30px; display: flex; flex-direction: column; gap: 20px; }
.cmd-modal.active { opacity: 1; visibility: visible; transform: translate(-50%, -50%) scale(1); }
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px dashed rgba(0,0,0,0.1); padding-bottom: 15px; }
.modal-title { font-family: 'Courier New', Courier, monospace; font-size: 1.5rem; font-weight: 800; color: var(--role-color-primary); background: rgba(0,0,0,0.05); padding: 5px 15px; border-radius: 10px; word-break: break-all; }
.close-modal { background: none; border: none; font-size: 1.5rem; color: var(--text-muted); cursor: pointer; transition: color 0.3s; padding: 5px; }
.close-modal:hover { color: #ff4757; }
.modal-body { font-size: 1.05rem; line-height: 1.6; color: var(--text-main); }
.modal-body h4 { color: var(--role-color-primary); margin: 20px 0 10px 0; font-size: 1.1rem; display: flex; align-items: center; gap: 8px; }
.modal-body h4 i { opacity: 0.7; }
.modal-usage { background: #2d3436; color: #a29bfe; font-family: monospace; padding: 15px; border-radius: 10px; margin-bottom: 15px; overflow-x: auto; font-size: 1rem; border-left: 4px solid var(--role-color-primary); }
.modal-example { background: rgba(0,0,0,0.03); padding: 15px; border-radius: 10px; border: 1px solid rgba(0,0,0,0.05); font-style: italic; color: var(--text-muted); }
body.no-scroll { overflow: hidden; }

/* ---- Indicateur d'interactivité sur les cartes commandes ---- */
.cmd-card { position: relative; }

.click-hint-icon {
    position: absolute;
    bottom: 12px;
    right: 14px;
    font-size: 1rem;
    color: var(--role-color-primary);
    opacity: 0.6;
    pointer-events: none;
    z-index: 10;
    transform: translateZ(0); /* Force un layer GPU — corrige le rendu iOS Safari avec backdrop-filter */
    -webkit-transform: translateZ(0);
    animation: clickHintTap 2.4s ease-in-out infinite;
}

@keyframes clickHintTap {
    0%,  60%, 100% { transform: scale(1) rotate(0deg);    opacity: 0.6; }
    30%            { transform: scale(1.3) rotate(-15deg); opacity: 1;   }
    45%            { transform: scale(1.15) rotate(6deg);  opacity: 0.85; }
}

@media (max-width: 768px) {
    header { margin: 10px; padding: 15px 20px; top: 10px; flex-direction: column; gap: 15px; border-radius: 25px; }
    .logo { font-size: 20px; }
    .cmd-modal { width: 95%; padding: 20px; max-height: 90vh; }
    .modal-title { font-size: 1.2rem; }
}

/* ========================================================= */
/* TRANSITIONS DE PAGE — CIRCLE WIPE PREMIUM               */
/* ========================================================= */

#app-transition {
    position: fixed;
    inset: 0;
    z-index: 999999;
    pointer-events: none;    /* invisible par défaut, laisse tout passer */
}

/* Bloque les interactions quand le voile est actif */
#app-transition.is-active {
    pointer-events: all;
}

/* ---- Le fond dégradé qui fait le wipe ---- */
.transition-wiper {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        var(--role-color-primary)   0%,
        var(--role-color-secondary) 100%
    );
    /* Shimmer lumineux en surimpression */
    background-image:
        radial-gradient(ellipse at 25% 25%, rgba(255,255,255,0.18) 0%, transparent 55%),
        linear-gradient(135deg, var(--role-color-primary) 0%, var(--role-color-secondary) 100%);

    /* Démarre invisible : cercle de 0% */
    clip-path: circle(0% at var(--clip-x, 50%) var(--clip-y, 50%));
    transition: clip-path 0.78s cubic-bezier(0.76, 0, 0.24, 1);
    will-change: clip-path;
}

/* SORTIE : cercle qui grandit depuis le point de clic */
#app-transition.is-expanding .transition-wiper {
    clip-path: circle(150% at var(--clip-x, 50%) var(--clip-y, 50%));
}

/* COUVERTURE INSTANTANÉE : nouvelle page chargée, tout est caché */
#app-transition.is-covered .transition-wiper {
    clip-path: circle(150% at 50% 50%);
    transition: none;
}

/* RÉVÉLATION : le cercle se rétracte pour dévoiler la page */
#app-transition.is-covered.is-revealing .transition-wiper {
    clip-path: circle(0% at 50% 50%);
    transition: clip-path 0.82s cubic-bezier(0.76, 0, 0.24, 1) !important;
}


/* ---- Contenu central (icône + label + dots) ---- */
#transition-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s ease;
    padding: 20px;
}

/* Visible lors de l'expansion (sortie) */
#app-transition.is-expanding #transition-content {
    opacity: 1;
    transition-delay: 0.22s;
}

/* Visible sur la nouvelle page (couverture) */
#app-transition.is-covered #transition-content {
    opacity: 1;
}

/* Disparaît avant que le cercle finisse de se rétracter */
#app-transition.is-covered.is-revealing #transition-content {
    opacity: 0;
    transition-delay: 0s;
    transition-duration: 0.18s;
}

/* Icône animée */
#transition-icon {
    font-size: 3.8rem;
    margin-bottom: 22px;
    filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.35));
    animation: tIconFloat 2.2s ease-in-out infinite;
    line-height: 1;
}

/* Texte du rôle */
#transition-label {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-shadow: 0 2px 16px rgba(0, 0, 0, 0.25);
    margin-bottom: 30px;
    max-width: 300px;
    line-height: 1.45;
}

/* Points animés */
.t-dots {
    display: flex;
    gap: 10px;
    align-items: center;
}

.t-dots span {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.82);
    animation: tDotPulse 1.35s ease-in-out infinite;
}

.t-dots span:nth-child(2) { animation-delay: 0.22s; }
.t-dots span:nth-child(3) { animation-delay: 0.44s; }

@keyframes tIconFloat {
    0%, 100% { transform: translateY(0)    scale(1);    }
    50%       { transform: translateY(-9px) scale(1.06); }
}

@keyframes tDotPulse {
    0%, 100% { opacity: 0.25; transform: scale(0.65); }
    50%       { opacity: 1;    transform: scale(1.3);  }
}


/* ========================================================= */
/* LAYOUT DOC + SIDEBAR LIQUID GLASS (toutes pages rôles)   */
/* ========================================================= */

.doc-container {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    gap: 40px;
    align-items: flex-start;
}

/* ---- Panneau sidebar ---- */
.sidebar {
    flex: 0 0 290px;
    position: sticky;
    top: 110px;
    padding: 26px 18px;
    height: calc(100vh - 130px);
    overflow-y: auto;
    overflow-x: hidden;

    /* Liquid Glass — profondeur de verre */
    background: linear-gradient(
        155deg,
        rgba(255, 255, 255, 0.86) 0%,
        rgba(255, 255, 255, 0.58) 55%,
        rgba(255, 255, 255, 0.40) 100%
    ) !important;
    backdrop-filter: blur(28px) saturate(190%) brightness(1.03) !important;
    -webkit-backdrop-filter: blur(28px) saturate(190%) brightness(1.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.90) !important;
    border-radius: 24px !important;
    box-shadow:
        0 8px 40px rgba(31, 38, 135, 0.08),
        0 2px 6px rgba(0, 0, 0, 0.03),
        inset 0 2px 0 rgba(255, 255, 255, 1),
        inset 0 -1px 0 rgba(0, 0, 0, 0.025),
        inset 1px 0 0 rgba(255, 255, 255, 0.75) !important;

    scrollbar-width: thin;
    scrollbar-color: var(--role-color-primary) transparent;
}

/* Reflet de lumière en haut du panneau */
.sidebar::before {
    content: '';
    position: absolute;
    top: 0; left: 12%; width: 76%; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.95) 50%, transparent);
    pointer-events: none;
    border-radius: 50%;
}

/* ---- En-tête Sommaire ---- */
.sidebar h3 {
    position: relative;
    margin-bottom: 20px;
    padding-bottom: 14px;
    font-size: 1.08rem;
    font-weight: 700;
    color: var(--role-color-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Ligne dégradée sous l'en-tête */
.sidebar h3::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 1.5px;
    background: linear-gradient(
        90deg,
        var(--role-color-primary),
        var(--role-color-secondary) 55%,
        transparent
    );
    opacity: 0.38;
    border-radius: 2px;
}

/* Icône de l'en-tête en dégradé */
.sidebar h3 i {
    background: linear-gradient(135deg, var(--role-color-primary), var(--role-color-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar ul { list-style: none; }

/* ---- Labels de catégorie ---- */
.sidebar .nav-label {
    margin-top: 20px;
    margin-bottom: 5px;
    padding: 0 4px;
    font-size: 0.67rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 1.9px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 7px;
    opacity: 0.72;
}

.sidebar .nav-label i {
    font-size: 0.78rem;
    width: 14px;
    text-align: center;
    background: linear-gradient(135deg, var(--role-color-primary), var(--role-color-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    opacity: 1;
}

/* ---- Liens de navigation ---- */
.sidebar li a {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-main);
    padding: 8px 11px;
    border-radius: 14px;
    font-size: 0.87rem;
    margin-bottom: 2px;
    font-weight: 500;
    border: 1px solid transparent;
    transition:
        background    0.22s ease,
        color         0.22s ease,
        transform     0.28s cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow    0.22s ease,
        border-color  0.22s ease;
}

.sidebar li a i {
    font-size: 0.92rem;
    width: 17px;
    text-align: center;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: all 0.22s ease;
}

/* Hover — pilule verre liquide */
.sidebar li a:hover {
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.70) 0%,
        rgba(255, 255, 255, 0.32) 100%
    );
    color: var(--role-color-primary);
    transform: translateX(5px);
    border-color: rgba(255, 255, 255, 0.82);
    box-shadow:
        0 3px 12px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.88);
}

/* Actif — pilule + accent gauche coloré */
.sidebar li a.active {
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.82) 0%,
        rgba(255, 255, 255, 0.44) 100%
    );
    color: var(--role-color-primary);
    transform: translateX(5px);
    border-color: rgba(255, 255, 255, 0.90);
    box-shadow:
        0 4px 18px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.95),
        -3px 0 0 var(--role-color-primary);
}

.sidebar li a:hover i,
.sidebar li a.active i {
    color: var(--role-color-primary);
    transform: scale(1.12);
}

/* Scrollbar webkit */
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, var(--role-color-primary), var(--role-color-secondary));
    border-radius: 10px;
}

/* ---- Bouton FAB mobile ---- */
.mobile-toggle-btn { display: none; }

@media (max-width: 992px) {
    .doc-container { flex-direction: column; padding: 0 15px; gap: 20px; }

    .sidebar {
        flex: unset;
        position: fixed !important;
        top: 0; left: -320px;
        width: 300px;
        height: 100vh;
        z-index: 999;
        border-radius: 0 26px 26px 0 !important;
        background: linear-gradient(
            155deg,
            rgba(255, 255, 255, 0.95) 0%,
            rgba(255, 255, 255, 0.82) 100%
        ) !important;
        transition: left 0.46s cubic-bezier(0.4, 0, 0.2, 1);
        margin: 0;
        padding-top: 85px;
        padding-bottom: 100px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar.active {
        left: 0;
        box-shadow:
            22px 0 60px rgba(0, 0, 0, 0.12),
            inset -1px 0 0 rgba(255, 255, 255, 0.8) !important;
    }

    /* Bouton FAB — squircle + dégradé */
    .mobile-toggle-btn {
        display: flex;
        position: fixed;
        bottom: 28px; left: 20px;
        width: 52px; height: 52px;
        border-radius: 16px;
        background: linear-gradient(135deg, var(--role-color-primary), var(--role-color-secondary));
        color: white;
        border: 1px solid rgba(255, 255, 255, 0.32);
        align-items: center; justify-content: center;
        font-size: 18px;
        z-index: 1000;
        cursor: pointer;
        box-shadow:
            0 8px 24px rgba(0, 0, 0, 0.18),
            inset 0 1px 0 rgba(255, 255, 255, 0.35);
        transition: all 0.38s cubic-bezier(0.34, 1.56, 0.64, 1);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }

    .mobile-toggle-btn:active { transform: scale(0.92); }

    .mobile-toggle-btn.active {
        left: 310px;
        border-radius: 50%;
        background: rgba(45, 52, 54, 0.88);
        border-color: rgba(255, 255, 255, 0.15);
    }
}

@media (max-width: 480px) {
    .sidebar { width: 85vw; left: -90vw; }
    .sidebar.active { left: 0; }
    .mobile-toggle-btn.active { left: calc(85vw - 26px); }
}