/*
 * Potisk výrobcem — konfigurátor v detailu produktu (assets/ballprint/factory.js,
 * templates/partials/factory-print-app.php).
 *
 * Vše pod `.gbf`, tokeny `--gbf-*` (stejné barvy jako konfigurátor našich tiskáren, widget.css):
 * blok stojí uvnitř detailu produktu v obou vzhledech eshopu (v1 Bootstrap, v2 gb.css) a nesmí
 * na nich záviset ani s nimi kolidovat. Dotykové cíle ≥ 44 px, fokus z klávesnice viditelný.
 * Písmo přebírá ze stránky (detail produktu má svoje), velikosti jen ze škály --gbf-fs-*.
 */
.gbf {
  --gbf-primary:     #092857;
  --gbf-cta:         #3a772e;   /* bílý text 5,4 : 1 */
  --gbf-cta-2:       #2e6425;
  --gbf-text:        #1d242d;
  --gbf-muted:       #4b5563;
  --gbf-surface:     #ffffff;
  --gbf-soft:        #f4f6f9;
  --gbf-line:        #cfd5dd;
  --gbf-line-soft:   #e3e7ec;
  --gbf-ok-bg:       #e5efdc;
  --gbf-ok-ink:      #2e6425;
  --gbf-warn-bg:     #fdf3dc;
  --gbf-warn-ink:    #6f5410;
  --gbf-bad-bg:      #fbe3e0;
  --gbf-bad-ink:     #8d1c10;
  --gbf-info-bg:     #e8eef7;
  --gbf-info-ink:    #1c3d6e;
  --gbf-gold:        #e4d9b1;   /* barva akce výrobce (bannery) */
  --gbf-navy:        #1f2140;
  --gbf-radius:      10px;
  --gbf-fs-xs:  13px;
  --gbf-fs-sm:  14px;
  --gbf-fs-md:  16px;
  --gbf-fs-lg:  20px;
  --gbf-fs-xl:  26px;

  color: var(--gbf-text);
  font-size: var(--gbf-fs-md);
  line-height: 1.45;
  text-align: left;
}
.gbf *, .gbf *::before, .gbf *::after { box-sizing: border-box; }
.gbf :where(h2, p, ol, ul, fieldset, legend) { margin: 0; padding: 0; }
.gbf :where(fieldset) { border: 0; min-width: 0; }
.gbf :where(button, input) { font-family: inherit; font-size: var(--gbf-fs-md); }
.gbf [hidden] { display: none !important; }
.gbf :focus-visible { outline: 3px solid rgba(58, 119, 46, 0.6); outline-offset: 2px; }
/* v1 (dist/css/styles.min.css) posouvá všechna radia a checkboxy relativně o −2 px */
.gbf input[type="checkbox"], .gbf input[type="radio"] { position: static; top: auto; }
.gbf-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.gbf-hp { position: absolute !important; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* ── náhled ── */
.gbf-stagebox { display: grid; gap: 10px; }
.gbf-stage {
  position: relative; width: 100%; aspect-ratio: 1 / 1; max-height: 78vh;
  background: radial-gradient(120% 90% at 50% 20%, #ffffff 0%, #eef1f5 62%, #dfe4ea 100%);
  border: 1px solid var(--gbf-line-soft); border-radius: var(--gbf-radius); overflow: hidden;
  touch-action: pan-y;
}
.gbf-stage__cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.gbf-stage__cv[id$="3d"] { cursor: grab; touch-action: none; }
.gbf-stage__cv[id$="3d"]:active { cursor: grabbing; }
.gbf-stage__photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; }
.gbf-stage__badge {
  position: absolute; right: 12px; top: 12px; padding: 4px 10px; border-radius: 999px;
  background: var(--gbf-primary); color: #fff; font-size: var(--gbf-fs-xs); font-weight: 700; letter-spacing: 0.02em;
}
.gbf-stage__hint {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); white-space: nowrap;
  padding: 4px 12px; border-radius: 999px; background: rgba(255, 255, 255, 0.86); color: var(--gbf-muted); font-size: var(--gbf-fs-xs);
}
.gbf-stage__msg { position: absolute; left: 12px; right: 12px; bottom: 44px; text-align: center; color: var(--gbf-muted); font-size: var(--gbf-fs-xs); }
.gbf-stage__msg:empty { display: none; }
.gbf-views { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.gbf-view {
  min-height: 44px; padding: 8px 14px; border: 1px solid var(--gbf-line); border-radius: 999px;
  background: var(--gbf-surface); color: var(--gbf-text); font-size: var(--gbf-fs-sm); font-weight: 600; cursor: pointer;
}
.gbf-view:hover { border-color: var(--gbf-primary); }
.gbf-view.is-active { background: var(--gbf-primary); border-color: var(--gbf-primary); color: #fff; }
.gbf-view--photo { padding: 2px; border-radius: 8px; width: 52px; height: 52px; overflow: hidden; }
.gbf-view--photo img { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: 6px; }
.gbf-view--photo.is-active { background: var(--gbf-surface); outline: 2px solid var(--gbf-primary); outline-offset: 1px; }
.gbf-note { color: var(--gbf-muted); font-size: var(--gbf-fs-xs); }
.gbf-stagebox--viewer .gbf-stage { max-width: 420px; }

/* ── zakázka v Můj účet a na děkovné stránce (templates/partials/factory-job-block.php) ── */
.gbf-job { display: grid; gap: 14px; padding: 16px 0; border-top: 1px solid var(--gbf-line-soft); }
.gbf-job:first-of-type { border-top: 0; padding-top: 0; }
.gbf-job__head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.gbf-job__title { margin: 0; font-size: var(--gbf-fs-lg); font-weight: 700; color: var(--gbf-primary); }
.gbf-job__no { font-weight: 400; color: var(--gbf-muted); font-size: var(--gbf-fs-md); }
.gbf-job__state { padding: 4px 10px; border-radius: 999px; background: var(--gbf-ok-bg); color: var(--gbf-ok-ink); font-size: var(--gbf-fs-sm); font-weight: 600; }
.gbf-job__state.is-off { background: var(--gbf-bad-bg); color: var(--gbf-bad-ink); }
.gbf-job__info { margin: 0; color: var(--gbf-text); }
.gbf-job__body { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 18px; align-items: start; }
.gbf-job__img { width: 220px; height: auto; border-radius: var(--gbf-radius); background: var(--gbf-soft); }
.gbf-job__spec { margin: 0; display: grid; gap: 10px; }
.gbf-job__spec dt { font-size: var(--gbf-fs-xs); color: var(--gbf-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.gbf-job__spec dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.gbf-job__acts { margin: 0; }
.gbf-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; counter-reset: gbfstep; }
.gbf-steps li { counter-increment: gbfstep; padding: 8px 6px 0; border-top: 4px solid var(--gbf-line); font-size: var(--gbf-fs-xs); color: var(--gbf-muted); text-align: center; }
.gbf-steps li.is-done { border-top-color: var(--gbf-cta); color: var(--gbf-ok-ink); }
.gbf-steps li.is-current { border-top-color: var(--gbf-primary); color: var(--gbf-primary); font-weight: 700; }
@media (max-width: 640px) {
  .gbf-job__body { grid-template-columns: minmax(0, 1fr); }
}

/* ── přepínač v detailu míčku: nákup bez potisku × konfigurátor ──
   Třída gbf-on na <html> (factory.js; odkaz #personalizace ji nastaví už skript v <head> šablony detailu)
   ukáže části data-gbf-factory (scéna, formulář — partials/factory-print-app.php) a schová prvky běžného
   nákupu data-gbf-plain (galerie, dostupnost, cena, „Do košíku“ i plovoucí lišty, náš potisk). */
html:not(.gbf-on) [data-gbf-factory], html.gbf-on [data-gbf-plain] { display: none !important; }
.gbf-mode { display: grid; gap: 8px; min-width: 0; margin: 0; padding: 0; border: 0; }
.pd-buy > .gbf-mode { margin-top: var(--gb-sp-lg, 20px); }
/* v4 staví cenu hned pod název (gb4.css) — volba „s potiskem / bez“ je nad ní */
body.v4 .pd-buy > .gbf-mode { order: -2; }
.gbf-mode .gbf-seg { display: grid; grid-template-columns: 1fr 1fr; }
.gbf-mode .gbf-seg__opt span { justify-content: center; width: 100%; height: 100%; text-align: center; }
/* volba akce výrobce v barvách jeho bannerů */
.gbf-mode .gbf-seg__opt input[value="factory"]:checked + span { border-color: var(--gbf-navy); box-shadow: none; background: var(--gbf-navy); color: var(--gbf-gold); }
.gbf-mode__hint { margin: 0; color: var(--gbf-muted); font-size: var(--gbf-fs-sm); }

/* ── nákupní část ── */
.gbf-buy { display: grid; gap: 14px; }
/* v2–v4: blok stojí v nákupním sloupci pod přepínačem — odstup jako dostupnost běžné karty */
.pd-buy > .gbf-buy { margin-top: var(--gb-sp-lg, 20px); }
.gbf-form { display: grid; gap: 18px; }
.gbf-field { display: grid; gap: 8px; }
.gbf .gbf-label { display: block; font-size: var(--gbf-fs-sm); font-weight: 700; color: var(--gbf-text); float: none; width: auto; }
/* úvod pole textu: co psát a kdo to tiskne */
.gbf-desc { margin-top: -2px; font-size: var(--gbf-fs-sm); color: var(--gbf-text); }
.gbf-hint { color: var(--gbf-muted); font-size: var(--gbf-fs-xs); }
.gbf-hint--note { color: var(--gbf-info-ink); }

.gbf-models { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 8px; }
.gbf a.gbf-model {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; min-height: 68px; padding: 6px 10px 6px 6px; align-items: center;
  border: 1px solid var(--gbf-line); border-radius: 8px; background: var(--gbf-surface); color: var(--gbf-text); text-decoration: none;
}
.gbf-model__img { width: 56px; height: 56px; object-fit: contain; border-radius: 6px; background: #fff; }
.gbf-model__txt { display: grid; gap: 2px; min-width: 0; }
.gbf a.gbf-model:hover { border-color: var(--gbf-primary); }
.gbf a.gbf-model.is-active { border-color: var(--gbf-primary); box-shadow: inset 0 0 0 1px var(--gbf-primary); background: var(--gbf-info-bg); }
.gbf-model__name { font-weight: 700; font-size: var(--gbf-fs-sm); }
.gbf-model__price { color: var(--gbf-muted); font-size: var(--gbf-fs-xs); }
/* doporučená cena přeškrtnutá vedle naší (dlaždice modelu, řádek míčků v ceně) */
.gbf-was { color: var(--gbf-muted); font-weight: 400; }

.gbf-seg { display: flex; flex-wrap: wrap; gap: 8px; }
.gbf-seg__opt { position: relative; cursor: pointer; margin: 0; }
.gbf .gbf-seg__opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.gbf-seg__opt span { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 14px; border: 1px solid var(--gbf-line); border-radius: 8px; background: var(--gbf-surface); font-size: var(--gbf-fs-sm); font-weight: 600; }
.gbf-seg__opt input:checked + span { border-color: var(--gbf-primary); box-shadow: inset 0 0 0 1px var(--gbf-primary); background: var(--gbf-info-bg); }
.gbf-seg__opt input:focus-visible + span { outline: 3px solid rgba(58, 119, 46, 0.6); outline-offset: 2px; }

/* nahrání loga */
.gbf-upload { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.gbf-upload__name { font-weight: 600; word-break: break-all; }
.gbf-upload .gbf-sr:focus-visible + .gbf-btn { outline: 3px solid rgba(58, 119, 46, 0.6); outline-offset: 2px; }
.gbf-field--in { margin: 14px 0 0; padding: 0; border: 0; }
.gbf-seg--stack { flex-direction: column; align-items: stretch; }
.gbf-seg--stack .gbf-seg__opt span { display: flex; }
.gbf-swatch { display: inline-block; width: 14px; height: 14px; margin-right: 8px; border-radius: 50%; flex: none; }
/* výrobce tiskne text tak, jak je napsaný — pole nesmí předstírat verzálky */
.gbf.gbf--mixed .gbf-input { text-transform: none; letter-spacing: 0.01em; }
.gbf-line { display: grid; gap: 4px; }
.gbf-inputwrap { position: relative; }
.gbf .gbf-input {
  width: 100%; min-height: 48px; padding: 10px 64px 10px 14px; margin: 0;
  border: 1px solid var(--gbf-line); border-radius: 8px; background: var(--gbf-surface); color: var(--gbf-text);
  font-size: 18px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; box-shadow: none; height: auto;
}
.gbf .gbf-input::placeholder { font-weight: 400; letter-spacing: normal; text-transform: none; color: #6b7280; }
.gbf .gbf-input:focus { border-color: var(--gbf-primary); outline: none; box-shadow: 0 0 0 3px rgba(9, 40, 87, 0.15); }
.gbf .gbf-input[aria-invalid="true"] { border-color: var(--gbf-bad-ink); background: #fffafa; }
.gbf .gbf-input--short { width: 96px; padding-right: 14px; }
.gbf-count { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--gbf-muted); font-size: var(--gbf-fs-xs); font-variant-numeric: tabular-nums; pointer-events: none; }
.gbf-count.is-over { color: var(--gbf-bad-ink); font-weight: 700; }
.gbf-err { color: var(--gbf-bad-ink); font-size: var(--gbf-fs-sm); }

.gbf-qty { display: flex; align-items: center; gap: 0; flex-wrap: wrap; }
.gbf .gbf-qty__btn {
  width: 48px; height: 48px; border: 1px solid var(--gbf-line); background: var(--gbf-soft); color: var(--gbf-text);
  font-size: 22px; line-height: 1; cursor: pointer; padding: 0;
}
.gbf .gbf-qty__btn:first-child { border-radius: 8px 0 0 8px; }
.gbf .gbf-qty__btn:nth-of-type(2) { border-radius: 0 8px 8px 0; }
.gbf .gbf-qty__btn:hover { background: #e7ebf0; }
.gbf .gbf-qty__in {
  width: 64px; height: 48px; margin: 0; padding: 0 4px; text-align: center; border: 1px solid var(--gbf-line); border-left: 0; border-right: 0; border-radius: 0;
  background: var(--gbf-surface); color: var(--gbf-text); font-size: 18px; font-weight: 700; -moz-appearance: textfield; appearance: textfield; box-shadow: none;
}
.gbf .gbf-qty__in::-webkit-outer-spin-button, .gbf .gbf-qty__in::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.gbf-qty__unit { margin-left: 12px; color: var(--gbf-muted); font-size: var(--gbf-fs-sm); }

.gbf-price { border: 1px solid var(--gbf-line-soft); border-radius: var(--gbf-radius); background: var(--gbf-soft); padding: 14px 16px; display: grid; gap: 6px; }
.gbf-price__row { display: flex; justify-content: space-between; gap: 16px; font-size: var(--gbf-fs-sm); }
.gbf-price__row span:last-child { white-space: nowrap; font-weight: 600; }
.gbf-price__row.is-free span:last-child { color: var(--gbf-ok-ink); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 700; }
.gbf-price__total { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding-top: 8px; border-top: 1px solid var(--gbf-line); font-weight: 700; }
.gbf-price__total > span:last-child { text-align: right; display: grid; }
.gbf-price__total strong { font-size: var(--gbf-fs-xl); line-height: 1.15; color: var(--gbf-primary); white-space: nowrap; }
.gbf-price__total small { font-size: var(--gbf-fs-xs); font-weight: 400; color: var(--gbf-muted); }


.gbf .gbf-submit {
  display: inline-flex; align-items: center; justify-content: center; width: 100%; min-height: 54px; padding: 12px 20px;
  border: 0; border-radius: 8px; background: var(--gbf-cta); color: #fff; font-size: 18px; font-weight: 700; text-decoration: none; cursor: pointer;
}
.gbf .gbf-submit:hover { background: var(--gbf-cta-2); color: #fff; }
.gbf .gbf-submit:disabled { opacity: 0.7; cursor: progress; }
.gbf .gbf-btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 54px; padding: 12px 20px;
  border: 1px solid var(--gbf-primary); border-radius: 8px; background: var(--gbf-surface); color: var(--gbf-primary); font-weight: 700; cursor: pointer;
}

.gbf-alert { padding: 10px 14px; border-radius: 8px; font-size: var(--gbf-fs-sm); }
.gbf-alert--info { background: var(--gbf-info-bg); color: var(--gbf-info-ink); }
.gbf-alert--warn { background: var(--gbf-warn-bg); color: var(--gbf-warn-ink); }
.gbf-alert--bad  { background: var(--gbf-bad-bg); color: var(--gbf-bad-ink); }

.gbf-success { padding: 16px; border-radius: var(--gbf-radius); background: var(--gbf-ok-bg); color: var(--gbf-ok-ink); display: grid; gap: 8px; }
.gbf-success:focus { outline: none; }
.gbf-success__title { font-size: var(--gbf-fs-lg); font-weight: 700; }
.gbf-success__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }

.gbf-facts { list-style: none; display: grid; gap: 6px; font-size: var(--gbf-fs-sm); }
.gbf-facts li { position: relative; padding-left: 26px; }
.gbf-facts li::before { content: "✓"; position: absolute; left: 4px; top: 0; color: var(--gbf-ok-ink); font-weight: 700; }
.gbf-facts li.is-muted { color: var(--gbf-muted); }
.gbf-facts li.is-muted::before { content: "•"; color: var(--gbf-muted); }

.gbf-terms { border-top: 1px solid var(--gbf-line-soft); padding-top: 10px; font-size: var(--gbf-fs-sm); }
.gbf-terms summary { cursor: pointer; font-weight: 700; color: var(--gbf-primary); min-height: 44px; display: flex; align-items: center; }
.gbf-terms ol { display: grid; gap: 6px; padding-left: 20px; color: var(--gbf-muted); }

/* jiná možnost pod nákupem: náš vlastní potisk */
.gbf-alt { display: grid; gap: 6px; padding: 12px 14px; border-radius: var(--gbf-radius); background: var(--gbf-soft); font-size: var(--gbf-fs-sm); }
.gbf-alt__title { font-size: var(--gbf-fs-xs); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gbf-muted); }
.gbf-alt a { color: var(--gbf-primary); font-weight: 600; text-decoration: underline; }
.gbf-alt a:hover { text-decoration-thickness: 2px; }
.gbf-alt a.gbf-alt__cta { white-space: nowrap; }

@media (max-width: 520px) {
  .gbf-success__actions { grid-template-columns: 1fr; }
  .gbf-qty__unit { flex-basis: 100%; margin: 6px 0 0; }
}
