/*
 * Pptx local viewer: when .ppt-local-root is moved to document.body for iOS/fullscreen,
 * Blazor scoped rules like [b-xxxxx] .ppt-local-root no longer match (no scoped ancestor).
 * These un-scoped rules restore layout and interaction.
 */
body > .ppt-local-root {
    margin-top: 0;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
    max-width: 100%;
}

body > .ppt-local-root.ppt-local-pseudo-fs {
    position: fixed !important;
    inset: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100vh !important;
    height: 100dvh !important;
    min-height: -webkit-fill-available !important;
    max-height: 100vh !important;
    max-height: -webkit-fill-available !important;
    z-index: 2147483647 !important;
    margin: 0 !important;
    border-radius: 0 !important;
    background: #eef1f4 !important;
    overflow: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    /* pan-y: allow vertical scroll; pinch-zoom: iOS zoom; avoids “stuck” pages where manipulation blocks scrolling */
    touch-action: pan-y pinch-zoom;
    padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)) !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    isolation: isolate;
    pointer-events: auto;
}

/* min-height: 0 lets the slide area shrink inside flex so overflow scroll works on iOS Safari */
body > .ppt-local-root.ppt-local-pseudo-fs .ppt-local-canvas-wrap {
    flex: 1 1 auto;
    min-width: 0 !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: auto !important;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y pinch-zoom;
    align-items: center;
    justify-content: flex-start;
}

body > .ppt-local-root .ppt-local-canvas {
    width: 100%;
    max-width: 100%;
    height: auto !important;
    flex: 0 0 auto;
}

/* Sticky so Prev/Next/Exit stay reachable when the overlay scrolls (common iPhone “stuck” symptom) */
body > .ppt-local-root.ppt-local-pseudo-fs .ppt-local-toolbar {
    flex-shrink: 0;
    margin-top: auto;
    padding-top: 10px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    border-top: 1px solid #cfd6de;
    background: #eef1f4;
    position: sticky;
    bottom: 0;
    z-index: 4;
    touch-action: manipulation;
    -webkit-transform: translateZ(0);
}

@media (max-width: 640px) {
    body > .ppt-local-root.ppt-local-pseudo-fs .ppt-local-toolbar {
        display: grid;
        grid-template-columns: minmax(3rem, 1fr) minmax(0, 2fr) minmax(3rem, 1fr);
        grid-template-areas:
            "pptprev pptlabel pptnext"
            "pptfs pptfs pptfs";
        gap: 10px 8px;
        align-items: center;
        justify-items: stretch;
        overflow-x: visible;
        padding-left: 2px;
        padding-right: 2px;
    }

    body > .ppt-local-root.ppt-local-pseudo-fs .ppt-local-toolbar > .ppt-local-prev {
        grid-area: pptprev;
    }

    body > .ppt-local-root.ppt-local-pseudo-fs .ppt-local-toolbar > .ppt-local-slide-label {
        grid-area: pptlabel;
        min-width: 0 !important;
        max-width: 100%;
        font-size: 14px !important;
        font-weight: 700 !important;
        color: #1e3a5f !important;
        text-align: center;
        line-height: 1.25;
        padding: 0 4px;
    }

    body > .ppt-local-root.ppt-local-pseudo-fs .ppt-local-toolbar > .ppt-local-next {
        grid-area: pptnext;
    }

    body > .ppt-local-root.ppt-local-pseudo-fs .ppt-local-toolbar > .ppt-local-fs {
        grid-area: pptfs;
        width: 100%;
        min-height: 48px;
    }
}
