/* Incident Report program window (LASD SH-R-49)
 *
 * Structural/z-index override only for the MDCLib.createProgram() instance
 * built by frontend/js/incident-report-form.js. Visual theming is
 * intentionally left to mdc-ui-lib.css's own default light chrome (the same
 * light gray title bar / beveled buttons every other program window in this
 * app renders with), matching the now-light report content in
 * assets/incident-report-complete.html — this file no longer applies any
 * custom color palette of its own.
 *
 * Fix-forward (2026-08-09, post-runtime-engineer regression correction):
 * mdc-ui-lib.css also defines *conditional* dark styling for these same
 * classes, gated on the app's real, user-togglable body.dark-mode/
 * night-mode preference (Other Functions window's DAY/NIGHT MODE button,
 * persisted in localStorage and reapplied on every page load). With no
 * exclusion below, #ir-program would inherit that and go dark whenever the
 * user's browser has Night Mode on — contradicting this file's own stated
 * "always-light chrome" intent above. The body.dark-mode/night-mode-scoped
 * rules below exist solely to pin #ir-program's chrome back to the exact
 * same light values already used in the non-dark-mode case, regardless of
 * the app-wide Night Mode toggle. This does not make #ir-program
 * participate in real Night Mode (that remains explicitly out of scope,
 * per the architect's plan) — it is the opposite: a targeted exemption.
 *
 * z-index is explicitly overridden here: .mdc-program's own default
 * (mdc-ui-lib.css) is 1000, which sits below .mdc-window (2000, styles.css)
 * and the mini-windows (2100, e.g. inquiries-window.css) and would render
 * invisible-behind them if left unmodified. 9999 sits above .file-manager-
 * window's 9998 (file-manager.css) too - File Manager's own openIncidentReport()
 * reopen path never closes/lowers File Manager, so the IR window must clear
 * it explicitly or it renders hidden behind File Manager's opaque panel
 * (confirmed live by qa-engineer/runtime-engineer). This matches the
 * existing precedent in this codebase for exactly this "opened from File
 * Manager" scenario: file-manager.js's own renderVehicleReportModal() uses
 * the same z-index:9999 for the same reason. 9999 still sits below the
 * 10000/10001 top-level toast/overlay layer (styles.css, desktop.css,
 * file-manager.css context menu).
 *
 * Win11 acrylic exemption (2026-08-11, Phase 1 desktop redesign, §D.3/§E.2):
 * mdc-ui-lib.css's .mdc-program/.mdc-title-bar/.mdc-title-btn now default to
 * a translucent Win11 acrylic material (background + backdrop-filter blur)
 * in BOTH the light-default state and the body.dark-mode/night-mode state.
 * #ir-program stays the one deliberate exception, always flat/opaque/paper-
 * like, in both states — the default-state block below (added this pass)
 * and the pre-existing night-mode-exemption block immediately after it
 * (extended this pass with explicit backdrop-filter:none, since the dark
 * variant now also carries a blur that didn't exist when that block was
 * first written) together guarantee this. Confirmed the single highest-risk
 * regression surface in the approved plan.
 */

/* ── Default-state exemption — pin to the same flat, opaque light values
 * the night-mode exemption block below already uses. No new palette
 * introduced; #ir-program never participates in the shared library's new
 * acrylic look in either state.
 */
#ir-program {
    z-index: 9999;
    background: #f0f0f0;
    border-color: #888;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    /* Day/Night mode (RUN_ID 20260825-day-night-mode-and-themes): #ir-program's
     * chrome never changes with theme (exemption affirmed, Design Spec §4) —
     * this is the one property it was genuinely missing, since it previously
     * fell back to mdc-ui-lib.css's .mdc-program dark-family shadow token
     * unconditionally, in every state. Unconditional, not scoped to
     * body.dark-mode/.night-mode — #ir-program's own ID specificity already
     * beats .mdc-program regardless of theme, so one declaration fixes both
     * states permanently. */
    box-shadow: var(--win11-shadow-window-light, 0 32px 80px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.06));
}

#ir-program .mdc-title-bar {
    background: linear-gradient(to bottom, #e6e6e6, #cccccc);
    border-bottom-color: #666;
    color: #000;
}

#ir-program .mdc-title-btn {
    background: linear-gradient(to bottom, #e6e6e6, #cccccc);
    border-color: #999;
    color: #333;
}

#ir-program .mdc-title-btn:hover {
    background: linear-gradient(to bottom, #d4d4d4, #b8b8b8);
}

#ir-program .mdc-title-btn:active {
    background: #aaaaaa;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.3);
}

#ir-program .mdc-title-btn.mdc-close-btn:hover {
    background: linear-gradient(to bottom, #e8a0a0, #cc6666);
    color: #fff;
    border-color: #aa4444;
}

#ir-program .mdc-content {
    padding: 0;
}

#ir-program .ir-program-iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: none;
    background: #fff;
}

/* ── Night Mode exemption — pin to the same light values as above ──────
 * Each selector below adds #ir-program's ID to mdc-ui-lib.css's
 * body.dark-mode/body.night-mode selector for the same class, giving it
 * one extra ID-level specificity (0,2,1 -> 1,2,1 etc.) so it always wins
 * the cascade against the library's dark-mode rule, regardless of source
 * order. Values are copied verbatim from mdc-ui-lib.css's own
 * non-dark-mode defaults (the same defaults #ir-program already falls
 * back to above when Night Mode is off) — no new palette introduced.
 *
 * backdrop-filter:none added this pass (Phase 1 desktop redesign): the
 * shared library's dark-mode .mdc-program variant now also carries a real
 * acrylic blur (previously it was flat, so this override never needed to
 * cancel one) — without this, #ir-program would render blurred/translucent
 * whenever Night Mode is on, even though its background/border above are
 * already correctly pinned flat/opaque.
 */
body.dark-mode #ir-program,
body.night-mode #ir-program {
    background: #f0f0f0;
    border-color: #888;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

body.dark-mode #ir-program .mdc-title-bar,
body.night-mode #ir-program .mdc-title-bar {
    background: linear-gradient(to bottom, #e6e6e6, #cccccc);
    border-bottom-color: #666;
    color: #000;
}

body.dark-mode #ir-program .mdc-title-btn,
body.night-mode #ir-program .mdc-title-btn {
    background: linear-gradient(to bottom, #e6e6e6, #cccccc);
    border-color: #999;
    color: #333;
}

body.dark-mode #ir-program .mdc-title-btn:hover,
body.night-mode #ir-program .mdc-title-btn:hover {
    background: linear-gradient(to bottom, #d4d4d4, #b8b8b8);
}

body.dark-mode #ir-program .mdc-title-btn:active,
body.night-mode #ir-program .mdc-title-btn:active {
    background: #aaaaaa;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.3);
}

body.dark-mode #ir-program .mdc-title-btn.mdc-close-btn:hover,
body.night-mode #ir-program .mdc-title-btn.mdc-close-btn:hover {
    background: linear-gradient(to bottom, #e8a0a0, #cc6666);
    color: #fff;
    border-color: #aa4444;
}
