/* NebulaNexus accent, overriding Tabler's default blue. */
:root {
    --tblr-primary: #5b4bd6;
    --tblr-primary-rgb: 91, 75, 214;
    --tblr-primary-fg: #ffffff;
}

/* Lightened for contrast against dark surfaces. */
[data-bs-theme="dark"] {
    --tblr-primary: #8b7cf0;
    --tblr-primary-rgb: 139, 124, 240;
    --tblr-primary-fg: #1a1725;
}

/* --- Root scrollbar gutter -------------------------------------------------
   Tabler reserves the scrollbar width as a left margin on the root
   (`@media (min-width:992px){:host,:root{margin-left:calc(100vw - 100%)}}`) so centred
   layouts don't jump when a scrollbar appears. Our sidebar is position:fixed at left:0,
   so it is anchored to the viewport and ignores that margin, while .page-wrapper's 15rem
   offset is measured from the shifted root - leaving a scrollbar-wide dead band between
   the rail and the topbar on every page long enough to scroll. Same specificity as
   Tabler's rule, later stylesheet, so it wins. */
:root {
    margin-left: 0;
    margin-right: 0;
}

/* --- Sidebar collapse-to-rail ------------------------------------------------
   Tabler 1.4 has no condensed sidebar, so the rail is ours. Only applies at
   lg and up; below that Tabler's own mobile navbar collapse takes over. */
.sidebar-brand-short {
    display: none;
}

@media (min-width: 992px) {
    .sidebar-collapsed .navbar-vertical {
        width: 4.5rem;
    }

    /* Tabler offsets the content with `.navbar-expand-lg.navbar-vertical ~ .page-wrapper`
       (three classes). A plainer `.sidebar-collapsed .page-wrapper` rule LOSES that
       specificity contest, leaving the content pushed out at 15rem while the rail is only
       4.5rem wide - a visible dead band between the rail and the topbar. Match Tabler's
       shape and add one class to win, and use `margin-left` rather than the logical
       property so it is unambiguously the same declaration Tabler is setting. */
    .sidebar-collapsed .navbar-vertical.navbar-expand-lg ~ .page-wrapper {
        margin-left: 4.5rem;
    }

    .sidebar-collapsed .nav-link-title,
    .sidebar-collapsed .sidebar-brand-full {
        display: none;
    }

    .sidebar-collapsed .sidebar-brand-short {
        display: inline;
    }

    .sidebar-collapsed .navbar-vertical .nav-link {
        justify-content: center;
    }

    .sidebar-collapsed .navbar-vertical .nav-link-icon {
        margin-inline-end: 0;
    }
}

/* --- Theme toggle icon swap ------------------------------------------------
   Both spans need an explicit flex display, not just the one being revealed. A bare
   <span> is display:inline, which puts the SVG on the text baseline and drops it below
   the centre of the topbar - visibly out of line with the flex-centred account icon
   beside it. */
.theme-icon-light,
.theme-icon-dark {
    align-items: center;
}

/* Light theme offers the moon (click to go dark); dark theme offers the sun. */
.theme-icon-light {
    display: inline-flex;
}

.theme-icon-dark {
    display: none;
}

[data-bs-theme="dark"] .theme-icon-light {
    display: none;
}

[data-bs-theme="dark"] .theme-icon-dark {
    display: inline-flex;
}

/* --- ASP.NET / jQuery unobtrusive validation -------------------------------
   These class names are emitted by MVC and toggled by jquery.validate.unobtrusive
   (valid <-> error); Tabler knows nothing about them. Styling them here is what
   lets the views call ValidationSummary/ValidationMessageFor with no CSS classes
   of their own - hardcoding the error variants in markup would paint an empty
   red box on every freshly loaded form. */
.input-validation-error {
    border-color: var(--tblr-danger);
}

.input-validation-error:focus {
    border-color: var(--tblr-danger);
    box-shadow: 0 0 0 .25rem rgba(var(--tblr-danger-rgb), .25);
}

.field-validation-valid {
    display: none;
}

.field-validation-error {
    display: block;
    margin-top: .25rem;
    font-size: .75rem;
    color: var(--tblr-danger);
}

/* MVC renders the summary container even when the form is valid. */
.validation-summary-valid {
    display: none;
}

.validation-summary-errors {
    margin-bottom: 1rem;
    padding: .75rem 1rem;
    border: 1px solid var(--tblr-danger);
    border-radius: var(--tblr-border-radius);
    color: var(--tblr-danger);
    background-color: rgba(var(--tblr-danger-rgb), .1);
}

.validation-summary-errors ul {
    margin-bottom: 0;
    padding-inline-start: 1rem;
}

/* --- Data table density ---------------------------------------------------- */
.card-table td,
.card-table th {
    vertical-align: middle;
}

.table-cell-nowrap {
    white-space: nowrap;
}

/* Raw crawled content and config blobs: bounded and scrollable, so a stack trace or a
   large HTML result scrolls inside its own box instead of stretching the page. */
.pre-scroll {
    max-height: 24rem;
    overflow: auto;
    margin-bottom: 0;
}

/* Listing source notes: hand-written labeled lines; keep the line breaks, wrap long URLs. */
.notes-block {
    white-space: pre-wrap;
    font-family: var(--tblr-font-monospace);
    font-size: .875rem;
}
