/* ============================================================
 * The console on a till-sized screen (#544)
 *
 * The Sunmi D3 MINI presents 1280x800. Bootstrap 4 expands a
 * `navbar-expand-md` sidebar from 768px up and has no breakpoint above
 * xl (1200px), so on the till the owner console spent 250px of width on
 * a sidebar and 258px of height on the banner -- about a third of the
 * screen before any content. The floor plan got 1024x540 of it.
 *
 * This band restores the layout the console already uses on a phone,
 * which is the one shape that is known to work with a finger: the
 * sidebar becomes a top bar with a hamburger, and the banner becomes a
 * title strip.
 *
 * The cap is 1365.98px and that is the whole safety argument: 1440 and
 * 1920 never see a rule in this file, so the desktop console is
 * untouched. A 1280-wide laptop gets the compact layout too -- the
 * pixels are the same and nothing can tell the two apart, which is the
 * trade this makes knowingly.
 *
 * Loaded last in layouts/app.blade.php, after owner-legacy-skin.css.
 * ============================================================ */

@media (min-width: 768px) and (max-width: 1365.98px) {

    /* ── The sidebar stops being a column ───────────────────── */
    .navbar-vertical.navbar-expand-md {
        position: static;
        overflow-y: visible;
        width: 100%;
        max-width: none;
        padding: .5rem 1rem;
    }

    .navbar-vertical.navbar-expand-md.fixed-left,
    .navbar-vertical.navbar-expand-md.fixed-right {
        border-width: 0 0 1px 0;
    }

    /* …so the content stops leaving room for one.
       Both selectors are needed. Argon's is the class pair; custom.css
       also carries `#sidenav-main ~ .main-content { margin-left: 250px }`,
       and an id outranks any number of classes, so undoing only Argon's
       left the content indented by exactly the sidebar's old width with
       nothing in it. */
    .navbar-vertical.navbar-expand-md.fixed-left + .main-content,
    .navbar-vertical.navbar-expand-md.fixed-right + .main-content,
    #sidenav-main ~ .main-content {
        margin-left: 0;
        margin-right: 0;
    }

    .navbar-vertical.navbar-expand-md > [class*='container'] {
        flex-direction: row;
        min-height: 0;
        align-items: center;
    }

    /* ── The menu collapses behind the hamburger ────────────── */
    /* Bootstrap forces `display: flex` on the collapse and hides the
       toggler from 768px up. Both have to be undone together: a hidden
       toggler with a collapsed menu is a console with no navigation. */
    .navbar-expand-md .navbar-collapse {
        display: none !important;
    }
    .navbar-expand-md .navbar-collapse.show,
    .navbar-expand-md .navbar-collapse.collapsing {
        display: block !important;
    }
    .navbar-expand-md .navbar-toggler {
        display: block;
    }

    /* The open menu is a sheet over the page, not something that pushes
       the floor plan down the screen. */
    .navbar-vertical.navbar-expand-md .navbar-collapse.show {
        position: absolute;
        z-index: 1040;
        top: 100%;
        right: 0;
        left: 0;
        max-height: calc(100vh - 64px);
        overflow-y: auto;
        padding: 1rem;
        background: #fff;
        box-shadow: 0 24px 48px -12px rgba(15, 23, 42, .18);
    }
    .navbar-vertical.navbar-expand-md {
        position: relative;
    }

}

/* The banner, on anything smaller than a desktop.
 *
 * Separate block on purpose: the sidebar rules above start at 768px
 * because below that the console already collapses it, but the banner is
 * oversized at BOTH ends -- 258px on the till, and on a phone the title
 * wraps to three lines and pushes the first table to 600px down an 844px
 * screen. Same cap, so 1440 and 1920 keep the banner they have.
 */
@media (max-width: 1365.98px) {
    /* ── The banner becomes a title strip ───────────────────── */
    /* 258px of a 800px screen is a third of the till given to a heading
       the owner has already read. */
    .header.bg-gradient-primary {
        padding-top: .75rem !important;
        padding-bottom: 3rem !important;
    }
    /* `h1` as well as `.display-2`: not every owner page uses the utility
       class, and the floor plan's title was 40px and wrapping to three
       lines on a phone -- most of the banner, for a heading the owner has
       already read. */
    .header.bg-gradient-primary .display-2,
    .header .display-2,
    .header h1,
    .header .header-body h1 {
        font-size: 1.375rem !important;
        line-height: 1.25;
    }
    .header.bg-gradient-primary p {
        font-size: 12.5px !important;
    }
    /* The card is pulled up over the banner. With the banner shortened,
       the original -80px pull put the card ON TOP of the page title.
       owner-legacy-skin.css sets that with a three-class selector, so the
       override has to match it rather than just carry !important. */
    .container-fluid.mt--7,
    .owner-workspace .header + .container-fluid.mt--7,
    .owner-workspace .header.bg-gradient-primary + .container-fluid.mt--7 {
        margin-top: -1.5rem !important;
    }

    /* The padding alone changes nothing: a `min-height: 258px` elsewhere
       holds the banner open whatever the padding says. */
    .header,
    .header.bg-gradient-primary {
        min-height: 0 !important;
    }

    /* A 76px logo is most of the top bar on a till. */
    #sidenav-main .navbar-brand img,
    #sidenav-main .navbar-brand-img {
        max-height: 34px;
        width: auto;
    }
    #sidenav-main .navbar-brand {
        padding-top: .25rem;
        padding-bottom: .25rem;
    }
}
