/* ========================================
   COMMERCIFY MENU SIDEBAR - STYLES
   Gestion de l'affichage du menu latéral
   ======================================== */

/* MENU HYPER-PROFIL & MURS PERSONNALISÉS */
.hyper-profil-heading,
.murs-perso-heading {
    display: block;
    padding: 1rem 1.8rem;
    margin: 0.75rem 0.5rem 1rem;
    border-radius: 0;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 18px 36px rgba(8, 8, 8, 0.45);
    background-color: #212529;
    /* Les thèmes peuvent surcharger ces propriétés via les variables CSS */
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.hyper-profil-heading {
    padding-left: 0.25rem;
    margin-left: 0;
}

.hyper-profil-heading > div {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.murs-perso-heading {
    padding-left: 0.25rem;
    margin-left: 0;
}

.murs-perso-heading > div {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hyper-profil-heading .overline-title,
.murs-perso-heading .overline-title {
    color: #fff !important;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    font-size: 0.8rem;
    font-weight: 850;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
}

/* Affichage : label complet toujours visible */
.label-full {
    display: inline;
}

/* Les sections hyper-profil-heading et murs-perso-heading sont toujours affichées
   pour garantir le scroll sur iPhone et éviter les problèmes de calcul de hauteur */

/* Interrupteur « Mon hyper-profil » — tous les utilisateurs : affichage seul, aucune interaction */
.hyperprofil-toggle--readonly {
    pointer-events: none;
    user-select: none;
    cursor: default;
    touch-action: none;
}

.hyperprofil-toggle--readonly .custom-control-input,
.hyperprofil-toggle--readonly .custom-control-label {
    pointer-events: none !important;
    cursor: default !important;
}

/* Décoché : rendu visuellement inactif */
.hyperprofil-toggle--readonly #profile-toggle:not(:checked) ~ .custom-control-label::before {
    opacity: 0.42;
    filter: grayscale(0.35);
}

/* Coché : rendu visuellement actif (état reflété côté serveur uniquement) */
.hyperprofil-toggle--readonly #profile-toggle:checked ~ .custom-control-label::before {
    opacity: 1;
    filter: none;
}

html.dark-mode .hyperprofil-toggle--readonly #profile-toggle:not(:checked) ~ .custom-control-label::before,
.dark-mode .hyperprofil-toggle--readonly #profile-toggle:not(:checked) ~ .custom-control-label::before {
    opacity: 0.5;
}

/* Cacher hyper-profil et murs personnalisés quand le menu est replié */
/* UNIQUEMENT sur desktop (>= 1200px) - Ne pas appliquer sur mobile/tablette */
@media (min-width: 1200px) {
    .nk-sidebar.is-compact:not(:hover) .hyper-profil-heading,
    .nk-sidebar.is-compact:not(:hover) .murs-perso-heading {
        display: none !important;
    }
}

/* TOUJOURS réafficher hyper-profil et murs personnalisés quand le menu est déplié */
.nk-sidebar:not(.is-compact) .hyper-profil-heading,
.nk-sidebar:not(.is-compact) .murs-perso-heading,
.nk-sidebar.is-compact:hover .hyper-profil-heading,
.nk-sidebar.is-compact:hover .murs-perso-heading {
    display: block !important;
}

/* ========================================
   CORRECTION SCROLL IPHONE - DÉSACTIVER SIMPLEBAR ET FORCER SCROLL NATIF
   ======================================== */
/* TOUJOURS afficher hyper-profil et murs personnalisés sur mobile/tablette - TOUS LES BREAKPOINTS */
/* Forcer l'affichage même si le menu a la classe is-compact sur mobile/tablette */
@media (max-width: 1199px) {
    .nk-sidebar .hyper-profil-heading,
    .nk-sidebar .murs-perso-heading,
    .nk-sidebar.is-compact .hyper-profil-heading,
    .nk-sidebar.is-compact .murs-perso-heading,
    .nk-sidebar.is-compact:not(:hover) .hyper-profil-heading,
    .nk-sidebar.is-compact:not(:hover) .murs-perso-heading {
        display: block !important;
    }
    /* Désactiver complètement simplebar sur iPhone et forcer le scroll natif */
    .nk-sidebar-content .nk-sidebar-menu[data-simplebar] {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        height: 100% !important;
        max-height: 100% !important;
        position: relative !important;
    }
    
    /* Désactiver tous les éléments simplebar qui bloquent le scroll */
    .nk-sidebar-content .nk-sidebar-menu[data-simplebar] .simplebar-wrapper {
        overflow: visible !important;
        height: auto !important;
        position: static !important;
    }
    
    .nk-sidebar-content .nk-sidebar-menu[data-simplebar] .simplebar-mask {
        overflow: visible !important;
        position: static !important;
    }
    
    .nk-sidebar-content .nk-sidebar-menu[data-simplebar] .simplebar-offset {
        overflow: visible !important;
        position: static !important;
    }
    
    .nk-sidebar-content .nk-sidebar-menu[data-simplebar] .simplebar-content-wrapper {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        height: 100% !important;
        max-height: 100% !important;
        position: relative !important;
    }
    
    .nk-sidebar-content .nk-sidebar-menu[data-simplebar] .simplebar-content {
        overflow-y: visible !important;
        overflow-x: hidden !important;
        min-height: 100% !important;
        position: relative !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Empêcher le scroll horizontal sur le contenu du menu */
    .nk-sidebar-content .nk-sidebar-menu[data-simplebar] .nk-menu {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Masquer la scrollbar simplebar sur mobile */
    .nk-sidebar-content .nk-sidebar-menu[data-simplebar] .simplebar-track {
        display: none !important;
    }
}

/* Media queries supplémentaires pour garantir l'affichage sur tous les breakpoints mobile/tablette */
/* Forcer l'affichage même si le menu a la classe is-compact */
@media (max-width: 991.98px) {
    .nk-sidebar .hyper-profil-heading,
    .nk-sidebar .murs-perso-heading,
    .nk-sidebar.is-compact .hyper-profil-heading,
    .nk-sidebar.is-compact .murs-perso-heading,
    .nk-sidebar.is-compact:not(:hover) .hyper-profil-heading,
    .nk-sidebar.is-compact:not(:hover) .murs-perso-heading {
        display: block !important;
    }
}

@media (max-width: 767.98px) {
    .nk-sidebar .hyper-profil-heading,
    .nk-sidebar .murs-perso-heading,
    .nk-sidebar.is-compact .hyper-profil-heading,
    .nk-sidebar.is-compact .murs-perso-heading,
    .nk-sidebar.is-compact:not(:hover) .hyper-profil-heading,
    .nk-sidebar.is-compact:not(:hover) .murs-perso-heading {
        display: block !important;
    }
}

@media (max-width: 575.98px) {
    .nk-sidebar .hyper-profil-heading,
    .nk-sidebar .murs-perso-heading,
    .nk-sidebar.is-compact .hyper-profil-heading,
    .nk-sidebar.is-compact .murs-perso-heading,
    .nk-sidebar.is-compact:not(:hover) .hyper-profil-heading,
    .nk-sidebar.is-compact:not(:hover) .murs-perso-heading {
        display: block !important;
    }
}

/* ========================================
   COMPATIBILITÉ AVEC LES THÈMES
   ======================================== */

/* Assurer que les thèmes peuvent surcharger les styles existants */
.nk-menu-badge {
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.nk-menu-icon .icon {
    transition: color 0.2s ease;
}

.nk-menu-text {
    transition: color 0.2s ease;
}

.nk-menu-link {
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* Support RTL pour les thèmes */
[dir="rtl"] .nk-menu-badge {
    margin-left: auto;
    margin-right: 0;
}

/* ========================================
   TOOLTIPS NATIFS STYLISÉS - CSS PUR
   Tooltips hover natifs sans JavaScript
   ======================================== */

/* Tooltips natifs pour les liens du menu */
.nk-sidebar .nk-menu-link[title] {
    position: relative;
}

/* Masquer le tooltip natif du navigateur */
.nk-sidebar .nk-menu-link[title]:hover {
    text-decoration: none;
}

/* Tooltip stylisé avec CSS pur */
.nk-sidebar .nk-menu-link[title]:hover::before {
    content: attr(title);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 12px;
    padding: 0.5rem 0.75rem;
    background-color: #1f2b3a;
    color: #fff;
    font-size: 0.8125rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-weight: 400;
    line-height: 1.65;
    white-space: nowrap;
    border-radius: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 1080;
    pointer-events: none;
    opacity: 0.9;
    max-width: 200px;
    word-wrap: break-word;
    white-space: normal;
}

/* Flèche du tooltip */
.nk-sidebar .nk-menu-link[title]:hover::after {
    content: '';
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 6px;
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-right: 6px solid #1f2b3a;
    z-index: 1081;
    pointer-events: none;
}

/* Support RTL pour les tooltips */
[dir="rtl"] .nk-sidebar .nk-menu-link[title]:hover::before {
    left: auto;
    right: 100%;
    margin-left: 0;
    margin-right: 12px;
}

[dir="rtl"] .nk-sidebar .nk-menu-link[title]:hover::after {
    left: auto;
    right: 100%;
    margin-left: 0;
    margin-right: 6px;
    border-right: none;
    border-left: 6px solid #1f2b3a;
}

/* Confinement dans la sidebar - ajustement si le tooltip dépasse */
.nk-sidebar .nk-menu-link[title]:hover::before {
    /* Si le tooltip dépasse à droite, l'afficher à gauche */
    right: auto;
}

/* Mode compact : tooltips toujours visibles au hover */
.nk-sidebar.is-compact .nk-menu-link[title]:hover::before,
.nk-sidebar.is-compact .nk-menu-link[title]:hover::after {
    display: block;
}

