/* =========================================================
   18. RESPONSIVE
   ========================================================= */
@media (max-width: 991px) {
    #sidebar {
        left: calc(-1 * var(--srx-sidebar-width)) !important;
    }

    #main-container {
        margin-left: 0 !important;
    }

    header.navbar .srx-topbar {
        gap: 6px;
    }

    header.navbar .srx-topbar-search-item {
        flex-basis: 180px !important;
        min-width: 150px;
    }

    header.navbar .srx-action-label,
    header.navbar .srx-user-menu-copy {
        display: none;
    }

    header.navbar .srx-user-menu-toggle {
        padding: 3px 8px 3px 4px !important;
    }
}

@media (max-width: 576px) {
    header.navbar {
        padding: 0 8px !important;
        gap: 6px;
    }

    header.navbar .srx-topbar-search-item {
        display: none !important;
    }

    header.navbar .srx-topbar-action {
        min-width: 38px !important;
        width: 38px;
        height: 38px !important;
        padding: 0 !important;
        gap: 0;
    }

    header.navbar .srx-topbar-action > .badge {
        position: absolute !important;
        top: -4px !important;
        right: -4px !important;
        min-width: 18px;
        height: 18px;
        line-height: 18px;
        font-size: 9px;
        padding: 0 5px !important;
    }

    header.navbar .srx-topbar-avatar,
    header.navbar .nav.navbar-nav-custom > li > a > img.srx-topbar-avatar {
        width: 30px !important;
        height: 30px !important;
    }
}

/* =========================================================
   22. RESPONSIVO v2
   ========================================================= */
@media (max-width: 767.98px) {
    #page-content {
        padding: 16px 16px 40px;
    }

    #page-container.header-fixed-top #page-content {
        padding-top: calc(var(--srx-header-height) + 16px);
    }

    .content-header {
        margin-bottom: 16px;
    }

    .content-header h1,
    .content-header h2 {
        font-size: var(--ds-text-xl);
    }

    .block,
    .block.full,
    .wizard-content {
        --ds-card-pad: 16px;
    }

    .widget-content,
    .panel-body,
    .card-body {
        padding: 16px;
    }

    /* Bajo 768 px las columnas col-md-* no tienen ancho y el campo se encoge en la fila flexible. */
    .form-horizontal .form-group > [class*="col-"] {
        flex: 0 0 100%;
        width: 100%;
        max-width: 100%;
    }

    /* Tablas: desplazamiento horizontal dentro de la tarjeta. */
    table.dataTable,
    .block > table.table,
    .block > form > table.table,
    .tab-content > table.table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table-responsive > table.dataTable {
        display: table;
    }

    table.dataTable th,
    table.dataTable td,
    .block > table.table th,
    .block > table.table td {
        white-space: nowrap;
    }

    .dataTables_wrapper > .row > [class*="col-"] {
        flex: 1 1 auto;
        width: auto;
    }

    .dataTables_wrapper > .row:last-child > [class*="col-"] {
        flex: 0 0 100%;
        width: 100%;
    }

    .dataTables_filter .input-group {
        width: 100%;
    }

    .dataTables_paginate {
        justify-content: center;
    }

    /* Anchos en linea pensados para escritorio: a todo el ancho en telefono. */
    #page-content .form-control[style*="width"],
    #page-content select[style*="width"]:not([style*="display: none"]),
    #page-content .chosen-container[style*="width"] {
        width: 100% !important;
    }

    #page-content div[style*="inline-block"]:has(> .form-control, > select, > .chosen-container) {
        display: block !important;
        width: 100%;
    }

    #page-content div[style*="inline-block"]:has(> .form-control, > select, > .chosen-container) > * + * {
        margin-top: 8px;
    }

    .modal-dialog {
        margin: 8px;
    }

    .nav-tabs > li > a,
    .nav-tabs .nav-link {
        padding: 0 12px;
    }
}

@media (max-width: 575.98px) {
    .content-header > .row > [class*="col-"]:has(> .btn),
    .content-header > .row > [class*="col-"]:has(> a.btn) {
        flex: 0 0 100%;
        justify-content: flex-start;
        margin-left: 0;
    }

    .block-title {
        min-height: 52px;
    }
}

/* Objetivos tactiles de al menos 40 px. */
@media (pointer: coarse) {
    .btn-sm,
    .btn-xs,
    .table td .btn {
        --ds-btn-h: 40px;
        min-width: 40px;
    }

    .pagination > li > a,
    .pagination > li > span,
    .pagination .page-link {
        min-width: 40px;
        height: 40px;
    }

    .sidebar-nav > li > a,
    .sidebar-nav ul > li > a {
        min-height: 44px;
    }

    label:has(> input[type="checkbox"]),
    label:has(> input[type="radio"]),
    .form-check {
        min-height: 40px;
    }

    input[type="checkbox"]:not(.btn-check):not(.form-check-input),
    input[type="radio"]:not(.btn-check):not(.form-check-input),
    .form-check-input {
        width: 20px;
        height: 20px;
    }

    .chosen-container .chosen-results li {
        padding: 11px 10px;
    }
}

/* =========================================================
   19. PRINT
   ========================================================= */
@media print {
    #sidebar,
    header.navbar,
    #sidebar-extra-info,
    .no-print,
    .preloader,
    .btn,
    .dataTables_length,
    .dataTables_filter,
    .dataTables_paginate {
        display: none !important;
    }

    #main-container {
        margin-left: 0 !important;
    }

    body {
        background: #fff !important;
    }

    .widget,
    .block,
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}

/* =========================================================
   23. MOVIMIENTO REDUCIDO
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .btn.is-loading::after,
    .btn[aria-busy="true"]::after {
        animation-duration: 1.6s !important;
        animation-iteration-count: infinite !important;
    }

    .btn:active {
        transform: none;
    }
}
