/* ==========================================================
   eCLASSWeB · Adaptación global para computadora, tablet y móvil
   Se carga al final de las vistas para respetar los estilos
   específicos de cada módulo y corregir sus desbordamientos.
   ========================================================== */

html {
    width: 100%;
    min-width: 320px;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    max-width: 100%;
    min-width: 320px;
    overflow-x: hidden;
}

.dashboard-contentPage {
    box-sizing: border-box;
    max-width: 100%;
    overflow-x: hidden;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
}

.dashboard-contentPage img,
.dashboard-contentPage video,
.dashboard-contentPage iframe,
.dashboard-contentPage embed,
.dashboard-contentPage object,
.dashboard-contentPage canvas,
.dashboard-contentPage svg {
    max-width: 100%;
}

.dashboard-contentPage .container,
.dashboard-contentPage .container-fluid {
    box-sizing: border-box;
    max-width: 100%;
}

.dashboard-contentPage input,
.dashboard-contentPage select,
.dashboard-contentPage textarea,
.dashboard-contentPage button,
.dashboard-contentPage .btn,
.dashboard-contentPage .form-control {
    box-sizing: border-box;
}

.dashboard-contentPage input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]),
.dashboard-contentPage select,
.dashboard-contentPage textarea,
.dashboard-contentPage .form-control {
    max-width: 100%;
}

.dashboard-contentPage pre,
.dashboard-contentPage code,
.dashboard-contentPage a,
.dashboard-contentPage p,
.dashboard-contentPage td,
.dashboard-contentPage th {
    overflow-wrap: anywhere;
}

/* Contenedor añadido únicamente a tablas que no poseen ya desplazamiento */
.eclass-responsive-table-wrap {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 0 0 15px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
}

.eclass-responsive-table-wrap:focus {
    outline: 2px solid #1976d2;
    outline-offset: 2px;
}

.eclass-responsive-table-wrap > table {
    width: max-content;
    min-width: 100%;
    max-width: none;
    margin-bottom: 0;
}

/* Tabletas: que el contenido utilice todo el ancho disponible. */
@media (min-width: 768px) and (max-width: 1199px) {
    .dashboard-contentPage {
        max-width: 100%;
    }

    .dashboard-contentPage .container,
    .dashboard-contentPage .container-fluid {
        padding-left: 14px;
        padding-right: 14px;
    }

    .dashboard-contentPage .page-header h1,
    .dashboard-contentPage h1.text-titles {
        overflow-wrap: anywhere;
    }
}

/* Teléfonos */
@media (max-width: 767px) {
    html,
    body {
        width: 100%;
        min-width: 320px;
        max-width: 100%;
    }

    .dashboard-contentPage {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 100%;
        max-width: 100vw;
        padding-left: 0 !important;
        padding-right: 0 !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    /* Menú lateral como cajón deslizable con fondo oscurecido */
    .dashboard-sideBar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        min-height: 100%;
        z-index: 10000 !important;
        overflow: hidden !important;
    }

    .dashboard-sideBar-ct {
        position: absolute !important;
        top: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        width: min(88vw, 320px) !important;
        max-width: min(88vw, 320px) !important;
        height: 100% !important;
        max-height: 100dvh;
        padding-left: 12px !important;
        padding-right: 12px !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        transform: translateX(-105%) !important;
        box-shadow: 8px 0 28px rgba(8, 36, 70, .22) !important;
    }

    .dashboard-sideBar.show-sidebar {
        pointer-events: auto !important;
        opacity: 1 !important;
    }

    .dashboard-sideBar.show-sidebar > .dashboard-sideBar-ct {
        transform: translateX(0) !important;
    }

    .dashboard-sideBar-bg {
        position: absolute !important;
        inset: 0 !important;
        width: 100% !important;
        height: 100% !important;
        background: rgba(12, 28, 48, .58) !important;
    }

    .dashboard-sideBar-UserInfo .logo-contenedor {
        max-width: 112px !important;
        max-height: 112px !important;
    }

    .dashboard-sideBar-Menu > li > a {
        min-height: 48px !important;
    }

    /* Cabecera: texto legible, botones alcanzables y sin desbordamiento */
    .dashboard-Navbar {
        width: 100% !important;
        max-width: 100% !important;
        overflow: visible !important;
    }

    .navbar-title-row,
    .navbar-institution-row,
    .navbar-controls-row,
    .navbar-controls-row > ul {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .navbar-platform-title {
        white-space: normal !important;
        overflow-wrap: anywhere;
        text-align: center;
        line-height: 1.2 !important;
    }

    .navbar-institution-title {
        white-space: normal !important;
        overflow-wrap: anywhere;
        text-overflow: clip !important;
        line-height: 1.12 !important;
    }

    .navbar-controls-row > ul {
        padding-left: 5px !important;
        padding-right: 5px !important;
    }

    .navbar-social-wrapper {
        gap: 3px !important;
        max-width: 100%;
    }

    /* Páginas, tarjetas y encabezados */
    .dashboard-contentPage .container,
    .dashboard-contentPage .container-fluid {
        width: 100% !important;
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    .dashboard-contentPage .row {
        margin-left: -8px;
        margin-right: -8px;
    }

    .dashboard-contentPage .row > [class*="col-"] {
        padding-left: 8px;
        padding-right: 8px;
    }

    .dashboard-contentPage .page-header {
        margin-top: 14px;
        margin-bottom: 14px;
        padding-bottom: 9px;
    }

    .dashboard-contentPage .page-header h1,
    .dashboard-contentPage h1.text-titles {
        font-size: clamp(20px, 5.5vw, 27px) !important;
        line-height: 1.2 !important;
        overflow-wrap: anywhere;
    }

    .dashboard-contentPage h2 {
        overflow-wrap: anywhere;
    }

    .dashboard-contentPage .panel-body,
    .dashboard-contentPage .admin-modern-card .panel-body {
        padding: 13px !important;
    }

    .dashboard-contentPage .btn,
    .dashboard-contentPage button {
        max-width: 100%;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .dashboard-contentPage .form-group {
        min-width: 0;
        max-width: 100%;
    }

    .dashboard-contentPage .form-inline {
        display: flex;
        flex-wrap: wrap;
        align-items: flex-end;
        gap: 8px;
    }

    .dashboard-contentPage .form-inline .form-group {
        flex: 1 1 150px;
        margin-bottom: 8px;
    }

    .dashboard-contentPage .form-inline .btn {
        margin: 0 0 8px;
    }

    /* Todas las tablas mantienen sus columnas y se desplazan dentro de su zona. */
    .dashboard-contentPage .table-responsive,
    .dashboard-contentPage .admin-table-wrap,
    .dashboard-contentPage .admin-modern-table-wrap,
    .dashboard-contentPage .student-list-table-wrap,
    .dashboard-contentPage .tm-grid-wrap,
    .dashboard-contentPage .th-all-wrap,
    .dashboard-contentPage .cg-table-wrap,
    .dashboard-contentPage .smn3-table-wrap,
    .dashboard-contentPage .enrolled-table-wrap,
    .dashboard-contentPage .wg-table-wrap,
    .dashboard-contentPage .responsive-table-wrap,
    .eclass-responsive-table-wrap {
        width: 100%;
        max-width: 100%;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
    }

    .dashboard-contentPage .pagination {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 4px;
        padding-left: 0;
        margin: 12px 0;
    }

    .dashboard-contentPage .pagination > li {
        display: inline-flex;
        margin: 0 1px;
    }

    .dashboard-contentPage .pagination > li > a,
    .dashboard-contentPage .pagination > li > span {
        min-width: 34px;
        min-height: 34px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 6px 9px;
    }

    /* Ventanas y cuadros emergentes */
    .dashboard-contentPage .modal-dialog {
        width: auto !important;
        max-width: calc(100vw - 20px) !important;
        margin: 10px auto !important;
    }

    .dashboard-contentPage .modal-content,
    .dashboard-contentPage .modal-body {
        max-width: 100%;
        box-sizing: border-box;
    }

    .dashboard-contentPage .modal-body {
        padding: 12px !important;
        overflow-x: auto;
    }

    .dashboard-contentPage .modal-footer {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        padding: 12px;
    }

    .dashboard-contentPage .modal-footer .btn {
        margin: 0;
        flex: 1 1 auto;
    }

    .system-copyright-footer {
        max-width: 100%;
        overflow-wrap: anywhere;
    }
}

@media (max-width: 380px) {
    .navbar-platform-title {
        font-size: 13px !important;
    }

    .navbar-institution-title {
        font-size: 18px !important;
    }

    .navbar-social-wrapper {
        gap: 2px !important;
    }

    .navbar-controls-row .btn-menu-dashboard,
    .navbar-controls-row .btn-search,
    .navbar-controls-row .social-icon-button {
        width: 29px !important;
        height: 29px !important;
        min-width: 29px !important;
        border-radius: 8px !important;
    }

    .navbar-social-wrapper .social-icon-button i {
        font-size: 15px !important;
    }

    .dashboard-contentPage .container,
    .dashboard-contentPage .container-fluid {
        padding-left: 9px !important;
        padding-right: 9px !important;
    }
}

/* Reduce animaciones cuando el dispositivo lo solicita. */
@media (prefers-reduced-motion: reduce) {
    .dashboard-sideBar,
    .dashboard-sideBar-ct,
    .dashboard-contentPage,
    .dashboard-sideBar-Menu > li > a,
    .navbar-controls-row a {
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
    }
}
