/* Outfit - the app font (self-hosted variable font, weights 100-900; no italics).
   AS400 mode overrides this with a monospace stack, see html.bms-green further down. */
@font-face {
    font-family: 'Outfit';
    src: url('../fonts/Outfit-VariableFont_wght.ttf') format('truetype-variations');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

html, body {
    font-family: 'Outfit', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    margin: 0;
    padding: 0;
}

/*
 * Brand/theme accent. Drives the app header and the nav-menu hover/active highlight.
 * Deliberately separate from --mud-palette-primary so Color.Primary buttons stay functional.
 * Keep these in step with ThemePalette.Default:
 *   --bms-theme        the fill colour (header background, calendar header, selected toggle)
 *   --bms-theme-rgb    the same colour as space-separated channels, for rgba() tints
 *   --bms-theme-text   text/icons on that fill (white for dark tones, #444 for light ones)
 *   --bms-theme-strong text-on-white-safe version of the hue (nav hover/active, tab accents);
 *                      equals --bms-theme for dark tones, a dark shade for light ones
 *   --bms-theme-strong-rgb  channels of --bms-theme-strong
 */
:root {
    --bms-theme: #3D5A80;
    --bms-theme-rgb: 61, 90, 128;
    --bms-theme-text: #fff;
    --bms-theme-strong: #3D5A80;
    --bms-theme-strong-rgb: 61, 90, 128;
}

/*
 * Opt-in theme-colour helpers. Add the class to the wrapper component so its "selected"
 * element(s) follow the theme colour instead of --mud-palette-primary. Buttons without one of
 * these wrappers are untouched.
 */

/* MudButtonGroup used as an Active/Inactive-style toggle: the filled (selected) button. */
.bms-theme-toggle .mud-button-filled-primary,
.bms-theme-toggle .mud-button-filled-primary:hover,
.bms-theme-toggle .mud-button-filled-primary:active {
    background-color: var(--bms-theme) !important;
    color: var(--bms-theme-text) !important;
}

.bms-theme-toggle .mud-button-filled-primary:hover {
    filter: brightness(0.93);
}

/* MudToggleGroup (Color="Primary"): the selected item. */
.bms-theme-toggle .mud-toggle-item.mud-toggle-item-selected {
    color: var(--bms-theme-strong) !important;
    background-color: rgba(var(--bms-theme-strong-rgb), 0.14) !important;
}

/* All toggle borders/dividers use the same light grey as grids and inputs,
   never the primary or theme colour. */
.bms-theme-toggle,
.bms-theme-toggle.mud-toggle-group,
.bms-theme-toggle .mud-toggle-item,
.bms-theme-toggle .mud-button,
.bms-theme-toggle .mud-button-root {
    border-color: var(--mud-palette-lines-default) !important;
}

/* MudTabs: the active tab label and the slider (underline). */
.bms-theme-tabs .mud-tab.mud-tab-active {
    color: var(--bms-theme-strong) !important;
}

.bms-theme-tabs .mud-tab-slider {
    background-color: var(--bms-theme-strong) !important;
}

/* ============================================================================
 * Theme modes (see docs/specs/Theme_Modes_Plan.md).
 *
 * html.bms-dark  - set for BOTH Dark and Green Screen. MudBlazor's dark palette
 *   (MudThemeProvider @bind-IsDarkMode) recolours everything that reads
 *   --mud-palette-*; the html.bms-dark rules below only cover hand-coded light
 *   colours it can't reach. Because they resolve through --mud-palette-* /
 *   --bms-theme-* vars, Green Screen's palette flows through them unchanged.
 * html.bms-green - adds the deep-black + phosphor-green palette, the monospace
 *   font, and a monochrome-green accent that overrides the user's accent choice.
 *
 * _Host.cshtml server-renders the classes on load; MainLayout toggles them live.
 * ============================================================================ */

/* Actual html/body background-color. _Host.cshtml also pre-paints these (so there's no flash
   before the circuit connects and this stylesheet loads), but that only covers whichever mode
   was active when the page was rendered - it doesn't add anything for a mode the page didn't
   load in. Without the rules below, a *live* mode switch changes --mud-palette-background (fine,
   most things read it) but nothing actually repaints html/body's own background-color, since
   nothing else maps that literal property to the current classes - only a full reload (which
   re-runs _Host.cshtml against the newly-saved mode) ever picks it up. These make it reactive. */
html.bms-dark:not(.bms-green), html.bms-dark:not(.bms-green) body { background-color: #32333d; }
html.bms-green, html.bms-green body { background-color: #000; }

/* Menu (drawer) and main body text: unconditional for the same live-switch reason as the
   background-color rule above - _Host.cshtml's pre-paint values only apply for whichever mode
   the page loaded in. Lighter than MudBlazor's/the previous defaults for better contrast against
   the dark surfaces. Kept in sync with the matching values in _Host.cshtml. */
html.bms-dark:not(.bms-green) {
    --mud-palette-drawer-text: rgba(255, 255, 255, 0.75);
    --mud-palette-text-primary: rgba(255, 255, 255, 0.87);
    --mud-palette-primary: #9288eb;
    --mud-palette-primary-rgb: 146, 136, 235;
    --mud-palette-primary-text: #fff;
}

/* Zebra stripe (both dark bases): MudBlazor's dark --mud-palette-table-striped is
   rgba(255,255,255,0.2) - reads as ~#333 and far too loud. Dial it right down. The var handles
   most cases; the scoped !important covers MudBlazor's own high-specificity striped selector.
   Green Screen re-overrides both further down. */
html.bms-dark { --mud-palette-table-striped: rgba(255, 255, 255, 0.04); }
html.bms-dark .mud-table-striped .mud-table-body .mud-table-row:nth-of-type(odd):not(:hover),
html.bms-dark .mud-table-striped .mud-table-container table tbody tr:nth-of-type(odd):not(:hover) {
    background-color: rgba(255, 255, 255, 0.04) !important;
}

/* Notification bell dropdown (NotificationBell.razor.css). Fallbacks match MudBlazor's
   dark palette so these hold even during the pre-paint window before the circuit connects. */
html.bms-dark .notification-dropdown { background: var(--mud-palette-surface, #373740); }
html.bms-dark .notification-dropdown-header,
html.bms-dark .notification-dropdown-footer { background: var(--mud-palette-background-gray, #27272f); }
html.bms-dark .notification-dropdown-header,
html.bms-dark .notification-dropdown-footer,
html.bms-dark .notification-item { border-color: var(--mud-palette-lines-default, rgba(255, 255, 255, 0.12)); }
html.bms-dark .notification-item:hover { background-color: rgba(255, 255, 255, 0.06); }
html.bms-dark .notification-item.unread { background-color: rgba(var(--bms-theme-on-dark-rgb), 0.12); }
html.bms-dark .notification-item.unread:hover { background-color: rgba(var(--bms-theme-on-dark-rgb), 0.18); }
html.bms-dark .notification-title { color: var(--mud-palette-text-primary, rgba(255, 255, 255, 0.70)); }
html.bms-dark .notification-message,
html.bms-dark .notification-loading,
html.bms-dark .notification-empty { color: var(--mud-palette-text-secondary, rgba(255, 255, 255, 0.50)); }
html.bms-dark .notification-time { color: var(--mud-palette-text-disabled, rgba(255, 255, 255, 0.20)); }
html.bms-dark .notification-dropdown-body::-webkit-scrollbar-track { background: var(--mud-palette-background-gray, #27272f); }
html.bms-dark .notification-dropdown-body::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); }

/* Notification centre list (NotificationCenter.razor.css) */
html.bms-dark .notification-center-item { border-bottom-color: var(--mud-palette-lines-default); }
html.bms-dark .notification-center-item:hover { background-color: rgba(255, 255, 255, 0.06); }
html.bms-dark .notification-center-item.unread { background-color: rgba(var(--bms-theme-on-dark-rgb), 0.12); }
html.bms-dark .notification-center-item.unread:hover { background-color: rgba(var(--bms-theme-on-dark-rgb), 0.18); }
html.bms-dark .notification-center-message { color: var(--mud-palette-text-secondary); }

/* Rich text editor toolbar (RichTextEditor.razor, Quill's Snow theme). Quill's own CSS hardcodes
   the toolbar icon strokes/fills and the placeholder text to near-black, which barely shows up
   against a dark surface. Match the colour used by MudBlazor's own input labels. Dark mode only -
   AS400 isn't reported as affected. */
html.bms-dark:not(.bms-green) .rich-text-editor .ql-toolbar.ql-snow .ql-stroke {
    stroke: var(--mud-palette-text-secondary);
}
html.bms-dark:not(.bms-green) .rich-text-editor .ql-toolbar.ql-snow .ql-fill,
html.bms-dark:not(.bms-green) .rich-text-editor .ql-toolbar.ql-snow .ql-stroke.ql-fill {
    fill: var(--mud-palette-text-secondary);
}
html.bms-dark:not(.bms-green) .rich-text-editor .ql-toolbar.ql-snow .ql-picker {
    color: var(--mud-palette-text-secondary);
}
html.bms-dark:not(.bms-green) .rich-text-editor .ql-editor.ql-blank::before {
    color: var(--mud-palette-text-secondary);
}

/* Toast notifications (ToastNotification.razor.css) */
html.bms-dark .toast { background: var(--mud-palette-surface); }
html.bms-dark .toast-body { color: var(--mud-palette-text-primary); }
html.bms-dark .toast-header { border-bottom-color: var(--mud-palette-lines-default); }
html.bms-dark .toast-success .toast-header { background-color: rgba(76, 175, 80, 0.16); color: #a5d6a7; }
html.bms-dark .toast-error .toast-header { background-color: rgba(244, 67, 54, 0.16); color: #ef9a9a; }
html.bms-dark .toast-warning .toast-header { background-color: rgba(255, 152, 0, 0.16); color: #ffcc80; }
html.bms-dark .toast-info .toast-header { background-color: rgba(33, 150, 243, 0.16); color: #90caf9; }

/* My Timesheets calendar + list grid (MyTimesheets.razor inline <style>) */
html.bms-dark .timesheet-list-grid .grid-total-row td { background-color: rgba(255, 255, 255, 0.05); }
html.bms-dark .timesheet-list-grid .grid-total-low { color: #ef9a9a; }
html.bms-dark .timesheet-list-grid .grid-total-high { color: #ce93d8; }
html.bms-dark .calendar-time-label { background-color: var(--mud-palette-background-gray); }
html.bms-dark .work-hour-bg { background-color: var(--mud-palette-surface); }
html.bms-dark .off-hour-bg { background-color: rgba(255, 255, 255, 0.03); }
html.bms-dark .weekend-bg { background-color: rgba(255, 255, 255, 0.06); }
html.bms-dark .today-column-bg { background-color: rgba(251, 192, 45, 0.10) !important; }
html.bms-dark .today-column-bg.off-hour-bg,
html.bms-dark .today-column-bg.weekend-bg { background-color: rgba(251, 192, 45, 0.16) !important; }
html.bms-dark .calendar-meeting { background-color: rgba(142, 36, 170, 0.22); color: #e1bee7; border-color: #8e24aa; }
html.bms-dark .event-color-default { background-color: rgba(25, 118, 210, 0.20); color: #bbdefb; border-color: rgba(25, 118, 210, 0.4); }
html.bms-dark .event-color-invoiced { background-color: rgba(46, 125, 50, 0.22); color: #c8e6c9; border-color: rgba(46, 125, 50, 0.4); }

/* Leave calendar (LeaveCalendar.razor inline <style>). Public Holiday/Approved/Pending are fixed
   and theme-agnostic at the source now (see LeaveCalendar.razor / LeaveGridWidget.razor) - no
   dark-mode variant needed for those. The "muted" (prev/next month overflow) treatment still
   needs dimming against a dark surface. */
html.bms-dark .calendar-day-cell.muted,
html.bms-dark .calendar-day-cell.muted.weekend { background-color: rgba(255, 255, 255, 0.04); }

/* Weekend cells, Calendar (month) view: a light grey wash to read as "not a workday" in Light
   mode, but not coloured in at all in Dark/AS400 - it should match the page rather than stand
   out as its own light-grey box on a dark surface. */
html.bms-dark .calendar-day-cell.weekend { background-color: transparent; }

/* Weekend cells, Grid view (LeaveCalendar.razor) and the Leave Grid dashboard widget: a dark
   fill in Dark/AS400, distinct from the page background so the column still reads as a
   weekend. Dark mode uses its own surface-grey tone; AS400 uses a near-black tone to match its
   deeper palette. The Weekend legend swatch keeps its fixed colour in every mode so it still
   reads as a swatch. */
html.bms-dark:not(.bms-green) .day-cell.weekend,
html.bms-dark:not(.bms-green) .lgw-day-cell.lgw-weekend { background-color: #27272f; }

html.bms-green .day-cell.weekend,
html.bms-green .lgw-day-cell.lgw-weekend { background-color: #141414; }

/* Leave applications history rows (MyLeaveApplications.razor inline <style>) */
html.bms-dark .leave-row-pending         { background-color: rgba(255, 213, 79, 0.15) !important; }
html.bms-dark .leave-row-rejected        { background-color: rgba(239, 83, 80, 0.22) !important; }
html.bms-dark .leave-row-approved-past   { background-color: rgba(66, 165, 245, 0.18) !important; }
html.bms-dark .leave-row-approved-future { background-color: rgba(102, 187, 106, 0.18) !important; }
html.bms-dark .leave-row-cancelled       { background-color: rgba(255, 255, 255, 0.06) !important; }
html.bms-dark .legend-swatch { border-color: rgba(255, 255, 255, 0.2); }

/* ── Green Screen ── deep black + phosphor green, IBM i / 5250 terminal look.
   Layered on top of bms-dark. Overrides MudBlazor's dark palette and the accent. */
html.bms-green {
    --mud-palette-black: #000;
    --mud-palette-background: #000;
    --mud-palette-background-gray: #0a0a0a;
    --mud-palette-surface: #0d0d0d;              /* cards - near-black, no tint */
    --mud-palette-drawer-background: #161616;    /* menu - a touch lighter than the page so it reads, no tint */
    --mud-palette-drawer-text: #33ff33;
    --mud-palette-drawer-icon: #33ff33;
    --mud-palette-appbar-background: #001a00;
    --mud-palette-text-primary: #33ff33;
    --mud-palette-text-secondary: #1faa1f;
    --mud-palette-text-disabled: #0f5a0f;
    --mud-palette-action-default: #33ff33;
    --mud-palette-action-disabled: #0f5a0f;
    --mud-palette-lines-default: rgba(51, 255, 51, 0.22);
    --mud-palette-lines-inputs: rgba(51, 255, 51, 0.38);
    --mud-palette-table-lines: rgba(51, 255, 51, 0.18);
    --mud-palette-divider: rgba(51, 255, 51, 0.20);
    /* Grid zebra stripe - kept very close to the surface so the alternation is barely there.
       Tweak this one value to taste. Also forced below with !important in case MudBlazor
       re-emits the variable with extra weight. */
    --mud-palette-table-striped: #141414;
    --mud-palette-table-hover: #242424;   /* row hover - MudBlazor's dark default is ~invisible on black */
    /* Active sidebar item - a touch more visible than the stripe, it's a single highlight */
    --mud-palette-action-default-hover: #1c1c1c;
    --mud-palette-primary: #2fcf2f;
    --mud-palette-primary-rgb: 47, 207, 47;
    --mud-palette-primary-text: #000;
    --mud-palette-secondary: #7890F0;
    --mud-palette-secondary-rgb: 120, 144, 240;

    /* Accent (navbar + nav highlights) - monochrome green, overrides the user's accent choice */
    --bms-theme: #001a00;
    --bms-theme-rgb: 0, 26, 0;
    --bms-theme-text: #33ff33;
    --bms-theme-strong: #33ff33;
    --bms-theme-strong-rgb: 51, 255, 51;
    --bms-theme-on-dark: #33ff33;
    --bms-theme-on-dark-rgb: 51, 255, 51;

    /* Monospace everything (MudBlazor reads these per-variant) */
    --mud-typography-default-family: "Cascadia Mono", "SFMono-Regular", "Consolas", "Liberation Mono", "Menlo", monospace;
    --mud-typography-body1-family: var(--mud-typography-default-family);
    --mud-typography-body2-family: var(--mud-typography-default-family);
    --mud-typography-button-family: var(--mud-typography-default-family);
    --mud-typography-caption-family: var(--mud-typography-default-family);
    --mud-typography-input-family: var(--mud-typography-default-family);
    --mud-typography-overline-family: var(--mud-typography-default-family);
    --mud-typography-subtitle1-family: var(--mud-typography-default-family);
    --mud-typography-subtitle2-family: var(--mud-typography-default-family);
    --mud-typography-h1-family: var(--mud-typography-default-family);
    --mud-typography-h2-family: var(--mud-typography-default-family);
    --mud-typography-h3-family: var(--mud-typography-default-family);
    --mud-typography-h4-family: var(--mud-typography-default-family);
    --mud-typography-h5-family: var(--mud-typography-default-family);
    --mud-typography-h6-family: var(--mud-typography-default-family);
}

html.bms-green,
html.bms-green body,
html.bms-green input,
html.bms-green textarea,
html.bms-green button,
html.bms-green select {
    font-family: "Cascadia Mono", "SFMono-Regular", "Consolas", "Liberation Mono", "Menlo", monospace;
}

/* Force the zebra stripe past MudBlazor's own dark-palette value (rgba(255,255,255,0.2), too
   light on black). Covers MudDataGrid + MudTable + MudSimpleTable. :not(:hover) so row hover
   still shows. Keep in step with --mud-palette-table-striped above. */
html.bms-green .mud-table-striped .mud-table-body .mud-table-row:nth-of-type(odd):not(:hover),
html.bms-green .mud-table-striped .mud-table-container table tbody tr:nth-of-type(odd):not(:hover) {
    background-color: #141414 !important;
}

/* Green Screen: the dark rules above tint notification unread rows with the accent; that's now
   green — fine. But the amber "today" / meeting / event chips read oddly against pure green.
   Pull them toward the monochrome. */
html.bms-green .today-column-bg { background-color: rgba(51, 255, 51, 0.12) !important; }
html.bms-green .today-column-bg.off-hour-bg,
html.bms-green .today-column-bg.weekend-bg { background-color: rgba(51, 255, 51, 0.18) !important; }
html.bms-green .calendar-meeting { background-color: rgba(120, 144, 240, 0.22); color: #b9c4f7; border-color: #7890F0; }
html.bms-green .event-color-default,
html.bms-green .event-color-invoiced { background-color: rgba(51, 255, 51, 0.14); color: #7dff7d; border-color: rgba(51, 255, 51, 0.4); }

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 5px rgba(0,0,0,0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.file-upload-container {
    max-width: 480px;
    margin: 0 auto;
}

.file-dropzone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1.5rem;
    border: 2px dashed var(--mud-palette-divider);
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
    text-align: center;
    user-select: none;
}

/* Transparent full-cover native file input: handles click-to-browse and drag-and-drop
   natively, so the browser never opens the dropped file. */
.file-dropzone__input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-dropzone:hover {
    border-color: var(--mud-palette-primary);
    background-color: var(--mud-palette-primary-hover);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transform: translateY(-1px);
}

.file-dropzone:active {
    transform: translateY(0);
    box-shadow: none;
}

.file-dropzone--dragging {
    border-color: var(--mud-palette-primary);
    border-style: solid;
    background-color: var(--mud-palette-primary-hover);
    box-shadow: 0 0 0 3px rgba(var(--mud-palette-primary-rgb), 0.15);
    transform: scale(1.01);
}

.file-dropzone__icon {
    transition: transform 0.2s ease;
}

.file-dropzone__icon--dragging {
    transform: scale(1.2) translateY(-4px);
}

.file-selected-panel {
    border-radius: 8px;
    background-color: rgba(76, 175, 80, 0.08);
}

/* Future styling changes - not yet enabled */

/*
:root {
    --mud-palette-secondary: rgba(255, 45, 90, 1);
}
*/

/*
* {
    font-family: 'Outfit', sans-serif;
}
*/

/*
:root {
    --mud-palette-text-primary: #000080;
}
*/
