/* LilleHus Kasse — globale Basis. Komponenten-Styles liegen in *.razor.css (CSS-Isolation).
   Farben kommen aus den MudBlazor-Variablen (--mud-palette-*, Theme/KasseTheme.cs), damit Dark Mode automatisch greift.
   CI-Tokens: LilleHus B2BPortal site.css (--lh-*). Schriften lokal (keine CDNs), siehe ../fonts/. */

@font-face {
    font-family: 'Dosis';
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url('../fonts/dosis-latin-variable.woff2') format('woff2-variations');
}

@font-face {
    font-family: 'Merriweather';
    font-style: normal;
    font-weight: 300 900;
    font-display: swap;
    src: url('../fonts/merriweather-latin-variable.woff2') format('woff2-variations');
}

/* Dosis hat keine tabellarischen Ziffern → Ziffern-Subset mit gleicher Breite (tools/Kasse/dosis-ziffern.py), nur für Beträge. */
@font-face {
    font-family: 'Dosis Ziffern';
    font-style: normal;
    font-weight: 100 699;
    font-display: swap;
    src: url('../fonts/dosis-ziffern-600.woff2') format('woff2');
    unicode-range: U+0030-0039;
}

@font-face {
    font-family: 'Dosis Ziffern';
    font-style: normal;
    font-weight: 700 1000;
    font-display: swap;
    src: url('../fonts/dosis-ziffern-800.woff2') format('woff2');
    unicode-range: U+0030-0039;
}

:root {
    --k-font-display: 'Dosis', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --k-font-body: 'Merriweather', Georgia, serif;
    --k-font-num: 'Dosis Ziffern', 'Dosis', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

    /* Teal als Schrift/Rahmen: blue-700 (≥ 4.5:1 auf Sand und Weiß); Flächen nutzen --mud-palette-primary (blue-500). */
    --k-accent-ink: #307382;
    --k-tile-border: #DBE7EA;
    --k-on-accent: #FFFFFF;
    --k-shadow-sm: 0 2px 6px rgba(77, 77, 77, .07);
    --k-shadow-md: 0 6px 18px rgba(77, 77, 77, .08);
    --k-bg: #FAF8F4;
    --k-fg: #2E2E2E;
    --k-shadow-brand: 0 6px 18px rgba(58, 125, 140, .22);
    --k-scrim: rgba(46, 46, 46, .42);
    /* Rückgeld/Hinweise (CI success/warning/danger -100 als Fläche, -ink als Schrift ≥ 4.5:1). */
    --k-soft: #EEF4F5;
    --k-ok-soft: #E2EDE6;
    --k-ok-ink: #3D6050;
    --k-warn-soft: #F6E9D6;
    --k-danger-soft: #F3E0DC;
}

@media (prefers-color-scheme: dark) {
    :root {
        --k-accent-ink: #7CC0CF;
        --k-tile-border: #3E4B4D;
        --k-on-accent: #0F2328;
        --k-shadow-sm: 0 2px 6px rgba(0, 0, 0, .35);
        --k-shadow-md: 0 6px 18px rgba(0, 0, 0, .4);
        --k-bg: #1A1816;
        --k-fg: #F3EEE6;
        --k-shadow-brand: 0 6px 18px rgba(0, 0, 0, .4);
        --k-scrim: rgba(0, 0, 0, .55);
        --k-soft: #24343A;
        --k-ok-soft: #22332B;
        --k-ok-ink: #8FC1A6;
        --k-warn-soft: #3A2E20;
        --k-danger-soft: #3A2421;
    }
}

html,
body {
    margin: 0;
    height: 100%;
    background: var(--k-bg);
    color: var(--k-fg);
    font-family: var(--k-font-display);
    font-size: 16px;
    font-weight: 500;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior: none;
}

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

a {
    color: var(--k-accent-ink);
}

/* Merriweather nur sparsam: Hinweise/Fließtext. */
.k-prose {
    font-family: var(--k-font-body);
    font-weight: 400;
    line-height: 1.6;
}

.k-num {
    font-family: var(--k-font-num);
}

/* ---- Gemeinsame Bausteine (Kasse, Journal, Einstellungen) ---- */

.k-page {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-width: 900px;
    margin: 0 auto;
    padding: 12px;
}

.k-h1 {
    margin: 4px 0;
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--k-accent-ink);
}

.k-h2 {
    margin: 0;
    font-size: 1.375rem;
    font-weight: 700;
    line-height: 1.2;
}

.k-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 56px;
    min-width: 56px;
    padding: 0 18px;
    border-radius: 14px;
    border: 2px solid transparent;
    font: inherit;
    font-family: var(--k-font-display);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: .01em;
    text-decoration: none;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.k-btn:disabled {
    opacity: .35;
    cursor: default;
}

.k-btn:not(:disabled):active {
    transform: scale(.98);
}

.k-btn-outline {
    background: var(--mud-palette-surface);
    border-color: var(--k-accent-ink);
    color: var(--k-accent-ink);
}

.k-btn-back {
    background: var(--mud-palette-surface);
    border-color: var(--mud-palette-text-secondary);
    color: var(--mud-palette-text-primary);
}

.k-btn-pay {
    min-height: 72px;
    font-size: 1.5rem;
    background: var(--mud-palette-primary);
    color: var(--mud-palette-primary-text);
    box-shadow: var(--k-shadow-sm);
}

.k-btn-confirm {
    width: 100%;
    min-height: 64px;
    border-radius: 999px;
    font-size: 1.375rem;
    letter-spacing: .03em;
    background: var(--mud-palette-primary);
    color: var(--mud-palette-primary-text);
    box-shadow: var(--k-shadow-brand);
}

/* Inhalt einer Zahlart im Bezahl-Blatt (Home): scrollt; Buchen-Knopf darunter bleibt sichtbar. */
.k-sheet-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.k-sheet-actions {
    flex: 0 0 auto;
}

.k-due {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.k-due .k-total {
    font-size: 2.5rem;
    font-weight: 600;
}

.k-hint {
    padding: 12px 16px;
    border-radius: 16px;
    background: var(--k-warn-soft);
    color: var(--mud-palette-text-primary);
    font-family: var(--k-font-body);
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
}

/* QR immer auf weißer Platte (auch im Dark Mode / auf Teal), sonst scannen manche Handys schlecht. */
.k-qr-plate {
    align-self: center;
    padding: 14px;
    border-radius: 22px;
    background: #fff;
    box-shadow: var(--k-shadow-md);
}

.k-qr-plate img.qr,
.k-qr-plate div.qr-missing {
    width: min(60vw, 32vh, 260px);
}

/* Bezahl-/Beleg-Schritte: Kopf (Zurück), Inhalt (scrollt), Aktion unten. */
.k-pay {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.k-pay-top {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 12px;
}

.k-pay-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--k-accent-ink);
}

.k-pay-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 6px 14px 14px;
    text-align: center;
}

.k-pay-actions {
    flex: 0 0 auto;
    padding: 10px 12px 12px;
    border-top: 2px solid var(--mud-palette-divider);
    background: var(--mud-palette-surface);
}

.k-label {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--mud-palette-text-secondary);
}

.k-total {
    font-family: var(--k-font-num);
    font-size: clamp(3.25rem, 13vw, 5.5rem);
    font-weight: 800;
    line-height: 1.05;
}

.k-error {
    margin: 8px 12px 0;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--mud-palette-error);
    color: var(--mud-palette-error-text);
    font-size: 1.125rem;
    font-weight: 700;
}

.k-ok {
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--mud-palette-success);
    color: var(--mud-palette-success-text);
    font-size: 1.125rem;
    font-weight: 700;
}

/* ---- Blazor-Standard (Fehlerleiste, Ladeanzeige) ---- */

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    color: #1e1e1e;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.8rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    font-size: 1.125rem;
}

#blazor-error-ui .reload {
    display: inline-block;
    min-height: 44px;
    padding: 0.5rem 1rem;
    font-weight: 700;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
    padding: 0.5rem;
}

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "Ein Fehler ist aufgetreten.";
}

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto;
}

.loading-progress circle {
    fill: none;
    stroke: #E0D9CD;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: #3A7D8C;
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text::after {
    content: var(--blazor-load-percentage-text, "Kasse lädt");
}

/* Gäste-QR drucken (/admin/gaeste): nur den Druckbogen drucken, A5 hoch. */
@media print {
    @page { size: A5 portrait; margin: 10mm; }

    body:has(.gq-sheet) * {
        visibility: hidden;
    }

    body:has(.gq-sheet) .gq-sheet,
    body:has(.gq-sheet) .gq-sheet * {
        visibility: visible;
    }

    body:has(.gq-sheet) .gq-sheet {
        position: fixed;
        inset: 0;
        margin: 0;
    }
}
