/* === Font & Body === */
html, body {
    font-family: 'Segoe UI', 'Noto Sans Thai', 'Leelawadee UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: #FAF7F5;
    color: #231F20;
    margin: 0;
    padding: 0;
}

/* === Links === */
a, .btn-link {
    color: #E8491D; /* HumanOk orange, from the logo mark */
}

/* === Buttons === */
.btn-primary {
    color: #fff;
    background-color: #E8491D;
    border-color: #C43A15;
}

.btn:focus, .btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #E8491D;
}

/* === Content === */
.content {
    background-color: #FFFFFF;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(29, 43, 79, 0.08), 0 1px 2px rgba(29, 43, 79, 0.06);
    margin-top: 1rem;
    margin-bottom: 1rem;
}

/* === Headings === */
h1:focus {
    outline: none;
}

/* === Validation === */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid #32CD32; /* LimeGreen */
}

.invalid {
    outline: 1px solid #DC143C; /* Crimson */
}

.validation-message {
    color: #DC143C;
}

/* === Error Boundary === */
.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,...) no-repeat 1rem/1.8rem, #B22222; /* Firebrick */
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred.";
    }

/* === Checkbox Border === */
.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

/* === Page Layout === */
.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* === Footer === */
footer {
    background-color: #1D2B4F;
    color: #E7E9F0;
    font-size: 0.85rem;
    text-align: center;
    padding: 0.75rem 0;
    margin-top: auto;
}

/* === Table Hover === */
.table-hover tbody tr:hover {
    background-color: #FDECE6 !important; /* Light tint of the HumanOk orange */
}

/* ============================================================
   Mobile responsive layer (phones) — added for the PWA / mobile
   pass. Everything is inside the media query, so desktop layout
   is untouched. Rides on MudBlazor's own responsive AppBar +
   Drawer by styling its existing classes.
   ============================================================ */
@media (max-width: 600px) {
    /* Reclaim horizontal space: tighter page gutters */
    .mud-main-content .content,
    .mud-main-content .mud-container {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    /* App bar: shrink gaps so the actions row fits a ~360px phone */
    .mud-appbar .mud-toolbar {
        padding-left: 8px;
        padding-right: 4px;
    }
    .mud-appbar .mud-typography-h6 { font-size: 1.05rem; }

    /* Drawer: readable width as a mobile overlay + bigger touch targets */
    .mud-drawer {
        width: min(85vw, 320px) !important;
    }
    .mud-drawer .mud-nav-link { min-height: 46px; }

    /* Wide content (tables) scrolls inside its own box instead of
       forcing the whole page to scroll sideways */
    .mud-table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }

    /* Cards / papers: a touch less padding so content isn't cramped */
    .mud-paper.pa-4 { padding: 12px !important; }

    /* Keep big page titles from wrapping to three lines on a phone */
    .mud-typography-h4 { font-size: 1.55rem; }
    .mud-typography-h5 { font-size: 1.25rem; }

    /* Never allow horizontal page scroll */
    html, body { overflow-x: hidden; }
}

/* Mobile app-bar: keep action buttons on one line (never stack text
   vertically) and make login/logout compact so the row fits a phone. */
@media (max-width: 600px) {
    .mud-appbar .mud-button-root { white-space: nowrap; min-width: 0; }
    .mud-appbar a[href="/login"] .mud-button-label,
    .mud-appbar a[href="/logout"] .mud-button-label { gap: 2px; }
    /* Login/Logout: icon-only on phones (the page body has the real
       login form; logout is obvious from the exit icon) */
    .mud-appbar a[href="/login"] .mud-button-label,
    .mud-appbar a[href="/logout"] .mud-button-label { font-size: 0; }
    .mud-appbar a[href="/login"] .mud-icon-root,
    .mud-appbar a[href="/logout"] .mud-icon-root { font-size: 1.5rem; }
}

/* === Reconnect overlay with the AD logo (see App.razor #components-reconnect-modal) ===
   blazor.web.js toggles components-reconnect-show / -failed / -rejected on the modal element.
   Hidden by default; only the message that matches the current state is visible. */
.ad-reconnect { display: none; position: fixed; inset: 0; z-index: 2000; background: rgba(250, 247, 245, .92);
                align-items: center; justify-content: center; font-family: inherit; }
.ad-reconnect.components-reconnect-show,
.ad-reconnect.components-reconnect-failed,
.ad-reconnect.components-reconnect-rejected { display: flex; }
.ad-reconnect-card { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 32px 40px;
                     background: #fff; border-radius: 16px; box-shadow: 0 8px 32px rgba(29, 43, 79, .14); color: #231F20; }
.ad-reconnect-logo { width: 72px; height: 72px; animation: ad-reconnect-pulse 1.6s ease-in-out infinite; }
.ad-reconnect-show, .ad-reconnect-failed, .ad-reconnect-rejected { display: none; }
.components-reconnect-show .ad-reconnect-show,
.components-reconnect-failed .ad-reconnect-failed,
.components-reconnect-rejected .ad-reconnect-rejected { display: block; }
.ad-reconnect a { color: #E8491D; font-weight: 600; }
@keyframes ad-reconnect-pulse { 0%, 100% { transform: scale(1); opacity: .85 } 50% { transform: scale(1.08); opacity: 1 } }
@media (prefers-reduced-motion: reduce) { .ad-reconnect-logo { animation: none; } }
