/* ══════════════════════════════════════════════════════════════════════════
   Nařízni to — vizuální styl sladěný s webem machuldyzajn.cz
   antracit + dub + světlá stěna, písma Space Grotesk (nadpisy) a Inter (text)
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Písma (self-hosted, SIL OFL — viz fonts/LICENSE-*.txt) ── */
@font-face {
    font-family: "Inter Variable";
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url("fonts/inter-latin-ext-wght-normal.woff2") format("woff2-variations");
    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-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: "Inter Variable";
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url("fonts/inter-latin-wght-normal.woff2") format("woff2-variations");
    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: "Space Grotesk Variable";
    font-style: normal;
    font-display: swap;
    font-weight: 300 700;
    src: url("fonts/space-grotesk-latin-ext-wght-normal.woff2") format("woff2-variations");
    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-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: "Space Grotesk Variable";
    font-style: normal;
    font-display: swap;
    font-weight: 300 700;
    src: url("fonts/space-grotesk-latin-wght-normal.woff2") format("woff2-variations");
    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;
}

/* ── Barvy a Bootstrap proměnné ── */
:root {
    --antracit: #1d1e1c;
    --antracit-soft: #2b2c29;
    --dub: #c69c6d;
    --dub-light: #e4cba8;
    --dub-dark: #8c6239;
    --stena: #f5f2ec;
    --ocel: #6d7174;
    --line: rgba(29, 30, 28, .12);
    --font-display: "Space Grotesk Variable", ui-sans-serif, system-ui, sans-serif;
    --font-sans: "Inter Variable", ui-sans-serif, system-ui, sans-serif;

    --bs-body-font-family: var(--font-sans);
    --bs-body-bg: var(--stena);
    --bs-body-color: var(--antracit);
    --bs-secondary-color: rgba(29, 30, 28, .62);
    --bs-border-color: var(--line);
    --bs-border-radius: .5rem;
    --bs-border-radius-sm: .375rem;
    --bs-border-radius-lg: .75rem;
    --bs-link-color: var(--dub-dark);
    --bs-link-color-rgb: 140, 98, 57;
    --bs-link-hover-color: var(--antracit);
    --bs-link-hover-color-rgb: 29, 30, 28;
    --bs-primary: var(--antracit);
    --bs-primary-rgb: 29, 30, 28;
    --bs-primary-bg-subtle: #f1e6d6;
    --bs-primary-border-subtle: var(--dub-light);
    --bs-primary-text-emphasis: var(--dub-dark);
    --bs-focus-ring-color: rgba(198, 156, 109, .45);
    --bs-emphasis-color: var(--antracit);
}

html, body {
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
}

body {
    background: var(--stena);
    color: var(--antracit);
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, .h1, .h2, .h3, .h4, .h5, .card-header, .navbar-brand {
    font-family: var(--font-display);
    letter-spacing: -.01em;
    text-wrap: balance;
}
h1, .h1, h2, .h2, h3, .h3 { font-weight: 700; }

a { text-underline-offset: 2px; }

:focus-visible {
    outline: 2px solid var(--dub-dark);
    outline-offset: 2px;
}
h1:focus { outline: none; }

.text-muted { color: rgba(29, 30, 28, .6) !important; }

/* Malý nadpis nad obsahem — jako na webu (uppercase, dub) */
.eyebrow {
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--dub-dark);
}

/* ── Tlačítka: zaoblené „pilulky“ jako na webu ── */
.btn {
    --bs-btn-border-radius: 999px;
    --bs-btn-font-weight: 600;
    --bs-btn-focus-box-shadow: 0 0 0 .2rem rgba(198, 156, 109, .45);
}
.btn-sm { --bs-btn-padding-x: .85rem; }
.btn-primary {
    --bs-btn-bg: var(--antracit);
    --bs-btn-border-color: var(--antracit);
    --bs-btn-hover-bg: var(--dub-dark);
    --bs-btn-hover-border-color: var(--dub-dark);
    --bs-btn-active-bg: var(--dub-dark);
    --bs-btn-active-border-color: var(--dub-dark);
    --bs-btn-disabled-bg: var(--antracit);
    --bs-btn-disabled-border-color: var(--antracit);
}
.btn-outline-primary, .btn-outline-dark, .btn-outline-secondary {
    --bs-btn-color: var(--antracit);
    --bs-btn-border-color: rgba(29, 30, 28, .25);
    --bs-btn-hover-color: var(--stena);
    --bs-btn-hover-bg: var(--antracit);
    --bs-btn-hover-border-color: var(--antracit);
    --bs-btn-active-color: var(--stena);
    --bs-btn-active-bg: var(--antracit);
    --bs-btn-active-border-color: var(--antracit);
    --bs-btn-disabled-color: rgba(29, 30, 28, .4);
}
.btn-accent {
    --bs-btn-color: var(--antracit);
    --bs-btn-bg: var(--dub);
    --bs-btn-border-color: var(--dub);
    --bs-btn-hover-color: var(--antracit);
    --bs-btn-hover-bg: var(--dub-light);
    --bs-btn-hover-border-color: var(--dub-light);
    --bs-btn-active-bg: var(--dub-light);
}
.btn-outline-danger {
    --bs-btn-border-color: rgba(185, 28, 28, .35);
    --bs-btn-color: #b91c1c;
}
.btn-link {
    --bs-btn-font-weight: 500;
    --bs-btn-color: var(--dub-dark);
    --bs-btn-hover-color: var(--antracit);
    text-underline-offset: 2px;
}
/* Skupina přepínačů (směr vláken) — jedna pilulka se segmenty */
.btn-group > .btn { --bs-btn-border-radius: 999px; }

/* ── Formuláře ── */
.form-control, .form-select {
    border-color: rgba(29, 30, 28, .18);
    background-color: #fff;
}
.form-control:focus, .form-select:focus, .form-check-input:focus {
    border-color: var(--dub);
    box-shadow: 0 0 0 .2rem rgba(198, 156, 109, .3);
}
.form-check-input:checked {
    background-color: var(--antracit);
    border-color: var(--antracit);
}
.form-label { margin-bottom: .25rem; }
.form-control:disabled, .form-select:disabled { background-color: rgba(29, 30, 28, .05); }

.valid.modified:not([type=checkbox]) { outline: 1px solid #3f8f5a; }
.invalid { outline: 1px solid #b91c1c; }
.validation-message, .validation-errors { color: #b91c1c; }

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

/* ── Karty, tabulky ── */
.card {
    --bs-card-border-color: var(--line);
    --bs-card-cap-bg: #fff;
    --bs-card-border-radius: .75rem;
    --bs-card-inner-border-radius: calc(.75rem - 1px);
    box-shadow: 0 1px 2px rgba(29, 30, 28, .04);
}
.card-header {
    font-weight: 600;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
}
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > thead th {
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: rgba(29, 30, 28, .55);
    white-space: nowrap;
}
.table-sm td, .table-sm th, .table td, .table th { vertical-align: middle; }
.table-light { --bs-table-bg: rgba(29, 30, 28, .04); }
.table-primary { --bs-table-bg: #f1e6d6; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: rgba(198, 156, 109, .12); }
.list-group { --bs-list-group-border-color: var(--line); }
.badge { font-weight: 600; letter-spacing: .01em; }
.alert { border-radius: .75rem; }
.text-bg-primary { background-color: var(--antracit) !important; }
.text-bg-info { background-color: var(--dub-light) !important; color: var(--antracit) !important; }

/* ── Pomocné třídy aplikace ── */
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.input-num { max-width: 7.5rem; }
.stat {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: .25rem .75rem;
    background: #fff;
    font-size: .85rem;
    white-space: nowrap;
}
.stat b { font-variant-numeric: tabular-nums; }
.stat.good { background: #e7f2e4; border-color: #c9e2c2; }
.stat.warn { background: #f7ecd9; border-color: var(--dub-light); }
.stat.bad { background: #f9e1dc; border-color: #efc2b8; }

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem .75rem;
    margin-bottom: 1rem;
}
.page-head h1 { margin: 0 auto 0 0; font-size: clamp(1.4rem, 1.1rem + 1vw, 1.9rem); }
.page-head .actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.crumbs { font-size: .85rem; margin-bottom: .35rem; color: rgba(29, 30, 28, .55); }
.crumbs a { color: inherit; }
.crumbs a:hover { color: var(--dub-dark); }

/* Řádek „název + výběr + tlačítko“ — na mobilu se zalomí */
.add-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.add-row > .grow { flex: 1 1 12rem; min-width: 0; }
.add-row > .pick { flex: 1 1 11rem; min-width: 0; max-width: 18rem; }
.add-row > .qty { flex: 0 0 6.5rem; }
.add-row > .unit { flex: 0 0 5rem; }
.add-row > .btn { flex: 0 0 auto; }
@media (max-width: 575.98px) {
    .add-row > .pick { max-width: none; }
    .add-row > .btn { flex: 1 1 100%; }
}

/* Výběr hran — kříž kolem náhledu dílu, na mobilu se nepřetéká */
.edge-cross {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(5rem, 7rem) minmax(0, 1fr);
    grid-template-areas: ". top ." "left part right" ". bottom .";
    gap: .4rem;
    align-items: center;
}
.edge-cross .e-top { grid-area: top; }
.edge-cross .e-bottom { grid-area: bottom; }
.edge-cross .e-left { grid-area: left; }
.edge-cross .e-right { grid-area: right; }
.edge-cross .e-top, .edge-cross .e-bottom { grid-column: 1 / -1; justify-self: center; width: min(100%, 12rem); }
.edge-cross .e-part {
    grid-area: part;
    height: 3rem;
    border: 2px solid var(--dub);
    background: #f1e6d6;
    border-radius: .375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    font-variant-numeric: tabular-nums;
    color: var(--dub-dark);
}

/* Vizualizace */
.sheet-svg { display: block; width: 100%; height: auto; background: #fff; }
.bar-row { display: flex; height: 28px; border: 1px solid #94a3b8; border-radius: 4px; overflow: hidden; background: repeating-linear-gradient(45deg, #f4f1ea, #f4f1ea 6px, #e8e3d8 6px, #e8e3d8 12px); }
.bar-piece { border-right: 2px solid var(--antracit-soft); display: flex; align-items: center; justify-content: center; font-size: .7rem; overflow: hidden; white-space: nowrap; color: var(--antracit); }
.bar-trim { background: #cbd5e1; }
.badge-status { font-weight: 600; }

/* ── Chybové stavy Blazoru ── */
.blazor-error-boundary {
    background: #b32121;
    padding: 1rem 1.25rem;
    color: white;
    border-radius: .75rem;
}
.blazor-error-boundary::after { content: "Nastala chyba."; }

/* ── Tisk ── */
@media print {
    .app-sidebar, .app-topbar, .no-print, #blazor-error-ui, #components-reconnect-modal { display: none !important; }
    .app-shell, .app-main, .app-content { display: block !important; padding: 0 !important; margin: 0 !important; }
    body { background: #fff; }
    .card { box-shadow: none; border: 0; }
}

/* ── Přihlášení a registrace ── */
.auth-wrap { display: flex; justify-content: center; padding: 1rem 0 2rem; }
.auth-card { width: 100%; max-width: 28rem; }
.auth-or { display: flex; align-items: center; gap: .75rem; margin: 1rem 0; color: rgba(29, 30, 28, .5); font-size: .8rem; text-transform: uppercase; letter-spacing: .12em; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.account-body h3, .account-body h4 { font-size: 1.15rem; margin-bottom: 1rem; }
.brand-mark-print { width: 2rem; height: 2rem; }
.table td.font-monospace { white-space: nowrap; }

/* ── Mobil: výběr hran ve dvou sloupcích, tabulky bez zalamování (posouvají se v kartě) ── */
@media (max-width: 575.98px) {
    .edge-cross {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        grid-template-areas: "top top" "left right" "bottom bottom";
    }
    .edge-cross .e-part { display: none; }
    .edge-cross .e-top, .edge-cross .e-bottom { width: 100%; }
}
@media (max-width: 767.98px) {
    .table-responsive .table td, .table-responsive .table th { white-space: nowrap; }
}

/* ── Rozpis kalkulace ── */
.quote-table td, .quote-table th { padding: .45rem .75rem; white-space: normal !important; }
.quote-table td.num, .quote-table th.num { white-space: nowrap !important; width: 1%; }
.quote-table .quote-group > * { background: rgba(29, 30, 28, .04); font-family: var(--font-display); }
.quote-calc { font-size: .78rem; color: rgba(29, 30, 28, .55); font-variant-numeric: tabular-nums; }
.quote-table tfoot td, .quote-table tfoot th { border-bottom-width: 0; }
.quote-table tfoot tr:first-child > * { border-top: 2px solid var(--line); }
.quote-total > * { font-family: var(--font-display); font-size: 1.15rem; border-top: 2px solid var(--antracit) !important; }
