/* GlassFlow – doplňky k Bootstrapu (UI_DESIGN.md – Design systém). Bez inline stylů. */

:root {
  --gf-sidebar-width: 15rem;
  --gf-topbar-height: 3.5rem;
  --gf-touch-target: 44px;
}

/* Odkaz „Přeskočit na obsah“ – viditelný jen při ovládání klávesnicí. */
.gf-skip-link:focus {
  position: fixed;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 2000;
  padding: 0.5rem 1rem;
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
  border: 2px solid var(--bs-primary);
  border-radius: var(--bs-border-radius);
}

/* Výrazný focus pro klávesnici (WCAG 2.2 AA). */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
.nav-link:focus-visible {
  outline: 3px solid var(--bs-primary);
  outline-offset: 2px;
  box-shadow: none;
}

.gf-topbar {
  min-height: var(--gf-topbar-height);
}

.gf-topbar .btn {
  min-width: var(--gf-touch-target);
  min-height: var(--gf-touch-target);
}

.gf-layout {
  display: flex;
  min-height: calc(100vh - var(--gf-topbar-height));
}

.gf-content {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
}

.gf-content > main {
  flex: 1 0 auto;
}

.gf-content > main:focus {
  outline: none;
}

@media (min-width: 992px) {
  .gf-sidebar {
    flex: 0 0 var(--gf-sidebar-width);
    width: var(--gf-sidebar-width);
    background: var(--bs-tertiary-bg);
  }
}

.gf-nav-section {
  margin: 1rem 0.75rem 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--bs-secondary-color);
}

.gf-sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-height: var(--gf-touch-target);
  padding: 0.5rem 0.75rem;
  border-radius: var(--bs-border-radius);
  color: var(--bs-body-color);
}

.gf-sidebar .nav-link:hover {
  background: var(--bs-secondary-bg);
}

.gf-sidebar .nav-link.active {
  background: var(--bs-primary-bg-subtle);
  color: var(--bs-primary-text-emphasis);
  font-weight: 600;
}

.gf-sidebar .nav-link.disabled {
  color: var(--bs-secondary-color);
}

/* Přihlášení a obnova hesla – vystředěná karta. */
.gf-auth {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--gf-topbar-height));
}

.gf-auth-main {
  flex: 1 0 auto;
  width: 100%;
  max-width: 27rem;
  margin: 0 auto;
}

.gf-auth-main:focus {
  outline: none;
}

.gf-footer {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: var(--bs-secondary-color);
}

/* Přepínače (radio) ve formulářích vedle sebe. */
.gf-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.5rem;
}

.gf-choice {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: var(--gf-touch-target);
  margin: 0;
  padding-left: 0;
}

.gf-choice .form-check-input {
  float: none;
  margin: 0;
}

.gf-actions .btn,
.gf-actions form {
  display: inline-block;
}

/* Hlavička tabulek – přizpůsobí se světlému i tmavému režimu (na rozdíl od .table-light). */
.gf-thead th {
  background-color: var(--bs-tertiary-bg);
}

/* Skrytý text pro čtečky (.visually-hidden) má absolutní pozici; bez toho by
   uvnitř posuvné tabulky roztáhl celou stránku do šířky na mobilu. */
.table-responsive {
  position: relative;
}

/* Stav s textem i ikonou – barva není jediný nositel významu. */
.gf-status {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-weight: 600;
}

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

/* Editor tvaru skla a výkres (ADR 0010) – vzhled SVG řídí třídy, ne atribut style. */
.gf-drawing-wrap {
  background-color: var(--bs-body-bg);
}
.gf-drawing {
  width: 100%;
  height: auto;
  max-height: 70vh;
  display: block;
}
.gf-drawing .gf-glass {
  fill: #cfe8f3;
  fill-opacity: 0.55;
  stroke: none;
}
[data-bs-theme="dark"] .gf-drawing .gf-glass {
  fill: #2b5d73;
}
.gf-drawing .gf-edge {
  fill: none;
  stroke: var(--bs-body-color);
  stroke-linecap: round;
}
.gf-drawing .gf-edge-processed {
  stroke: var(--bs-primary);
}
.gf-drawing .gf-hit {
  fill: none;
  stroke: transparent;
  cursor: pointer;
  pointer-events: stroke;
}
.gf-drawing .gf-hit:hover {
  stroke: var(--bs-primary);
  stroke-opacity: 0.25;
}
.gf-drawing .gf-hole {
  fill: var(--bs-body-bg);
  stroke: var(--bs-body-color);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
}
.gf-drawing .gf-cutout {
  fill: var(--bs-body-bg);
  stroke: var(--bs-body-color);
  stroke-dasharray: 4 2;
  vector-effect: non-scaling-stroke;
}
.gf-drawing .gf-dim {
  stroke: var(--bs-secondary-color);
  fill: none;
}
.gf-drawing text {
  fill: var(--bs-body-color);
  font-family: var(--bs-body-font-family);
}
.gf-drawing .gf-edge-label {
  fill: var(--bs-primary);
  font-weight: 700;
}
.gf-drawing .gf-small {
  fill: var(--bs-secondary-color);
}
.gf-highlight {
  outline: 3px solid var(--bs-warning);
  outline-offset: 2px;
}

/* Výroba (0.5.0): pořadí kroku v úpravě trasy */
.gf-input-order { width: 5rem; }
.gf-route-step { white-space: nowrap; }
/* Kus otevřený skenem QR (odkaz #kus-…) */
.gf-piece:target { background: var(--bs-warning-bg-subtle); outline: 3px solid var(--bs-warning); outline-offset: -3px; }

/* Dílna: velké cíle pro práci v rukavicích a na dotyk (UI_DESIGN.md – Workshop) */
.gf-big-button { min-height: 3.5rem; font-size: 1.25rem; }
.gf-main-button { min-height: 5rem; font-size: 1.75rem; font-weight: 600; }
.gf-check-lg { width: 1.75rem; height: 1.75rem; }
.gf-workshop-tile:hover, .gf-workshop-tile:focus-visible { border-color: var(--bs-primary); }

/* Výrobní tabule (televize v dílně): větší písmo, čísla zarovnaná. */
.gf-board { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.gf-board-number { font-size: 2rem; font-weight: 700; line-height: 1; }
.gf-board-running { font-size: 1.2rem; }

/* Editor prodejního ceníku (0.5.1): upozornění, seskupená tabulka, lišta dole, karty na telefonu. */
.gf-alert-chip { display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .75rem; border-radius: .5rem; border: 1px solid transparent; text-decoration: none; font-size: .9rem; }
.gf-alert-chip.active { border-color: currentColor; }
.gf-chip-bad { background: var(--bs-danger-bg-subtle); color: var(--bs-danger-text-emphasis); }
.gf-chip-warn { background: var(--bs-warning-bg-subtle); color: var(--bs-warning-text-emphasis); }
.gf-chip-info { background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis); }
.gf-chip-muted { background: var(--bs-secondary-bg); color: var(--bs-secondary-color); }
.gf-chip-ok { background: var(--bs-success-bg-subtle); color: var(--bs-success-text-emphasis); }
.gf-sheet { border: 1px solid var(--bs-border-color); border-radius: .5rem; overflow-x: auto; background: var(--bs-body-bg); }
.gf-pricebook-table td, .gf-pricebook-table th { font-variant-numeric: tabular-nums; }
.gf-group-row > td { background: var(--bs-tertiary-bg); padding-top: .6rem; padding-bottom: .6rem; }
.gf-group-toggle { border: 0; background: transparent; padding: 0 .2rem; color: inherit; }
.gf-group-toggle[aria-expanded="false"] .bi { display: inline-block; transform: rotate(-90deg); }
.gf-group-edit summary { cursor: pointer; width: max-content; }
.gf-group-edit .form-control { max-width: 9rem; }
.gf-source { font-size: .75rem; color: var(--bs-secondary-color); line-height: 1.1; }
.gf-code { font-family: var(--bs-font-monospace); font-size: .8em; }
.gf-col-check { width: 2.2rem; }
.gf-line.gf-selected > td { background: var(--bs-primary-bg-subtle); }
.gf-mobile-line { display: none; }
.gf-has-dock { padding-bottom: 1rem; }
.gf-dock { position: sticky; bottom: 0; z-index: 1020; margin-top: 1rem; padding: .75rem 1rem; background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); border-radius: .5rem; box-shadow: 0 -.4rem 1.2rem rgb(0 0 0 / .08); }
.gf-dock-field .form-control { width: 7rem; }
.gf-dock-scope { margin: 0; }
.gf-dock [hidden] { display: none !important; }
.gf-dock-compare summary { cursor: pointer; width: max-content; }
.gf-dock-compare[open] { max-height: 40vh; overflow: auto; }

@media (max-width: 767.98px) {
  .gf-pricebook-table thead { display: none; }
  .gf-pricebook-table, .gf-pricebook-table tbody, .gf-pricebook-table tr, .gf-pricebook-table td { display: block; width: 100%; }
  .gf-pricebook-table tr.gf-line { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: .6rem; padding: .6rem .75rem; border-bottom: 1px solid var(--bs-border-color); }
  .gf-pricebook-table tr.gf-line > td { border: 0; padding: 0; width: auto; }
  .gf-pricebook-table .gf-col-check { grid-column: 1; grid-row: 1 / span 2; }
  .gf-pricebook-table .gf-col-item { grid-column: 2; grid-row: 1 / span 2; }
  .gf-pricebook-table .gf-col-sale { grid-column: 3; grid-row: 1; }
  .gf-pricebook-table .gf-col-actions { grid-column: 3; grid-row: 2; align-self: end; }
  .gf-pricebook-table .gf-col-buy, .gf-pricebook-table .gf-col-waste, .gf-pricebook-table .gf-col-markup,
  .gf-pricebook-table .gf-col-profit, .gf-pricebook-table .gf-col-change { display: none !important; }
  .gf-pricebook-table .gf-code { display: none; }
  .gf-mobile-line { display: flex; flex-wrap: wrap; column-gap: .8rem; margin-top: .15rem; }
  .gf-dock { padding: .6rem .75rem; }
  .gf-dock-field .form-control { width: 5.5rem; }
}

/* Řez skladbou vrstveného skla (0.6.0): v detailu nabídky a v dílně. */
.gf-section-mini svg { width: 100%; max-width: 34rem; height: auto; display: block; }
.gf-section-wrap svg { width: 100%; height: auto; }

/* =========================================================================================
   Vzhled 0.6.7 – tmavý panel, písmo Inter, karty se stínem (UI_DESIGN.md – Design systém)
   ========================================================================================= */

/* Písmo Inter (OFL 1.1, static/vendor/inter/LICENSE.txt) – proměnná řezů 100–900. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../vendor/inter/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";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../vendor/inter/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;
}

:root,
[data-bs-theme="light"] {
  --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-border-radius: 0.5rem;
  --bs-border-radius-lg: 0.75rem;
  --gf-page-bg: #f2f4f8;
  --gf-card-shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.08);
  --gf-card-border: rgba(16, 24, 40, 0.06);
  --gf-brand: #0c2340;
  --gf-brand-2: #12345c;
  --gf-brand-accent: #4dabf7;
}

[data-bs-theme="dark"] {
  --gf-page-bg: #0f141a;
  --gf-card-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  --gf-card-border: rgba(255, 255, 255, 0.07);
}

html[data-bs-theme="dark"] {
  --gf-brand: #0a1828;
  --gf-brand-2: #0f2238;
}

body {
  background-color: var(--gf-page-bg);
  font-feature-settings: "cv11", "tnum" 0;
  -webkit-font-smoothing: antialiased;
}

/* Čísla v tabulkách a souhrnech pod sebou. */
.table,
.fs-4,
.gf-board-number {
  font-variant-numeric: tabular-nums;
}

h1, .h1, h2, .h2, h3, .h3 {
  letter-spacing: -0.015em;
  font-weight: 650;
}

/* --- Horní lišta a postranní panel: tmavě modrá ---------------------------------------- */
.gf-topbar {
  background: var(--gf-brand) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
}

.gf-topbar .navbar-brand {
  color: #fff;
  letter-spacing: -0.01em;
}

.gf-logo {
  width: 1.75rem;
  height: 1.75rem;
}

@media (min-width: 992px) {
  /* Bootstrap dává .offcanvas-lg na širokém displeji průhledné pozadí s !important. */
  .gf-sidebar.offcanvas-lg {
    background-color: var(--gf-brand-2) !important;
    border-right: 0 !important;
  }
}

.gf-sidebar.offcanvas-lg {
  --bs-offcanvas-bg: var(--gf-brand-2);
}

.gf-sidebar .gf-nav-section {
  color: rgba(255, 255, 255, 0.45);
}

.gf-sidebar .nav-link {
  color: rgba(255, 255, 255, 0.78);
  position: relative;
}

.gf-sidebar .nav-link .bi {
  font-size: 1.05rem;
  opacity: 0.85;
}

.gf-sidebar .nav-link:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.gf-sidebar .nav-link.active {
  background: rgba(77, 171, 247, 0.16);
  color: #fff;
  font-weight: 600;
}

.gf-sidebar .nav-link.active::before {
  content: "";
  position: absolute;
  left: -0.5rem;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 3px;
  border-radius: 3px;
  background: var(--gf-brand-accent);
}

.gf-sidebar .nav-link.active .bi {
  color: var(--gf-brand-accent);
  opacity: 1;
}

/* --- Karty, tabulky, formuláře ---------------------------------------------------------- */
.card {
  --bs-card-border-color: var(--gf-card-border);
  --bs-card-border-radius: 0.75rem;
  --bs-card-inner-border-radius: calc(0.75rem - 1px);
  --bs-card-cap-bg: transparent;
  box-shadow: var(--gf-card-shadow);
}

.card-header {
  padding-top: 0.875rem;
  padding-bottom: 0.875rem;
}

.card-header .h6,
.card-header h2 {
  font-weight: 650;
}

.list-group {
  --bs-list-group-border-color: var(--gf-card-border);
}

.list-group:not(.list-group-flush) {
  box-shadow: var(--gf-card-shadow);
  border-radius: 0.75rem;
}

.table {
  --bs-table-bg: transparent;
}

.table > thead > tr > th {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--bs-secondary-color);
  border-bottom-width: 1px;
  white-space: nowrap;
}

.table > tbody > tr:hover > * {
  --bs-table-bg-state: rgba(13, 110, 253, 0.035);
}

.form-control,
.form-select {
  border-color: rgba(16, 24, 40, 0.16);
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
  border-color: rgba(255, 255, 255, 0.14);
}

.btn {
  font-weight: 500;
}

.badge {
  font-weight: 600;
}

/* --- Přehled: dlaždice s barevným proužkem ---------------------------------------------- */
.gf-tile {
  border-left: 4px solid var(--gf-tile-accent, var(--bs-primary)) !important;
}

.gf-tile h2 .bi {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  background: color-mix(in srgb, var(--gf-tile-accent, var(--bs-primary)) 14%, transparent);
  color: var(--gf-tile-accent, var(--bs-primary));
}

.gf-tile[aria-labelledby="karta-zakaznici"] { --gf-tile-accent: #0d6efd; }
.gf-tile[aria-labelledby="karta-poptavky"] { --gf-tile-accent: #0aa2c0; }
.gf-tile[aria-labelledby="karta-vyroba"] { --gf-tile-accent: #fd7e14; }
.gf-tile[aria-labelledby="karta-nabidky"] { --gf-tile-accent: #6f42c1; }
.gf-tile[aria-labelledby="karta-cenik"] { --gf-tile-accent: #198754; }
.gf-tile[aria-labelledby="karta-stav"] { --gf-tile-accent: #6c757d; }

/* --- Ukázková instance: nenápadný proužek ------------------------------------------------ */
.gf-demo-strip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  background: rgba(13, 202, 240, 0.12);
  color: var(--bs-info-text-emphasis);
}

/* --- Přihlášení: barevný panel vlevo, formulář vpravo ----------------------------------- */
.gf-auth-split {
  display: flex;
  flex: 1 0 auto;
}

.gf-auth-brand {
  flex: 0 0 44%;
  flex-direction: column;
  justify-content: center;
  gap: 1.5rem;
  padding: 3rem 4rem;
  color: #fff;
  background:
    radial-gradient(circle at 20% 15%, rgba(77, 171, 247, 0.35), transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(32, 201, 151, 0.22), transparent 40%),
    linear-gradient(160deg, var(--gf-brand-2), var(--gf-brand));
}

.gf-auth-brand .gf-logo {
  width: 3.5rem;
  height: 3.5rem;
}

.gf-auth-brand ul {
  color: rgba(255, 255, 255, 0.8);
}

.gf-auth-brand .bi {
  color: var(--gf-brand-accent);
}

.gf-auth-split .gf-auth-main {
  align-self: center;
}
