/**
 * Loading Cloak System
 * Cache les éléments dynamiques (logo, nom, modules) jusqu'au chargement complet
 * pour éviter le "flash" du contenu par défaut
 */

/* ═══════════════════════════════════════════════════════════
   ÉLÉMENTS À CACHER AU CHARGEMENT
   ═══════════════════════════════════════════════════════════ */

/* Sidebar header (logo + nom) */
.sidebar-header,
.mp-sidebar-header,
.mobile-logo {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

/* Section des modules actifs PRO+ */
#active-modules-container,
.sidebar-nav .sidebar-section-header:nth-of-type(2),
.sidebar-nav .sidebar-section-header:nth-of-type(2) ~ a {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

/* Footer utilisateur dans la sidebar */
.sidebar-footer {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

/* ═══════════════════════════════════════════════════════════
   RÉVÉLATION APRÈS CHARGEMENT
   ═══════════════════════════════════════════════════════════ */

/* Classe ajoutée par JS après le chargement complet */
.app-ready .sidebar-header,
.app-ready .mp-sidebar-header,
.app-ready .mobile-logo,
.app-ready #active-modules-container,
.app-ready .sidebar-nav .sidebar-section-header:nth-of-type(2),
.app-ready .sidebar-nav .sidebar-section-header:nth-of-type(2) ~ a,
.app-ready .sidebar-footer {
    opacity: 1;
}

/* ═══════════════════════════════════════════════════════════
   LOADER OPTIONNEL (spinner discret)
   ═══════════════════════════════════════════════════════════ */

.sidebar-loading-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.app-ready .sidebar-loading-indicator {
    display: none;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ═══════════════════════════════════════════════════════════
   FALLBACK - Afficher après 2 secondes max (si JS échoue)
   ═══════════════════════════════════════════════════════════ */

@keyframes reveal-fallback {
    to { opacity: 1; }
}

.sidebar-header,
.mp-sidebar-header,
.mobile-logo,
#active-modules-container,
.sidebar-footer {
    animation: reveal-fallback 0s 2s forwards;
}

/* Annuler l'animation fallback si app-ready est appliqué */
.app-ready .sidebar-header,
.app-ready .mobile-logo,
.app-ready #active-modules-container,
.app-ready .sidebar-footer {
    animation: none;
}
