﻿/* ═══════════════════════════════════════════════════════════════════════════
   RECF AURORA — the shared visual language for RECF's internal apps.

   Drop this file and recf-aurora.js into a new app, wire the four things listed
   in docs/recf-aurora-theme.md, and it will look like the rest of the estate.
   Nothing in here is specific to this app; app components live alongside it in
   their own sheet and read the tokens defined here.

   THE PALETTE is RECF's: brand navy #1B365D, violet #7C3AED as the dark-mode
   accent, teal #0FA3B1 and amber #E8A33D for notices. Somebody arriving from
   another RECF app should not feel they have left.

   THEMING is Bootstrap 5.3's data-bs-theme, set before first paint by a
   blocking script in the layout and toggled in recf-aurora.js, with DARK AS THE
   DEFAULT so the apps match for anyone who has never touched the toggle.

   WHY A SEPARATE SHEET rather than _Layout.cshtml.css: MVC's CSS isolation
   scopes a layout's stylesheet to markup written directly in that layout, so a
   .btn-primary rendered by any other view never picks it up. Everything here
   has to be global to work at all.
   ═══════════════════════════════════════════════════════════════════════════ */

html {
    font-size: 14px;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

/* ── Links ─────────────────────────────────────────────────────────────────
   Set as TOKENS, never as `a { color: ... }`. Bootstrap resolves `a` to
   var(--bs-link-color), so a plain element rule at the same specificity —
   loaded after bootstrap.min.css — wins in BOTH themes and silently defeats the
   dark-mode violet below. */
:root {
    --bs-link-color: #0075c9;
    --bs-link-color-rgb: 0, 117, 201;
    --bs-link-hover-color: #1b365d;
    --bs-link-hover-color-rgb: 27, 54, 93;
}

/* ── Dark accents ──────────────────────────────────────────────────────────
   Violet rather than grey-on-grey. Links are a lighter, more saturated violet
   than the button accent so they still read as clickable on a dark ground.

   Attribute-selector specificity beats Bootstrap's own single-class rules
   regardless of stylesheet order, which is what makes these reliable. */
[data-bs-theme="dark"] {
    --bs-link-color: #a78bfa;
    --bs-link-color-rgb: 167, 139, 250;
    --bs-link-hover-color: #c4b5fd;
    --bs-link-hover-color-rgb: 196, 181, 253;
}

[data-bs-theme="dark"] .navbar-brand {
    color: #a78bfa;
}

[data-bs-theme="dark"] .btn-primary {
    background-color: #7c3aed;
    border-color: #6d28d9;
}

[data-bs-theme="dark"] .btn-primary:hover,
[data-bs-theme="dark"] .btn-primary:active {
    background-color: #6d28d9;
    border-color: #5b21b6;
}

/* Cards default to a barely-there border in Bootstrap's stock dark theme. A
   violet tint keeps panels from looking like flat holes. */
[data-bs-theme="dark"] .card {
    border-color: rgba(139, 92, 246, 0.35);
}

/* ── Focus rings ───────────────────────────────────────────────────────────
   Blue in light, violet in dark, so the ring stays visible against each ground
   rather than being a fixed colour that vanishes on one of them. */
.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.1rem var(--bs-body-bg), 0 0 0 0.25rem #258cfb;
}

[data-bs-theme="dark"] .btn:focus,
[data-bs-theme="dark"] .btn:active:focus,
[data-bs-theme="dark"] .btn-link.nav-link:focus,
[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus,
[data-bs-theme="dark"] .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem var(--bs-body-bg), 0 0 0 0.25rem #8b5cf6;
}

/* ── Sticky footer ─────────────────────────────────────────────────────────
   Flexbox version: the footer sits in normal flow and is pushed down by
   margin-top:auto, so it grows with its content instead of being a hard-coded
   strip that clips whatever is inside it. */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

body > .container,
body > .container-fluid {
    flex: 1 0 auto;
}

.recf-footer {
    width: 100%;
    margin-top: auto;
}

/* ── Brand ─────────────────────────────────────────────────────────────────
   The logo is dark navy artwork, unreadable against a dark navbar — flattened
   to white with a filter rather than shipping a second asset to keep in sync. */
.brand-logo {
    width: 40px;
    height: 40px;
}

[data-bs-theme="dark"] .brand-logo {
    filter: brightness(0) invert(1);
}

a.navbar-brand {
    white-space: normal;
    text-align: center;
    word-break: break-word;
}

/* ── Theme toggle ──────────────────────────────────────────────────────────
   Shows the icon for the mode a click switches TO — moon in light mode invites
   going dark, sun in dark mode invites going back — not the current mode. */
.theme-icon-sun {
    display: none;
}

[data-bs-theme="dark"] .theme-icon-sun {
    display: inline-block;
}

[data-bs-theme="dark"] .theme-icon-moon {
    display: none;
}

/* ── Notices ───────────────────────────────────────────────────────────────
   Teal, and readable prose on a tinted ground rather than small print. This is
   the chrome that answers "what is this page for" or "what are you doing with
   my data", so it gets weight. */
.recf-note {
    border: 1px solid rgba(15, 163, 177, .28);
    border-left: 6px solid #0FA3B1;
    background-color: rgba(15, 163, 177, .08);
    color: var(--bs-body-color);
    border-radius: .5rem;
    padding: 1rem 1.25rem;
    line-height: 1.6;
}

.recf-note p {
    max-width: 82ch;
}

.recf-note-title {
    font-weight: 700;
    color: #0B7C88;
    margin-bottom: .25rem;
}

.recf-note-icon {
    font-size: 1.4rem;
    line-height: 1;
    color: #0FA3B1;
}

[data-bs-theme="dark"] .recf-note {
    background-color: rgba(34, 211, 238, .10);
    border-color: rgba(34, 211, 238, .30);
    border-left-color: #22D3EE;
}

[data-bs-theme="dark"] .recf-note-title {
    color: #67E8F9;
}

[data-bs-theme="dark"] .recf-note-icon {
    color: #22D3EE;
}

/* ── Status panels ─────────────────────────────────────────────────────────
   A heavy left rule in the colour of the state, a tinted ground, and full-size
   body text. Colour tracks URGENCY, not novelty: blocked is red, anything still
   in hand is amber, settled is green and says almost nothing because there is
   nothing to do. */
.recf-panel {
    border: 1px solid var(--bs-border-color);
    border-left: 6px solid var(--bs-secondary-color);
    background-color: var(--bs-tertiary-bg);
    border-radius: .5rem;
    padding: 1.25rem 1.5rem;
    line-height: 1.6;
}

.recf-panel p {
    max-width: 74ch;
}

.recf-panel.state-valid {
    border-left-color: #198754;
    background-color: var(--bs-success-bg-subtle);
}

.recf-panel.state-attention {
    border-left-color: #E8A33D;
    background-color: var(--bs-warning-bg-subtle);
}

.recf-panel.state-blocked {
    border-left-color: #B3261E;
    background-color: var(--bs-danger-bg-subtle);
}

.recf-panel.state-waiting {
    border-left-color: #0FA3B1;
    background-color: var(--bs-info-bg-subtle);
}

/* On near-black the subtle grounds almost vanish — lift them and add a ring so
   each panel still reads as a distinct block. */
[data-bs-theme="dark"] .recf-panel {
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .04), 0 .5rem 1.5rem rgba(0, 0, 0, .45);
}

[data-bs-theme="dark"] .recf-panel.state-attention {
    background-color: rgba(240, 182, 92, .12);
    border-color: rgba(240, 182, 92, .5);
    border-left-color: #F0B65C;
}

[data-bs-theme="dark"] .recf-panel.state-blocked {
    background-color: rgba(220, 53, 69, .14);
    border-color: rgba(220, 53, 69, .40);
}

[data-bs-theme="dark"] .recf-panel.state-valid {
    background-color: rgba(25, 135, 84, .14);
    border-color: rgba(25, 135, 84, .38);
}

[data-bs-theme="dark"] .recf-panel.state-waiting {
    background-color: rgba(15, 163, 177, .14);
    border-color: rgba(15, 163, 177, .38);
}

/* ── Reference tables ──────────────────────────────────────────────────────
   Records, audit, logs: reference material, so tighter rows than Bootstrap's
   default and a header that stays distinguishable in both themes. */
.table-records {
    font-size: .925rem;
}

.table-records th {
    white-space: nowrap;
    color: var(--bs-secondary-color);
    font-weight: 600;
    text-transform: uppercase;
    font-size: .78rem;
    letter-spacing: .04em;
}

/* Long wording and URLs must wrap rather than push the page sideways — the one
   thing a reference table must never do. */
.table-records td.wrap {
    white-space: normal;
    overflow-wrap: anywhere;
    max-width: 32ch;
}

/* ── Copyable values ───────────────────────────────────────────────────────
   Monospace where somebody will select and paste it. Hand-selecting a long
   value out of a table is where a truncated one comes from. */
.copy-field {
    font-family: var(--bs-font-monospace);
    font-size: .9rem;
    word-break: break-all;
}

/* ── Section headings ──────────────────────────────────────────────────────
   Above a table or a form group. Quieter than an <h2> so a page of several
   sections does not read as several pages. */
.section-heading {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -.01em;
    margin-bottom: .5rem;
}

.section-note {
    color: var(--bs-secondary-color);
    max-width: 80ch;
}

/* ── Chrome ────────────────────────────────────────────────────────────────
   No .border-top / .border-bottom here. Bootstrap ships utilities by those names carrying
   !important, so anything defined here loses to them regardless of load order — and Bootstrap's
   already resolve --bs-border-color, so they follow the theme on their own. Redefining them would
   be dead code that looks like it works. */
.box-shadow {
    box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
}
