﻿/* ===== Toshiba iframe layout ===== */

/* Panel size in Modal display mode. Full screen / compact override these
   (see "Display modes" at the end of this file). */
:root {
    --qm-panel-width: 80vw;
    --qm-panel-height: 90vh;
}

/* Make sure the page fills the iframe */
html,
body {
    height: 100%;
}

/* Base body: POS shows through */
body {
    margin: 0;
    padding: 0;
    background: transparent !important;
    overflow: hidden !important; /* no page scroll; internal areas handle scrolling */
}

/* Full-screen backdrop: darken + blur POS */
.iframe-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5); /* dark overlay */
    backdrop-filter: blur(6px); /* blur POS behind */
    -webkit-backdrop-filter: blur(6px);
    pointer-events: auto;
    cursor: pointer;
    z-index: 0;
}

/* Centered Q-Mgr panel (80% width, 90% height) */
.iframe-panel {
    position: fixed; /* anchor to viewport */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* center horizontally & vertically */

    z-index: 2;
    width: var(--qm-panel-width);
    height: var(--qm-panel-height); /* 90vh leaves 5vh top & bottom */
    margin: 0; /* no auto margins now */

    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    overflow: hidden; /* panel fixed; inside areas scroll as before */
}

/* Prevent Bootstrap's container from centering inside the panel */
.iframe-panel .container {
    max-width: 100% !important;
}

/* --- Header / main / footer behaviour inside the panel --- */

/* Header: keep inside panel, not full screen */
.iframe-panel .side-nav {
    position: relative !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100%;
    z-index: 10;
    border-radius: 12px 12px 0 0; /* match panel rounding */
}

/* Main content: fills remaining height; NO global vertical scroll.
   A flex column so the order board takes the space left under the header and the
   board columns do the scrolling. */
.iframe-panel main {
    flex: 1 1 auto;
    width: 100%;
    overflow: hidden; /* the page itself never scrolls */
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* --- Toshiba-specific content layout tweaks --- */

/* Login / PIN view: centered between the header and the bottom of the panel */
.iframe-panel .home-container {
    height: 100%;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4rem;
}

/* Ensure the Bootstrap backdrop is above our blurred iframe-backdrop */
.iframe-panel .modal-backdrop {
    position: fixed; /* cover the whole panel/viewport */
    z-index: 2001; /* above bottom toolbar (1000) and iframe-backdrop */
}

/* Ensure the modal itself is above its backdrop and fully clickable */
.iframe-panel .modal {
    z-index: 2002;
}

/* Let the Bootstrap modal be interactive even with the backdrop on */
.modal-backdrop.show {
    /* keep whatever opacity you like here */
    opacity: var(--bs-backdrop-opacity); /* or 0.5, etc. */
    pointer-events: none; /* <- critical: don't block clicks */
}

/* Make the standard Bootstrap backdrop invisible and non-interactive */
body.modal-open .modal-backdrop,
body.modal-open .modal-backdrop.show {
    background-color: transparent !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* ===== Display modes (QMT-1926) =====

   Modal (default)   - blurred backdrop over the POS + centred panel (rules above).
                       Tapping the backdrop closes Q-Mgr.
   Full screen       - html.qm-fullscreen, from the Settings > Display option.
                       No backdrop; panel fills the screen. Close X still closes Q-Mgr.
   Compact (auto)    - phones and portrait screens. Always full screen, whatever
                       the setting says.

   COMPACT BREAKPOINT - keep identical everywhere it is used:
   (max-width: 767.98px), (orientation: portrait) and (max-width: 1024px)
*/

html.qm-fullscreen {
    --qm-panel-width: 100vw;
    --qm-panel-height: 100vh;
}

html.qm-fullscreen .iframe-backdrop {
    display: none;
}

/* Pin to all four edges rather than 100vw/100vh so mobile browser toolbars
   don't push the bottom of the panel off screen */
html.qm-fullscreen .iframe-panel {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: auto;
    height: auto;
    transform: none;
    border-radius: 0;
    box-shadow: none;
}

html.qm-fullscreen .iframe-panel .side-nav {
    border-radius: 0;
}

@media (max-width: 767.98px), (orientation: portrait) and (max-width: 1024px) {
    :root {
        --qm-panel-width: 100vw;
        --qm-panel-height: 100vh;
    }

    .iframe-backdrop {
        display: none;
    }

    .iframe-panel {
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        width: auto;
        height: auto;
        transform: none;
        border-radius: 0;
        box-shadow: none;
    }

    .iframe-panel .side-nav {
        border-radius: 0;
    }
}
