/* ============================================
   SIDEBAR MODERNE - STYLE 2025
   ============================================ */

/* Override des styles existants */
.sidebar-wrapper {
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%) !important;
    border-right: none !important;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15) !important;
    width: 280px !important;
    z-index: 999 !important;
}

/* Quand modal est ouverte, réduire le z-index de la sidebar */
body.modal-open .sidebar-wrapper,
body.modal-open #sidebar,
body.modal-open #sidebar.active,
body.modal-open #sidebar.active .sidebar-wrapper {
    z-index: 1 !important;
}

/* S'assurer que le main est au-dessus de la sidebar quand modal ouverte */
body.modal-open #main {
    z-index: 2 !important;
    position: relative;
}

.sidebar-wrapper .sidebar-header {
    padding: 2rem 1.5rem !important;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 0 0 20px 20px;
    margin: 0 0.5rem 1.5rem 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Logo texte ENT Escale */
.ent-logo-text {
    text-align: center;
}

.ent-logo-text .ent-main {
    font-size: 2.5rem;
    font-weight: 900;
    color: white;
    letter-spacing: 8px;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    margin-bottom: -0.5rem;
}

.ent-logo-text .ent-sub {
    font-size: 1.2rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    letter-spacing: 3px;
    text-transform: uppercase;
}

/* Bouton fermeture sidebar (X) - dans la sidebar */
.sidebar-toggler.btn-close-sidebar {
    position: absolute;
    right: 1rem;
    top: 1rem;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    display: none; /* Caché par défaut */
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
    z-index: 1000;
}

.sidebar-toggler.btn-close-sidebar:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg) scale(1.1);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.sidebar-toggler.btn-close-sidebar:active {
    transform: rotate(90deg) scale(0.95);
}

.sidebar-toggler.btn-close-sidebar i,
.sidebar-toggler.btn-close-sidebar svg {
    color: white !important;
    stroke: white !important;
    width: 22px;
    height: 22px;
}

/* Bouton ouverture sidebar (menu hamburger) - dans la navbar */
.navbar .sidebar-toggler {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: transparent;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 1rem;
}

.navbar .sidebar-toggler:hover {
    background: rgba(102, 126, 234, 0.1);
    border-color: rgba(102, 126, 234, 0.2);
    transform: scale(1.05);
}

.navbar .sidebar-toggler:active {
    transform: scale(0.95);
}

.navbar .sidebar-toggler .navbar-toggler-icon {
    width: 22px;
    height: 22px;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%23667eea' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2.5' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

@media screen and (max-width: 1199px) {
    .sidebar-toggler.btn-close-sidebar {
        display: flex !important;
    }
}

@media screen and (min-width: 1200px) {
    .navbar .sidebar-toggler {
        display: none;
    }
}

/* Menu principal */
.sidebar-wrapper .menu {
    padding: 0 0.5rem;
}

.sidebar-wrapper .menu .sidebar-title {
    color: rgba(255, 255, 255, 0.7) !important;
    font-size: 0.75rem !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 1.5rem 1.5rem 0.5rem !important;
    margin-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-wrapper .menu .sidebar-title:first-of-type {
    border-top: none;
    margin-top: 0;
}

/* Items de menu */
.sidebar-wrapper .menu .sidebar-item {
    margin: 0.3rem 0;
}

.sidebar-wrapper .menu .sidebar-link {
    padding: 0.9rem 1.2rem !important;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    position: relative;
    overflow: hidden;
    cursor: pointer !important;
    pointer-events: auto !important;
}

.sidebar-wrapper .menu .sidebar-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    transition: left 0.3s;
}

.sidebar-wrapper .menu .sidebar-link:hover::before {
    left: 0;
}

.sidebar-wrapper .menu .sidebar-link:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    transform: translateX(5px);
}

.sidebar-wrapper .menu .sidebar-link > span {
    color: white !important;
    font-weight: 500 !important;
    opacity: 1 !important;
    font-size: 0.9rem;
}

.sidebar-wrapper .menu .sidebar-link i,
.sidebar-wrapper .menu .sidebar-link svg {
    color: white !important;
    stroke: white !important;
}

/* Item actif */
.sidebar-wrapper .menu .sidebar-item.active .sidebar-link {
    background: rgba(255, 255, 255, 0.25) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.sidebar-wrapper .menu .sidebar-item.active .sidebar-link::before {
    display: none;
}

.sidebar-wrapper .menu .sidebar-item.active .sidebar-link:before {
    content: "" !important;
    position: absolute !important;
    left: 0 !important;
    height: 60% !important;
    top: 20% !important;
    background: white !important;
    width: 4px !important;
    border-radius: 0 4px 4px 0;
}

/* Sous-menu */
.sidebar-wrapper .menu .sidebar-item.has-sub .sidebar-link {
    cursor: pointer !important;
    pointer-events: auto !important;
}

.sidebar-wrapper .menu .sidebar-item.has-sub .sidebar-link:after {
    filter: brightness(0) invert(1) !important;
    opacity: 0.8 !important;
    pointer-events: none !important;
    transition: transform 0.3s ease !important;
}

.sidebar-wrapper .menu .sidebar-item.active .sidebar-link:after {
    transform: rotate(180deg) !important;
}

.sidebar-wrapper .menu .submenu {
    background: rgba(0, 0, 0, 0.15) !important;
    border-radius: 12px !important;
    margin: 0.5rem 0 0.5rem 1rem !important;
    padding: 0 !important;
    pointer-events: auto !important;
    list-style: none !important;
    max-height: 0 !important;
    overflow: hidden !important;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), padding 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    opacity: 0 !important;
}

.sidebar-wrapper .menu .submenu.active {
    max-height: 800px !important;
    padding: 0.5rem 0 !important;
    opacity: 1 !important;
}

.sidebar-wrapper .menu .submenu li a {
    color: rgba(255, 255, 255, 0.85) !important;
    padding: 0.7rem 2rem !important;
    font-size: 0.85rem !important;
    border-radius: 8px;
    margin: 0.2rem 0.5rem;
    transition: all 0.2s;
}

.sidebar-wrapper .menu .submenu li a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white !important;
    transform: translateX(5px);
}

/* Animation d'ouverture */
@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

#sidebar.active .sidebar-wrapper {
    animation: slideInLeft 0.4s ease-out;
}

/* Scrollbar personnalisée */
.sidebar-wrapper::-webkit-scrollbar {
    width: 6px;
}

.sidebar-wrapper::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-wrapper::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}

.sidebar-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Responsive */
@media screen and (max-width: 767px) {
    .sidebar-wrapper {
        width: 260px !important;
    }
}
