/* =========================================================================
   mioweb — vzhľad konfigurátora (nie náhľadu, ten je v preview.css).
   Biely podklad, jedna akcentová farba, žiadny framework.

   Rozloženie podľa zadania:
     ≥1280 px  panel vľavo, presne 20 % šírky obrazovky, náhľad zaberie zvyšok
     <1280 px  panel hore cez celú šírku (mobil, tablet), náhľad pod ním

   Mobil má iný model scrollovania než desktop a je to zámer:
     desktop  panel má výšku obrazovky a vnútri seba scrolluje telo formulára
     mobil    panel tečie v dokumente, scrolluje sa celá stránka, hlavička
              a pätička sú sticky. Vnorený scroll s pevnou výškou panela tu
              nechať nemožno — hlavička + pätička zjedia celú výšku a na
              formulár zostane pár desiatok pixelov.
   ========================================================================= */

:root {
  --c-bg: #ffffff;
  --c-surface: #f7f8fa;
  --c-surface-2: #eef1f5;
  --c-line: #e3e7ec;
  --c-text: #11161d;
  --c-muted: #5d6673;
  --c-brand: #1d4ed8;
  --c-brand-soft: #eaf0ff;
  --c-ok: #0f7b4f;
  --c-ok-soft: #e7f6ee;
  --c-warn: #a15c00;
  --c-err: #b42318;
  --c-err-soft: #fdecea;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --panel-w: 20vw;
  --panel-min: 260px;
  /* Dotykový cieľ: 44 px je minimum podľa WCAG 2.2 (2.5.8) aj iOS HIG.
     Na desktope stačí 40 px — myš trafí aj menší cieľ. */
  --tap: 44px;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }

/* .btn má display:inline-flex, ktoré prebije display:none z UA štýlu pre
   [hidden]. Bez tohto riadku svieti „Späť“ v prvom kroku a „Pokračovať“
   v poslednom, hoci ich JS schoval. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--c-surface-2);
  color: var(--c-text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--c-text);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 var(--r-sm) 0;
}
.skip-link:focus { left: 0; }

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid var(--c-brand);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* ------------------------------- kostra ------------------------------- */

.shell {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.panel {
  display: flex;
  flex-direction: column;
  background: var(--c-bg);
  border-bottom: 1px solid var(--c-line);
}

.panel__head {
  padding: 10px 16px 0;
  border-bottom: 1px solid var(--c-line);
  background: var(--c-bg);
  position: sticky;
  top: 0;
  z-index: 20;
}

.panel__bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.brand { display: flex; align-items: center; gap: 9px; min-width: 0; }

.brand__mark {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--c-brand);
  color: #fff;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex: none;
}

.brand__text { font-weight: 650; letter-spacing: -0.01em; }
.brand__text small { display: block; font-weight: 400; font-size: 11px; color: var(--c-muted); letter-spacing: 0.04em; text-transform: uppercase; }

.panel__toggle {
  flex: none;
  min-height: 36px;
  padding: 4px 14px;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
}

.steps { margin: 9px 0 8px; }
.steps__list { display: flex; gap: 4px; flex-wrap: wrap; font-size: 12px; }

/* Sedem dlaždíc s názvami krokov sa na telefóne láme do štyroch riadkov
   a zje výšku, ktorú potrebuje formulár. Na mobile ich nahrádza jeden
   riadok „Krok 3 zo 7 · Riešenie“; zoznam sa vracia až na desktope. */
.steps__list { display: none; }

.steps__compact {
  display: flex;
  align-items: baseline;
  gap: 7px;
  font-size: 12.5px;
  color: var(--c-muted);
}
.steps__compact b { color: var(--c-text); font-weight: 650; }

.steps__item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px 3px 4px;
  border-radius: 999px;
  color: var(--c-muted);
  background: transparent;
  border: 0;
  cursor: pointer;
  min-height: 28px;
}
.steps__item[disabled] { cursor: default; opacity: 0.55; }
.steps__item .dot {
  width: 20px; height: 20px; flex: none;
  border-radius: 50%;
  background: var(--c-surface-2);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 650;
}
.steps__item.is-done .dot { background: var(--c-ok-soft); color: var(--c-ok); }
.steps__item.is-current { background: var(--c-brand-soft); color: var(--c-brand); font-weight: 600; }
.steps__item.is-current .dot { background: var(--c-brand); color: #fff; }

.progress { height: 3px; background: var(--c-surface-2); border-radius: 2px; overflow: hidden; }
.progress__bar { height: 100%; width: 0; background: var(--c-brand); transition: width 0.25s ease; }

.panel__body {
  padding: 16px;
  flex: 1 1 auto;
}
.panel.is-collapsed .panel__body,
.panel.is-collapsed .panel__foot { display: none; }

.step__title { font-size: 20px; letter-spacing: -0.015em; margin-bottom: 4px; }
.step__lead { color: var(--c-muted); font-size: 14px; margin-bottom: 14px; }

.panel__foot {
  border-top: 1px solid var(--c-line);
  padding: 9px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--c-bg);
  position: sticky;
  bottom: 0;
  z-index: 15;
  box-shadow: 0 -6px 16px rgba(16, 24, 40, 0.06);
}

.panel__actions { display: flex; gap: 8px; }
.panel__note { font-size: 11.5px; color: var(--c-muted); margin-top: 8px; }

/* ------------------------------- tlačidlá ------------------------------ */

.btn {
  min-height: var(--tap);
  padding: 0 16px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.btn--primary { background: var(--c-brand); color: #fff; flex: 1 1 auto; }
.btn--primary:hover:not(:disabled) { background: #1a43b8; }
.btn--ghost { background: var(--c-bg); border-color: var(--c-line); color: var(--c-text); }
.btn--ghost:hover:not(:disabled) { background: var(--c-surface); }
.btn--sm { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn--block { width: 100%; }

.link-btn {
  background: none; border: 0; padding: 4px 2px;
  /* WCAG 2.2 (2.5.8) žiada cieľ aspoň 24 px — samotný text má 17 px. */
  min-height: 24px;
  color: var(--c-brand); text-decoration: underline; cursor: pointer; font-size: inherit;
}

/* ----------------------------- formulárové polia ----------------------- */

.field { margin-bottom: 14px; }
.field__label { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 5px; }
.field__hint { font-size: 12px; color: var(--c-muted); margin-top: 4px; }
.field__req { color: var(--c-err); }

.input, .select, .textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 8px 11px;
  background: var(--c-bg);
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  /* Safari na iOS priblíži stránku, keď má pole písmo menšie než 16 px,
     a po priblížení sa rozpadne celé rozloženie. Preto 16 px na mobile. */
  font-size: 16px;
}
.textarea { min-height: 80px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--c-brand); }
.input[aria-invalid="true"] { border-color: var(--c-err); background: var(--c-err-soft); }

.input-row { display: flex; gap: 8px; flex-wrap: wrap; }
.input-row .input { flex: 1 1 11em; min-width: 0; }
.input-row .btn { flex: 0 0 auto; }

fieldset { border: 0; margin: 0 0 16px; padding: 0; }
legend { font-weight: 600; font-size: 13.5px; padding: 0; margin-bottom: 7px; }

/* ------------------------- voľby (karty, dlaždice) --------------------- */

.options { display: grid; gap: 7px; }
.options--2 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

.option {
  display: block;
  position: relative;
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  padding: 11px 12px;
  min-height: var(--tap);
  cursor: pointer;
  background: var(--c-bg);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.option:hover { border-color: #c4ccd8; background: var(--c-surface); }
.option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.option__name { font-weight: 600; font-size: 14px; display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; }
.option__note { font-size: 12.5px; color: var(--c-muted); margin-top: 2px; display: block; }
.option__bullets { margin-top: 6px; font-size: 12.5px; color: var(--c-muted); }
.option__bullets li { padding-left: 13px; position: relative; }
.option__bullets li::before { content: "–"; position: absolute; left: 0; }
.option__price { font-size: 12px; font-weight: 600; color: var(--c-brand); white-space: nowrap; }

.option:has(input:checked) { border-color: var(--c-brand); background: var(--c-brand-soft); box-shadow: inset 0 0 0 1px var(--c-brand); }
.option:has(input:focus-visible) { outline: 3px solid var(--c-brand); outline-offset: 2px; }

/* paleta */
.palettes { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.palette { padding: 9px; }
.palette__swatches { display: flex; gap: 3px; margin-bottom: 6px; }
.palette__swatches span { height: 20px; flex: 1; border-radius: 3px; border: 1px solid rgba(0, 0, 0, 0.07); }
.palette__name { font-size: 13px; font-weight: 600; display: block; }
.palette__note { font-size: 11.5px; color: var(--c-muted); line-height: 1.35; display: block; }

.color-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.color-field { display: flex; align-items: center; gap: 7px; font-size: 12.5px; }
.color-field input[type="color"] { width: 38px; height: 34px; padding: 2px; border: 1px solid var(--c-line); border-radius: var(--r-sm); background: var(--c-bg); cursor: pointer; }

/* zaškrtávacie polia */
.check {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding: 11px 12px;
  min-height: var(--tap);
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  cursor: pointer;
  background: var(--c-bg);
  margin-bottom: 7px;
}
.check > span { display: block; min-width: 0; }
.check:hover { background: var(--c-surface); }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--c-brand); flex: none; }
.check__name { font-weight: 600; font-size: 13.5px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; }
.check__desc { font-size: 12px; color: var(--c-muted); line-height: 1.4; margin-top: 2px; display: block; }
.check:has(input:checked) { border-color: var(--c-brand); background: var(--c-brand-soft); }
.check:has(input:disabled) { background: var(--c-ok-soft); border-color: #cdebdb; cursor: default; }
.check:has(input:disabled) .check__name { color: var(--c-ok); }

.group { margin-bottom: 18px; }
.group__title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--c-muted); margin-bottom: 7px; }

/* ------------------------------ domény --------------------------------- */

.domains { display: grid; gap: 6px; }
.domain {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  min-height: var(--tap);
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  cursor: pointer;
  background: var(--c-bg);
}
.domain > span { display: block; min-width: 0; }
.domain input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.domain:has(input:checked) { border-color: var(--c-brand); background: var(--c-brand-soft); }
.domain[data-state="taken"] { opacity: 0.55; cursor: not-allowed; background: var(--c-surface); }
.domain__name { font-weight: 600; font-size: 14px; word-break: break-word; display: block; }
.domain__note { font-size: 12px; color: var(--c-muted); display: block; }
.tag {
  font-size: 11px;
  font-weight: 650;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
}
.tag--free { background: var(--c-ok-soft); color: var(--c-ok); }
.tag--taken { background: var(--c-surface-2); color: var(--c-muted); }
.tag--unknown { background: #fff6e5; color: var(--c-warn); }
.tag--reco { background: var(--c-brand-soft); color: var(--c-brand); }

/* ------------------------ WordPress šablóny ---------------------------- */

.themes { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.theme { padding: 0; overflow: hidden; }
.theme img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; object-position: top center; display: block; background: var(--c-surface-2); }
.theme__meta { padding: 7px 8px; }
.theme__name { font-size: 12.5px; font-weight: 600; }
.theme__author { font-size: 11px; color: var(--c-muted); }

/* ------------------------------ rôzne ---------------------------------- */

.alert { padding: 10px 12px; border-radius: var(--r-md); font-size: 13px; margin-top: 12px; }
.alert--error { background: var(--c-err-soft); color: var(--c-err); border: 1px solid #f3c6c2; }
.alert--info { background: var(--c-brand-soft); color: #12307f; border: 1px solid #cdddff; }
.alert--ok { background: var(--c-ok-soft); color: var(--c-ok); border: 1px solid #cdebdb; }
.alert ul { margin-top: 5px; }
.alert li { padding-left: 14px; position: relative; }
.alert li::before { content: "•"; position: absolute; left: 2px; }

/* Rozpis ceny má na telefóne osem riadkov a sám by zabral polovicu
   obrazovky. V pätičke preto zostáva len jeden riadok so sumou; rozpis
   sa rozbalí klepnutím. Na desktope je rozpis vidieť stále. */
.quote__bar {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: var(--tap);
  padding: 0 12px;
  margin-bottom: 8px;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  cursor: pointer;
  text-align: left;
}
.quote__bar-label { font-size: 12.5px; color: var(--c-muted); }
.quote__bar-value { margin-left: auto; font-weight: 700; font-size: 14px; white-space: nowrap; }
.quote__bar-chevron { flex: none; color: var(--c-muted); transition: transform 0.15s ease; }
.quote__bar-chevron::before { content: "▾"; }
.panel.is-quote-open .quote__bar-chevron { transform: rotate(180deg); }

.panel__foot .quote { display: none; }
.panel.is-quote-open .panel__foot .quote {
  display: block;
  max-height: 38dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.quote { font-size: 12.5px; margin-bottom: 9px; }
.quote__row { display: flex; justify-content: space-between; gap: 10px; color: var(--c-muted); }
.quote__total { display: flex; justify-content: space-between; font-weight: 700; font-size: 15px; color: var(--c-text); padding-top: 5px; border-top: 1px solid var(--c-line); margin-top: 5px; }
.quote__note { font-size: 11px; color: var(--c-muted); margin-top: 3px; }

.summary { font-size: 13px; border: 1px solid var(--c-line); border-radius: var(--r-md); overflow: hidden; margin-bottom: 14px; }
.summary__row { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 2px 12px; padding: 8px 11px; border-bottom: 1px solid var(--c-line); }
.summary__row:last-child { border-bottom: 0; }
.summary__row dt { color: var(--c-muted); flex: none; }
.summary__row dd { margin: 0; text-align: right; font-weight: 600; min-width: 0; word-break: break-word; }

.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid var(--c-line);
  border-top-color: var(--c-brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading { font-size: 12.5px; color: var(--c-muted); display: flex; align-items: center; gap: 8px; padding: 10px 0; }

/* ------------------------------ náhľad --------------------------------- */

.stage {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--c-surface-2);
}

.stage__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 10px;
  padding: 9px 12px;
  flex-wrap: wrap;
  background: var(--c-surface-2);
}
.stage__label { font-size: 12px; color: var(--c-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.stage__label span { text-transform: none; letter-spacing: 0; font-weight: 400; margin-left: 8px; }
.stage__devices { display: flex; gap: 4px; }

.chip {
  min-height: 32px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--c-line);
  background: var(--c-bg);
  font-size: 12.5px;
  cursor: pointer;
}
.chip.is-active { background: var(--c-text); color: #fff; border-color: var(--c-text); }

.stage__canvas {
  flex: 1 1 auto;
  padding: 0 12px 16px;
  overflow: auto;
  overscroll-behavior: contain;
  display: flex;
  justify-content: center;
  /* Náhľad celej stránky má aj 2 500 px. Keby tiekol v dokumente, používateľ
     by sa k ničomu pod ním nedostal — na mobile je to vlastné okno. */
  max-height: 72dvh;
}

.device {
  background: #fff;
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  overflow: hidden;
  width: 100%;
  box-shadow: 0 10px 30px rgba(16, 24, 40, 0.07);
  align-self: flex-start;
  transition: max-width 0.25s ease;
}
.device--desktop { max-width: none; }
.device--tablet { max-width: 820px; }
.device--mobile { max-width: 390px; }

/* ------------------------------- modal --------------------------------- */

/* Dialóg je flex stĺpec: hlavička má pevnú výšku, telo dostane zvyšok.
   Pôvodné max-height: calc(85dvh - 56px) na tele rátalo s jednoriadkovou
   hlavičkou — na telefóne sa nadpis zalomí, hlavička narastie a text
   právneho dokumentu vytiekol pod spodnú hranu okna. */
.modal {
  border: 0;
  border-radius: var(--r-lg);
  padding: 0;
  width: min(760px, 94vw);
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(16, 24, 40, 0.22);
}
.modal:not([open]) { display: none; }
.modal::backdrop { background: rgba(16, 24, 40, 0.45); }
.modal__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--c-line); background: var(--c-bg); flex: none; }
.modal__head h2 { font-size: 15px; line-height: 1.3; }
.modal__head .btn { flex: none; }
.modal__body { padding: 14px 16px calc(20px + env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain; flex: 1 1 auto; min-height: 0; font-size: 14px; line-height: 1.65; }
.modal__body h3 { font-size: 14px; margin: 18px 0 6px; }
.modal__body p, .modal__body li { margin-bottom: 8px; color: #243041; }
.modal__body ol, .modal__body ul { padding-left: 20px; list-style: revert; }

/* =============================== desktop =============================== */

@media (min-width: 1280px) {
  :root { --tap: 40px; }

  .shell { flex-direction: row; height: 100dvh; }

  .panel {
    /* Zadanie: konfigurátor najviac 20 % šírky obrazovky. */
    width: var(--panel-w);
    max-width: var(--panel-w);
    min-width: var(--panel-min);
    height: 100dvh;
    border-right: 1px solid var(--c-line);
    border-bottom: 0;
  }

  /* Na desktope scrolluje telo panela, nie stránka — hlavička a pätička
     držia samy od seba, sticky netreba. */
  .panel__head { position: static; padding: 12px 16px 0; }
  .panel__body { overflow-y: auto; overscroll-behavior: contain; }
  .panel__foot { position: static; box-shadow: none; padding: 10px 16px 14px; }

  .steps__list { display: flex; }
  .steps__compact { display: none; }

  .quote__bar { display: none; }
  .panel__foot .quote,
  .panel.is-quote-open .panel__foot .quote { display: block; max-height: none; overflow: visible; }

  .input, .select, .textarea { font-size: 14px; }

  .panel__toggle { display: none; }
  .panel.is-collapsed .panel__body, .panel.is-collapsed .panel__foot { display: revert; }
  .stage { height: 100dvh; }
  .stage__bar { padding: 9px 16px; }
  .stage__canvas { padding: 0 24px 24px; max-height: none; }
  .options--2, .palettes, .color-grid { grid-template-columns: 1fr; }
}

@media (min-width: 1700px) {
  .options--2, .palettes { grid-template-columns: 1fr 1fr; }
}

/* ============================ malé obrazovky =========================== */

@media (max-width: 400px) {
  .themes { grid-template-columns: 1fr; }
  .stage__canvas { padding: 0 8px 10px; }
  .panel__body { padding: 14px 12px; }
  .panel__head, .panel__foot { padding-left: 12px; padding-right: 12px; }
}

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

@media print {
  .panel, .stage__bar { display: none; }
}
