/*
 * Phone fit for every portal page: admin, teacher, parent, student, director, accountant,
 * inventory and the public forms. Added to each page by App\Http\Middleware\InjectPwa, so no
 * layout needs editing. The themes hide sideways scrolling on small screens, which cut off
 * anything wider than the phone; mobile-fit.js puts such tables in their own scroll box and
 * these rules keep pictures, fields and long words inside the screen.
 */
@media screen and (max-width: 767px) {
    .mf-scroll { display: block; width: 100%; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .mf-scroll > table { margin-bottom: 0; }
    .mf-scroll-hint { font-size: 12px; color: #7a8691; margin: 4px 0 8px; }

    img { max-width: 100%; }
    img:not([height]) { height: auto; }
    input, select, textarea, .form-control { max-width: 100%; }
    pre { white-space: pre-wrap; word-break: break-word; }
    iframe, video, canvas, svg { max-width: 100%; }

    /* long words, emails and IDs wrap instead of pushing the page wider */
    p, li, .alert { overflow-wrap: break-word; word-wrap: break-word; }
    .label { white-space: normal; display: inline-block; max-width: 100%; line-height: 1.4; }

    /* buttons floated beside a card heading sit on their own line above it instead of squeezing it */
    .card-box > a.pull-right.btn, .card-box > button.pull-right.btn, .card-box > .btn.pull-right {
        float: none !important; display: inline-block; margin: 0 6px 8px 0 !important;
    }

    /* button rows and filter forms wrap onto the next line */
    .form-inline .form-group, .form-inline .btn { margin-bottom: 8px; }
    .btn-toolbar, .dt-buttons { display: flex; flex-wrap: wrap; gap: 4px; }
    .dataTables_wrapper .dataTables_filter, .dataTables_wrapper .dataTables_length { float: none; text-align: left; }
    .dataTables_wrapper .dataTables_filter input { width: 100%; margin-left: 0; }

    /* long page-number bars wrap; search boxes with a fixed width shrink to the screen */
    .pagination { display: flex; flex-wrap: wrap; max-width: 100%; }
    .pagination > li { display: inline-block; }
    .select2-container { max-width: 100% !important; }

    /* dialogs use the whole width of the phone */
    .modal-dialog { margin: 10px auto; width: auto; max-width: calc(100% - 20px); }
}
