/* Estilos responsive específicos para páginas de administración */

/* Ajustes para pantallas ultra-anchas (1920px+) — no afecta escritorio estándar */
@media (min-width: 1920px) {
    /* Reducir márgenes levemente en pantallas muy grandes */
    .mb-4 {
        margin-bottom: 0.75rem !important;
    }

    .mb-3 {
        margin-bottom: 0.6rem !important;
    }

    .mt-3 {
        margin-top: 0.6rem !important;
    }

    .mt-4 {
        margin-top: 0.75rem !important;
    }

    .p-3 {
        padding: 0.6rem !important;
    }

    .p-4 {
        padding: 0.75rem !important;
    }

    /* Iconos levemente reducidos — excepto dentro de stat-cards (usan tamaño calculado) */
    :not(.stat-icon) > .fas,
    :not(.stat-icon) > .far,
    :not(.stat-icon) > .fab {
        font-size: 0.85rem !important;
    }

    /* Stat-card icons mantienen su tamaño proporcional al contenedor */
    .stat-card .stat-icon .fas,
    .stat-card .stat-icon .far,
    .stat-card .stat-icon .fab {
        font-size: inherit !important;
    }

    .fa-2x {
        font-size: 1.4em !important;
    }

    .fa-3x {
        font-size: 2em !important;
    }

    /* Imágenes de perfil */
    img[style*="width: 50px"],
    img[style*="height: 50px"] {
        width: 40px !important;
        height: 40px !important;
        max-width: 40px !important;
        max-height: 40px !important;
    }

    /* Espaciado de botones en grupo */
    .btn.me-2 {
        margin-right: 0.5rem !important;
    }

    /* Espaciado de columnas */
    .row.g-3 {
        --bs-gutter-x: 0.6rem !important;
        --bs-gutter-y: 0.6rem !important;
    }

    /* Dropdown menú */
    .dropdown-menu {
        font-size: 0.85rem !important;
        padding: 0.5rem 0 !important;
    }

    .dropdown-item {
        padding: 0.4rem 0.8rem !important;
        font-size: 0.85rem !important;
    }

    /* Paginación */
    .pagination {
        font-size: 0.85rem !important;
    }

    .page-link {
        padding: 0.4rem 0.65rem !important;
    }

    /* Tabs más compactas */
    .nav-tabs .nav-link {
        padding: 0.5rem 1rem !important;
        font-size: 0.875rem !important;
    }

    /* Breadcrumbs más compactos */
    .breadcrumb {
        font-size: 0.85rem !important;
        padding: 0.5rem 0.75rem !important;
    }

    /* Progress bars más delgadas */
    .progress {
        height: 1rem !important;
        font-size: 0.7rem !important;
    }

    /* Tooltips más pequeños */
    .tooltip {
        font-size: 0.8rem !important;
    }

    /* Popovers más compactos */
    .popover {
        font-size: 0.85rem !important;
    }

    /* Acordeones más compactos */
    .accordion-button {
        padding: 0.75rem 1rem !important;
        font-size: 0.875rem !important;
    }

    .accordion-body {
        padding: 0.75rem 1rem !important;
    }

    /* Input groups más compactos */
    .input-group-text {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.875rem !important;
    }

    /* List groups más compactos */
    .list-group-item {
        padding: 0.6rem 0.9rem !important;
        font-size: 0.875rem !important;
    }

    /* Offcanvas más compacto */
    .offcanvas-header {
        padding: 0.75rem 1rem !important;
    }

    .offcanvas-body {
        padding: 0.75rem 1rem !important;
    }

    /* Spinners más pequeños */
    .spinner-border {
        width: 1.5rem !important;
        height: 1.5rem !important;
    }

    .spinner-border-sm {
        width: 1rem !important;
        height: 1rem !important;
    }
}

/* Bloque eliminado: los ajustes "extremos" a 1920px causaban íconos de 0.55rem
   y line-height:1.2 en todo el DOM — ver commit fix/admin-responsive-icons */

/* Ajustes específicos para pantallas 4K (2560px+) */
@media (min-width: 2560px) {
    .container,
    .container-fluid {
        max-width: 1400px !important;
        margin-inline: auto !important;
    }

    .sistema-navbar .navbar-inner {
        max-width: 1400px !important;
        margin-inline: auto !important;
    }

    html {
        font-size: 14px;
    }
}

/* Mejoras de rendimiento para tablas grandes */
@media (min-width: 1366px) {
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Sticky primera columna con fondo explícito para zebra striping */
    .table th:first-child {
        position: sticky;
        left: 0;
        z-index: 11;
        background: linear-gradient(135deg, var(--primary-beige, #fcdca9) 0%, var(--primary-beige-dark, #f5d19d) 100%);
    }

    .table tbody tr td:first-child {
        position: sticky;
        left: 0;
        z-index: 10;
        background: var(--neutral-cream, #fffef9);
    }

    .table tbody tr:nth-child(even) td:first-child {
        background: var(--neutral-warm-50, #f5f2ed);
    }

    .table tbody tr:hover td:first-child {
        background: var(--primary-beige-light, #fef6e9);
    }
}

/* Ajustes para modales en pantallas grandes */
@media (min-width: 1366px) {
    .modal-dialog {
        max-width: 600px !important;
    }

    .modal-lg {
        max-width: 900px !important;
    }

    .modal-xl {
        max-width: 1200px !important;
    }

    .modal-title {
        font-size: 1.1rem !important;
    }
}

/* Reducir espaciado de filas en listas */
@media (min-width: 1366px) {
    .list-group-item + .list-group-item {
        margin-top: 0 !important;
        border-top-width: 1px !important;
    }
}

/* Optimizar cards en grids */
@media (min-width: 1366px) {
    .row > [class*="col-"] {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
}

/* Reducir altura de header */
@media (min-width: 1366px) {
    .d-flex.justify-content-between.align-items-center {
        margin-bottom: 1rem !important;
    }

    .d-flex.justify-content-between.align-items-center h1 {
        margin-bottom: 0 !important;
    }
}

/* Ajustes para filtros y búsqueda */
@media (min-width: 1366px) {
    .card-body form .row {
        margin-bottom: 0 !important;
    }

    .card-body form .col-md-2,
    .card-body form .col-md-6 {
        padding-bottom: 0 !important;
    }
}

/* Optimizar espaciado de badges */
@media (min-width: 1366px) {
    .badge + .badge {
        margin-left: 0.3rem !important;
    }
}

/* Reducir altura de navbar */
@media (min-width: 1366px) {
    .navbar {
        padding-top: 0.5rem !important;
        padding-bottom: 0.5rem !important;
    }

    .navbar-brand {
        font-size: 1rem !important;
        padding-top: 0.25rem !important;
        padding-bottom: 0.25rem !important;
    }

    .nav-link {
        padding: 0.4rem 0.8rem !important;
    }
}

/* ── Mobile (< 768px): botones de acción icon-only en tablas de admin ── */
@media (max-width: 767.98px) {
    /* Docentes: botones ya son icon-only, solo compactar */
    .admin-teachers-page table td:last-child .btn {
        padding: 0.3rem 0.45rem !important;
    }
    .admin-teachers-page table td:last-child .d-flex {
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    /* Tutores: compactar botones */
    .admin-tutors-page table td:last-child .btn {
        font-size: 0 !important;
        padding: 0.3rem 0.45rem !important;
        line-height: 1;
    }
    .admin-tutors-page table td:last-child .btn i {
        font-size: 0.82rem !important;
    }
    /* El texto "Estudiantes" ya usa d-none d-md-inline — no necesita font-size:0 */
}

/* ── Mobile (< 576px): encabezados de página ── */
@media (max-width: 575.98px) {
    /* Cualquier d-flex con justify-content-between dentro de container-fluid: wrappea */
    .container-fluid .d-flex.justify-content-between {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    /* Grupos de botones dentro de esos headers: también wrappean */
    .container-fluid .d-flex.justify-content-between > div {
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    /* Títulos más pequeños en mobile */
    .container-fluid h1 {
        font-size: 1.25rem !important;
        margin-bottom: 0.25rem !important;
    }

    /* Botones de encabezado más compactos en mobile */
    .container-fluid .d-flex.justify-content-between .btn:not(.btn-sm) {
        font-size: 0.8rem !important;
        padding: 0.35rem 0.65rem !important;
    }
}
