/*
  Rivens design system. One stylesheet for the member PWA and the admin app.
  Derived from the BJJAA prototype (rivens.me/bjjaa): deep blue, frosted glass, Manrope.
  Club branding overrides the --rv-club-* tokens at runtime (see ClubTheme).
*/

/* Manrope ships with the app (fonts/, SIL OFL): no third-party requests, and the PWA has it offline. Latin covers EN/NL. */
@font-face {
    font-family: Manrope;
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url("../fonts/manrope-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: Manrope;
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url("../fonts/manrope-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
    color-scheme: dark;

    /* club tokens (overridden per club) */
    --rv-club-bg: #0a1830;
    --rv-club-surface: #13294b;
    --rv-club-accent: #e9f2ff;
    --rv-club-text: #f6f8fa;

    /* palette */
    --rv-bg: var(--rv-club-bg);
    --rv-bg-deep: color-mix(in srgb, var(--rv-club-bg) 72%, #000);
    --rv-surface: var(--rv-club-surface);
    --rv-text: var(--rv-club-text);
    --rv-muted: #b7c7de;
    --rv-faint: #8ea4bd;
    --rv-accent: var(--rv-club-accent);
    --rv-on-accent: #102139;
    --rv-line: rgba(219, 235, 255, .21);
    --rv-line-soft: rgba(219, 235, 255, .11);
    --rv-glass: linear-gradient(125deg, rgba(198, 220, 252, .19), rgba(128, 165, 214, .07) 76%);
    --rv-field-bg: rgba(12, 35, 59, .4);

    --rv-success: #b7e6da;
    --rv-success-bg: rgba(184, 238, 219, .1);
    --rv-warning: #ffe3a3;
    --rv-warning-bg: rgba(255, 214, 120, .12);
    --rv-danger: #ffbaa9;
    --rv-danger-bg: rgba(255, 150, 125, .12);

    /* shape and type */
    --rv-radius-xl: 29px;
    --rv-radius-lg: 22px;
    --rv-radius: 15px;
    --rv-radius-pill: 999px;
    --rv-font: Manrope, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --rv-shadow: 0 15px 35px rgba(0, 0, 0, .12), inset 0 1px 0 rgba(233, 250, 255, .05);
    --rv-focus: #b1d0ff;
    --rv-ease: cubic-bezier(.18, .8, .2, 1);
}

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

html, body { margin: 0; min-height: 100%; }

body {
    font-family: var(--rv-font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--rv-text);
    background: var(--rv-bg-deep);
    -webkit-font-smoothing: antialiased;
    font-synthesis: none;
    -webkit-tap-highlight-color: transparent;
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
p { margin: 0; }
h1, h2, h3, h4 { margin: 0; line-height: 1.18; letter-spacing: -.04em; }
h1 { font-size: 30px; font-weight: 800; }
h2 { font-size: 22px; font-weight: 750; }
h3 { font-size: 18px; font-weight: 700; }
code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .92em; }

:focus-visible { outline: 2px solid var(--rv-focus); outline-offset: 3px; }

/* ---------- backgrounds ---------- */

.rv-ambient {
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(ellipse at 74% 12%, color-mix(in srgb, var(--rv-club-surface) 90%, #4a8fb8 10%), transparent 52%),
        radial-gradient(ellipse at 12% 82%, color-mix(in srgb, var(--rv-club-bg) 70%, #1d4a66 30%), transparent 55%),
        var(--rv-bg-deep);
}

/* ---------- text helpers ---------- */

.rv-eyebrow { font-size: 11px; font-weight: 750; letter-spacing: .19em; text-transform: uppercase; color: var(--rv-muted); }
.rv-muted { color: var(--rv-muted); }
.rv-small { font-size: 13px; color: var(--rv-muted); }
.rv-tiny { font-size: 11px; color: var(--rv-faint); }
.rv-mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .08em; }
.rv-num { font-variant-numeric: tabular-nums; }
.rv-nowrap { white-space: nowrap; }

/* ---------- layout helpers ---------- */

.rv-stack { display: grid; gap: 12px; }
.rv-stack-lg { display: grid; gap: 22px; }
.rv-row { display: flex; align-items: center; gap: 12px; }
.rv-between { justify-content: space-between; }
.rv-wrap { flex-wrap: wrap; }
.rv-grow { flex: 1; min-width: 0; }
.rv-center { text-align: center; }

/* ---------- surfaces ---------- */

.rv-glass {
    position: relative;
    border-radius: var(--rv-radius-xl);
    border: 1px solid var(--rv-line);
    background: var(--rv-glass);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: var(--rv-shadow);
    overflow: hidden;
}

.rv-pad { padding: 21px; }
.rv-pad-lg { padding: 28px; }

.rv-section { margin-top: 26px; }
.rv-section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.rv-section-title h2 { font-size: 18px; }

/* ---------- buttons ---------- */

.rv-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 49px;
    padding: 13px 19px;
    border-radius: var(--rv-radius-lg);
    border: 1px solid var(--rv-line);
    background: rgba(190, 217, 233, .08);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: background .2s, transform .2s, box-shadow .2s, opacity .2s;
}
@media (hover: hover) { .rv-button:hover { background: rgba(190, 217, 233, .15); } }
.rv-button:active { transform: scale(.97); }
.rv-button:disabled, .rv-button[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none; }
.rv-button.rv-primary {
    color: var(--rv-on-accent);
    border-color: rgba(255, 255, 255, .33);
    background: linear-gradient(130deg, #fff, var(--rv-accent));
    box-shadow: 0 6px 24px rgba(1, 17, 38, .13), inset 0 1px 0 rgba(255, 255, 255, .6);
}
@media (hover: hover) { .rv-button.rv-primary:hover { box-shadow: 0 6px 28px rgba(188, 220, 255, .14); } }
.rv-button.rv-danger { color: var(--rv-danger); border-color: rgba(255, 176, 155, .19); }
.rv-button.rv-ghost { background: transparent; border-color: transparent; }
.rv-button.rv-small { min-height: 36px; padding: 7px 14px; font-size: 12px; border-radius: var(--rv-radius); }
.rv-button.rv-full { width: 100%; }
.rv-button[aria-busy="true"] { color: transparent; }
.rv-button[aria-busy="true"]::after {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid currentColor;
    border-color: var(--rv-on-accent) transparent var(--rv-on-accent) transparent;
    animation: rv-spin .8s linear infinite;
}
.rv-button:not(.rv-primary)[aria-busy="true"]::after { border-color: var(--rv-text) transparent var(--rv-text) transparent; }

.rv-text-button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 0 8px 8px;
    border: 0;
    background: none;
    font-size: 12px;
    font-weight: 600;
    color: #bcd0dc;
    cursor: pointer;
    text-decoration: none;
}

/* ---------- forms ---------- */

/* align-content: a field next to a taller one (a hint under it) keeps its input under its label instead of stretching */
.rv-field { display: grid; align-content: start; gap: 7px; text-align: left; }
.rv-field label, .rv-field .rv-label { font-size: 12px; color: #bdcfd9; }
.rv-input, .rv-field input, .rv-field select, .rv-field textarea {
    width: 100%;
    min-width: 0;
    padding: 13px 14px;
    border: 1px solid rgba(215, 234, 247, .17);
    border-radius: var(--rv-radius);
    background: var(--rv-field-bg);
    color: #f0f5f9;
    font-size: 15px;
    outline-offset: 1px;
}
/* Safari on iOS draws date and time fields its own way: wider than their column, the value centred, an empty field
   lower than the text fields. Without that look they keep the column, and the value its line. */
@supports (-webkit-touch-callout: none) {
    .rv-input:is([type=date], [type=time]), .rv-field input:is([type=date], [type=time]) { -webkit-appearance: none; appearance: none; }
    .rv-input::-webkit-date-and-time-value, .rv-field input::-webkit-date-and-time-value { min-height: 1lh; margin: 0; text-align: left; }
}
/* Selects look like the other fields, with the app's chevron instead of the browser's arrow. Where the browser lets the
   list be styled (Chrome), it opens as a panel of the app too; elsewhere the system list opens. */
.rv-input:is(select), .rv-field select {
    -webkit-appearance: none;
    appearance: none;
    padding-right: 40px;
    background: var(--rv-field-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b7c7de' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 14px center / 16px;
    cursor: pointer;
}
.rv-input:is(select) option, .rv-field select option { background: #203858; color: #f0f5f9; }
@supports (appearance: base-select) {
    .rv-input:is(select), .rv-field select, .rv-input:is(select)::picker(select), .rv-field select::picker(select) { appearance: base-select; }
    .rv-input:is(select)::picker-icon, .rv-field select::picker-icon { display: none; }
    .rv-input:is(select)::picker(select), .rv-field select::picker(select) {
        margin-block: 6px;
        padding: 6px;
        border: 1px solid var(--rv-line);
        border-radius: var(--rv-radius);
        background: color-mix(in srgb, var(--rv-club-surface) 90%, #fff 10%);
        box-shadow: 0 18px 44px rgba(0, 0, 0, .45);
        color: var(--rv-text);
    }
    .rv-input:is(select) option, .rv-field select option { padding: 10px 12px; border-radius: 10px; background: transparent; font-size: 14px; }
    .rv-input:is(select) option:is(:hover, :focus-visible), .rv-field select option:is(:hover, :focus-visible) { background: rgba(219, 235, 255, .1); outline: none; }
    .rv-input:is(select) option:checked, .rv-field select option:checked { background: rgba(233, 244, 255, .14); font-weight: 700; }
}
/* the swatch fills the field instead of the browser's grey frame */
.rv-field input[type=color] { height: 50px; padding: 5px; cursor: pointer; }
.rv-field input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.rv-field input[type=color]::-webkit-color-swatch { border: 0; border-radius: 11px; }
.rv-field input[type=color]::-moz-color-swatch { border: 0; border-radius: 11px; }
/* Chrome pads the value of date and time fields by a pixel above and below: one line less those 2px keeps them as high
   as the text fields next to them */
@supports not (-webkit-touch-callout: none) {
    .rv-input:is([type=date], [type=time]), .rv-field input:is([type=date], [type=time]) { line-height: calc(1.5em - 2px); }
}
.rv-field input.invalid, .rv-field input[aria-invalid="true"] { border-color: rgba(255, 176, 155, .55); }
.rv-field .validation-message, .rv-error-text { font-size: 12px; color: var(--rv-danger); }
.rv-check { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--rv-muted); }
/* drawn by the app: unchecked, the browser's dark-mode box was a grey square unlike the fields */
.rv-check input[type=checkbox] {
    -webkit-appearance: none;
    appearance: none;
    display: grid;
    place-content: center;
    width: 20px;
    height: 20px;
    flex: none;
    margin: 0;
    border: 1.5px solid rgba(215, 234, 247, .32);
    border-radius: 6px;
    background: var(--rv-field-bg);
    cursor: pointer;
}
.rv-check input[type=checkbox]::before {
    content: "";
    width: 12px;
    height: 12px;
    background: var(--rv-on-accent);
    clip-path: polygon(14% 52%, 0 66%, 38% 100%, 100% 22%, 86% 8%, 37% 70%);
    transform: scale(0);
    transition: transform .12s var(--rv-ease);
}
.rv-check input[type=checkbox]:checked { border-color: var(--rv-accent); background: var(--rv-accent); }
.rv-check input[type=checkbox]:checked::before { transform: scale(1); }
.rv-check input[type=checkbox]:focus-visible { outline: 2px solid var(--rv-accent); outline-offset: 2px; }
.rv-check input[type=checkbox]:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- feedback ---------- */

.rv-alert {
    padding: 13px 15px;
    border-radius: var(--rv-radius);
    border: 1px solid var(--rv-line-soft);
    background: rgba(199, 222, 235, .06);
    font-size: 13px;
}
.rv-alert.rv-error { color: var(--rv-danger); background: var(--rv-danger-bg); border-color: rgba(255, 176, 155, .2); }
.rv-alert.rv-success { color: var(--rv-success); background: var(--rv-success-bg); border-color: rgba(184, 238, 219, .2); }
.rv-alert.rv-warning { color: var(--rv-warning); background: var(--rv-warning-bg); border-color: rgba(255, 214, 120, .2); }

.rv-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: var(--rv-radius-pill);
    border: 1px solid rgba(215, 240, 255, .08);
    background: rgba(204, 229, 243, .09);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}
.rv-pill.rv-success { color: var(--rv-success); background: var(--rv-success-bg); }
.rv-pill.rv-warning { color: var(--rv-warning); background: var(--rv-warning-bg); }
.rv-pill.rv-danger { color: var(--rv-danger); background: var(--rv-danger-bg); }
.rv-pill.rv-outline { background: transparent; border-color: rgba(167, 200, 213, .16); color: #9cb7c5; }

.rv-spinner {
    width: 28px;
    height: 28px;
    margin: 32px auto;
    border-radius: 50%;
    border: 2.5px solid var(--rv-line);
    border-top-color: var(--rv-accent);
    animation: rv-spin .9s linear infinite;
}

/* ---------- lists and tables ---------- */

.rv-list { display: grid; }
.rv-list-item { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid var(--rv-line-soft); }
.rv-list-item:first-child { border-top: 0; }
/* a whole row or pill that is a link reads as a row, not as underlined text */
a.rv-list-item, a.rv-pill { color: inherit; text-decoration: none; }

.rv-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rv-table th { text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--rv-faint); padding: 10px 12px; border-bottom: 1px solid var(--rv-line); }
.rv-table td { padding: 12px; border-bottom: 1px solid var(--rv-line-soft); vertical-align: middle; }
.rv-table tr:last-child td { border-bottom: 0; }
.rv-table .rv-right { text-align: right; }

/* ---------- member card ---------- */

.rv-card-code { font-size: 22px; font-weight: 700; letter-spacing: .14em; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }

/* ---------- blazor chrome ---------- */

#blazor-error-ui {
    display: none;
    position: fixed;
    inset: auto 12px 12px;
    z-index: 1000;
    padding: 12px 16px;
    border-radius: var(--rv-radius);
    background: #3b1720;
    color: #ffd5cc;
    font-size: 13px;
}
#blazor-error-ui .reload { margin-left: 8px; font-weight: 700; }
#blazor-error-ui .dismiss { float: right; cursor: pointer; }

.rv-boot { min-height: 100vh; display: grid; place-items: center; }

@keyframes rv-spin { to { transform: rotate(360deg); } }
@keyframes rv-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.rv-page { animation: rv-in .38s var(--rv-ease); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

