/*
 * Magic Display: the sign-in page.
 * PHPMaker Custom File css/Login.css (standalone, output folder css), added to the Login page only, by that page's
 * Page_Load event (AddStylesheet). PHPMaker's own form stays as it is; this file hides the admin chrome around it,
 * draws the stage, the Designer in miniature (markup from the Login page's Page_DataRendering event) and restyles the form.
 * Strict CSP: no inline styles or scripts; the stage moves once, with CSS only, and not at all for reduced motion.
 */

:root {
    --mdl-ink: #171f47;          /* the logo's navy */
    --mdl-night: #10173a;        /* the stage */
    --mdl-bezel: #060a22;
    --mdl-paper: #ffffff;        /* the logo sits on white */
    --mdl-line: #d9deec;
    --mdl-text: #171f47;
    --mdl-text-soft: #4a5378;
    --mdl-on-night: #c9cfea;
    --mdl-green: #007a29;        /* the wand, darkened for white text */
    --mdl-green-hover: #00661f;
    --mdl-red: #e10600;          /* star red: on screen now */
    --mdl-blue: #009cde;         /* star blue */
    --mdl-orange: #ff860a;       /* star orange */
    --mdl-display: "Bahnschrift SemiCondensed", "Bahnschrift", "Arial Narrow", sans-serif;
    --mdl-body: Verdana, Geneva, sans-serif;
}

[data-bs-theme="dark"] {
    --mdl-paper: #1b2349;
    --mdl-line: #36407a;
    --mdl-text: #eef0f8;
    --mdl-text-soft: #a9b0cc;
}

/* === The page: no admin chrome, two halves === */

.main-header,
.main-sidebar,
.content-header,
.main-footer {
    display: none !important;
}

body .wrapper > .content-wrapper { /* beats AdminLTE's [data-bs-theme=dark] .content-wrapper */
    margin-left: 0 !important;
    min-height: 100vh;
    background: var(--mdl-paper);
}

.content-wrapper > .content,
.content-wrapper > .content > .container-fluid {
    padding: 0;
}

/* PHPMaker wraps the page header (the stage) in #ew-page-header: let the stage itself be the grid's first cell */
#ew-page-header {
    display: contents;
}

.content-wrapper > .content > .container-fluid {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    min-height: 100vh;
}

/*
 * === The stage: the Designer in miniature ===
 * The tool people are about to use, drawn in its own colours (css/Editor.css tokens): the layout rail, the screen with
 * its segments and the selection, and "What plays when" with the red playhead. It moves once, when it appears (page
 * load, or when a narrow window widens again and the stage comes back): the window settles, the segments drop in, the
 * bars fill and the playhead slides to now. Then it stands still. Reduced motion: no movement at all.
 */

.mdl-stage {
    --mdl-signal: #00bc8c;      /* Designer: selection */
    --mdl-tally: #d62f35;       /* Designer: on screen now, the playhead */
    --mdl-cue: #f5b83d;         /* Designer: waiting for approval */
    --mdl-panel: #f5f7f8;
    --mdl-panel-line: #d5dbe0;
    --mdl-app-text: #1f2a33;
    --mdl-app-muted: #56616b;
    --mdl-seg-1: #4b8df0;       /* Designer segment colours */
    --mdl-seg-2: #d4761a;
    --mdl-seg-3: #9b6be6;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 36px;
    overflow: hidden;
    padding: 48px clamp(24px, 5vw, 80px);
    background: var(--mdl-night);
    color: var(--mdl-on-night);
}

.mdl-app,
.mdl-claim {
    width: 100%;
    max-width: 820px;
    margin: 0 auto;
}

/* The window */
.mdl-app {
    overflow: hidden;
    border-radius: 12px;
    background: #ffffff;
    color: var(--mdl-app-text);
    font-family: var(--mdl-body);
    font-size: 11px;
    box-shadow: 0 40px 80px -30px rgb(0 0 0 / 70%), 0 0 0 1px rgb(255 255 255 / 8%);
    animation: mdl-settle 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.mdl-app-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--mdl-panel-line);
}

.mdl-app-crumb {
    color: var(--mdl-app-muted);
}

.mdl-app-title {
    flex: 1;
    font-family: var(--mdl-display);
    font-size: 16px;
    font-weight: 700;
}

.mdl-app-tab {
    padding: 3px 9px;
    border: 1px solid var(--mdl-panel-line);
    border-radius: 4px;
    color: var(--mdl-app-muted);
}

.mdl-app-tab.is-active {
    border-color: var(--mdl-signal);
    background: rgb(0 188 140 / 12%);
    color: #00785a;
}

.mdl-app-save {
    padding: 4px 10px;
    border-radius: 4px;
    background: var(--mdl-signal);
    color: #06261d;
    font-weight: 700;
}

.mdl-app-body {
    display: grid;
    grid-template-columns: 24% minmax(0, 1fr);
}

/* The layout rail */
.mdl-rail {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    border-right: 1px solid var(--mdl-panel-line);
    background: var(--mdl-panel);
}

.mdl-rail-heading {
    margin: 0 0 2px;
    color: var(--mdl-app-muted);
}

.mdl-card {
    padding: 6px;
    border: 1px solid var(--mdl-panel-line);
    border-radius: 6px;
    background: #ffffff;
}

.mdl-card.is-active {
    border-color: var(--mdl-signal);
    box-shadow: 0 0 0 2px rgb(0 188 140 / 25%);
}

.mdl-card-thumb {
    display: grid;
    grid-template-columns: 2fr 1fr;
    grid-template-rows: 3fr 1fr;
    gap: 2px;
    aspect-ratio: 16 / 9;
    margin-bottom: 5px;
}

.mdl-card-thumb span:nth-child(1) { background: rgb(75 141 240 / 55%); }
.mdl-card-thumb span:nth-child(2) { background: rgb(212 118 26 / 55%); }
.mdl-card-thumb span:nth-child(3) { grid-column: 1 / -1; background: rgb(155 107 230 / 55%); }

.mdl-card-name {
    display: flex;
    align-items: center;
    gap: 5px;
    font-family: var(--mdl-display);
    font-size: 12px;
    font-weight: 700;
}

.mdl-card-name.is-live::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--mdl-tally);
}

.mdl-card-hours {
    color: var(--mdl-app-muted);
    font-size: 10px;
}

/* The screen */
.mdl-centre {
    padding: 14px 16px 12px;
}

.mdl-canvas {
    padding: 8px;
    border-radius: 8px;
    background: #d3d9de;
}

.mdl-screen {
    position: relative;
    display: grid;
    grid-template-columns: 2fr 1fr;
    grid-template-rows: 3fr 1fr;
    aspect-ratio: 16 / 9;
    border: 2px solid #7c8792;
    background: #ffffff;
}

.mdl-seg {
    position: relative;
    border: 2px solid var(--mdl-seg-color);
    background: var(--mdl-seg-fill);
    animation: mdl-drop 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.mdl-seg:nth-child(1) { --mdl-seg-color: var(--mdl-seg-1); --mdl-seg-fill: rgb(75 141 240 / 40%); animation-delay: 0.35s; }
.mdl-seg:nth-child(2) { --mdl-seg-color: var(--mdl-seg-2); --mdl-seg-fill: rgb(212 118 26 / 40%); animation-delay: 0.5s; }
.mdl-seg:nth-child(3) { --mdl-seg-color: var(--mdl-seg-3); --mdl-seg-fill: rgb(155 107 230 / 40%); grid-column: 1 / -1; animation-delay: 0.65s; }

.mdl-seg-name {
    position: absolute;
    top: 6px;
    left: 6px;
    padding: 1px 6px;
    border-radius: 3px;
    background: var(--mdl-seg-color);
    color: #ffffff;
    font-family: var(--mdl-display);
    font-size: 12px;
    font-weight: 700;
}

/* The selection: teal outline and handles on Main, as in the Designer */
.mdl-seg.is-selected::after {
    content: "";
    position: absolute;
    inset: -4px;
    border: 2px solid var(--mdl-signal);
    border-radius: 2px;
    animation: mdl-fade 0.3s ease-out 0.9s both;
}

.mdl-handle {
    position: absolute;
    width: 9px;
    height: 9px;
    border: 2px solid var(--mdl-signal);
    background: #ffffff;
    animation: mdl-fade 0.3s ease-out 0.9s both;
}

.mdl-handle:nth-of-type(1) { top: -8px; left: -8px; }
.mdl-handle:nth-of-type(2) { top: -8px; right: -8px; }
.mdl-handle:nth-of-type(3) { bottom: -8px; left: -8px; }
.mdl-handle:nth-of-type(4) { right: -8px; bottom: -8px; }

/* What plays when */
.mdl-rundown {
    margin-top: 12px;
}

.mdl-rundown-head {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-family: var(--mdl-display);
    font-size: 13px;
    font-weight: 700;
}

.mdl-rundown-head span {
    color: var(--mdl-app-muted);
    font-family: var(--mdl-body);
    font-size: 10px;
    font-weight: 400;
}

.mdl-rows {
    position: relative;
    display: grid;
    gap: 5px;
}

.mdl-row {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
}

.mdl-row-label {
    color: var(--mdl-app-muted);
}

.mdl-track {
    position: relative;
    height: 14px;
    border-radius: 3px;
    background: var(--mdl-panel);
}

.mdl-bar {
    position: absolute;
    top: 2px;
    bottom: 2px;
    border-radius: 2px;
    transform-origin: left center;
    animation: mdl-fill 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.mdl-row:nth-child(1) .mdl-bar { background: var(--mdl-seg-1); animation-delay: 0.75s; }
.mdl-row:nth-child(2) .mdl-bar { background: var(--mdl-seg-2); animation-delay: 0.85s; }
.mdl-row:nth-child(3) .mdl-bar { background: var(--mdl-seg-3); animation-delay: 0.95s; }

/* A bar still waiting for approval: amber outline, as in the Designer */
.mdl-bar.is-waiting {
    background: rgb(245 184 61 / 25%) !important;
    box-shadow: inset 0 0 0 1px var(--mdl-cue);
}

.mdl-bar-a { left: 12%; width: 30%; }
.mdl-bar-b { left: 48%; width: 40%; }
.mdl-bar-c { left: 8%; width: 52%; }
.mdl-bar-d { left: 66%; width: 22%; }
.mdl-bar-e { left: 12%; width: 76%; }

/* The playhead: slides to now once, then stays */
.mdl-playhead {
    position: absolute;
    top: -4px;
    bottom: -4px;
    left: calc(56px + (100% - 56px) * 0.58);
    width: 2px;
    background: var(--mdl-tally);
    animation: mdl-sweep 1.1s cubic-bezier(0.2, 0.8, 0.2, 1) 0.9s both;
}

.mdl-playhead::before {
    content: "14:00";
    position: absolute;
    bottom: 100%;
    left: 50%;
    padding: 1px 5px;
    border-radius: 3px;
    background: var(--mdl-tally);
    color: #ffffff;
    font-family: var(--mdl-display);
    font-size: 10px;
    transform: translateX(-50%);
}

/* The line under the window */
.mdl-claim {
    margin: 0 auto;
    color: #ffffff;
    font-family: var(--mdl-display);
    font-size: clamp(30px, 3.4vw, 58px);
    font-weight: 700;
    line-height: 1.02;
}

/* The slim bar's line: only on small screens */
.mdl-strip {
    display: none;
}

@keyframes mdl-settle {
    from { opacity: 0; transform: translateY(18px) scale(0.98); }
    to { opacity: 1; transform: none; }
}

@keyframes mdl-drop {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: none; }
}

@keyframes mdl-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes mdl-fill {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

@keyframes mdl-sweep {
    from { left: 56px; opacity: 0; }
    15% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .mdl-app,
    .mdl-seg,
    .mdl-seg.is-selected::after,
    .mdl-handle,
    .mdl-bar,
    .mdl-playhead {
        animation: none;
    }
}

/* === The form: PHPMaker's, restyled === */

.ew-login-box {
    align-self: center;
    justify-self: center;
    width: min(380px, 100% - 48px) !important;
    margin: 48px auto;
    font-family: var(--mdl-body);
    color: var(--mdl-text);
}

/* The logo on a white tile its own shape, centred over the form, in both themes (owner, Nov 2026).
   The tile's width follows the picture's height × its shape: when the logo file changes, set
   --mdl-logo-shape to the new picture's width / height (MagicDisplayLogo.png is 1074 × 1173). */

.ew-login-box .login-logo {
    --mdl-logo-shape: 1074 / 1173;
    box-sizing: content-box;
    width: fit-content;
    height: 120px;
    aspect-ratio: var(--mdl-logo-shape);
    margin: 0 auto 28px;
    padding: 10px;
    border-radius: 12px;
    background: #ffffff url("../images/MagicDisplayLogo.png") center / contain no-repeat;
    background-origin: content-box;
}

.ew-login-box .ew-login-card {
    min-height: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
}

.ew-login-box .ew-login-card > .card-body {
    padding: 0;
}

.ew-login-box .login-box-msg {
    margin: 0 0 24px;
    padding: 0;
    text-align: left;
    color: var(--mdl-text);
    font-family: var(--mdl-display);
    font-size: 32px;
    line-height: 1.15;
}

.ew-login-form > .row {
    margin-bottom: 16px;
}

.ew-login-box .form-control.ew-form-control,
.ew-login-box .btn.ew-toggle-password {
    height: 48px;
    border-color: var(--mdl-line);
    background-color: var(--mdl-paper);
    color: var(--mdl-text);
    font-size: 16px;
}

/* AdminLTE's dark field colour comes with a chain of :not() selectors that nothing short of !important beats */
[data-bs-theme="dark"] .ew-login-box .form-control {
    background-color: var(--mdl-paper) !important;
    color: var(--mdl-text) !important;
}

.ew-login-box .form-control::placeholder {
    color: var(--mdl-text-soft);
}

.ew-login-box .form-control:focus {
    border-color: var(--mdl-blue);
    box-shadow: 0 0 0 3px rgb(0 156 222 / 30%);
}

.ew-login-box .ew-toggle-password {
    width: 48px;
    color: var(--mdl-text-soft);
}

.ew-login-box #btn-submit {
    height: 52px;
    margin-top: 8px;
    border: 0;
    background: var(--mdl-green);
    color: #ffffff;
    font-family: var(--mdl-display);
    font-size: 19px;
}

.ew-login-box #btn-submit:hover {
    background: var(--mdl-green-hover);
}

.ew-login-box #btn-submit:focus-visible {
    outline: 3px solid var(--mdl-blue);
    outline-offset: 3px;
}

.ew-login-box .invalid-feedback {
    font-size: 14px;
}

.ew-login-box .login-page-links {
    text-align: left !important;
    font-size: 14px;
}

.ew-login-box .login-page-links a {
    color: var(--mdl-text);
    text-decoration: underline;
}

/* === Tall portrait screens (a 1080 × 1920 monitor): the Designer above the form, both in view === */

@media (orientation: portrait) and (min-width: 920px) and (min-height: 1100px) {
    .content-wrapper > .content > .container-fluid {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto 1fr;
    }

    .mdl-stage {
        min-height: 55vh;
        padding: 56px clamp(32px, 7vw, 96px);
    }

    .ew-login-box {
        align-self: start;
        margin-top: 64px;
    }
}

/*
 * === Narrower than 920 px (phones, tablets, a small window) ===
 * The Designer folds away into a slim, still bar so the form is right there without scrolling, as on the
 * merdeka118 sign-in. Widening the window again brings the Designer back, and it plays its entrance once more.
 */

@media (max-width: 919.98px) {
    .content-wrapper > .content > .container-fluid {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto 1fr;
    }

    .mdl-stage {
        flex-direction: row;
        align-items: center;
        min-height: 56px;
        padding: 12px clamp(16px, 5vw, 40px);
    }

    .mdl-app,
    .mdl-claim {
        display: none;
    }

    .mdl-strip {
        display: flex;
        align-items: center;
        gap: 10px;
        min-width: 0;
        margin: 0;
        color: #ffffff;
        font-family: var(--mdl-display);
        font-size: 16px;
        font-weight: 700;
    }

    .mdl-strip::before {
        content: "";
        flex: none;
        width: 10px;
        height: 10px;
        border-radius: 50%;
        background: var(--mdl-tally);
    }

    .ew-login-box {
        align-self: start;
        margin: 32px auto 40px;
    }

    .ew-login-box .login-logo {
        height: 96px;
        margin-bottom: 20px;
    }

    .ew-login-box .login-box-msg {
        font-size: 28px;
    }
}

/* Short screens (a phone turned sideways): a tighter form */
@media (max-width: 919.98px) and (max-height: 520px) {
    .ew-login-box {
        margin: 16px auto 24px;
    }

    .ew-login-box .login-logo {
        height: 64px;
        padding: 6px;
        margin-bottom: 12px;
    }

    .ew-login-box .login-box-msg {
        margin-bottom: 16px;
        font-size: 24px;
    }
}

/* Very short screens: the heading already names Magic Display, so the logo steps aside */
@media (max-width: 919.98px) and (max-height: 400px) {
    .ew-login-box .login-logo {
        display: none;
    }
}