/* Estilos centralizados del sistema */

:root {
    --color-primario: #0d6efd;
    --color-secundario: #6c757d;
    --color-acento: #198754;
    --color-fondo: #ffffff;
    --color-texto: #212529;
}

/* Body con gradiente fijo */
body {
    background-image: linear-gradient(to bottom, #1d1f44, #2b2c4f, #393a5a, #474866, #555671);
    background-attachment: fixed;
    background-size: cover;
    background-repeat: no-repeat;
    min-height: 100vh;
    padding-top: 70px;
    padding-bottom: 140px;
}

/* Ancho centralizado del sistema - espacio al final para que el contenido no quede pegado al borde */
main {
    max-width: 90%;
    margin: 0 auto;
    padding-top: 2rem;
    padding-bottom: 5rem;
}

/* Header fijo con fondo */
.navbar {
    width: 100% !important;
    background-color: #051937 !important;
    border-bottom: 2px solid #ffac01 !important;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.navbar .container-fluid {
    max-width: 90%;
    margin: 0 auto;
}

/* Footer fijo con fondo negro */
footer {
    width: 100% !important;
    background-color: #000000 !important;
    color: white !important;
    box-shadow: 0 -2px 4px rgba(0,0,0,0.1);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

footer * {
    color: white !important;
}

footer .container-fluid {
    max-width: 90%;
    margin: 0 auto;
}

/* Logo personal en header - con transparencia */
.logo-container {
    background: transparent;
    border-radius: 8px;
    padding: 4px;
    display: inline-block;
}

.logo-header {
    max-height: 32px;
    max-width: 80px;
    object-fit: contain;
}

/* Estilos de login */
.login-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-texto);
    text-align: center;
    margin-bottom: 2rem;
}

.login-subtitle {
    font-size: 0.9rem;
    color: #6c757d;
    text-align: center;
    margin-bottom: 2rem;
}

/* Títulos - color para contraste con fondo oscuro */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6,
.card-title, .login-title {
    color: #ffac01 !important;
}

/* Botones de navegación */
.nav-item {
    margin-left: 0.25rem;
}

.nav-item:first-child {
    margin-left: 0;
}

.nav-button {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    color: white !important;
    text-transform: uppercase;
    font-weight: 500;
    font-size: 0.85rem;
}

.nav-button:hover {
    background: rgba(255, 255, 255, 0.35) !important;
    border-color: rgba(255, 255, 255, 0.6) !important;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(255, 255, 255, 0.3), 0 4px 15px rgba(0, 0, 0, 0.3);
    color: white !important;
}

.nav-button.active {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
    color: white !important;
}

/* Salir: botón discreto, no es módulo */
.nav-item-salir {
    margin-left: 0.5rem;
    padding-left: 0.75rem;
    border-left: 1px solid rgba(255, 255, 255, 0.25);
}

.nav-link-salir {
    font-size: 0.7rem !important;
    font-weight: 400 !important;
    text-transform: none !important;
    color: rgba(255, 255, 255, 0.7) !important;
    padding: 0.35rem 0.5rem !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.nav-link-salir:hover {
    color: rgba(255, 255, 255, 0.95) !important;
    background: transparent !important;
    transform: none !important;
}

/* Badges con texto blanco */
.badge {
    color: white !important;
}

/* Ocultar barras de scroll en todo el sistema */
html, body {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE y Edge antiguo */
}

html::-webkit-scrollbar,
body::-webkit-scrollbar,
*::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Edge */
    width: 0;
    height: 0;
    background: transparent;
}

html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track,
*::-webkit-scrollbar-track {
    display: none;
    background: transparent;
}

html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb,
*::-webkit-scrollbar-thumb {
    display: none;
    background: transparent;
}

/* Espaciado entre tablas */
.table-separator {
    margin-top: 2rem;
    margin-bottom: 2rem;
}

/* Precios alineados a la derecha */
.precio {
    text-align: right;
}

/* Cards de estadísticas */
.stats-card {
    transition: transform 0.2s ease;
}

.stats-card:hover {
    transform: translateY(-5px);
}

/* Formularios */
.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

/* Filtros módulo jugadores: una sola línea horizontal */
.form-filtros-jugadores.row {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    width: max-content;
    min-width: 100%;
}

.form-filtros-jugadores > .col-auto {
    width: auto !important;
    max-width: none !important;
    flex: 0 0 auto !important;
}

.form-filtros-jugadores .form-label {
    white-space: nowrap;
    margin-bottom: 0.25rem;
}

.form-filtros-jugadores .filtro-busqueda .form-control {
    width: 50ch;
    max-width: 50ch;
}

.form-filtros-jugadores .filtro-estado .form-select {
    width: 6.25rem;
}

.form-filtros-jugadores .filtro-habilitacion .form-select {
    width: 9.5rem;
}

.form-filtros-jugadores .filtro-deporte .form-select {
    width: 5.5rem;
}

.form-filtros-jugadores .filtro-categoria .form-select {
    width: 11rem;
}

.form-filtros-jugadores .filtro-anio .form-control {
    width: 4.5rem;
}

.form-filtros-jugadores .filtro-acciones {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.25rem;
}

/* Responsive - Móviles */
@media (max-width: 768px) {
    /* Ajustes generales */
    main {
        max-width: 95%;
        padding-top: 0.5rem;
        padding-bottom: 2rem;
    }
    
    body {
        padding-top: 60px;
        padding-bottom: 80px;
    }
    
    /* Navbar */
    .navbar {
        padding: 0.5rem 0;
        overflow: hidden;
    }
    
    .navbar .container-fluid {
        max-width: 95%;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
        overflow: hidden;
    }
    
    .navbar-brand {
        font-size: 0.65rem !important;
        padding: 0.25rem 0;
        max-width: calc(100% - 50px);
        overflow: hidden;
        flex-shrink: 1;
        min-width: 0;
    }
    
    .navbar-brand > .d-flex {
        max-width: 100%;
        overflow: hidden;
        min-width: 0;
    }
    
    .navbar-brand span {
        font-size: 0.6rem !important;
        line-height: 1.2;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 100%;
        display: block;
    }
    
    .navbar-brand .badge {
        font-size: 0.4em !important;
        margin-top: 0.1rem !important;
        padding: 0.1rem 0.3rem;
        white-space: nowrap;
    }
    
    .logo-header {
        max-height: 22px;
        max-width: 50px;
    }
    
    .logo-container {
        padding: 2px;
        flex-shrink: 0;
    }
    
    .nav-button {
        font-size: 0.75rem;
        padding: 0.5rem 0.75rem;
        margin-bottom: 0.5rem;
        text-align: center;
        width: 100%;
    }
    
    .nav-item {
        margin-left: 0;
        width: 100%;
    }
    
    .nav-item-salir {
        margin-left: 0;
        padding-left: 0;
        border-left: none;
        margin-top: 0.35rem;
        padding-top: 0.5rem;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
    }
    
    .navbar-nav {
        margin-top: 0.5rem;
    }
    
    .navbar-collapse {
        margin-top: 0.5rem;
    }
    
    /* Mensaje informativo para móviles */
    .mobile-info-alert {
        margin: 0.5rem auto 1rem auto !important;
        max-width: 95%;
        border-radius: 0.375rem;
        background-color: #d1ecf1 !important;
        border-color: #bee5eb !important;
        color: #0c5460 !important;
    }
    
    .mobile-info-alert strong {
        font-size: 0.7rem;
        font-weight: 600;
    }
    
    .mobile-info-alert i {
        font-size: 0.8rem;
    }
    
    /* Footer - Simplificado para móviles */
    footer {
        padding: 6px 0 !important;
        font-size: 0.65rem !important;
        line-height: 1.2;
    }
    
    footer .container-fluid {
        max-width: 100% !important;
        width: 100% !important;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
        margin: 0 auto !important;
    }
    
    footer .row {
        flex-direction: row;
        justify-content: flex-start !important;
        align-items: center !important;
        flex-wrap: nowrap;
        white-space: nowrap;
        margin: 0 !important;
        width: 100% !important;
        display: flex !important;
    }
    
    /* Ocultar UF en móviles */
    footer .col-4:nth-child(2) {
        display: none !important;
    }
    
    /* Fecha - alineada a la izquierda */
    footer .col-4:first-child {
        flex: 0 0 auto !important;
        text-align: left !important;
        font-size: 0.65rem !important;
        margin: 0 !important;
        padding: 0 !important;
        white-space: nowrap;
    }
    
    /* Separador entre fecha y nombre */
    footer .col-4:first-child::after {
        content: " | ";
        margin: 0 0.5rem;
        color: rgba(255, 255, 255, 0.5);
    }
    
    /* Nombre del sistema - alineado a la izquierda */
    footer .col-4:last-child {
        flex: 0 0 auto !important;
        text-align: left !important;
        font-size: 0.65rem !important;
        margin: 0 !important;
        padding: 0 !important;
        white-space: nowrap;
    }
    
    /* Ocultar "Desarrollado por MVisual" en móviles */
    footer .separador-footer,
    footer .desarrollado-por-footer {
        display: none !important;
    }
    
    footer .nombre-sistema-footer {
        display: inline;
    }
    
    /* Cards de estadísticas del dashboard - 3 columnas en móviles */
    .row.g-3.justify-content-center > .col {
        flex: 0 0 calc(33.333% - 0.67rem);
        max-width: calc(33.333% - 0.67rem);
        margin-bottom: 0.5rem;
    }
    
    /* Cards de estadísticas más pequeñas en móviles */
    .stats-card {
        margin-bottom: 0.5rem;
    }
    
    .stats-card .card-body {
        padding: 0.5rem 0.75rem !important;
    }
    
    .stats-card .text-muted {
        font-size: 0.6rem !important;
        margin-bottom: 0.2rem !important;
        line-height: 1.2;
    }
    
    .stats-card .h2 {
        font-size: 0.9rem !important;
        line-height: 1.2;
        font-weight: 600;
    }
    
    .stats-card .fs-1 {
        font-size: 1.2rem !important;
    }
    
    .stats-card .d-flex.align-items-center {
        flex-wrap: nowrap;
        gap: 0.25rem;
    }
    
    .stats-card .flex-fill {
        min-width: 0;
        flex: 1 1 auto;
    }
    
    .stats-card .ms-3 {
        margin-left: 0.25rem !important;
        flex-shrink: 0;
    }
    
    /* Ocultar card "Asistencia Mes Actual" en móviles (última card de stats) */
    .row.g-3.justify-content-center > .col:nth-child(7) {
        display: none !important;
    }
    
    /* Ocultar card "Asistencia de Funcionarios" en móviles (3ra col-lg-3) */
    .row.g-3 > .col-lg-3:nth-child(3) {
        display: none !important;
    }
    
    /* Cards de la sección de gráficas - más compactas y menos altas en móviles */
    .row.g-3 > .col-lg-3 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        margin-bottom: 0.75rem;
    }
    
    /* Card "Estado de la Cobranza" más compacta */
    .row.g-3 > .col-lg-3:first-child .card {
        font-size: 0.75rem;
    }
    
    .row.g-3 > .col-lg-3:first-child .card-header {
        padding: 0.4rem 0.75rem !important;
        margin-bottom: 0 !important;
    }
    
    .row.g-3 > .col-lg-3:first-child .card-header h3 {
        font-size: 0.8rem !important;
        margin: 0 !important;
        line-height: 1.2;
    }
    
    .row.g-3 > .col-lg-3:first-child .card-header .badge {
        font-size: 0.6rem !important;
        padding: 0.2rem 0.4rem !important;
    }
    
    .row.g-3 > .col-lg-3:first-child .card-body {
        padding: 0.25rem 0.75rem 0.5rem 0.75rem !important;
    }
    
    .row.g-3 > .col-lg-3:first-child .card-body > div[style*="height"] {
        height: 150px !important;
        margin: 0 !important;
    }
    
    .row.g-3 > .col-lg-3:first-child canvas {
        max-height: 150px !important;
    }
    
    /* Reducir márgenes en cards de asistencia */
    .row.g-3 > .col-lg-3:nth-child(2) .card-body .d-flex.align-items-end {
        margin-bottom: 0.5rem !important;
    }
    
    .row.g-3 > .col-lg-3:nth-child(2) .card-body .row.text-center {
        margin-top: 0.5rem !important;
    }
    
    .row.g-3 > .col-lg-3:nth-child(2) .card-body .row.text-center .col {
        padding: 0.25rem !important;
    }
    
    /* Card "Asistencia de Jugadores" más compacta */
    .row.g-3 > .col-lg-3:nth-child(2) .card {
        font-size: 0.75rem;
    }
    
    .row.g-3 > .col-lg-3:nth-child(2) .card-header {
        padding: 0.5rem 0.75rem !important;
    }
    
    .row.g-3 > .col-lg-3:nth-child(2) .card-header h3 {
        font-size: 0.8rem !important;
        margin: 0 !important;
    }
    
    .row.g-3 > .col-lg-3:nth-child(2) .card-header .badge {
        font-size: 0.6rem !important;
        padding: 0.2rem 0.4rem !important;
    }
    
    .row.g-3 > .col-lg-3:nth-child(2) .card-body {
        padding: 0.5rem 0.75rem !important;
    }
    
    .row.g-3 > .col-lg-3:nth-child(2) .card-body p {
        font-size: 0.65rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    .row.g-3 > .col-lg-3:nth-child(2) .display-5 {
        font-size: 1.5rem !important;
        margin-bottom: 0.25rem !important;
    }
    
    .row.g-3 > .col-lg-3:nth-child(2) .card-body .text-muted {
        font-size: 0.65rem !important;
    }
    
    .row.g-3 > .col-lg-3:nth-child(2) .progress {
        height: 6px !important;
        margin-bottom: 0.5rem !important;
    }
    
    .row.g-3 > .col-lg-3:nth-child(2) .fw-semibold {
        font-size: 0.7rem !important;
    }
    
    .row.g-3 > .col-lg-3:nth-child(2) small {
        font-size: 0.6rem !important;
    }
    
    /* Card última col-lg-3 más compacta en móviles */
    .row.g-3 > .col-lg-3:last-child {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        width: 100% !important;
        overflow: hidden !important;
    }
    
    .row.g-3 > .col-lg-3:last-child .card {
        font-size: 0.7rem;
        max-width: 100% !important;
        width: 100% !important;
        overflow: hidden !important;
    }
    
    .row.g-3 > .col-lg-3:last-child .card-header {
        padding: 0.4rem 0.5rem !important;
        overflow: hidden !important;
    }
    
    .row.g-3 > .col-lg-3:last-child .card-header h3 {
        font-size: 0.75rem !important;
        margin: 0 !important;
        line-height: 1.2;
        word-wrap: break-word;
    }
    
    .row.g-3 > .col-lg-3:last-child .card-header .badge {
        font-size: 0.55rem !important;
        padding: 0.15rem 0.3rem !important;
    }
    
    .row.g-3 > .col-lg-3:last-child .card-body {
        padding: 0.4rem 0.5rem !important;
        overflow: hidden !important;
        max-width: 100% !important;
    }
    
    .row.g-3 > .col-lg-3:last-child .table-responsive .table,
    .row.g-3 > .col-lg-3:last-child .table-responsive {
        margin: 0 !important;
        padding: 0 !important;
        overflow-x: hidden !important;
        overflow-y: visible !important;
        max-width: 100% !important;
        width: 100% !important;
        display: block !important;
    }
    
    .row.g-3 > .col-lg-3:last-child .table {
        font-size: 0.65rem !important;
        margin-bottom: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        table-layout: fixed !important;
    }
    
    .row.g-3 > .col-lg-3:last-child .table th,
    .row.g-3 > .col-lg-3:last-child .table td {
        padding: 0.2rem 0.3rem !important;
        word-wrap: break-word;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .row.g-3 > .col-lg-3:last-child .table th:first-child,
    .row.g-3 > .col-lg-3:last-child .table td:first-child {
        width: 60% !important;
        max-width: 60% !important;
    }
    
    .row.g-3 > .col-lg-3:last-child .table th:last-child,
    .row.g-3 > .col-lg-3:last-child .table td:last-child {
        width: 40% !important;
        max-width: 40% !important;
    }
    
    .row.g-3 > .col-lg-3:last-child .table thead th {
        font-size: 0.6rem !important;
        font-weight: 600;
    }
    
    .row.g-3 > .col-lg-3:last-child .table tbody td {
        font-size: 0.65rem !important;
    }
    
    .row.g-3 > .col-lg-3:last-child .table tbody tr {
        line-height: 1.3;
    }
    
    /* Otras cards de estadísticas - apilar en móviles */
    .row.g-2 > .col {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 0.75rem;
    }
    
    /* Cards de módulos - más compactas en móviles (excluyendo dashboard) */
    .container-fluid > .card:not(.stats-card) {
        margin-bottom: 1rem;
    }
    
    .container-fluid > .card:not(.stats-card) .card-header {
        padding: 0.5rem 0.75rem !important;
    }
    
    .container-fluid > .card:not(.stats-card) .card-header h3 {
        font-size: 0.9rem !important;
        margin: 0 !important;
        line-height: 1.2;
    }
    
    .container-fluid > .card:not(.stats-card) .card-body {
        padding: 0.75rem !important;
    }
    
    /* Tablas en módulos - más compactas */
    .container-fluid > .card .table-responsive {
        margin: -0.75rem;
        padding: 0.75rem;
    }
    
    .container-fluid > .card .table {
        font-size: 0.75rem !important;
    }
    
    .container-fluid > .card .table th,
    .container-fluid > .card .table td {
        padding: 0.4rem 0.5rem !important;
        vertical-align: middle;
    }
    
    .container-fluid > .card .table thead th {
        font-size: 0.7rem !important;
        font-weight: 600;
    }
    
    /* Cards de estadísticas en módulos - 3 columnas en móviles (igual que dashboard) */
    .row.g-2 > .col[style*="flex: 0 0 20%"],
    .row.g-2 > .col[style*="max-width: 20%"],
    .row.g-2 > .col-md-3 {
        flex: 0 0 calc(33.333% - 0.67rem) !important;
        max-width: calc(33.333% - 0.67rem) !important;
        margin-bottom: 0.5rem;
    }
    
    /* Cards de estadísticas en módulos - aplicar estilos compactos */
    .row.g-2 > .col[style*="flex: 0 0 20%"] .card,
    .row.g-2 > .col[style*="max-width: 20%"] .card,
    .row.g-2 > .col-md-3 .card {
        font-size: 0.75rem;
    }
    
    .row.g-2 > .col[style*="flex: 0 0 20%"] .card-body,
    .row.g-2 > .col[style*="max-width: 20%"] .card-body,
    .row.g-2 > .col-md-3 .card-body {
        padding: 0.5rem 0.75rem !important;
    }
    
    .row.g-2 > .col[style*="flex: 0 0 20%"] .text-muted,
    .row.g-2 > .col[style*="max-width: 20%"] .text-muted,
    .row.g-2 > .col-md-3 .text-muted {
        font-size: 0.6rem !important;
        margin-bottom: 0.2rem !important;
        line-height: 1.2;
    }
    
    .row.g-2 > .col[style*="flex: 0 0 20%"] .h3,
    .row.g-2 > .col[style*="max-width: 20%"] .h3,
    .row.g-2 > .col-md-3 .h3 {
        font-size: 0.9rem !important;
        line-height: 1.2;
        font-weight: 600;
    }
    
    .row.g-2 > .col[style*="flex: 0 0 20%"] .fs-1,
    .row.g-2 > .col[style*="max-width: 20%"] .fs-1,
    .row.g-2 > .col-md-3 .fs-1,
    .row.g-2 > .col[style*="flex: 0 0 20%"] i[style*="font-size: 2rem"],
    .row.g-2 > .col[style*="max-width: 20%"] i[style*="font-size: 2rem"],
    .row.g-2 > .col-md-3 i[style*="font-size: 2rem"] {
        font-size: 1.2rem !important;
    }
    
    .row.g-2 > .col[style*="flex: 0 0 20%"] .d-flex.align-items-center,
    .row.g-2 > .col[style*="max-width: 20%"] .d-flex.align-items-center,
    .row.g-2 > .col-md-3 .d-flex.align-items-center {
        flex-wrap: nowrap;
        gap: 0.25rem;
    }
    
    .row.g-2 > .col[style*="flex: 0 0 20%"] .flex-shrink-0,
    .row.g-2 > .col[style*="max-width: 20%"] .flex-shrink-0,
    .row.g-2 > .col-md-3 .flex-shrink-0 {
        flex-shrink: 0;
    }
    
    .row.g-2 > .col[style*="flex: 0 0 20%"] .ms-3,
    .row.g-2 > .col[style*="max-width: 20%"] .ms-3,
    .row.g-2 > .col-md-3 .ms-3 {
        margin-left: 0.25rem !important;
    }
    
    .row.g-2 > .col[style*="flex: 0 0 20%"] .bg-opacity-10,
    .row.g-2 > .col[style*="max-width: 20%"] .bg-opacity-10,
    .row.g-2 > .col-md-3 .bg-opacity-10 {
        padding: 0.5rem !important;
    }
    
    .row.g-2 > .col[style*="flex: 0 0 20%"] small,
    .row.g-2 > .col[style*="max-width: 20%"] small,
    .row.g-2 > .col-md-3 small {
        font-size: 0.55rem !important;
    }
    
    .row.g-2 > .col[style*="flex: 0 0 20%"] h6,
    .row.g-2 > .col[style*="max-width: 20%"] h6,
    .row.g-2 > .col-md-3 h6 {
        font-size: 0.6rem !important;
        margin-bottom: 0.2rem !important;
    }
    
    /* Cards de gráficas - 2 columnas en móviles */
    .row.g-2 > .col[style*="flex: 0 0 25%"],
    .row.g-2 > .col[style*="max-width: 25%"] {
        flex: 0 0 calc(50% - 0.5rem) !important;
        max-width: calc(50% - 0.5rem) !important;
        margin-bottom: 0.5rem;
    }
    
    /* Gráficas en módulos - más pequeñas */
    .container-fluid > .card canvas {
        max-height: 200px !important;
    }
    
    .container-fluid > .card .card-body > div[style*="height"] {
        max-height: 200px !important;
    }
    
    /* Filtros en módulos - más compactos */
    .container-fluid > .card .card-body form .row.g-3 {
        margin-bottom: 0.5rem;
    }
    
    .container-fluid > .card .card-body form .col-md-2,
    .container-fluid > .card .card-body form .col-md-3 {
        margin-bottom: 0.5rem;
    }
    
    /* Botones en módulos - más pequeños */
    .container-fluid > .card .btn {
        font-size: 0.75rem;
        padding: 0.4rem 0.6rem;
    }
    
    .container-fluid > .card .btn-group-sm .btn {
        font-size: 0.7rem;
        padding: 0.3rem 0.5rem;
    }
    
    /* Cards con flex fijo - convertir a 100% en móviles */
    .row.g-2 .col[style*="flex: 0 0 20%"],
    .row.g-3 .col[style*="flex: 0 0 20%"],
    .row.g-2 .col[style*="flex: 0 0 25%"],
    .row.g-3 .col[style*="flex: 0 0 25%"] {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
    
    /* Asegurar que todas las columnas con max-width fijo se apilen */
    .row .col[style*="max-width: 20%"],
    .row .col[style*="max-width: 25%"] {
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }
    
    /* Tablas responsivas */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        display: block;
        width: 100%;
    }
    
    .table {
        font-size: 0.875rem;
        min-width: 600px;
        width: 100%;
        margin-bottom: 0;
    }
    
    .table th,
    .table td {
        padding: 0.5rem 0.5rem;
        white-space: nowrap;
        vertical-align: middle;
    }
    
    .table thead th {
        font-size: 0.8rem;
        font-weight: 600;
    }
    
    /* Botones en tablas */
    .btn-group-sm {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    
    .btn-group-sm .btn {
        margin-bottom: 0;
        flex: 0 0 auto;
        min-width: 36px;
    }
    
    /* Asegurar que las tablas dentro de cards tengan scroll */
    .card-body .table-responsive {
        margin: -1rem;
        padding: 1rem;
    }
    
    /* Cards de dashboard */
    .card-body .h2,
    .card-body .h3 {
        font-size: 1.5rem;
    }
    
    .card-body .display-5 {
        font-size: 2rem;
    }
    
    /* Gráficas */
    canvas {
        max-height: 250px !important;
    }
    
    /* Formularios - asegurar que se apilen */
    .row.g-3 .col-md-6,
    .row.g-3 .col-md-4,
    .row.g-3 .col-md-3,
    .row.g-3 .col-md-2,
    .row.g-3 .col-md-12 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    /* Títulos */
    .h2 {
        font-size: 1.5rem;
    }
    
    .h3 {
        font-size: 1.25rem;
    }
    
    /* Botones de acción en headers */
    .d-flex.justify-content-between {
        flex-direction: column;
        gap: 1rem;
    }
    
    .d-flex.justify-content-between > div:first-child {
        margin-bottom: 0.5rem;
    }
    
    /* Paginación */
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .page-item {
        margin: 0.25rem;
    }
    
    /* Login */
    body[style*="padding-top: 0"] {
        padding-top: 0 !important;
        padding-bottom: 0 !important;
    }
    
    .container.d-flex {
        height: 100vh !important;
        min-height: 100vh !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .card.shadow-lg {
        margin: 1rem;
        max-width: calc(100% - 2rem);
        width: 100% !important;
    }
    
    .card.shadow-lg .card-body {
        padding: 1.5rem !important;
    }
    
    .card.shadow-lg img {
        max-width: 150px !important;
        margin-bottom: 0.75rem !important;
    }
    
    .login-subtitle {
        font-size: 0.8rem !important;
        margin-bottom: 1rem !important;
    }
}

/* Responsive - Tablets pequeñas */
@media (max-width: 992px) and (min-width: 769px) {
    /* Cards de estadísticas - 2 columnas en tablets */
    .row.g-3 .col[style*="flex: 0 0 20%"],
    .row.g-3 .col[style*="max-width: 20%"] {
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }
    
    .row.g-2 .col[style*="flex: 0 0 25%"],
    .row.g-2 .col[style*="max-width: 25%"] {
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }
}

/* Responsive - Móviles muy pequeños */
@media (max-width: 576px) {
    main {
        max-width: 98%;
        padding-top: 0.25rem;
        padding-bottom: 1.5rem;
    }
    
    .navbar .container-fluid {
        max-width: 98%;
        padding-left: 0.25rem;
        padding-right: 0.25rem;
        overflow: hidden;
    }
    
    .navbar-brand {
        max-width: calc(100% - 45px) !important;
    }
    
    .navbar-brand span {
        font-size: 0.55rem !important;
    }
    
    .logo-header {
        max-height: 20px;
        max-width: 45px;
    }
    
    footer {
        padding: 5px 0 !important;
        font-size: 0.6rem !important;
        line-height: 1.2;
    }
    
    footer .container-fluid {
        max-width: 98%;
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }
    
    footer .col-4:first-child,
    footer .col-4:last-child {
        font-size: 0.6rem !important;
    }
    
    footer .col-4:first-child::after {
        margin: 0 0.25rem;
    }
    
    .card {
        margin-bottom: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .card-header {
        padding: 0.75rem 1rem;
    }
    
    .btn {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }
    
    .table {
        font-size: 0.75rem;
        min-width: 500px;
    }
    
    .h2 {
        font-size: 1.25rem;
    }
    
    .h3 {
        font-size: 1.1rem;
    }
    
    .card-body .h2,
    .card-body .h3 {
        font-size: 1.25rem;
    }
    
    .card-body .display-5 {
        font-size: 1.5rem;
    }
    
    /* Ajustes adicionales para mejor visualización */
    .card {
        border-radius: 0.5rem;
    }
    
    .card-header h3,
    .card-header h5 {
        font-size: 1rem;
    }
    
    /* Filtros en formularios */
    .card-body form .row {
        margin-bottom: 0.5rem;
    }
    
    /* Iconos grandes en cards */
    .card-body i[style*="font-size: 2rem"] {
        font-size: 1.5rem !important;
    }
    
    /* Mejorar espaciado en cards de estadísticas */
    .card-body .d-flex.align-items-center {
        flex-wrap: wrap;
    }
    
    .card-body .flex-shrink-0 {
        margin-bottom: 0.5rem;
    }
    
    /* Login - móviles muy pequeños */
    .container.d-flex {
        padding-top: 0 !important;
        padding-bottom: 0 !important;
    }
    
    .card.shadow-lg {
        margin: 0.75rem;
        max-width: calc(100% - 1.5rem);
    }
    
    .card.shadow-lg .card-body {
        padding: 1.25rem !important;
    }
    
    .card.shadow-lg img {
        max-width: 120px !important;
        margin-bottom: 0.5rem !important;
    }
    
    .login-subtitle {
        font-size: 0.75rem !important;
        margin-bottom: 0.75rem !important;
    }
}

/* Estilos para el buscador de alumnos / apoderados en tiempo real */
#alumno-buscador-container {
    position: relative;
}

#alumno-resultados,
#apoderado-resultados {
    background-color: #fff;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    border-radius: 0.375rem;
    margin-top: 2px;
}

#alumno-resultados .list-group-item,
#apoderado-resultados .list-group-item {
    background-color: #fff;
    border-left: none;
    border-right: none;
    padding: 0.75rem 1rem;
    transition: background-color 0.15s ease-in-out;
}

#alumno-resultados .list-group-item:first-child,
#apoderado-resultados .list-group-item:first-child {
    border-top-left-radius: 0.375rem;
    border-top-right-radius: 0.375rem;
}

#alumno-resultados .list-group-item:last-child,
#apoderado-resultados .list-group-item:last-child {
    border-bottom-left-radius: 0.375rem;
    border-bottom-right-radius: 0.375rem;
}

#alumno-resultados .list-group-item:hover,
#alumno-resultados .list-group-item:focus,
#apoderado-resultados .list-group-item:hover,
#apoderado-resultados .list-group-item:focus {
    background-color: #f8f9fa;
    z-index: 1;
}

#alumno-resultados .list-group-item .fw-semibold,
#apoderado-resultados .list-group-item .fw-semibold {
    color: #212529;
    margin-bottom: 0.25rem;
}

#alumno-resultados .list-group-item small,
#apoderado-resultados .list-group-item small {
    display: block;
    font-size: 0.875rem;
}

#alumno-buscador:focus {
    border-color: var(--color-primario, #0d6efd);
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}
