/* StarByte Global Styles */
/* MudBlazor handles all theme colors via MudThemeProvider */

/* ===========================================
   CSS VARIABLES - Theme-aware (set by MudThemeProvider)
   =========================================== */
:root {
    /* Layout sizing */
    --mud-appbar-height: 60px;
}

/* Let MudBlazor control the body background */
html, body {
    font-family: var(--brand-font);
    margin: 0;
    padding: 0;
}

/* Error UI - Minimal styling */
#blazor-error-ui {
    background: var(--mud-palette-surface);
    bottom: 0;
    box-shadow: var(--mud-elevation-8);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.75rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    border-top: 1px solid var(--mud-palette-divider);
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: var(--mud-palette-text-secondary);
}

#blazor-error-ui .dismiss:hover {
    color: var(--mud-palette-text-primary);
}

.blazor-error-boundary {
    background: var(--mud-palette-surface);
    padding: 1rem;
    color: var(--mud-palette-error);
    border-left: 4px solid var(--mud-palette-error);
    border-radius: var(--mud-default-borderradius);
}

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

/* Custom scrollbar - theme aware */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--mud-palette-lines-default);
    border-radius: var(--mud-default-borderradius);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--mud-palette-text-disabled);
}

/* Brand text styling */
.brand-text {
    font-weight: 700 !important;
    letter-spacing: -0.025em;
}

/* Required connector badge - smaller star icon (50% of 0.5 = 0.25) */
.required-connector-badge {
    transform: scale(0.25);
    transform-origin: top right;
}

/* ===========================================
   Read-only Input Fields - AUTOMATIC Visual Distinction
   Targets MudBlazor's native readonly attribute - no Class needed
   =========================================== */

/* Target MudTextField with readonly input - automatic styling */
/* Only apply to text inputs, exclude selects, time pickers, and other controls */
.mud-input-control:has(input[readonly]:not(.mud-select-input)):not(:has(.mud-picker-input-text)):not(:has(.mud-select)) {
    /* Dashed border for outlined variant */
    .mud-input-outlined-border {
        border-style: dashed !important;
    }
    
    /* Subtle background to indicate non-editable */
    .mud-input-slot {
        background-color: var(--mud-palette-background-gray) !important;
    }
}

/* Italic text and secondary color for read-only input values */
.mud-input-slot input[readonly],
.mud-select-input[aria-readonly="true"] {
    font-style: italic;
    color: var(--mud-palette-text-secondary) !important;
}

/* Connector icon badge for data source list */
.connector-icon-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--mud-default-borderradius);
    padding: 4px;
}

.connector-icon-badge--error {
    border-color: var(--mud-palette-error);
    background-color: var(--mud-palette-error-lighten);
}

/* Category panel styling for grouped Policies */
.category-panel {
    margin-bottom: 16px !important;
    border: 1px solid var(--mud-palette-divider) !important;
    border-radius: var(--mud-default-borderradius) !important;
    background-color: var(--mud-palette-surface) !important;
    overflow: hidden;
}

.category-panel .mud-expand-panel-header {
    background-color: var(--mud-palette-background-gray) !important;
    border-bottom: 1px solid var(--mud-palette-divider) !important;
    padding: 14px 18px !important;
    transition: background-color 0.2s ease;
}

.category-panel .mud-expand-panel-header:hover {
    background-color: var(--mud-palette-table-hover) !important;
}

.category-panel::before {
    content: '';
    display: block;
    height: 4px;
    background: linear-gradient(90deg, var(--mud-palette-primary) 0%, var(--mud-palette-lines-default) 100%);
    border-radius: var(--mud-default-borderradius) var(--mud-default-borderradius) 0 0;
}


/* MudDataGrid striped rows — replicates MudTable Striped="true" */
.striped-grid .mud-table-row:nth-child(even) {
    background-color: var(--mud-palette-table-striped);
}

/* Waterfall chart container — sets a minimum height so the chart renders correctly */
.waterfall-chart-container {
    min-height: 300px;
}

/* Compact step rail — the product standard for steppers whose labels do not fit their container.
   See .github/standards/frontend/step-indicators.md and BladeStepper.StepLabelDisplay.

   Applied by BladeStepper, not by callers. It previously made the rail scroll instead: the
   onboarding wizard laid 785px of labels into a 412px rail, so three of five steps sat off-screen
   behind a sideways scroll no one goes looking for. Numbers always fit; the written position
   ("Step 2 of 5 — Source Setup") carries what the labels were there to say. */
.blade-stepper-compact {
    overflow-x: visible;
}

/* Circles only, so they can sit closer than MudBlazor's label-sized 24px gutters. Six steps at the
   default spacing already ran 20px past a 460px blade; this leaves room to add more without the
   rail quietly starting to hide them again. The connectors give up their fixed width first. */
/* !important, and the class doubled for specificity: MudBlazor sets the 24px gutters from a more
   specific selector of its own, so a plain override silently loses and the rail keeps overflowing
   while looking like it was fixed. */
.mud-stepper-nav.blade-stepper-compact .mud-step {
    padding-left: 10px !important;
    padding-right: 10px !important;
}

.mud-stepper-nav.blade-stepper-compact .mud-stepper-nav-connector {
    min-width: 0 !important;
    flex: 1 1 auto;
}

/* Visually hidden rather than display:none — the titles stay in the accessibility tree, so the
   step buttons are still announced by name instead of as bare numbers. */
.blade-stepper-compact .mud-step-label-content {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.blade-stepper-position {
    margin-top: 0.25rem;
    margin-bottom: 0.75rem;
}

/* Full-height splash behind the onboarding blade, so a brand-new signup does not land on an
   empty black page while the wizard drawer sits over it. */
.onboarding-splash {
    min-height: calc(100vh - 4rem);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
}

/* GatedActionButton — reasons an action is unavailable.
   See .github/standards/frontend/blocked-actions.md.

   These live here rather than in a .razor.css beside the component: the shared Web.Core.Blazor
   library has no scoped CSS anywhere, and adding the first one broke Admin.Blazor's static web
   asset manifest ("Sequence contains more than one element") at build time.

   Present in the DOM from the start so the button's aria-describedby can point at them and the
   reason is announced together with the button — not only after a click that appeared to do
   nothing. Hidden visually until the user actually tries, because listing every unmet condition
   before they have touched the form reads as a form that is already failing. */
.gated-action-reasons {
    margin-top: 0.5rem;
    font-size: 0.8125rem;
    line-height: 1.4;
    color: var(--mud-palette-warning);
}

/* Clipped, never display:none — display:none would take the text out of the accessibility tree
   too, which is the whole point of rendering it early. */
.gated-action-reasons-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.gated-action-reason + .gated-action-reason {
    margin-top: 0.25rem;
}

/* Billing banners (trial, subscription ending, plan upgrade): a fixed strip above the app bar.
   MainLayout puts `has-billing-banner` on the MudLayout while one is showing, which sets the strip's height
   and offsets everything MudBlazor pins to the top of the viewport by that height: the fixed app bar, the
   clipped drawer and the page content. A second fixed MudAppBar cannot be used for the strip: it shares the
   main bar's `top: 0` and `z-index` and the main bar is painted over it. */
.mud-layout.has-billing-banner {
    --billing-banner-height: 48px;
}

/* Two lines of text on a phone (the subscription-ending message wraps). */
@media (max-width: 599px) {
    .mud-layout.has-billing-banner {
        --billing-banner-height: 84px;
    }
}

.billing-banner {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: calc(var(--mud-zindex-appbar) + 1);
    box-sizing: border-box;
    display: flex;
    align-items: center;
    height: var(--billing-banner-height);
    padding: 4px 16px;
    overflow: hidden;
    background-color: var(--mud-palette-warning);
    color: var(--mud-palette-warning-text);
}

.mud-layout.has-billing-banner .mud-appbar.mud-appbar-fixed-top {
    top: var(--billing-banner-height);
}

/* `pt-16` (4rem, the app bar) on the main content is !important, so the offset has to be too. */
.mud-layout.has-billing-banner .mud-main-content {
    padding-top: calc(4rem + var(--billing-banner-height)) !important;
}

/* MudBlazor offsets a clipped drawer by the app bar height (less on phones, where the bar is shorter);
   these add the banner height to each of its three cases. */
.mud-layout.has-billing-banner .mud-drawer-fixed.mud-drawer-clipped-always {
    top: calc(var(--mud-appbar-height) + var(--billing-banner-height));
    height: calc(100% - var(--mud-appbar-height) - var(--billing-banner-height));
}

@media (max-width: 599px) and (orientation: landscape) {
    .mud-layout.has-billing-banner .mud-drawer-fixed.mud-drawer-clipped-always {
        top: calc(var(--mud-appbar-height) - var(--mud-appbar-height) / 4 + var(--billing-banner-height));
        height: calc(100% - (var(--mud-appbar-height) - var(--mud-appbar-height) / 4) - var(--billing-banner-height));
    }
}

@media (max-width: 599px) and (orientation: portrait) {
    .mud-layout.has-billing-banner .mud-drawer-fixed.mud-drawer-clipped-always {
        top: calc(var(--mud-appbar-height) - var(--mud-appbar-height) / 8 + var(--billing-banner-height));
        height: calc(100% - (var(--mud-appbar-height) - var(--mud-appbar-height) / 8) - var(--billing-banner-height));
    }
}

/* The "Cookie Settings" footer button: a button (it opens the banner, it does not navigate) that looks
   like the caption links beside it. */
.sb-footer-link {
    background: none;
    border: 0;
    padding: 4px 0;
    min-height: 24px; /* WCAG 2.5.8 target size */
    color: var(--mud-palette-text-secondary);
    cursor: pointer;
}

.sb-footer-link:hover {
    text-decoration: underline;
}

.sb-footer-link:focus-visible {
    outline: 2px solid var(--mud-palette-primary);
    outline-offset: 2px;
}
