/**
 * SIDEBAR FOOTER FIXE - PROFIL UTILISATEUR
 * Footer collant en bas de la sidebar avec info utilisateur et statut
 */

/* ========================================
   CONTAINER PRINCIPAL DU FOOTER
   ======================================== */

.sidebar-footer-fixed {
    position: sticky; /* Sticky pour rester fixe au scroll mais dans le flux */
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%; /* 100% de la largeur de la sidebar */
    margin-top: auto; /* Pousse le footer en bas */
    background: linear-gradient(180deg, rgba(26, 26, 26, 0) 0%, rgba(26, 26, 26, 0.98) 20%, #1A1A1A 100%);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.25rem 1.5rem;
    z-index: 1050;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.3);
}

/* Quand la sidebar est dans le drawer (mdk-drawer) */
.mdk-drawer .sidebar-footer-fixed {
    position: sticky;
    left: 0;
    right: 0;
    width: 100%;
}

/* Ajustement pour les différentes tailles de sidebar */
@media (min-width: 993px) {
    .mdk-drawer.mdk-drawer--open .sidebar-footer-fixed {
        left: 0;
        right: 0;
        width: 100%;
    }
}

/* La sidebar doit utiliser flexbox pour que margin-top: auto fonctionne */
.sidebar {
    display: flex !important;
    flex-direction: column !important;
    padding-bottom: 0 !important;
    overflow: hidden !important; /* Pas de scroll sur la sidebar elle-même */
    overflow-x: hidden !important; /* Override du custom.css */
    overflow-y: hidden !important; /* Override du custom.css */
    height: 100% !important; /* Prend toute la hauteur du parent */
    max-height: 100vh !important; /* Mais ne dépasse pas la hauteur de la fenêtre */
    max-width: none !important; /* Override */
}

.sidebar-p-y {
    flex: 1 1 auto !important; /* Prend tout l'espace disponible */
    overflow-y: auto !important; /* Permet le scroll du contenu */
    overflow-x: visible !important; /* Permet l'expansion horizontale */
    min-height: 0 !important; /* Important pour que le flex fonctionne correctement */
    position: relative !important; /* Pour éviter les glitches de Perfect Scrollbar */
    width: 100% !important;
}

/* Désactive les transformations de Perfect Scrollbar qui causent le glitch */
.sidebar-p-y .ps__rail-y,
.sidebar-p-y .ps__thumb-y {
    transform: none !important;
    will-change: auto !important;
}

/* Force la largeur stable des éléments de menu pendant le scroll */
.sidebar-p-y .sidebar-menu-button,
.sidebar-p-y .sidebar-heading,
.sidebar-p-y .sidebar-submenu .sidebar-menu-button {
    transform: none !important;
    will-change: auto !important;
    transition: background-color 0.3s ease, color 0.3s ease !important;
    backface-visibility: hidden !important;
    -webkit-backface-visibility: hidden !important;
}

/* Stabilise la largeur du contenu pendant le scroll */
.sidebar-p-y > * {
    transform: translateZ(0) !important;
    will-change: auto !important;
}

/* ========================================
   CONTAINER UTILISATEUR
   ======================================== */

.sidebar-footer-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0;
    width: 100%;
}

/* ========================================
   AVATAR
   ======================================== */

.sidebar-footer-avatar {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    overflow: visible;
    flex-shrink: 0;
    transition: all 0.3s ease;
    position: relative;
}

.sidebar-footer-avatar:hover {
    transform: scale(1.03);
}

.sidebar-footer-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}

.sidebar-footer-avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #F97316 0%, #fb923c 100%);
    color: #ffffff;
    font-weight: 700;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 12px;
}

/* Badge Free/Pro sur l'avatar */
.sidebar-footer-avatar-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    font-size: 0.5rem;
    font-weight: 700;
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    line-height: 1;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.badge-free {
    background: #dc2626;
    color: #ffffff;
}

.badge-pro {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
}

/* ========================================
   INFORMATIONS UTILISATEUR
   ======================================== */

.sidebar-footer-info {
    flex: 0 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sidebar-footer-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1;
    letter-spacing: 0.2px;
}

.sidebar-footer-email {
    font-size: 0.6875rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1;
    letter-spacing: 0.1px;
}

/* ========================================
   BADGES DE STATUT
   ======================================== */

.sidebar-footer-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    cursor: pointer;
    letter-spacing: 0.3px;
    flex-shrink: 0;
    margin-left: auto;
}

.sidebar-footer-badge i {
    font-size: 1.125rem;
}

/* Badge Passer Premium (membres gratuits) */
.sidebar-footer-badge-upgrade {
    background: linear-gradient(135deg, #F97316 0%, #ff9a1a 100%);
    color: #ffffff;
    position: relative;
    overflow: hidden;
}

/* Effet shine animé */
.sidebar-footer-badge-upgrade::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -60%;
    bottom: -50%;
    left: -60%;
    background: linear-gradient(50deg, rgba(255, 255, 255, 0) 40%, rgba(255, 255, 255, 0.5) 50%, rgba(255, 255, 255, 0) 60%);
    transform: translate(-80%, 0px);
    animation: highlight-footer 5s infinite;
    z-index: 1;
}

.sidebar-footer-badge-upgrade span {
    position: relative;
    z-index: 2;
}

.sidebar-footer-badge-upgrade:hover {
    background: linear-gradient(135deg, #ff9a1a 0%, #ffb347 100%);
    transform: scale(1.02);
    color: #ffffff;
    text-decoration: none;
}

.sidebar-footer-badge-upgrade:active {
    transform: scale(0.98);
}

/* Badge Accès Complet (étudiants premium) */
.sidebar-footer-badge-premium {
    background: #10b981;
    color: #ffffff;
    border: 1.5px solid #10b981;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
    font-weight: 600;
    padding: 0.5rem 1rem;
    gap: 0.3rem;
    justify-content: center;
    text-align: center;
}

/* Bouton de déconnexion */
.sidebar-footer-logout {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 8px !important;
    background: #dc2626 !important;
    color: #ffffff !important;
    text-decoration: none !important;
    flex-shrink: 0 !important;
    margin-left: 0.5rem !important;
    border: 2px solid #dc2626 !important;
}

.sidebar-footer-logout:hover {
    background: #dc2626 !important;
    color: #ffffff !important;
    text-decoration: none !important;
}

.sidebar-footer-logout:focus {
    outline: none !important;
    background: #dc2626 !important;
}

.sidebar-footer-logout i {
    font-size: 1.125rem !important;
    color: #ffffff !important;
}

/* ========================================
   RESPONSIVE
   ======================================== */

/* Desktop - S'adapte à la largeur de la sidebar */
@media (min-width: 993px) {
    .sidebar-footer-fixed {
        padding: 1.25rem 1.5rem;
    }
}

/* Tablette */
@media (max-width: 992px) {
    .sidebar-footer-fixed {
        padding: 1.125rem 1.25rem;
    }
    
    .sidebar-footer-avatar {
        width: 48px;
        height: 48px;
    }
}

@media (max-width: 768px) {
    .sidebar-footer-fixed {
        padding: 1rem;
    }
    
    .sidebar-footer-avatar {
        width: 44px;
        height: 44px;
    }
    
    .sidebar-footer-name {
        font-size: 0.875rem;
    }
    
    .sidebar-footer-badge {
        font-size: 0.75rem;
        padding: 0.4375rem 0.875rem;
    }
    
    .sidebar-footer-badge i {
        font-size: 1rem;
    }
}

/* Masquer le footer quand la sidebar est fermée sur mobile */
@media (max-width: 992px) {
    .mdk-drawer:not(.mdk-drawer--open) .sidebar-footer-fixed {
        display: none;
    }
}

/* ========================================
   AJUSTEMENT DU PADDING POUR LE FOOTER
   ======================================== */

/* Ajouter un padding en bas du contenu de la sidebar pour éviter que le footer ne cache le contenu */
.sidebar {
    position: relative;
}

.sidebar .sidebar-p-y {
    padding-bottom: 10px !important;
}

/* ========================================
   COMPATIBILITÉ PERFECT SCROLLBAR
   ======================================== */

/* S'assurer que le footer reste visible même avec Perfect Scrollbar */
.sidebar.ps {
    padding-bottom: 0 !important;
}

.sidebar.ps .sidebar-p-y {
    padding-bottom: 10px !important;
}

.mdk-drawer__content {
    position: relative;
}

/* ========================================
   ANIMATION D'ENTRÉE
   ======================================== */

@keyframes slideUpFooter {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sidebar-footer-fixed {
    animation: slideUpFooter 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.4s backwards;
}

/* ========================================
   ÉTATS SUPPLÉMENTAIRES ET ANIMATIONS
   ======================================== */

/* Animation pulse supprimée - garde uniquement l'effet shine */

/* Badge premium avec effet de vérification */
@keyframes checkMark {
    0%, 90%, 100% {
        transform: scale(1) rotate(0deg);
    }
    95% {
        transform: scale(1.2) rotate(5deg);
    }
}

.sidebar-footer-badge-premium i {
    animation: checkMark 3s ease-in-out infinite;
}

/* ========================================
   ACCESSIBILITÉ
   ======================================== */

.sidebar-footer-badge:focus {
    outline: 2px solid rgba(255, 107, 53, 0.6);
    outline-offset: 2px;
}

.sidebar-footer-badge:focus:not(:focus-visible) {
    outline: none;
}

/* ========================================
   AMÉLIORATION VISUELLE
   ======================================== */

/* Ligne décorative en haut du footer */
.sidebar-footer-fixed::before {
    content: '';
    position: absolute;
    top: 0;
    left: 1.5rem;
    right: 1.5rem;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.15) 50%, 
        transparent 100%);
}

/* Glow subtil en haut */
.sidebar-footer-fixed::after {
    content: '';
    position: absolute;
    top: -20px;
    left: 0;
    right: 0;
    height: 20px;
    background: linear-gradient(180deg, transparent 0%, rgba(10, 10, 10, 0.5) 100%);
    pointer-events: none;
}

/* ========================================
   ANIMATIONS BOUTON PREMIUM
   ======================================== */

/* Keyframe pour l'effet highlight (shine) */
@keyframes highlight-footer {
    0% {
        transform: translate(-80%, 0px);
    }
    50% {
        transform: translate(80%, 0px);
    }
    100% {
        transform: translate(-80%, 0px);
    }
}
