/*
 * Phone, tablet and installed-app fixes shared by the four installable panels:
 * Provider (/partner), Technician (/employee), Supplier and Property Manager,
 * on their panel pages and their sign-in pages. Never the admin panel.
 *
 * Linked from app/Views/backend/shared/pwa_head.php, which only renders for
 * those four panels. That partial comes BEFORE the theme's stylesheets on the
 * Provider and Technician pages, so every rule here starts with `html` to beat
 * a theme rule of the same specificity whatever the order.
 *
 * Each rule fixes something measured at 375x812, 768x1024 and 1366x768
 * (2026-10-09); the comment says what it was.
 */

/* The hidden phone/tablet sidebar is 260px wide but the theme only moves it
   255px off screen (style.css `body.sidebar-gone .main-sidebar { left: -255px }`),
   so a 5px strip of it - with the active-item marker - showed down the left
   edge of every page. Narrowing it while hidden works for RTL too, where the
   theme uses `right: -255px`. */
html body.sidebar-gone .main-sidebar {
    width: 255px;
    box-shadow: none;
}

/* Touch screens: form fields at 16px. iOS zooms into any field under 16px when
   it is focused, and in an installed app the page then stays zoomed in. The
   panels used to stop that with `maximum-scale=1`, which also stopped people
   from pinch-zooming at all on Android (WCAG 1.4.4); that is gone from the
   viewport tags now, and this keeps the focus zoom away. !important because
   some fields set their own size inline. */
@media (pointer: coarse) {
    html body input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]):not([type="hidden"]),
    html body select,
    html body textarea,
    html body .form-control,
    html body .select2-search__field,
    html body .tagify__input {
        font-size: 16px !important;
    }
}

/* Touch screens: buttons at least 40px tall. The theme's buttons are 36px
   (.btn), 30px (card-header buttons) and 29px (.btn-sm, e.g. the icon-only
   toolbar buttons of every list: refresh, columns, export - 27px wide). Only
   the vertical padding grows, so text stays centred; icon-only buttons get a
   40px minimum width. */
@media (pointer: coarse) {
    html .main-wrapper .btn:not(.btn-lg):not(.btn-link),
    html .main-wrapper .fixed-table-toolbar .btn {
        padding-top: .45rem;
        padding-bottom: .45rem;
        min-width: 40px;
    }

    html .main-wrapper .page-link {
        min-width: 40px;
        min-height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Phones and tablets: a table placed straight in a card (dashboards, detail
   pages) scrolls sideways inside its card. It used to widen the whole page -
   the Supplier dashboard became 468px wide on a 375px phone, pushing the top
   bar's account menu and the help button off screen. Lists built with
   bootstrap-table already scroll inside their own wrapper. */
@media (max-width: 991.98px) {
    html .main-content .card-body:has(> table) {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Phones: keep the top bar on one screen. The Supplier and Property Manager
   bars carry a status badge, a role badge, the language menu and the account
   menu; on a phone the account menu - the only way to Log out - ended up past
   the right edge (Property Manager: 391-470px on a 375px screen) and widened
   the page. The status badge is repeated in the sidebar's profile card. */
@media (max-width: 575.98px) {
    html .main-navbar .navbar-right > li.nav-item:has(> .badge:not(.badge-light):not(.badge-primary)) {
        display: none;
    }
}

/* Phones and tablets: the theme hides every <div> in a top-bar link below
   992px, exempting only the Provider panel's language code
   (#current-language-display). The Supplier and Property Manager language
   menus therefore showed a bare caret with no code. The theme's rule is
   !important and carries an id (:not(#current-language-display)), hence the
   !important and the :not(#...) here. */
@media (max-width: 991.98px) {
    html .main-navbar li.navbar_dropdown:has([onclick^="set_locale"]) > .nav-link > .d-inline-block:not(#fnb-specificity) {
        display: inline-block !important;
    }
}

/* Phones and tablets: no text under 12px. Bootstrap's <small> is 80% of the
   theme's 14px (11.2px) - card captions, table sub-lines, footer links - the
   sidebar's section headings are 10px and the profile card's role line 11px.
   Sign-in pages included (the "or continue with" divider was 11.2px). */
@media (max-width: 1024px), (pointer: coarse) {
    html body small,
    html body .small {
        font-size: max(80%, 12px);
    }

    html .main-sidebar .sidebar-menu .menu-header,
    html .main-sidebar .supplier-sidebar-profile-role,
    html .main-sidebar .pm-sidebar-profile-role {
        font-size: 12px;
    }
}

/* The orange help-assistant bubble is fixed in the bottom-right corner (58px,
   about 20px in) and covered the footer's "Terms and Conditions" link, which is
   right-aligned. Keep the footer's text out of that corner. !important because the
   footer carries Bootstrap's p-0 utility, which is !important itself. */
html .main-wrapper .main-footer {
    padding-right: 96px !important;
}
