/* ==========================================================================
   Pokladna – barvy se přebírají z administrace (Nastavení → Vzhled pokladny)
   přes CSS proměnné --primary, --accent, --bg, --text, --radius.
   ========================================================================== */
:root {
  /* Výchozí = vizuál BCG; administrace je přepisuje (Nastavení → Vzhled pokladny) */
  --primary: #075092;
  --accent: #075092;
  --bg: #f5f6f8;
  --text: #0e1627;
  --radius: 0px;
  --head-font: "Plus Jakarta Sans", "Montserrat", "Segoe UI", sans-serif;
  --card: #ffffff;
  --muted: #6b7280;
  --border: #e3e6eb;
  --error: #c62828;
  --ok: #1b7f4b;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .06);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 "Montserrat", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body.embed { background: transparent; }
a { color: var(--primary); }
button, input, select, textarea { font: inherit; color: inherit; }

.app { max-width: 1120px; margin: 0 auto; padding: 24px 16px 48px; }
.embed .app { padding: 8px 0 16px; }

/* --- hlavička ------------------------------------------------------------ */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 24px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; color: var(--text); text-decoration: none; }
.brand img { max-height: 40px; max-width: 180px; }
.back { font-size: 14px; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--primary); }
.steps { display: flex; gap: 6px; font-size: 13px; color: var(--muted); }
.steps b { color: var(--text); }
.test-banner { background: #fff4d6; color: #7a5300; border: 1px solid #f3d27a; border-radius: var(--radius); padding: 8px 14px; font-size: 13px; margin-bottom: 16px; text-align: center; }

/* --- rozložení ----------------------------------------------------------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } .summary { position: static !important; } }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.card + .card { margin-top: 16px; }
.card h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; font-size: 17px; }
.card h2 .num { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 13px; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.grid .full { grid-column: 1 / -1; }
@media (max-width: 560px) { .grid { grid-template-columns: 1fr; } }

/* --- formulář ------------------------------------------------------------ */
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.field .opt { color: var(--muted); font-weight: 400; }
.field input, .field textarea {
  width: 100%; padding: 11px 13px; border: 1px solid var(--border); border-radius: calc(var(--radius) * .7);
  background: #fff; outline: none; transition: border-color .15s, box-shadow .15s;
}
.field textarea { min-height: 80px; resize: vertical; }
.field input:focus, .field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent); }
.field.invalid input, .field.invalid textarea { border-color: var(--error); }
.field .err, .block-err { color: var(--error); font-size: 13px; margin-top: 5px; }
.block-err:empty, .field .err:empty { display: none; }

.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--primary); flex: none; }
.check-small { margin-top: 10px; font-size: 12.5px; color: var(--muted, #6b7280); }
.check-small input { width: 16px; height: 16px; }

/* --- volby dopravy / platby -------------------------------------------- */
.options { display: grid; gap: 10px; }
.option {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1.5px solid var(--border);
  border-radius: var(--radius); cursor: pointer; background: #fff; transition: border-color .15s, background .15s;
}
.option:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.option.selected { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 4%, #fff); }
.option input { margin-top: 3px; accent-color: var(--primary); width: 18px; height: 18px; flex: none; }
.option .body { flex: 1; min-width: 0; }
.option .title { display: flex; justify-content: space-between; gap: 12px; font-weight: 600; }
.option .price { white-space: nowrap; }
.option .price.free { color: var(--ok); }
.option .desc { color: var(--muted); font-size: 13px; margin-top: 2px; }
.carrier { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .4px; padding: 2px 7px; border-radius: 6px; margin-right: 6px; vertical-align: 1px; }
.carrier.packeta { background: #fde8e3; color: #b8321a; }
.carrier.ppl { background: #e3ecfb; color: #0d3d91; }

.point { margin-top: 10px; padding: 10px 12px; border-radius: calc(var(--radius) * .7); background: var(--bg); font-size: 14px; display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.point strong { display: block; }
.point .addr { color: var(--muted); font-size: 13px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer;
  border-radius: calc(var(--radius) * .8); padding: 11px 18px; font-weight: 600; text-decoration: none; transition: filter .15s, opacity .15s;
}
.btn:hover { filter: brightness(1.07); }
.btn:disabled { opacity: .6; cursor: not-allowed; filter: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-secondary { background: var(--primary); color: #fff; }
.btn-ghost { background: transparent; color: var(--primary); border: 1.5px solid var(--border); }
.btn-small { padding: 7px 12px; font-size: 13px; }
.btn-block { width: 100%; padding: 15px 18px; font-size: 16px; }

/* --- souhrn -------------------------------------------------------------- */
.summary { position: sticky; top: 16px; }
.items { list-style: none; margin: 0 0 14px; padding: 0; }
.item { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); align-items: center; }
.item:first-child { padding-top: 0; }
.item img, .item .ph { width: 56px; height: 56px; border-radius: calc(var(--radius) * .6); object-fit: cover; background: var(--bg); }
.item .name { font-weight: 600; font-size: 14px; line-height: 1.35; }
.item .unit { color: var(--muted); font-size: 12px; }
.item .warn { color: var(--error); font-size: 12px; }
.item .right { text-align: right; }
.item .line { font-weight: 600; white-space: nowrap; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 999px; margin-top: 6px; }
.qty button { width: 28px; height: 28px; border: 0; background: none; cursor: pointer; font-size: 16px; line-height: 1; color: var(--primary); }
.qty span { min-width: 24px; text-align: center; font-size: 14px; }
.remove { border: 0; background: none; color: var(--muted); font-size: 12px; cursor: pointer; padding: 4px 0 0; text-decoration: underline; }

.discount { display: flex; gap: 8px; margin: 4px 0 6px; }
.discount input { flex: 1; min-width: 0; padding: 9px 12px; border: 1px solid var(--border); border-radius: calc(var(--radius) * .7); text-transform: uppercase; }
.discount-msg { font-size: 13px; min-height: 0; }
.discount-msg.ok { color: var(--ok); }
.discount-msg.bad { color: var(--error); }

.totals { margin: 14px 0; font-size: 14px; }
.totals .row { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; color: var(--muted); }
.totals .row span:last-child { color: var(--text); white-space: nowrap; }
.totals .row.discount-row span:last-child { color: var(--ok); }
.totals .total { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 12px; font-size: 19px; font-weight: 700; color: var(--text); }
.totals .total span { color: var(--text) !important; }
.freebar { font-size: 13px; margin: 6px 0 4px; color: var(--muted); }
.freebar .bar { height: 6px; background: var(--bg); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.freebar .bar i { display: block; height: 100%; background: var(--ok); border-radius: 99px; }
.freebar.done { color: var(--ok); font-weight: 600; }

.legal { font-size: 12px; color: var(--muted); margin-top: 10px; text-align: center; }
.secure { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 12px; color: var(--muted); margin-top: 10px; }

.alert { padding: 12px 14px; border-radius: var(--radius); font-size: 14px; margin-bottom: 14px; }
.alert.error { background: #fdecec; color: var(--error); border: 1px solid #f5c2c2; }
.alert.info { background: #eef4fd; color: #1e4b8f; border: 1px solid #c9dbf6; }
.alert.ok { background: #e8f6ee; color: var(--ok); border: 1px solid #bfe5cf; }

/* --- prázdný košík / stav objednávky ----------------------------------- */
.center { max-width: 640px; margin: 0 auto; }
.empty { text-align: center; padding: 48px 24px; }
.empty .icon, .status-icon { width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 50%; display: grid; place-items: center; background: var(--bg); font-size: 28px; }
.status-icon.ok { background: #e8f6ee; color: var(--ok); }
.status-icon.wait { background: #fff4d6; color: #a06d00; }
.status-icon.bad { background: #fdecec; color: var(--error); }
.order-head { text-align: center; padding: 8px 0 4px; }
.order-head h1 { margin: 0 0 6px; font-size: 24px; }
.order-head p { margin: 0; color: var(--muted); }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 16px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
@media (max-width: 560px) { .kv { grid-template-columns: 1fr; gap: 2px; } .kv dd { margin-bottom: 8px; } }

/* --- modální okno mapy PPL ---------------------------------------------- */
.modal { position: fixed; inset: 0; z-index: 9999; background: rgba(15, 20, 30, .55); display: none; align-items: center; justify-content: center; padding: 16px; }
.modal.open { display: flex; }
.modal .box { background: #fff; border-radius: var(--radius); width: min(1000px, 100%); height: min(720px, 92vh); display: flex; flex-direction: column; overflow: hidden; }
.modal .head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); font-weight: 600; }
.modal .close { border: 0; background: none; font-size: 26px; line-height: 1; cursor: pointer; color: var(--muted); }
.modal .content { flex: 1; overflow: auto; position: relative; }
#ppl-parcelshop-map { width: 100%; height: 100%; min-height: 500px; }

.loading { display: grid; place-items: center; min-height: 50vh; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--primary); animation: spin .8s linear infinite; display: inline-block; }
.btn .spinner { width: 18px; height: 18px; border-width: 2px; border-color: rgba(255, 255, 255, .4); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* Písmo nadpisů a tlačítek podle webu BCG */
h1, h2, h3, .btn, .brand, .summary .total { font-family: var(--head-font); letter-spacing: -.01em; }

/* ==========================================================================
   v3 – přehlednost: záhlaví sekcí, výrazný výběr, barvy dopravců
   ========================================================================== */
body { background: #eceff4; }
body.embed { background: transparent; }
.card { border-color: #d9dee6; box-shadow: 0 1px 2px rgba(14, 22, 39, .05); }
.card > h2:first-child { margin: -22px -22px 18px; padding: 14px 22px; background: #f5f7fa; border-bottom: 1px solid #e8ecf1; font-size: 16px; }
.card h2 .num { border-radius: 0; width: 28px; height: 28px; font-size: 14px; }

.field input, .field textarea, .discount input { border-color: #cbd2db; }
.field label { color: var(--text); }

/* Volby dopravy a platby */
.options { gap: 8px; }
.option { border: 1px solid #cbd2db; padding: 14px 16px; align-items: center; }
.option:hover { border-color: var(--primary); background: #f7faff; }
.option.selected { border-color: var(--primary); background: #eaf2fb; box-shadow: inset 4px 0 0 var(--primary); }
.option input { margin-top: 0; width: 20px; height: 20px; }
.option .title { align-items: center; font-size: 15px; color: var(--text); }
.option .title > span:first-child { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.option .price { font-weight: 700; color: var(--text); font-family: var(--head-font); }
.option .price.free { color: var(--ok); }
.option .desc { color: #5b6472; font-size: 13px; margin-top: 4px; }
.option.selected .point { background: #fff; border: 1px solid #c9d8ea; }
.carrier { border-radius: 0; margin-right: 0; padding: 3px 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; vertical-align: middle; }
.carrier.packeta { background: #c8102e; color: #fff; }
.carrier.ppl { background: #00387b; color: #ffd200; }
.opt-group { font: 700 11.5px/1 var(--head-font); text-transform: uppercase; letter-spacing: .06em; color: #6b7280; margin: 10px 0 2px; }
.opt-group:first-child { margin-top: 0; }

/* Souhrn */
.summary .card { border-top: 4px solid var(--primary); }
.totals .total { font-size: 21px; font-family: var(--head-font); }
.btn-primary { font-family: var(--head-font); letter-spacing: .01em; }
.btn-primary:hover { filter: none; background: #023e75; }
.item img, .item .ph { object-fit: contain; background: #fff; border: 1px solid #e8ecf1; }
.carrier.pickup { background: #374151; color: #fff; }
