/* --- Estilos Existentes --- */

/* Contenido de navegación colapsable */
.nav-content {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease-out;
}

.nav-content.show {
    max-height: 500px;
    transition: max-height 0.5s ease-in;
}

/* Icono de chevron para toggle */
.toggle-nav .bi-chevron-down {
    transition: transform 0.3s;
}

.toggle-nav.collapsed .bi-chevron-down {
    transform: rotate(-90deg);
}

.toggle-nav:not(.collapsed) .bi-chevron-down {
    transform: rotate(0deg);
}

/* Padding específico para sem-week-months-nav */
#sem-week-months-nav {
    padding-left: 20px;
}

/* Estilos para los ítems de navegación */
.category-item,
.interval-item,
.year-item,
.month-item,
.month-filter-item,
.week-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
    padding: 0.5rem 1rem;
}

.category-item:hover,
.interval-item:hover,
.year-item:hover,
.month-item:hover,
.month-filter-item:hover,
.week-link:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* Estilos para inputs de formulario */
.form-check-input,
.form-check-label {
    cursor: pointer;
}

.form-check-input {
    width: 1rem;
    height: 1rem;
}

.form-check-label {
    margin-bottom: 0;
}

/* Overlay de carga */
.loading-overlay {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.sidebar:not(.loading) .loading-overlay {
    display: none;
}

/* --- Estilos del Sidebar --- */
.sidebar {
    position: fixed;
    left: -250px; /* Sidebar oculto por defecto en escritorio */
    width: 250px;
    height: 90%;
    background-color: #f8f9fa;
    overflow-y: auto;
    transition: left 0.3s ease;
    z-index: 1000;
}

/* Sidebar visible en escritorio */
.sidebar.open {
    left: 0;
}

/* Estilos para el contenido principal */
#main { /* Cambiado de .main a #main */
    margin-left: 2%;
    margin-right: 2%;
    transition: margin-left 0.3s ease, margin-top 0.3s ease;
}

/* Cuando el sidebar está abierto en escritorio, desplazar el contenido principal */
body.sidebar-open #main {
    margin-left: 250px;
}

/* --- Botón de Toggle para el Sidebar --- */
.sidebar-toggle-button {
    position: fixed;
    top: 70px;
    left: 0;
    z-index: 1100; /* Aumentado para estar por encima del sidebar */
    transition: left 0.3s ease;
}



/* Ocultar el ícono de cerrar por defecto */
.sidebar-toggle-button .close-icon {
    display: none;
}

/* Mostrar el ícono de cerrar y ocultar el ícono de abrir cuando el sidebar está abierto */
body.sidebar-open .sidebar-toggle-button .close-icon {
    display: inline;
}

body.sidebar-open .sidebar-toggle-button .open-icon {
    display: none;
}

/* --- Opcional: Transiciones Suaves para los Íconos --- */
.sidebar-toggle-button .open-icon,
.sidebar-toggle-button .close-icon {
    transition: opacity 0.3s ease;
}

.sidebar-toggle-button .close-icon {
    opacity: 0;
}

body.sidebar-open .sidebar-toggle-button .close-icon {
    opacity: 1;
}

body.sidebar-open .sidebar-toggle-button .open-icon {
    opacity: 0;
}

.sidebar-toggle-button .open-icon {
    opacity: 1;
}


/* --- Estilos Responsivos --- */


@media (min-width: 767.98px){
    .sidebar.open~.sidebar-toggle-button {
        left: 250px;
    }
}
/* Para pantallas pequeñas (dispositivos móviles) */
@media (max-width: 767.98px) {

    body.sidebar-open .sidebar-toggle-button {
        left: 2px; /* Mover el botón junto con el sidebar en escritorio */
    }
    /* Transformar el sidebar en un menú superior */
    .sidebar {
        position: fixed;
        left: 0;
        width: 100%;
        height: 90%;
        transform: translateY(-100%);
        transition: transform 0.3s ease;
        background-color: #f8f9fa;
        z-index: 1000;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
    }

    .sidebar.open {
        transform: translateY(0);
    }

    /* Posicionar el botón de toggle en la parte superior derecha */
    .sidebar-toggle-button {
        top: 10px;
        right: 10px;
        left: auto; /* Anular la propiedad left */
    }

    /* Mantener la posición del botón al abrir el sidebar */
    body.sidebar-open .sidebar-toggle-button {
        top: 10px;
        right: 10px;
        left: auto; /* Asegurar que no se mueva a la izquierda */
    }

    /* El contenido principal no se desplaza lateralmente */
    #main {
        margin-left: 0;
        margin-top: 70px;
    }

    /* Mantener el margen superior del contenido principal */
    body.sidebar-open #main {
        margin-top: 70px;
    }

    /* Estilizar el botón de toggle para pantallas pequeñas */
    .sidebar-toggle-button .btn {
        padding: 0.5rem 1rem;
        font-size: 1.2rem;
    }
    
}