/* Pokladňa a stránka objednávky (templates/eshop/*). Karty, tlačidlá, štítky a riadok
   objednávky sú z account.css — tu je len rozloženie, ktoré majú tieto dve stránky
   navyše. Stavy prepína knižnica `eshop` atribútmi na koreni pohľadu.

   `data-product` je prázdny pri bezplatnom výklade, `data-retryable` hovorí, či má
   zmysel zlyhaný výklad opakovať — oba píše knižnica z objednávky. */

[data-eshop-view][data-product=""] .when-paid,
[data-eshop-view]:not([data-product=""]) .when-free,
[data-eshop-view][data-retryable="false"] .when-retry,
[data-eshop-view][data-retryable="true"] .when-noretry { display: none; }

/* Darčekový poukaz: `data-kind="voucher"` = kupuje sa poukaz, `data-voucher="1"` =
   v pokladni je priložený kód, `data-paid-by-voucher="true"` = objednávka ním bola
   uhradená. */
[data-eshop-view]:not([data-kind="voucher"]) .when-gift,
[data-eshop-view][data-kind="voucher"] .when-reading,
[data-eshop-view]:not([data-voucher="1"]) .when-voucher,
[data-eshop-view][data-voucher="1"] .when-novoucher,
[data-eshop-view]:not([data-paid-by-voucher="true"]) .when-byvoucher,
[data-eshop-view][data-paid-by-voucher="true"] .when-bypay { display: none; }

[data-eshop-view="order"]:not([data-invoice="true"]) .when-invoice,
[data-eshop-view="order"][data-invoice="true"] .when-receipt { display: none; }

/* ── Pokladňa ───────────────────────────────────────────────────────────── */

.shopcart__grid { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 1.5rem 2rem; }
.shopcart__steps { flex: 999 1 24rem; min-width: 0; display: grid; gap: 1rem; }
.shopcart__summary { flex: 1 1 20rem; display: grid; gap: 1rem; }
.shopcart__back { justify-self: start; font-size: 0.92rem; font-weight: 600; text-decoration: none; }
.shopcart__empty { max-width: 34rem; }

/* fieldset si drží vlastný rám z .account-card; legenda je nadpis kroku */
.shopcart__step { min-width: 0; margin: 0; display: grid; gap: 0.75rem; }
.shopcart__step legend { float: left; width: 100%; margin: 0 0 0.25rem; padding: 0; font-size: 1.05rem; font-weight: 600; }
.shopcart__step > * { margin: 0; clear: both; }
.shopcart__who { color: var(--ink-soft); }
.shopcart__who strong { color: var(--ink); overflow-wrap: anywhere; }

.shopcart__summary h2 { margin: 0; color: var(--ink); font-family: var(--font-sans); font-size: 1.05rem; font-weight: 600; }
.shopcart__item { display: flex; align-items: flex-start; gap: 0.85rem; }
.shopcart__what { flex: 1 1 auto; min-width: 0; display: grid; gap: 0.1rem; }
.shopcart__what strong { color: var(--ink); font-weight: 600; }
.shopcart__edit { justify-self: start; font-size: 0.88rem; font-weight: 600; text-decoration: none; }
.shopcart__price { flex: 0 0 auto; color: var(--ink); font-weight: 600; white-space: nowrap; }
.shopcart__total {
    display: flex; justify-content: space-between; gap: 1rem; padding-top: 0.85rem;
    border-top: 1px solid var(--line); color: var(--ink); font-size: 1.1rem; font-weight: 600;
}
.shopcart__summary > p { margin: 0; }
.shopcart__line { display: flex; justify-content: space-between; gap: 1rem; color: var(--ink-soft); }
.shopcart__voucher { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.shopcart__voucher .radix-form__input { flex: 1 1 12rem; width: auto; border-color: var(--line-strong); text-transform: uppercase; }
.shopcart__voucher .radix-form__input::placeholder { text-transform: none; }
.shopcart__applied {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem;
    padding: 0.7rem 0.9rem; border-radius: var(--r-sm); background: var(--green-soft); color: #2c5e43;
}

/* ── Stránka objednávky ─────────────────────────────────────────────────── */

.shoporder { display: grid; gap: 1rem; }
.shoporder > * { margin: 0; }
.shoporder__no { margin-top: -0.75rem; color: var(--ink-soft); font-size: 0.92rem; }
.shoporder h2 { margin: 0 0 0.35rem; color: var(--ink); font-family: var(--font-serif); font-size: 1.45rem; font-weight: 500; line-height: 1.2; }
.shoporder .account-card { display: grid; gap: 0.75rem; }
.shoporder .account-card > * { margin: 0; }

.shoporder__pulse { display: flex; align-items: center; gap: 0.5rem; color: var(--brand); font-size: 0.88rem; font-weight: 600; }
.shoporder__pulse > span:first-child { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--brand); animation: shoporder-pulse 1.4s ease-in-out infinite; }
/* Priebeh bez percent: koľko krokov výklad má, vie až beh — pás len hovorí, že sa pracuje. */
.shoporder__bar { height: 0.5rem; overflow: hidden; border-radius: 99px; background: var(--surface-soft); }
.shoporder__bar span { display: block; width: 40%; height: 100%; border-radius: 99px; background: var(--brand); animation: shoporder-slide 1.6s ease-in-out infinite; }
@keyframes shoporder-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes shoporder-slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }
@media (prefers-reduced-motion: reduce) {
    .shoporder__pulse > span:first-child, .shoporder__bar span { animation: none; }
    .shoporder__bar span { width: 100%; opacity: 0.5; }
}

.shoporder__done { grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; column-gap: 1rem; }
.shoporder__ok { color: #2c5e43; font-size: 0.88rem; font-weight: 600; }
.shoporder__done h2 { margin: 0; }
/* Poukaz: kód ako hlavná vec stránky a formulár na odoslanie pod ním. */
.shoporder__code {
    color: var(--ink); font-family: var(--font-serif); font-size: clamp(1.6rem, 6vw, 2.1rem);
    font-weight: 700; letter-spacing: 0.06em; overflow-wrap: anywhere;
}
.shoporder__send { display: grid; gap: 0.75rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.shoporder__send > p { margin: 0; }
.shoporder__send strong { overflow-wrap: anywhere; }
/* potvrdenie pri tlačidle „Poslať e-mail znova" */
.shoporder__send [data-eshop-sent]::after { content: " · odoslané"; color: var(--green); font-weight: 600; }

.giftpage__form { display: grid; gap: 1rem; }
.giftpage__form > * { margin: 0; }
.giftpage__form .btn { justify-self: start; }

.shoporder__quota {
    padding: 0.75rem 1rem; border-radius: var(--r-sm);
    background: var(--amber-soft); color: #7a4f15; font-size: 0.92rem;
}

.shoporder__meta { padding-top: 0.5rem; }
.shoporder__meta dl { display: grid; gap: 0.5rem; margin: 0 0 1rem; }
.shoporder__meta dl > div { display: flex; justify-content: space-between; gap: 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--line); }
.shoporder__meta dt { color: var(--muted); font-size: 0.9rem; }
.shoporder__meta dd { margin: 0; color: var(--ink); text-align: right; overflow-wrap: anywhere; }
.shoporder__links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; font-weight: 600; }
.shoporder__links a { text-decoration: none; }

@media (max-width: 34rem) {
    .shoporder__done { grid-template-columns: auto minmax(0, 1fr); }
    .shoporder__done .btn { grid-column: 1 / -1; }
}

/* ── Poukaz na tlač (/eshop/voucher) ────────────────────────────────────── */

.giftprint { background: var(--bg); }
.giftprint__page { width: min(calc(100% - 2rem), 842px); margin: 2rem auto; }
.giftprint__tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.5rem; margin: 0 0 1.25rem; }
.giftcard {
    position: relative; overflow: hidden; aspect-ratio: 842 / 595;
    border-radius: var(--r-md); background: var(--brand-deep); color: #fffdf9;
    /* tmavá plocha sa má vytlačiť tak, ako je — nie ako biely papier s bielym textom */
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.giftcard__sky { position: absolute; inset: 0; width: 100%; height: 100%; }
.giftcard__text { position: relative; display: grid; align-content: center; gap: 0.6rem; height: 100%; max-width: 62%; padding: 6% 7%; }
.giftcard__text p { margin: 0; }
.giftcard__brand { font-family: var(--font-serif); font-size: 1.1rem; font-weight: 700; }
.giftcard__kicker { margin-top: 0.75rem !important; color: #d98b3f; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; }
.giftcard__title { font-family: var(--font-serif); font-size: clamp(1.5rem, 4.4vw, 2.4rem); font-weight: 500; line-height: 1.15; }
.giftcard__lead { color: #d9d3e6; font-size: 0.95rem; }
.giftcard__box { display: grid; gap: 0.3rem; margin-top: 1rem; padding: 1rem 1.1rem; border-radius: 0.75rem; background: #fffdf9; color: var(--ink-soft); font-size: 0.8rem; }
.giftcard__code { color: var(--ink); font-family: var(--font-serif); font-size: clamp(1.2rem, 3.4vw, 1.8rem); font-weight: 700; letter-spacing: 0.08em; }

/* Na úzkej obrazovke sa text do pomeru A5 nezmestí: karta rastie s obsahom a obloha
   ide do pozadia. Tlač má vlastné rozmery nižšie. */
@media screen and (max-width: 40rem) {
    .giftcard { aspect-ratio: auto; }
    .giftcard__sky { opacity: 0.35; }
    .giftcard__text { height: auto; max-width: 100%; padding: 1.5rem 1.25rem; }
}

@media print {
    @page { size: A5 landscape; margin: 0; }
    .giftprint { background: #fff; }
    .giftprint__tools { display: none; }
    .giftprint__page { width: 100%; margin: 0; }
    .giftcard { border-radius: 0; width: 100vw; height: 100vh; aspect-ratio: auto; }
}
