/* Sidebar Menu Styles */

/* Botón hamburguesa */
.menu-toggle {
    display: block;
    background: none;
    border: none;
    padding: 10px;
    cursor: pointer;
    flex-direction: column;
    justify-content: space-around;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.menu-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.hamburger-line {
    width: 24px;
    height: 3px;
    background-color: white;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.menu-toggle.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.menu-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* Overlay del sidebar */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Sidebar principal */
.sidebar {
    position: fixed;
    top: 0;
    left: -320px;
    width: 320px;
    height: 100%;
    background: linear-gradient(135deg, #4FE9E5, #0057C4);
    z-index: 9999;
    transition: left 0.3s ease;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
}

.sidebar.active {
    left: 0;
}

/* Header del sidebar */
.sidebar-header {
    padding: 20px;
    background: rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.sidebar-title {
    color: white;
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
}

.sidebar-close {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.sidebar-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Contenido del sidebar */
.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

/* Lista del menú principal */
.sidebar-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-menu-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-menu-item:last-child {
    border-bottom: none;
}

/* Enlaces del menú principal */
.sidebar-link {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    font-size: 1rem;
}

.sidebar-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    padding-left: 25px;
}

.sidebar-link i {
    margin-right: 12px;
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

.sidebar-link span {
    flex: 1;
}

/* Flecha para dropdown */
.sidebar-arrow {
    margin-left: auto;
    margin-right: 0;
    transition: transform 0.3s ease;
    font-size: 0.9rem !important;
    width: auto !important;
}

.sidebar-dropdown-toggle.active .sidebar-arrow {
    transform: rotate(180deg);
}

/* Submenú */
.sidebar-submenu {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 400px; /* Desplegado por defecto */
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.1);
    transition: max-height 0.3s ease;
}

.sidebar-submenu.active {
    max-height: 400px; /* Ajustar según el número de elementos */
}

/* Categorías desplegadas por defecto */
#categorias {
    max-height: 400px;
}

.sidebar-submenu-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-submenu-item:last-child {
    border-bottom: none;
}

/* Enlaces del submenú */
.sidebar-sublink {
    display: block;
    padding: 12px 20px 12px 50px;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.sidebar-sublink:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    padding-left: 55px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .sidebar {
        width: 280px;
        left: -280px;
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 100%;
        left: -100%;
    }
    
    .sidebar-header {
        padding: 15px;
    }
    
    .sidebar-title {
        font-size: 1.2rem;
    }
}

/* Ajustes al header para incluir el botón hamburguesa */
.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.header-content .logo {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

/* Animaciones adicionales */
@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

.sidebar.active {
    animation: slideInLeft 0.3s ease;
}

/* Estados hover mejorados */
.sidebar-link:active {
    background-color: rgba(255, 255, 255, 0.2);
}

.sidebar-sublink:active {
    background-color: rgba(255, 255, 255, 0.15);
}

/* Scrollbar personalizado para el sidebar */
.sidebar-content::-webkit-scrollbar {
    width: 6px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}
