/* ============================================================================
   sb-base.css — StackBuddy's own base layer. REPLACES Bootstrap (removed
   2026-06-10 per the AGENTS.md CSS-stack lock: custom CSS only).

   Loaded FIRST (Bootstrap's old cascade slot). Two parts:
   1. Reset — the Reboot essentials the app implicitly sat on.
   2. Owned utilities/components — exact, bounded replicas of the class
      vocabulary actually used in markup (inventoried 2026-06-10). Do NOT
      grow this into a framework; new work uses sb-* classes and tokens.
   ============================================================================ */

/* ── 1 · Reset ──────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--sb-ink, #15171C);
    background: var(--sb-paper, #fff);
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    font-weight: 500;
    line-height: 1.2;
}
h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

p { margin: 0 0 1rem; }
ul, ol { margin-top: 0; margin-bottom: 1rem; padding-left: 2rem; }
b, strong { font-weight: bolder; }
small { font-size: 0.875em; }
hr { margin: 1rem 0; border: 0; border-top: 1px solid var(--sb-line, #dee2e6); }

img, svg { vertical-align: middle; }

label { display: inline-block; }
button, input, optgroup, select, textarea {
    margin: 0;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}
button, [type="button"], [type="submit"], [type="reset"] { -webkit-appearance: button; }
button:not(:disabled), [type="button"]:not(:disabled), [type="submit"]:not(:disabled) { cursor: pointer; }
textarea { resize: vertical; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
::placeholder { color: var(--sb-ink-mute, #6c757d); opacity: 1; }

table { caption-side: bottom; border-collapse: collapse; }
[hidden] { display: none !important; }

/* Blazor's reconnect/error banner (div lives in the host page). Hidden until the
   framework toggles it; without this rule it would render as a visible bare div.
   (Ported from MainLayout.razor.css when CSS isolation was removed, 2026-06-10.) */
#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px 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;
}

/* ── 2 · Utilities (used vocabulary only) ───────────────────────────────── */

/* Display & flex */
.d-flex { display: flex !important; }
.flex-wrap { flex-wrap: wrap !important; }
.flex-column { flex-direction: column !important; }
.w-100 { width: 100% !important; }
.h-100 { height: 100% !important; }
.gap-1 { gap: 0.25rem !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 1rem !important; }

/* Mud-era flex helpers — dead since the MudBlazor removal; restored to authored intent. */
.align-center { align-items: center !important; }
.align-end { align-items: flex-end !important; }
.justify-center { justify-content: center !important; }
.justify-end { justify-content: flex-end !important; }
.justify-space-between { justify-content: space-between !important; }

/* Text */
.text-center { text-align: center !important; }
.text-end, .text-right { text-align: right !important; }
.text-start { text-align: left !important; }
.text-truncate { overflow: hidden !important; text-overflow: ellipsis !important; white-space: nowrap !important; }
.text-nowrap { white-space: nowrap !important; }
.text-danger { color: var(--sb-error, #dc3545) !important; }
.text-success { color: var(--sb-success, #198754) !important; }
.text-info { color: var(--sb-info, #0dcaf0) !important; }
.text-muted { color: var(--sb-ink-mute, #6c757d) !important; }
.font-weight-bold, .fw-bold { font-weight: 700 !important; }

/* Spacing — Bootstrap's rem scale (1=.25 2=.5 3=1 4=1.5 5=3), kept so the app
   renders pixel-identically to the Bootstrap era. */
.m-0 { margin: 0 !important; }
.m-2 { margin: 0.5rem !important; }
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.mt-5 { margin-top: 3rem !important; }
.mt-auto { margin-top: auto !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mb-5 { margin-bottom: 3rem !important; }
.my-1 { margin-top: 0.25rem !important; margin-bottom: 0.25rem !important; }
.my-2 { margin-top: 0.5rem !important; margin-bottom: 0.5rem !important; }
.my-3 { margin-top: 1rem !important; margin-bottom: 1rem !important; }
.my-4 { margin-top: 1.5rem !important; margin-bottom: 1.5rem !important; }
.my-5 { margin-top: 3rem !important; margin-bottom: 3rem !important; }
.mx-2 { margin-left: 0.5rem !important; margin-right: 0.5rem !important; }
.mx-4 { margin-left: 1.5rem !important; margin-right: 1.5rem !important; }
.ms-1 { margin-left: 0.25rem !important; }
.ms-2 { margin-left: 0.5rem !important; }
.me-1 { margin-right: 0.25rem !important; }
.me-2 { margin-right: 0.5rem !important; }
.p-3 { padding: 1rem !important; }
.p-4 { padding: 1.5rem !important; }
.px-0 { padding-left: 0 !important; padding-right: 0 !important; }
.px-1 { padding-left: 0.25rem !important; padding-right: 0.25rem !important; }
.px-2 { padding-left: 0.5rem !important; padding-right: 0.5rem !important; }
.px-3 { padding-left: 1rem !important; padding-right: 1rem !important; }
.px-4 { padding-left: 1.5rem !important; padding-right: 1.5rem !important; }
.py-1 { padding-top: 0.25rem !important; padding-bottom: 0.25rem !important; }
.py-2 { padding-top: 0.5rem !important; padding-bottom: 0.5rem !important; }

/* Mud-era sizes (4px step) that Bootstrap never had — dead since Mud removal;
   restored to authored intent. */
.mt-6 { margin-top: 24px !important; }
.mt-8 { margin-top: 32px !important; }
.mb-6 { margin-bottom: 24px !important; }
.mb-8 { margin-bottom: 32px !important; }
.mb-10 { margin-bottom: 40px !important; }

/* ── 3 · Form classes (Identity/auth pages — 23 files use these) ────────── */

.form-label { margin-bottom: 0.5rem; font-weight: 600; color: var(--sb-ink, #15171C); }

.form-control {
    display: block;
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--sb-ink, #15171C);
    background: var(--sb-paper, #fff);
    border: 1px solid var(--sb-line, #dee2e6);
    border-radius: var(--sb-radius, 0.375rem);
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}
.form-control:focus {
    outline: 0;
    border-color: var(--sb-accent, #2563EB);
    box-shadow: 0 0 0 3px var(--sb-accent-soft, rgba(37, 99, 235, 0.18));
}
.form-control:disabled { background: var(--sb-paper-soft, #e9ecef); opacity: 1; }

/* Floating labels (Bootstrap 5 emulation — markup: .form-floating > .form-control + label) */
.form-floating { position: relative; }
.form-floating > .form-control {
    height: calc(3.5rem + 2px);
    min-height: calc(3.5rem + 2px);
    padding: 1rem 0.75rem;
}
.form-floating > label {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    height: 100%;
    padding: 1rem 0.75rem;
    overflow: hidden;
    text-align: start;
    text-overflow: ellipsis;
    white-space: nowrap;
    pointer-events: none;
    border: 1px solid transparent;
    transform-origin: 0 0;
    transition: opacity 0.1s ease-in-out, transform 0.1s ease-in-out;
    color: var(--sb-ink-mute, #6c757d);
}
.form-floating > .form-control::placeholder { color: transparent; }
.form-floating > .form-control:focus,
.form-floating > .form-control:not(:placeholder-shown) {
    padding-top: 1.625rem;
    padding-bottom: 0.625rem;
}
.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label {
    opacity: 0.65;
    transform: scale(0.85) translateY(-0.5rem) translateX(0.15rem);
}

.input-group { position: relative; display: flex; flex-wrap: wrap; align-items: stretch; width: 100%; }
.input-group > .form-control { position: relative; flex: 1 1 auto; width: 1%; min-width: 0; }
.input-group-text {
    display: flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    color: var(--sb-ink-soft, #495057);
    background: var(--sb-paper-soft, #e9ecef);
    border: 1px solid var(--sb-line, #dee2e6);
    border-radius: var(--sb-radius, 0.375rem);
}

/* ── 4 · Buttons (legacy .btn markup on auth/legal/older pages) ─────────── */

.btn {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    color: var(--sb-ink, #15171C);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--sb-radius, 0.375rem);
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out,
                border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}
.btn:disabled { pointer-events: none; opacity: 0.65; }
.btn-primary { color: var(--sb-on-accent, #fff); background: var(--sb-accent, #2563EB); border-color: var(--sb-accent, #2563EB); }
.btn-primary:hover { color: var(--sb-on-accent, #fff); background: var(--sb-accent-ink, #1D4ED8); border-color: var(--sb-accent-ink, #1D4ED8); }
.btn-danger { color: #fff; background: var(--sb-error, #dc3545); border-color: var(--sb-error, #dc3545); }
.btn-danger:hover { color: #fff; filter: brightness(0.92); }
.btn-link { color: var(--sb-accent-ink, #2563EB); text-decoration: underline; border: 0; background: none; }
.btn-lg { padding: 0.5rem 1rem; font-size: 1.25rem; border-radius: calc(var(--sb-radius, 0.375rem) + 2px); }

/* ── 5 · Alerts ─────────────────────────────────────────────────────────── */

.alert {
    position: relative;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: var(--sb-radius, 0.375rem);
}
.alert-warning { color: #664d03; background: #fff3cd; border-color: #ffecb5; }
.alert-danger  { color: #842029; background: #f8d7da; border-color: #f5c2c7; }
.alert-info    { color: #055160; background: #cff4fc; border-color: #b6effb; }
.alert-success { color: #0f5132; background: #d1e7dd; border-color: #badbcc; }

/* ── 6 · Nav pills (Identity manage layout) ─────────────────────────────── */

.nav { display: flex; flex-wrap: wrap; padding-left: 0; margin-bottom: 0; list-style: none; }
.nav-link {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--sb-accent-ink, #2563EB);
    text-decoration: none;
    border-radius: var(--sb-radius, 0.375rem);
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out;
}
.nav-link:hover { background: var(--sb-paper-soft, #f8f9fa); }
.nav-pills .nav-link.active { color: var(--sb-on-accent, #fff); background: var(--sb-accent, #2563EB); }

/* ── 7 · Minimal grid (row/col-* on a handful of legacy pages) ──────────── */

.row { display: flex; flex-wrap: wrap; margin-left: -0.75rem; margin-right: -0.75rem; }
.row > * { padding-left: 0.75rem; padding-right: 0.75rem; width: 100%; }
@media (min-width: 768px) {
    .col-md-4 { flex: 0 0 auto; width: 33.3333%; }
    .col-md-6 { flex: 0 0 auto; width: 50%; }
    .col-md-12 { flex: 0 0 auto; width: 100%; }
}
@media (min-width: 992px) {
    .col-lg-3 { flex: 0 0 auto; width: 25%; }
    .col-lg-9 { flex: 0 0 auto; width: 75%; }
}
@media (min-width: 1200px) {
    .col-xl-6 { flex: 0 0 auto; width: 50%; }
}

/* ── 8 · Table (two legacy usages) ──────────────────────────────────────── */

.table { width: 100%; margin-bottom: 1rem; color: var(--sb-ink, #15171C); }
.table th, .table td { padding: 0.5rem; border-bottom: 1px solid var(--sb-line, #dee2e6); text-align: left; }
.table thead th { border-bottom-width: 2px; }
