/* ======================================================================
   OptimumPro Responsive Helpers
   ----------------------------------------------------------------------
   Shared utility classes and media-query tweaks to improve the default
   mobile and tablet experience across modules. Attach these helpers to
   toolbars, filter rows, and action areas without needing inline styles.
   ====================================================================== */

/* Flexible toolbar/action rows that stack on smaller screens */
.responsive-stack {
    gap: 0.75rem;
}

@media (max-width: 991.98px) {
    .responsive-stack {
        flex-wrap: wrap;
    }
}

@media (max-width: 767.98px) {
    .responsive-stack {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .responsive-stack > * {
        width: 100%;
    }

    .responsive-stack .btn,
    .responsive-stack .btn-group,
    .responsive-stack .input-group,
    .responsive-stack .form-control,
    .responsive-stack .form-select,
    .responsive-stack .form-check,
    .responsive-stack .dropdown,
    .responsive-stack .nav,
    .responsive-stack .pagination {
        width: 100%;
    }
}

/* Helper to transform primary action buttons into full-width blocks on phones */
.btn-block-sm {
    width: auto;
}

@media (max-width: 575.98px) {
    .btn-block-sm {
        width: 100% !important;
    }
}

/* Generic helper to stretch elements only on mobile */
.mobile-w-100 {
    width: auto;
}

@media (max-width: 575.98px) {
    .mobile-w-100 {
        width: 100% !important;
    }
}

/* Card/table wrappers gain a smoother horizontal scroll on touch devices */
.table-responsive {
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 991.98px) {
    .table-responsive > .table {
        min-width: 720px;
    }
}

@media (max-width: 767.98px) {
    .table-responsive > .table {
        min-width: 600px;
        font-size: 0.95rem;
    }
}

@media (max-width: 575.98px) {
    .table-responsive > .table {
        min-width: 520px;
        font-size: 0.9rem;
    }

    .table-responsive .btn,
    .table-responsive .badge,
    .table-responsive .dropdown {
        white-space: nowrap;
    }
}

/* Grid shortcut for dense filter panels */
.filter-grid {
    gap: 1rem;
}

@media (max-width: 991.98px) {
    .filter-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
        align-items: end;
    }
}

/* Reset hard right-aligned blocks when space is limited */
.text-end-mobile {
    text-align: right;
}

@media (max-width: 575.98px) {
    .text-end-mobile {
        text-align: left !important;
    }
}

/* Provide consistent inner spacing on compact viewports */
@media (max-width: 575.98px) {
    .card-body,
    .card-header,
    .modal-body,
    .modal-header,
    .list-group-item {
        padding-left: 1.1rem;
        padding-right: 1.1rem;
    }

    .card-header .btn,
    .card-header .btn-group {
        width: 100%;
    }
}

@media (max-width: 767.98px) {
    .card-header.d-flex,
    .card .card-toolbar,
    .card-body > .d-flex.justify-content-between,
    main .container > .d-flex.justify-content-between,
    main .container-fluid > .d-flex.justify-content-between {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.75rem;
    }

    .card-header.d-flex > *,
    .card .card-toolbar > *,
    .card-body > .d-flex.justify-content-between > *,
    main .container > .d-flex.justify-content-between > *,
    main .container-fluid > .d-flex.justify-content-between > * {
        width: 100%;
    }
}

