html {
    height: 100%;
}

/* Contenedor principal: a la derecha del sidebar, sin hueco extra bajo la navbar */
.main-content {
    margin-left: 0;
    padding-top: 0;
    padding: 10px 12px;
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    box-sizing: border-box;
    overflow-x: hidden;
    background: #f0f2f7;
}

/* Navbar: ancho completo encima de sidebar + contenido (mockup Escuela360) */
body > header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1100;
    background: #1e2d4a;
}

.navbar {
    position: relative;
    top: 0;
    left: 0 !important;
    width: 100% !important;
    z-index: 1100;
    background-color: #1e2d4a;
    color: white;
    padding: 0 16px;
    min-height: var(--app-navbar-height);
    box-shadow: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.12);
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    height: var(--app-navbar-height);
    box-sizing: border-box;
}


/* Estilo para el contenedor de los enlaces */
.navbar-nav {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: row !important;
    gap: 8px;
    width: 100% !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
}

.navbar-nav .nav-spacer {
    flex: 1 1 auto;
    min-width: 8px;
    list-style: none;
}

.navbar-nav .nav-brand-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #e8edf5;
    letter-spacing: 0.02em;
    margin-right: 20px;
    padding: 6px 0;
    white-space: nowrap;
}

.navbar-nav .nav-brand-link span {
    color: #5b9bd5;
}

.navbar-nav .nav-link {
    color: #8fa8c8;
    text-decoration: none;
    font-size: 0.8125rem;
    padding: 6px 18px;
    border-radius: 6px;
    white-space: nowrap;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.navbar-nav .nav-link:hover {
    color: #c8d8eb;
    background-color: rgba(255, 255, 255, 0.08);
}

.navbar-nav .nav-link.active {
    color: #5b9bd5;
    background: rgba(91, 155, 213, 0.26);
    font-weight: 500;
}

.navbar-nav .nav-user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #2d4a72;
    color: #c8d8eb;
    font-size: 0.6875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 4px;
    flex-shrink: 0;
}

/* Estilo para el logo o marca */


/* Ajustar el contenido principal para evitar que quede oculto detras de la navbar */
.content {
    margin-left: 20%; /* Deja espacio para el sidebar */
    padding-top: 60px; /* Ajusta el margen superior para compensar la altura de la navbar */
    max-width: 1200px;
    margin: 0 auto;
}

/* Botón de Actualización Global */
#btnActualizacionGlobal {
    width: 32px !important;
    height: 32px !important;
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: white !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: none !important;
    cursor: pointer;
    padding: 0 !important;
    border-radius: 4px;
    transition: background-color 0.3s ease;
    flex-shrink: 0 !important;
}

#btnActualizacionGlobal:hover:not(:disabled) {
    background-color: rgba(255, 255, 255, 0.15) !important;
}

#btnActualizacionGlobal:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

#btnActualizacionGlobal svg {
    width: 20px !important;
    height: 20px !important;
    fill: white !important;
    transition: transform 0.3s ease;
}

#btnActualizacionGlobal.updating svg {
    animation: spin 1s linear infinite;
}

#btnConfiguracion {
    width: 32px !important;
    height: 32px !important;
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: white !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: none !important;
    cursor: pointer;
    padding: 0 !important;
    border-radius: 4px;
    transition: background-color 0.3s ease;
    text-decoration: none !important;
    flex-shrink: 0 !important;
    position: relative !important;
    z-index: 1 !important;
}

#btnConfiguracion:hover {
    background-color: rgba(255, 255, 255, 0.15) !important;
}

#btnConfiguracion svg {
    width: 20px !important;
    height: 20px !important;
    fill: white !important;
}

.nav-item {
    display: flex !important;
    align-items: center !important;
    flex-shrink: 0; /* Evita que se encojan */
}

.nav-item[style*="margin-left: auto"] {
    margin-left: auto !important;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.layout-container {
    margin: 0;
    padding: 0;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: stretch;
    margin-top: var(--app-navbar-height);
    min-height: calc(100vh - var(--app-navbar-height));
}

/* Con sidebar: el cuerpo no hace scroll; solo sidebar y contenido principal */
body.layout-with-sidebar {
    height: 100%;
    overflow: hidden;
}

body.layout-with-sidebar .layout-container {
    flex-direction: row;
    height: calc(100vh - var(--app-navbar-height));
    max-height: calc(100vh - var(--app-navbar-height));
    min-height: 0;
    overflow: hidden;
}

/* Dimensiones del sidebar en panelLateral.css */

body.layout-with-sidebar .main-content {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}

body.layout-no-sidebar {
    min-height: 100%;
}

body.layout-no-sidebar .layout-container {
    flex-direction: column;
    height: auto;
    max-height: none;
    min-height: calc(100vh - var(--app-navbar-height));
    overflow: visible;
}

body.layout-no-sidebar .main-content {
    width: 100%;
    flex: 1 1 auto;
    max-height: none;
    overflow-x: hidden;
    overflow-y: visible;
}

@media (max-width: 576px) {
    body.layout-with-sidebar {
        height: auto;
        min-height: 100%;
        overflow: auto;
    }

    body.layout-with-sidebar .layout-container {
        height: auto;
        max-height: none;
        min-height: calc(100vh - var(--app-navbar-height));
        overflow: visible;
    }

    body.layout-with-sidebar .main-content {
        height: auto;
        max-height: none;
        overflow: visible;
    }
}

/* Optimización de espacio: Contenedores y tablas */
.main-content .container,
.main-content .container-fluid {
    max-width: 100%;
    padding-left: 0;
    padding-right: 0;
    width: 100%;
}

.main-content table {
    width: 100%;
    max-width: 100%;
}

/* Asegurar que DataTables y otros contenedores se expandan */
.main-content .dataTables_wrapper {
    width: 100%;
}

.main-content .dataTables_wrapper .dataTables_scroll {
    width: 100%;
}
