/* --- ESTRUCTURA PRINCIPAL DEL SIDEBAR --- */
.sidebar {
    background-color: #0b0b0b;
    width: 250px;
    min-height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    color: #fff;
}

/* Contenedor interno */
.sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Área scrolleable */
.sidebar-scroll {
    overflow-y: auto;
    overflow-x: hidden;
    flex-grow: 1;
    padding-right: 6px;
}

/* Footer */
.sidebar-footer {
    border-top: 1px solid #222;
    padding-top: .5rem;
    background-color: #0b0b0b;
}

/* --- LOGO SIDEBAR --- */
.sidebar-logo {
    max-width: 100px;  
}

/* Reduce el espacio vertical del contenedor */
.sidebar .text-center {
    margin-bottom: 1rem !important;
}

/* Desktop más compacto */
@media (min-width: 768px) {
    .sidebar-logo {
        max-width: 110px;
    }
}

/* Mobile aún más compacto */
@media (max-width: 768px) {
    .sidebar-logo {
        max-width: 100px;
    }
}


/* --- SCROLLBAR --- */
.sidebar-scroll::-webkit-scrollbar {
    width: 6px;
}
.sidebar-scroll::-webkit-scrollbar-thumb {
    background-color: #333;
    border-radius: 3px;
}
.sidebar-scroll::-webkit-scrollbar-thumb:hover {
    background-color: #555;
}

/* --- LINKS PRINCIPALES --- */
.sidebar .nav-link {
    font-size: .95rem;
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .6rem .75rem;
    color: #b5b5b5;
    transition: all .2s ease;
    border-radius: 10px;
}

.sidebar .nav-link i {
    font-size: .95rem;
    width: 20px;
    text-align: center;
    color: #caa24d;
}

/* Hover */
.sidebar .nav-link:hover {
    background-color: #111;
    color: #fff;
}

/* Active */
.sidebar .nav-link.active {
    background-color: #111;
    color: #fff;
    font-weight: 600;
    box-shadow: inset 4px 0 0 #caa24d;
}

/* Chevron animado */
.sidebar .nav-link .fa-chevron-down {
    transition: transform .25s ease;
    color: #777;
}

.sidebar .nav-link[aria-expanded="true"] .fa-chevron-down {
    transform: rotate(180deg);
    color: #caa24d;
}

/* --- SECCIONES (LABELS) --- */
.menu-label {
    color: #777;
    font-size: 11px;
    letter-spacing: .08em;
    padding-left: 8px;
}

/* --- SUBMENÚS --- */
.submenu {
    list-style: none;
    padding-left: 34px;
    margin-top: 6px;
    margin-bottom: 8px;
}

.submenu li a {
    display: block;
    padding: 6px 8px;
    font-size: 13px;
    color: #b5b5b5;
    text-decoration: none;
    border-radius: 8px;
    transition: all .15s ease;
}

.submenu li a:hover {
    background: #111;
    color: #fff;
}

.submenu li a.active {
    background: rgba(202,162,77,.12);
    color: #caa24d;
    font-weight: 600;
}

/* Línea visual sutil */
.submenu::before {
    content: '';
    display: block;
    width: 0px;
    height: 100%;
    background: #1f1f1f;
    position: absolute;
    left: 24px;
}

/* --- TEXT OVERFLOW --- */
.sidebar .text-white strong,
.sidebar .text-white .text-muted {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

/* --- SIDEBAR COLAPSADO (DESKTOP FUTURO) --- */
.sidebar.collapsed {
    width: 70px !important;
    transition: width .3s ease;
    overflow: hidden;
}

.sidebar.collapsed .nav-link span,
.sidebar.collapsed .menu-label,
.sidebar.collapsed .submenu {
    display: none;
}

/* --- MOBILE --- */
.sidebar-mobile-hidden {
    transform: translateX(-100%);
    transition: transform .3s ease;
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 250px;
    z-index: 1030;
}

.sidebar-mobile-visible {
    transform: translateX(0);
    transition: transform .3s ease;
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 250px;
    z-index: 1030;
}

/* Botón toggle */
#toggleSidebarMobile {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #111;
    color: #caa24d;
    border: 1px solid #222;
}

/* --- DESKTOP --- */
@media (min-width: 768px) {
    #layoutWrapper {
        display: flex;
        height: 100vh;
        overflow: hidden;
    }

    #sidebar {
        position: sticky;
        top: 0;
        height: 100vh;
        flex-shrink: 0;
        z-index: 1030;
    }

    #main-content {
        overflow-y: auto;
        height: 100vh;
        flex-grow: 1;
    }

    .sidebar-mobile-hidden,
    .sidebar-mobile-visible {
        transform: none !important;
    }
}

/* --- MOBILE --- */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform .3s ease;
    }

    .sidebar.sidebar-mobile-visible {
        transform: translateX(0);
    }

    .submenu {
        padding-left: 26px;
    }

    .sidebar-scroll {
        overflow-y: auto;
        max-height: calc(100vh - 200px);
    }
}
/* ===============================
   FIX: QUITAR AZUL BOOTSTRAP EN SUBMENÚ
   =============================== */

/* Quita fondo azul al abrir collapse */
.sidebar .collapse,
.sidebar .collapse.show {
    background: transparent !important;
}

/* Quita focus/active azul */
.sidebar .nav-link:focus,
.sidebar .nav-link:active,
.sidebar .nav-link:focus-visible {
    background-color: #111 !important;
    color: #fff !important;
    box-shadow: none !important;
    outline: none !important;
}

/* Cuando el submenu está abierto */
.sidebar .nav-link[aria-expanded="true"] {
    background-color: #111 !important;
    color: #fff !important;
}

/* Quita highlight azul en items internos */
.sidebar .submenu a:focus,
.sidebar .submenu a:active {
    background: #111 !important;
    color: #fff !important;
    box-shadow: none !important;
}

/* Evita efecto azul al hacer click prolongado (mobile) */
.sidebar a {
    -webkit-tap-highlight-color: transparent;
}

.nav-link .fa-chevron-down {
    transition: transform .2s ease;
}

.nav-link[aria-expanded="true"] .fa-chevron-down {
    transform: rotate(180deg);
}

