/* ============================================================
   Azimut - Responsive Overrides for Mobile & Tablet
   ============================================================ */

/* === NAVBAR: colapsar botones en movil === */
@media (max-width: 991.98px) {
    .navbar {
        flex-wrap: wrap !important;
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
        gap: 0.25rem;
    }
    .navbar-brand {
        font-size: 0.95rem;
        white-space: normal;
        max-width: 100%;
    }
    .navbar > .d-flex {
        flex-wrap: wrap !important;
        width: 100%;
        justify-content: flex-start !important;
        margin-top: 0.5rem;
        gap: 0.25rem !important;
    }
    .navbar .btn-sm {
        font-size: 0.72rem;
        padding: 0.2rem 0.45rem;
        white-space: nowrap;
    }
    .navbar .dropdown-menu {
        font-size: 0.8rem;
    }
}

/* === CONTENEDORES: reducir padding en movil === */
@media (max-width: 767.98px) {
    .container-fluid.px-4,
    .container-fluid.px-5 {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
    .container.px-4 {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
    .card.p-4 {
        padding: 1rem !important;
    }
    .card.p-5 {
        padding: 1.25rem !important;
    }
    .p-4 {
        padding: 1rem !important;
    }
    .p-5 {
        padding: 1.25rem !important;
    }
    .mb-4 {
        margin-bottom: 1rem !important;
    }
    .mt-4 {
        margin-top: 1rem !important;
    }
}

/* === TABLAS: botones de accion apilados en movil === */
@media (max-width: 767.98px) {
    .table-responsive {
        font-size: 0.78rem;
    }
    .table th,
    .table td {
        white-space: nowrap;
    }
    .table .btn-group.btn-group-sm {
        flex-direction: column;
        display: flex;
        gap: 2px;
        width: 100%;
    }
    .table .btn-group.btn-group-sm .btn {
        width: 100%;
        font-size: 0.7rem;
        padding: 0.15rem 0.3rem;
    }
    .table .btn-group:not(.btn-group-sm) {
        flex-wrap: wrap;
    }
}

/* === FORMULARIOS: ajustar form-container en movil === */
@media (max-width: 767.98px) {
    .form-container {
        margin: 10px auto !important;
        padding: 15px !important;
        max-width: 100% !important;
    }
    .section-header {
        margin-top: 15px !important;
        margin-bottom: 10px !important;
        padding: 7px 12px !important;
        font-size: 0.9rem;
    }
}

/* === TIPOGRAFIA: reducir titulos en pantallas muy pequenas === */
@media (max-width: 575.98px) {
    .navbar-brand {
        font-size: 0.85rem;
    }
    h3 {
        font-size: 1.15rem;
    }
    h4 {
        font-size: 1.05rem;
    }
    h5 {
        font-size: 0.95rem;
    }
    h6 {
        font-size: 0.85rem;
    }
    .fs-4 {
        font-size: 1rem !important;
    }
    .fs-5 {
        font-size: 0.85rem !important;
    }
    .fs-6 {
        font-size: 0.8rem !important;
    }
    .display-4,
    .display-5 {
        font-size: 1.5rem !important;
    }
}

/* === ALERTAS Y BADGES: mas compactos en movil === */
@media (max-width: 575.98px) {
    .alert {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.8rem;
    }
    .badge {
        font-size: 0.7rem !important;
    }
    .btn-sm {
        font-size: 0.72rem;
        padding: 0.2rem 0.45rem;
    }
}

/* === IMAGENES: evitar desbordamiento === */
@media (max-width: 767.98px) {
    img {
        max-width: 100%;
        height: auto;
    }
    .insignia-tablero-img {
        width: 48px !important;
        height: 48px !important;
    }
    .insignia-maximo-img {
        width: 64px !important;
        height: 64px !important;
    }
    .etapa-imagen {
        height: 36px !important;
    }
}

/* === NAV TABS: scroll horizontal en movil === */
@media (max-width: 767.98px) {
    .nav-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .nav-tabs .nav-item {
        white-space: nowrap;
    }
    .nav-tabs .nav-link {
        font-size: 0.8rem;
        padding: 0.4rem 0.6rem;
    }
}

/* === MODALES: pantalla completa en movil === */
@media (max-width: 575.98px) {
    .modal-dialog {
        margin: 0.25rem !important;
        max-width: calc(100% - 0.5rem) !important;
    }
    .modal-body {
        padding: 0.75rem !important;
    }
    .modal-footer {
        padding: 0.5rem 0.75rem !important;
    }
    .modal-footer .btn {
        font-size: 0.75rem;
    }
}

/* === DROPDOWN: ancho completo en movil === */
@media (max-width: 575.98px) {
    .dropdown-menu {
        width: 100%;
        min-width: auto;
    }
}

/* === FILTROS DEL DASHBOARD: apilar en movil === */
@media (max-width: 767.98px) {
    .row.g-3 > [class*="col-md-"] {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

/* === TARJETAS DE INSIGNIAS: 2 columnas en movil === */
@media (max-width: 575.98px) {
    .col-sm-6 {
        width: 50% !important;
    }
}

/* === BOTONES DE NAVBAR: ocultar texto redundante en movil === */
@media (max-width: 575.98px) {
    .navbar .btn-sm .me-1,
    .navbar .btn-sm i.bi::after {
        display: none;
    }
}

/* === SCROLL HORIZONTAL para tablas muy anchas === */
.table-responsive {
    -webkit-overflow-scrolling: touch;
}

/* === TOUCH: aumentar area tactil en movil === */
@media (max-width: 767.98px) {
    .btn-sm {
        min-height: 32px;
    }
    .form-control-sm,
    .form-select-sm {
        min-height: 34px;
    }
}
