/* IlluminateRisk — brand layer that adapts to Slate (dark) or Flatly (light).
   Bootswatch supplies the base palette / component theming; this sheet adds
   IlluminateRisk-specific polish (rounded cards, drop shadows, focus ring,
   validation, error UI) and re-keys color-bearing rules off [data-arc-theme]
   so the same selectors work in either theme. */

:root {
    --arc-card-radius: 0.75rem;
    --arc-accent: #f0ad4e; /* warm owl-amber accent — works on both themes */
}

/* Defaults assume the dark theme. Light overrides further down. */
:root,
[data-arc-theme="dark"] {
    --arc-card-shadow: 0 0.5rem 1.25rem rgba(0, 0, 0, 0.35), 0 0.125rem 0.25rem rgba(0, 0, 0, 0.2);
    --arc-card-shadow-hover: 0 0.75rem 1.75rem rgba(0, 0, 0, 0.45), 0 0.25rem 0.5rem rgba(0, 0, 0, 0.25);
    --arc-card-border: 1px solid rgba(255, 255, 255, 0.04);
    --arc-card-header-bg: rgba(255, 255, 255, 0.02);
    --arc-card-header-border: rgba(255, 255, 255, 0.05);
    --arc-table-header-border: rgba(255, 255, 255, 0.08);
    --arc-table-row-hover: rgba(255, 255, 255, 0.03);
    --arc-topbar-bg: rgba(0, 0, 0, 0.25);
    --arc-focus-ring: rgba(240, 173, 78, 0.25);
    --arc-validation-success: #5cb85c;
    --arc-validation-error: #d9534f;
}

[data-arc-theme="light"] {
    --arc-card-shadow: 0 0.5rem 1.25rem rgba(33, 37, 41, 0.08), 0 0.125rem 0.25rem rgba(33, 37, 41, 0.05);
    --arc-card-shadow-hover: 0 0.75rem 1.75rem rgba(33, 37, 41, 0.14), 0 0.25rem 0.5rem rgba(33, 37, 41, 0.08);
    --arc-card-border: 1px solid rgba(33, 37, 41, 0.06);
    --arc-card-header-bg: rgba(33, 37, 41, 0.02);
    --arc-card-header-border: rgba(33, 37, 41, 0.08);
    --arc-table-header-border: rgba(33, 37, 41, 0.08);
    --arc-table-row-hover: rgba(33, 37, 41, 0.03);
    --arc-topbar-bg: rgba(255, 255, 255, 0.85);
    --arc-focus-ring: rgba(240, 173, 78, 0.30);
    --arc-validation-success: #18bc9c;
    --arc-validation-error: #e74c3c;
}

html, body {
    min-height: 100vh;
}

/* ---- Cards: rounded, lifted, consistent across the app ---- */
.card {
    border-radius: var(--arc-card-radius);
    box-shadow: var(--arc-card-shadow);
    border: var(--arc-card-border);
    transition: box-shadow 0.18s ease-in-out, transform 0.18s ease-in-out;
}

.card.card-interactive:hover {
    box-shadow: var(--arc-card-shadow-hover);
    transform: translateY(-1px);
}

.card .card-header,
.card .card-footer {
    background-color: var(--arc-card-header-bg);
    border-color: var(--arc-card-header-border);
}

.card .card-header:first-child {
    border-top-left-radius: calc(var(--arc-card-radius) - 1px);
    border-top-right-radius: calc(var(--arc-card-radius) - 1px);
}

.card .card-footer:last-child {
    border-bottom-left-radius: calc(var(--arc-card-radius) - 1px);
    border-bottom-right-radius: calc(var(--arc-card-radius) - 1px);
}

/* ---- Buttons / inputs / focus polish ---- */
.btn {
    border-radius: 0.5rem;
}

.btn-sm {
    border-radius: 0.4rem;
}

.form-control,
.form-select {
    border-radius: 0.5rem;
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.2rem var(--arc-focus-ring);
}

/* ---- Tables: align with the surrounding card ---- */
.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--bs-body-color);
}

.table > :not(caption) > * > * {
    background-color: transparent;
}

.table thead th {
    border-bottom-color: var(--arc-table-header-border);
    color: var(--bs-secondary-color);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
}

.table-hover > tbody > tr:hover > * {
    background-color: var(--arc-table-row-hover);
}

/* ---- Validation ---- */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--arc-validation-success);
}

.invalid {
    outline: 1px solid var(--arc-validation-error);
}

.validation-message {
    color: var(--arc-validation-error);
}

/* ---- Modal close button: bigger hit area.
   Bootstrap's default .btn-close is ~16x16 (1em square) which is hard to
   hit even on desktop. Bump to 1.25em + extra padding so the click target
   matches user expectation regardless of theme. */
.modal-header .btn-close,
.alert .btn-close {
    width: 1.25em;
    height: 1.25em;
    padding: 0.5em;
    background-size: 0.85em;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 0.4rem;
    opacity: 0.85;
    transition: opacity 0.12s ease, background-color 0.12s ease;
}

.modal-header .btn-close:hover,
.alert .btn-close:hover {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.1);
}

[data-arc-theme="light"] .modal-header .btn-close:hover,
[data-arc-theme="light"] .alert .btn-close:hover {
    background-color: rgba(0, 0, 0, 0.06);
}

/* ---- Page content ---- */
.content {
    padding-top: 1.5rem;
    padding-bottom: 3rem;
}

h1:focus {
    outline: none;
}

/* ---- Brand owl: stays light against the dark sidebar in both themes ---- */
.brand-owl {
    color: #fff;
    filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.4));
}

/* The Home page's centered owl sits on the page background, so it needs
   to flip to dark in light mode to remain visible. */
[data-arc-theme="light"] .card.text-center .brand-owl,
[data-arc-theme="light"] .card-header .brand-owl {
    color: #2c3e50;
    filter: none;
}

/* ---- Skip link (a11y) ---- */
.visually-focusable:not(:focus):not(:focus-within) {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---- Blazor error / reconnect UI ---- */
.blazor-error-boundary {
    background: #b32121;
    padding: 1rem 1rem 1rem 1rem;
    color: white;
    border-radius: var(--arc-card-radius);
}

.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;
}

/* Blazor injects display:block on this element when an unhandled error
   bubbles out of an interactive circuit. Without an explicit hide-by-
   default rule (the standard template's app.css ships one; ours was
   missing it), the boilerplate div in MainLayout.razor stays visible at
   the bottom of every page and looks like a permanent error banner. */
#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    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;
}
