/* CSS optimisé pour la page Hyperprofil Langues - Performance optimisée */

/* ==========================================================================
   TOOLBAR FIXE - Barre bouton + recherche collée sous le header
   Prend en compte la sidebar Dashlite (déplié/replié) et le padding du conteneur
   ========================================================================== */
#hyperprofil_toolbar_languages {
    position: fixed;
    top: 65px;
    z-index: 1009;
    background: #f5f6fa;
    padding: 0.75rem 0;
}

/* Container 100 % largeur disponible (comme le header) — pas de padding sur le conteneur */
#hyperprofil_toolbar_languages[data-padding-horizontal] {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Mode sombre */
.dark-mode #hyperprofil_toolbar_languages,
html.dark-mode #hyperprofil_toolbar_languages,
[data-bs-theme='dark'] #hyperprofil_toolbar_languages {
    background: transparent !important;
}

/* Desktop (≥1200px) : pleine largeur à droite de la sidebar */
@media (min-width: 1200px) {
    #hyperprofil_toolbar_languages {
        left: 290px;
        right: 0;
    }
    .nk-sidebar.is-compact + .nk-wrap #hyperprofil_toolbar_languages {
        left: 76px;
        right: 0;
    }
}

/* Tablette/Mobile (<1200px) : pleine largeur */
@media (max-width: 1199px) {
    #hyperprofil_toolbar_languages {
        left: 0;
        right: 0;
    }
}

/* ==========================================================================
   SUPPORT RTL - Mode Right-To-Left
   ========================================================================== */
html[dir="rtl"] #hyperprofil_toolbar_languages {
    direction: rtl;
}

/* RTL : container pleine largeur */
html[dir="rtl"] #hyperprofil_toolbar_languages[data-padding-horizontal] {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Desktop (≥1200px) - RTL : pleine largeur à gauche de la sidebar */
@media (min-width: 1200px) {
    html[dir="rtl"] #hyperprofil_toolbar_languages {
        left: 0;
        right: 290px;
    }
    html[dir="rtl"] .nk-sidebar.is-compact + .nk-wrap #hyperprofil_toolbar_languages {
        left: 0;
        right: 76px;
    }
}

/* Tablette/Mobile (<1200px) - RTL */
@media (max-width: 1199px) {
    html[dir="rtl"] #hyperprofil_toolbar_languages {
        left: 0;
        right: 0;
    }
}

/* Styles pour les wrappers d'images de langues */
.language-image-wrapper {
    cursor: pointer;
}

.language-image-wrapper:hover .language-overlay {
    opacity: 1 !important;
}

.custom-control-input:checked + label .language-overlay {
    opacity: 1 !important;
    background: rgba(13, 71, 161, 0.6) !important;
}

.custom-control-input:checked + label {
    transform: scale(0.98);
    box-shadow: 0 0 0 3px #0d47a1 !important;
}

/* OPTIMISATION: Transition simplifiée - seulement transform */
.custom-control-label {
    will-change: transform;
    transition: transform 0.3s ease;
}

@media (hover: hover) {
    .custom-control-label:hover {
        transform: translateY(-5px);
        box-shadow: 0 10px 20px rgba(13, 71, 161, 0.2) !important;
    }
}

/* En-têtes de groupes de langues */
/* OPTIMISATION: Couleur unie au lieu de gradient pour meilleure performance */
.hyperprofil-language-group-header {
    padding-top: 20px;
    padding-bottom: 20px;
    background: #0d47a1;
    color: white;
}

/* Liens de langues - optimisation des transitions */
/* OPTIMISATION: Couleur unie au lieu de gradient pour meilleure performance */
.hyperprofil-language-link {
    display: block;
    padding: 0.5rem;
    position: relative;
    overflow: hidden;
    background: #0d47a1;
    color: white;
    border-radius: 0;
    /* OPTIMISATION: Transition simplifiée - seulement transform */
    transition: transform 0.3s ease;
    will-change: transform;
}

/* Labels de langues - optimisation des transitions */
.hyperprofil-language-label {
    transform: scale(1);
    /* OPTIMISATION: Transition simplifiée - seulement transform */
    transition: transform 0.3s ease;
    will-change: transform;
}

/* Overlay des images de langues */
.language-overlay {
    background: rgba(13, 71, 161, 0.3);
    opacity: 0;
    /* Optimisation: transition spécifique au lieu de "all" */
    transition: opacity 0.3s ease;
    will-change: opacity;
}

/* ==========================================================================
   ANIMATION DE CHARGEMENT
   ========================================================================== */
.loading-animation {
    z-index: 9999;
}

.loading-animation button {
    padding: clamp(1rem, 3vw, 2rem);
    font-size: clamp(1rem, 2.5vw, 1.5rem);
    border-radius: 0;
    background: linear-gradient(45deg, #6f42c1 0%, #a98eda 100%);
    box-shadow: 0 .5rem 1rem rgba(0,0,0,.15);
    transition: all .3s ease;
}

.loading-animation .spinner-border {
    width: clamp(2rem, 4vw, 3rem);
    height: clamp(2rem, 4vw, 3rem);
    border-width: .25em;
}

.loading-animation button .position-absolute {
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.2) 50%, transparent 100%);
    animation: shine 1.5s infinite;
}

@keyframes shine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

@media (max-width: 576px) {
    .loading-animation button {
        font-size: 1rem !important;
        padding: 0.75rem !important;
    }
}
