/* Global responsive utilities and overrides */

/* Images scale within containers */
img, svg, canvas {
    max-width: 100%;
    height: auto;
}

/* Tables: add horizontal scroll on small screens if not wrapped */
.table-responsive,
.table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Forms: stack controls on small screens */
@media (max-width: 768px) {
    .form-row,
    .row.g-3,
    .row {
        flex-direction: column !important;
    }

    .form-group,
    .col,
    [class*="col-"] {
        width: 100% !important;
        max-width: 100% !important;
    }

    .input-group {
        flex-wrap: wrap;
    }

    .input-group > .form-control,
    .input-group > .form-select,
    .input-group > .btn {
        width: 100%;
    }
}

/* Cards and containers: reduce padding on smaller screens */
@media (max-width: 768px) {
    .card-body,
    .card-header,
    .card-footer,
    .container, .container-fluid {
        padding: 0.75rem !important;
    }
}

/* Typography scaling */
html { font-size: 14px; }
@media (min-width: 768px) { html { font-size: 16px; } }

/* Tables: tighter padding on small screens */
@media (max-width: 768px) {
    table.table td, table.table th {
        padding: 0.5rem;
        white-space: nowrap;
    }
}

/* Utility to force wrap long content (e.g., codes, barcodes) */
.text-wrap-anywhere { overflow-wrap: anywhere; word-break: break-word; }

/* Buttons full width on very small screens */
@media (max-width: 480px) {
    .btn-block-xs { width: 100%; display: block; }
}

/* Modals: ensure proper fit on small screens */
@media (max-width: 576px) {
    .modal-dialog { margin: 0.5rem; }
}

/* DataTables wrappers: enable horizontal scroll on small screens */
@media (max-width: 992px) {
    .dataTables_wrapper .row {
        flex-direction: column !important;
        gap: 0.5rem;
    }

    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter,
    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        width: 100% !important;
        text-align: right;
    }
}

/* Sidebar/content safety: already controlled in layout; keep main content flexible */
.main-content { width: 100%; }


