/* ── Global z-index scale ──
   The MainLayout's sticky page header lives at --z-app-header (1000).
   Anything that interrupts the user (modal, toast) MUST sit above it.
   Use these variables instead of magic numbers anywhere a fixed/sticky
   element competes for stacking order with the page chrome.

   Full convention and decision tree: Documents/Wiki/UI/Overlays.md

   Layer hierarchy (low → high, every layer must be > the one below it):
     --z-base            1     in-flow content baseline (default elements)
     --z-dropdown      100     in-page dropdowns under the app header
     --z-sticky-content 500    in-flow sticky elements (sub-headers, table
                               headers, mode bars). Pages with nested sticky
                               bars may stack within this band using
                               calc(var(--z-sticky-content) + N) so the
                               relative ordering stays local to the page
                               without inventing global tokens.
     --z-app-header   1000     MainLayout's sticky page header — ANCHOR
     --z-modal-backdrop 1100   dark overlay behind a modal
     --z-modal        1110     modal dialog itself
     --z-popover      1200     dropdowns / popovers above a modal
     --z-tooltip      1250     tooltips above a popover
     --z-toast        9000     transient banners and toasts (always wins)

   Note: MainLayout.razor.css uses a literal `z-index: 1000` for the page
   header because scoped CSS files compile separately and cannot resolve
   :root custom properties from this file at build time. If you change
   --z-app-header here, change MainLayout.razor.css to match by hand.
*/
:root {
    --z-base: 1;
    --z-dropdown: 100;          /* in-page dropdowns under the app header */
    --z-sticky-content: 500;    /* in-flow sticky elements (table headers, sub-nav, etc.) */
    --z-app-header: 1000;       /* MainLayout's sticky page header — anchor */
    --z-modal-backdrop: 1100;   /* dark overlay behind a modal */
    --z-modal: 1110;            /* modal dialog itself */
    --z-popover: 1200;          /* dropdowns / popovers that sit ABOVE a modal */
    --z-tooltip: 1250;          /* tooltips that sit ABOVE a popover */
    --z-toast: 9000;            /* transient banners and toasts (always wins) */
}

html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

a, .btn-link {
    color: #006bb7;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.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 #258cfb;
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* ── Navbar ── */
.navbar {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.dropdown-menu {
    max-height: 80vh;
    overflow-y: auto;
}

.dropdown-header {
    font-weight: 600;
    color: #6c757d;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── Slide-out panel system (formerly centered modals) ── */
.modal-backdrop-custom {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: var(--z-modal-backdrop);
    animation: slideout-fade-in 0.25s ease;
}

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

.modal-custom {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: var(--z-modal);
    display: flex;
    align-items: stretch;
    justify-content: flex-end;
}

.modal-dialog-custom {
    position: relative;
    width: 100%;
    max-width: 560px;
    background: var(--bs-body-bg);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    max-height: 100vh;
    overflow: hidden;
    animation: slideout-in 0.3s ease;
}

@keyframes slideout-in {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@media (max-width: 600px) {
    .modal-dialog-custom {
        max-width: 100vw;
    }
}

.modal-dialog-custom .modal-content {
    background: var(--bs-body-bg);
    border: 0;
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.modal-dialog-custom .modal-header,
.modal-header-custom {
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid #dee2e6;
    background: linear-gradient(135deg, #1a237e 0%, #283593 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.modal-header-custom h6,
.modal-dialog-custom .modal-header .modal-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    margin: 0;
}

.modal-header-custom .btn-close {
    filter: brightness(0) invert(1);
}

.modal-dialog-custom .modal-body,
.modal-body-custom {
    padding: 1.25rem;
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--bs-body-color);
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-dialog-custom .modal-footer,
.modal-footer-custom {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--bs-border-color);
    background: var(--bs-tertiary-bg);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* Note: .hover-dropdown desktop / tablet rules used to live here at the
   lg breakpoint (992px) and were duplicated in NavMenu.razor.css at the xl
   breakpoint (1200px). The single source of truth is now NavMenu.razor.css
   — .hover-dropdown is a NavMenu-only class (verified by grep), so scoped
   CSS is the correct home for it. Removed from this file 2026-06 Wave 4C. */

/* ── Administration mega-menu with expandable groups ── */
.admin-mega-menu {
    min-width: 280px;
    padding: 0.25rem 0;
}

.nav-group-header {
    display: flex;
    align-items: center;
    padding: 0.45rem 1rem;
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--bs-secondary-color);
    cursor: pointer;
    background: var(--bs-tertiary-bg);
    border-top: 1px solid var(--bs-border-color);
    user-select: none;
    transition: background 0.15s;
    /* Wave 4C (2026-06-19) — these are now <button> elements (was <div>)
       so Tab + Enter actually open the group. Strip the native button chrome
       so the visual matches the surrounding dropdown rows. */
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    width: 100%;
    text-align: left;
    font-family: inherit;
}

.nav-group-header:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: -2px;
}

.nav-group-header:first-child {
    border-top: none;
}

.nav-group-header:hover {
    background: var(--bs-secondary-bg);
}

.nav-group-header .nav-group-chevron {
    font-size: 0.6rem;
    margin-left: auto;
    transition: transform 0.2s ease;
}

.nav-group.open > .nav-group-header .nav-group-chevron {
    transform: rotate(180deg);
}

.nav-group-body {
    display: none;
    padding: 0;
    margin: 0;
    list-style: none;
}

.nav-group.open > .nav-group-body {
    display: block;
}

.nav-group-body .dropdown-item {
    padding-left: 2.25rem;
    font-size: 0.82rem;
}

/* Note: mobile/tablet nav-collapse rules (max-width: 1199.98px) used to
   live here AND in NavMenu.razor.css. Consolidated into NavMenu.razor.css
   2026-06 Wave 4C — see the note above .hover-dropdown for rationale. */

/* ── Portal mobile polish ──
   Phase 4 mobile-responsive pass for /portal/* (Phases 1–3 pages and the
   Phase 4 admin reconciliation surface).

   Goals:
   - 44px minimum touch targets per Apple HIG on small screens
   - Big balance / MTD numbers shrink so they don't overflow on phones
   - PayPal Smart Buttons fill 100% of their column
   - Tables collapse to card lists via Bootstrap d-none/d-block utilities
     (handled inline in the .razor; this block is the visual tuning that
     supports the collapse pattern).
*/
.portal-authed .display-3,
.portal-authed .display-4,
.portal-authed .display-5 {
    word-break: break-word;
}

/* PayPal Smart Buttons container — make it width-fill its column at every
   breakpoint so the rendered iframe matches the card width. */
.paypal-button-container {
    width: 100%;
    min-height: 45px;
}

/* On phones the balance hero needs to scale or it overflows narrow cards. */
@media (max-width: 575.98px) {
    .portal-authed .display-3 { font-size: 2.25rem; }
    .portal-authed .display-4 { font-size: 1.875rem; }
    .portal-authed .display-5 { font-size: 1.5rem; }
    .portal-authed .display-6 { font-size: 1.5rem; }

    /* Touch targets — Apple HIG recommends 44pt minimum. Buttons in cards
       and chips at the top of activity / admin pages get a floor here. */
    .portal-authed .btn,
    .portal-authed .form-control,
    .portal-authed .form-select {
        min-height: 44px;
    }
    .portal-authed .btn-sm,
    .portal-authed .form-control-sm,
    .portal-authed .form-select-sm {
        min-height: 38px;
    }

    /* Nav-tabs (Profile page) wrap nicely on phones instead of clipping. */
    .portal-authed .nav-tabs .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.95rem;
    }

    /* Card padding shrinks so content gets breathing room on phones. */
    .portal-authed .card-body.p-4 { padding: 1rem !important; }
    .portal-authed .card-body.p-5 { padding: 1.25rem !important; }
}

/* Mobile dropdown menus inside the portal navbar render full-width so
   admin sub-items are easy to tap. */
@media (max-width: 991.98px) {
    .portal-authed .navbar .dropdown-menu {
        border: 0;
        background-color: transparent;
        box-shadow: none;
        padding-left: 1rem;
    }
    .portal-authed .navbar .dropdown-toggle::after {
        margin-left: 0.5rem;
    }
}

/* Admin pages — collapsing the desktop table to a card stack means the
   table cell typography can keep its normal density on lg+ while phones
   read a vertical list. The .d-lg-block / .d-lg-none Bootstrap utilities
   handle the swap; this just nudges the mobile cards a bit tighter. */
.portal-authed .card .row.g-2 .col-6,
.portal-authed .card .row.g-2 .col-12 {
    line-height: 1.2;
}

/* Modal dialogs on small screens — give the scrollable body more vertical
   room so the raw payload viewer is usable on a phone. */
@media (max-width: 575.98px) {
    .portal-authed .modal-dialog,
    .modal-dialog-scrollable {
        margin: 0.5rem;
    }
}

/* ── Blazor error banner — fixed at top of viewport ── */
#blazor-error-ui {
    background: #fff3cd;
    border-bottom: 1px solid #ffc107;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    color: #664d03;
    display: none;
    left: 0;
    padding: 0.5rem 1.25rem;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: var(--z-toast);
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    float: right;
    font-weight: bold;
    margin-left: 1rem;
}