/* ========================================
   SISTEMA RESPONSIVE OPTIMIZADO PARA GGEE
   Resoluciones específicas: 1366x768, 1920x1080, móviles
======================================== */

/* ================================
   MEDIA QUERIES POR RESOLUCIÓN
================================ */

/* Laptops medianas - 1366x768 (problema principal) */
@media screen and (min-width: 1200px) and (max-width: 1400px) {

    /* Reducir padding general */
    .container-fluid {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }

    .container {
        max-width: 1320px !important;
    }

    /* Optimizar cards del menú */
    .card-menu {
        padding: 1rem !important;
        margin-bottom: 1rem !important;
    }

    .card-body {
        padding: 1.25rem !important;
    }

    /* Formularios más compactos */
    .form-control,
    .form-select {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.9rem !important;
    }

    .form-label {
        font-size: 0.9rem !important;
        margin-bottom: 0.4rem !important;
    }

    /* Tablas optimizadas */
    .table {
        font-size: 0.85rem !important;
    }

    .table th,
    .table td {
        padding: 0.5rem 0.75rem !important;
    }

    /* Modales más compactos */
    .modal-lg {
        max-width: 85% !important;
    }

    .modal-xl {
        max-width: 95% !important;
    }

    /* Botones más compactos */
    .btn {
        padding: 0.5rem 1rem !important;
        font-size: 0.9rem !important;
    }

    .btn-sm {
        padding: 0.25rem 0.5rem !important;
        font-size: 0.8rem !important;
    }
}

/* Tablets y laptops pequeñas - 768px a 1199px */
@media screen and (min-width: 768px) and (max-width: 1199px) {
    .container-fluid {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    /* Grid más estrecho */
    .col-md-3 {
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }

    .col-md-4 {
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }

    .col-md-6 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }

    /* Formularios apilados */
    .row.g-3>div {
        margin-bottom: 1rem !important;
    }

    /* Tablas con scroll horizontal */
    .table-responsive {
        border: 1px solid #dee2e6 !important;
        border-radius: 0.375rem !important;
    }

    /* Cards del menú en 2 columnas */
    .menu-grid .col-lg-4 {
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }
}

/* Móviles - máximo 767px */
@media screen and (max-width: 767px) {
    .container-fluid {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    /* Todo en una columna */
    [class*="col-"] {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        margin-bottom: 1rem !important;
    }

    /* Header más compacto */
    .navbar {
        padding: 0.25rem 0.5rem !important;
    }

    .navbar-brand {
        font-size: 1rem !important;
    }

    /* Formularios móviles */
    .form-control,
    .form-select {
        padding: 0.75rem !important;
        font-size: 1rem !important;
    }

    /* Botones más grandes para touch */
    .btn {
        padding: 0.75rem 1.5rem !important;
        font-size: 1rem !important;
        width: 100% !important;
        margin-bottom: 0.5rem !important;
    }

    /* Modales full screen */
    .modal-dialog {
        margin: 0 !important;
        max-width: none !important;
        height: 100vh !important;
    }

    .modal-content {
        height: 100vh !important;
        border-radius: 0 !important;
    }

    /* Tablas con scroll */
    .table-responsive {
        font-size: 0.75rem !important;
    }

    .table th,
    .table td {
        padding: 0.25rem !important;
        white-space: nowrap !important;
    }

    /* Ocultar columnas menos importantes en móviles */
    .table .d-none-mobile {
        display: none !important;
    }
}

/* ================================
   OPTIMIZACIONES ESPECÍFICAS
================================ */

/* Mejorar legibilidad en todas las resoluciones */
@media screen and (max-height: 800px) {

    /* Para pantallas con poca altura (como 1366x768) */
    .page-with-navbar {
        padding-top: 50px !important;
    }

    .navbar {
        min-height: 50px !important;
    }

    .card {
        margin-bottom: 1rem !important;
    }

    /* Reducir espaciado vertical */
    .mb-3 {
        margin-bottom: 1rem !important;
    }

    .mb-4 {
        margin-bottom: 1.5rem !important;
    }

    .py-4 {
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }
}

/* Pantallas ultra anchas - 1920px y superiores */
@media screen and (min-width: 1920px) {
    .container {
        max-width: 1600px !important;
    }

    /* Aprovechar el espacio extra */
    .col-xl-3 {
        flex: 0 0 20% !important;
        max-width: 20% !important;
    }

    .col-xl-4 {
        flex: 0 0 25% !important;
        max-width: 25% !important;
    }

    /* Formularios en más columnas */
    .form-row-wide .col-md-6 {
        flex: 0 0 33.333333% !important;
        max-width: 33.333333% !important;
    }

    .form-row-wide .col-md-4 {
        flex: 0 0 25% !important;
        max-width: 25% !important;
    }
}

/* ================================
   COMPONENTES ESPECÍFICOS
================================ */

/* Tablas responsive mejoradas */
.table-auto-responsive {
    width: 100%;
    overflow-x: auto;
}

.table-auto-responsive table {
    min-width: 800px;
    /* Ancho mínimo para mantener legibilidad */
}

/* Cards de reportes más compactos */
.reporte-card-compact {
    min-height: 200px !important;
}

.reporte-card-compact .card-body {
    padding: 1rem !important;
}

.reporte-card-compact h5 {
    font-size: 1rem !important;
    margin-bottom: 0.5rem !important;
}

.reporte-card-compact p {
    font-size: 0.8rem !important;
    margin-bottom: 1rem !important;
}

/* Formularios adaptativos */
.form-adaptive .row {
    --bs-gutter-x: 0.75rem;
}

.form-adaptive .form-label {
    font-weight: 600;
    color: var(--color-principal);
}

/* Debug info responsive */
.debug-info-bar {
    font-size: 0.7rem !important;
    padding: 0.25rem 1rem !important;
}

@media screen and (max-width: 768px) {
    .debug-info-bar {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        transform: none !important;
        margin-bottom: 1rem !important;
        border-radius: 0.375rem !important;
    }
}

/* ================================
   UTILIDADES RESPONSIVE
================================ */

/* Clases para mostrar/ocultar por resolución */
@media screen and (max-width: 767px) {
    .d-none-mobile {
        display: none !important;
    }

    .d-block-mobile {
        display: block !important;
    }
}

@media screen and (min-width: 768px) and (max-width: 1199px) {
    .d-none-tablet {
        display: none !important;
    }

    .d-block-tablet {
        display: block !important;
    }
}

@media screen and (min-width: 1200px) and (max-width: 1400px) {
    .d-none-laptop {
        display: none !important;
    }

    .d-block-laptop {
        display: block !important;
    }
}

@media screen and (min-width: 1920px) {
    .d-none-desktop {
        display: none !important;
    }

    .d-block-desktop {
        display: block !important;
    }
}

/* Espaciado adaptativo */
.spacing-adaptive {
    margin: 0.5rem 0;
}

@media screen and (min-width: 1200px) {
    .spacing-adaptive {
        margin: 1rem 0;
    }
}

@media screen and (min-width: 1920px) {
    .spacing-adaptive {
        margin: 1.5rem 0;
    }
}

/* ================================
   PRINT STYLES
================================ */
@media print {
    .no-print {
        display: none !important;
    }

    body {
        font-size: 12pt !important;
        line-height: 1.4 !important;
    }

    .table {
        font-size: 10pt !important;
    }

    .btn,
    .navbar,
    .debug-info-bar {
        display: none !important;
    }
}