/* ============================================
   SIDEBAR MODERNE VERTICALE - Artisan Code
   ============================================ */

/* Variables spécifiques à la sidebar */
:root {
    --sidebar-width-collapsed: 70px;
    --sidebar-width-expanded: 250px;
    
    /*--sidebar-bg: rgba(255, 254, 245, 0.75); /* Jaune pâle à 75% - couleur des div */
    /*--sidebar-text: #0e2e52; /* Bleu sombre */

    --sidebar-bg: rgba(14, 46, 82, 0.75); /* bleu sombre à 75% */
    --sidebar-text: rgba(255, 254, 245, 1); /* Jaune pâle */


    /*--sidebar-text-hover: #0e2e52; /* bleu sombre au hover */
    --sidebar-text-hover: rgba(255, 254, 245, 1); /* Jaune pâle */
    --sidebar-active-bg: rgba(14, 46, 82, 0.1);
    --sidebar-transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);

    --sidebar-lng-text: rgba(14, 46, 82, 1); /* bleu sombre*/
}

/* ============================================
   STRUCTURE PRINCIPALE
   ============================================ */

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: var(--sidebar-width-collapsed);
    background: var(--sidebar-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1000;
    transition: var(--sidebar-transition);
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.sidebar:hover {
    width: var(--sidebar-width-expanded);
}

.sidebar-content {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 20px 0;
}

/* Ajustement du contenu principal pour compenser la sidebar */
body {
    margin-left: var(--sidebar-width-collapsed);
    transition: margin-left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   LOGO
   ============================================ */

.sidebar-logo {
    padding: 0 15px;
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
}

.sidebar-logo a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    transition: var(--sidebar-transition);
}

.logo-full {
    width: 0;
    height: auto;
    opacity: 0;
    transition: var(--sidebar-transition);
}

.sidebar:hover .logo-full {
    width: 180px;
    opacity: 1;
}

.logo-mini {
    width: 40px;
    height: 40px;
    opacity: 1;
    transition: var(--sidebar-transition);
}

.sidebar:hover .logo-mini {
    width: 0;
    opacity: 0;
}

/* ============================================
   NAVIGATION
   ============================================ */

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0; /* Permet au flex child de se rétrécir */
}

/* Scrollbar personnalisée */
.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--sidebar-text);
    border-radius: 2px;
}

.nav-items {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-item {
    margin-bottom: 8px;
    opacity: 0;
    animation: fadeInItem 0.5s ease forwards;
}

/* Animation d'apparition échelonnée */
.nav-item:nth-child(1) { animation-delay: 0.1s; }
.nav-item:nth-child(2) { animation-delay: 0.15s; }
.nav-item:nth-child(3) { animation-delay: 0.2s; }
.nav-item:nth-child(4) { animation-delay: 0.25s; }
.nav-item:nth-child(5) { animation-delay: 0.3s; }

@keyframes fadeInItem {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.nav-item a {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: var(--sidebar-transition);
    position: relative;
    overflow: hidden;
}

/* Effet de survol */
.nav-item a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 100%;
    background: var(--sidebar-text);
    transform: scaleY(0);
    transform-origin: top;
    transition: transform 0.3s ease;
}

.nav-item a:hover::before,
.nav-item.active a::before {
    transform: scaleY(1);
}

.nav-item a:hover {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-text-hover);
    padding-left: 24px;
}

.nav-item.active a {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-text-hover);
}

/* Icônes */
.nav-icon {
    width: 24px;
    height: 24px;
    min-width: 24px;
    stroke: currentColor;
    transition: var(--sidebar-transition);
}

.nav-item a:hover .nav-icon {
    transform: scale(1.1);
}

/* Texte du menu */
.nav-text {
    margin-left: 18px;
    font-size: 0.95rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(-10px);
    transition: var(--sidebar-transition);
}

.sidebar:hover .nav-text {
    opacity: 1;
    transform: translateX(0);
}

/* ============================================
   FOOTER (LANGUE)
   ============================================ */

.sidebar-footer {
    margin-top: auto;
    padding: 20px 0 0 0;
    border-top: 1px solid rgba(14, 46, 82, 0.2);
}

.sidebar-lang {
    position: relative;
}

.lang-current {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    color: var(--sidebar-text);
    cursor: pointer;
    transition: var(--sidebar-transition);
}

.lang-current:hover {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-text-hover);
}

.lang-name {
    margin-left: 18px;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(-10px);
    transition: var(--sidebar-transition);
}

.sidebar:hover .lang-name {
    opacity: 1;
    transform: translateX(0);
}

/* Dropdown de langue */
.lang-dropdown {
    position: absolute;
    bottom: 100%;
    left: 10px;
    background: rgba(255, 254, 245, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid var(--sidebar-text);
    border-radius: 8px;
    padding: 8px;
    display: none;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.2);
    min-width: 180px;
    opacity: 0;
    transform: translateY(10px);
    transition: var(--sidebar-transition);
}

.lang-dropdown.active {
    display: flex;
    animation: slideUpFadeIn 0.3s ease forwards;
}

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

.lang-option {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    border-radius: 6px;
    transition: var(--sidebar-transition);
    color: var(--sidebar-lng-text);
}

.lang-option:hover {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-lng-text);
    transform: translateX(4px);
}

.flag-icon {
    width: 24px;
    height: 16px;
    object-fit: cover;
    border: 1px solid var(--sidebar-text);
    border-radius: 3px;
    margin-right: 10px;
}

/* ============================================
   BOUTON MOBILE & OVERLAY
   ============================================ */

.sidebar-toggle {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1001;
    background: var(--sidebar-bg);
    backdrop-filter: blur(10px);
    border: 2px solid var(--sidebar-text);
    border-radius: 8px;
    width: 50px;
    height: 50px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    transition: var(--sidebar-transition);
    padding: 0;
}

.sidebar-toggle span {
    width: 24px;
    height: 2px;
    background: var(--sidebar-text);
    border-radius: 2px;
    transition: var(--sidebar-transition);
}

.sidebar-toggle:hover {
    background: var(--sidebar-active-bg);
    transform: scale(1.05);
}

.sidebar-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.sidebar-toggle.active span:nth-child(2) {
    opacity: 0;
}

.sidebar-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

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

@media (max-width: 768px) {
    body {
        margin-left: 0;
    }
    
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width-expanded);
    }
    
    .sidebar-content {
        height: 100vh;
        padding: 20px 0 10px 0; /* Réduit le padding-bottom */
        display: flex;
        flex-direction: column;
    }
    
    .sidebar-logo {
        flex-shrink: 0;
        margin-bottom: 20px; /* Réduit le margin-bottom */
    }
    
    /* Navigation avec hauteur calculée précisément */
    .sidebar-nav {
        flex: 0 1 auto; /* Ne pas grandir, peut rétrécir */
        height: calc(100vh - 240px); /* 100vh - logo(~80px) - footer(~140px) - paddings(~20px) */
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    .sidebar-footer {
        flex-shrink: 0;
        margin-top: 10px; /* Remplace le margin-top: auto par une valeur fixe */
        padding-top: 10px;
    }
    
    /* Ajustement du dropdown pour mobile */
    .lang-dropdown {
        bottom: 100%;
        left: 10px;
        margin-bottom: 10px;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .sidebar.active .nav-text,
    .sidebar.active .lang-name {
        opacity: 1;
        transform: translateX(0);
    }
    
    .sidebar.active .logo-full {
        width: 180px;
        opacity: 1;
    }
    
    .sidebar.active .logo-mini {
        width: 0;
        opacity: 0;
    }
    
    .sidebar-toggle {
        display: flex;
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 80%;
    }
    
    .sidebar-toggle {
        width: 45px;
        height: 45px;
    }
    
    .sidebar-toggle span {
        width: 20px;
    }
}

/* ============================================
   ANIMATIONS SUPPLÉMENTAIRES
   ============================================ */

/* Effet de pulsation subtile sur l'icône active */
.nav-item.active .nav-icon {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Smooth scroll pour les liens internes */
html {
    scroll-behavior: smooth;
}
