/* Portál dárkových poukazů Šedová – jednoduchý, uhlazený vzhled pro mobil, tablet i počítač (ADR 0009). Bez knihoven. */

:root {
    --brand: #1ca636;
    --brand-strong: #13782a;
    --brand-soft: #e9f6ec;
    --ink: #1c231e;
    --ink-2: #566059;
    --line: #e1e6e0;
    --bg: #f4f6f3;
    --card: #ffffff;
    --redeemed: #1f5f9e;
    --redeemed-soft: #e8f0f9;
    --expired: #8a5300;
    --expired-soft: #fdf3e0;
    --cancelled: #b02a1f;
    --cancelled-soft: #fcecea;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgb(20 40 25 / 6%), 0 6px 20px rgb(20 40 25 / 6%);
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Consolas, monospace;
    --nav-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--ink);
    font: 400 1rem/1.5 var(--font);
}

a { color: var(--brand-strong); text-underline-offset: 2px; }
a:hover { color: var(--ink); }
img, svg { display: block; }
h1, h2 { line-height: 1.25; text-wrap: balance; }
p { text-wrap: pretty; }

:focus-visible { outline: 3px solid rgb(28 166 54 / 45%); outline-offset: 2px; border-radius: 6px; }

.visually-hidden {
    position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}

.icon { width: 1.25em; height: 1.25em; flex: none; }
.icon--lg { width: 1.75rem; height: 1.75rem; }
.muted { color: var(--ink-2); }
.break { overflow-wrap: anywhere; }

/* ----- hlavička a navigace ----- */

.topbar {
    position: sticky; top: 0; z-index: 10;
    background: rgb(255 255 255 / 96%);
    border-bottom: 1px solid var(--line);
    backdrop-filter: saturate(1.4) blur(8px);
}
.topbar__inner {
    max-width: 760px; margin: 0 auto; padding: 10px 16px;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); min-width: 0; }
.brand img { height: 27px; width: auto; }
.brand__title { font-weight: 600; color: var(--ink-2); white-space: nowrap; padding-left: 12px; border-left: 1px solid var(--line); }
.topbar__user { color: var(--ink-2); font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }

.nav { display: flex; justify-content: center; gap: 4px; max-width: 760px; margin: 0 auto; padding: 0 12px 8px; }
.nav__item {
    display: flex; align-items: center; gap: 8px;
    padding: 9px 16px; border-radius: 999px;
    color: var(--ink-2); text-decoration: none; font-weight: 600;
    transition: background-color .15s, color .15s;
}
.nav__item:hover { background: var(--bg); color: var(--ink); }
.nav__item.is-active { background: var(--brand-soft); color: var(--brand-strong); }

/* telefon: navigace jako spodní lišta (na dosah palce) */
@media (max-width: 639.98px) {
    body:not(.page-login) { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
    .brand__title { display: none; }
    /* backdrop-filter by z hlavičky udělal kontejner pro position: fixed – spodní lišta by se vykreslila u hlavičky */
    .topbar { backdrop-filter: none; background: #fff; }
    .nav {
        position: fixed; inset: auto 0 0 0; z-index: 20;
        max-width: none; margin: 0; padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
        background: #fff; border-top: 1px solid var(--line);
        justify-content: space-around;
    }
    .nav__item { flex: 1; flex-direction: column; gap: 2px; padding: 6px 4px; border-radius: 12px; font-size: .75rem; }
    .nav__item .icon { width: 1.5rem; height: 1.5rem; }
}

/* ----- obsah ----- */

.main { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 20px 16px 32px; }
.page-title { font-size: 1.6rem; margin: 4px 0 16px; }
.section { margin-top: 32px; }
.section h2 { font-size: 1.15rem; margin: 0; }
.section__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.foot { text-align: center; color: var(--ink-2); font-size: .8rem; padding: 16px; }
@media (max-width: 639.98px) { .foot { display: none; } }
.back { margin: 0 0 8px; }
.back a { text-decoration: none; font-weight: 600; }
.hint { color: var(--ink-2); font-size: .9rem; margin: 8px 0 0; }
.empty { color: var(--ink-2); background: var(--card); border-radius: var(--radius); padding: 24px; text-align: center; }
.results-count { color: var(--ink-2); margin: 16px 0 10px; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
.card h2 { font-size: 1.15rem; margin: 0 0 8px; }
.card__footer { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }

/* ----- hlášky ----- */

.flash {
    border-radius: var(--radius-sm); padding: 12px 16px; margin: 0 0 16px;
    border: 1px solid; font-weight: 500;
}
.flash--ok { background: var(--brand-soft); border-color: #bfe3c7; color: #0f5e22; }
.flash--error { background: var(--cancelled-soft); border-color: #f3c4bf; color: #8c1d14; }
.flash--info { background: var(--redeemed-soft); border-color: #c7daf0; color: #174a7c; }

/* ----- formuláře a tlačítka ----- */

.form { display: grid; gap: 16px; }
.form--narrow { max-width: 420px; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 600; }
.optional { font-weight: 400; color: var(--ink-2); }

input[type="text"], input[type="password"], input[type="search"], select {
    width: 100%; min-height: 48px; padding: 10px 14px;
    font: inherit; color: var(--ink);
    background: #fff; border: 1.5px solid #cfd6ce; border-radius: var(--radius-sm);
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgb(28 166 54 / 18%); }
input::placeholder { color: #8b948d; }

.password { position: relative; }
.password input { padding-right: 96px; }
.password__toggle {
    position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
    min-height: 36px; padding: 0 12px; border: 0; border-radius: 8px;
    background: var(--bg); color: var(--ink-2); font: 600 .85rem var(--font); cursor: pointer;
}

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 48px; padding: 10px 20px;
    border: 1.5px solid transparent; border-radius: var(--radius-sm);
    font: 600 1rem/1.2 var(--font); text-decoration: none; cursor: pointer;
    transition: background-color .15s, border-color .15s, color .15s, transform .05s;
    touch-action: manipulation;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--brand-strong); color: #fff; }
.btn--primary:hover { background: #0f6322; color: #fff; }
.btn--ghost { background: #fff; color: var(--ink); border-color: #cfd6ce; }
.btn--ghost:hover { border-color: var(--ink-2); color: var(--ink); }
.btn--lg { min-height: 56px; padding: 12px 26px; font-size: 1.1rem; }
.btn--sm { min-height: 40px; padding: 6px 14px; font-size: .9rem; }
.btn--block { width: 100%; }
.inline { display: inline; }

/* ----- přihlášení ----- */

.page-login .main { display: grid; place-items: center; }
.login { width: 100%; max-width: 420px; }
.login__card { background: var(--card); border-radius: 20px; box-shadow: var(--shadow); padding: 32px 24px; }
.login__logo { height: 40px; width: auto; margin: 0 auto 20px; }
.login__title { text-align: center; font-size: 1.5rem; margin: 0; }
.login__lead { text-align: center; color: var(--ink-2); margin: 6px 0 24px; }
.login__help { text-align: center; color: var(--ink-2); font-size: .9rem; margin: 20px 0 0; }

/* ----- ověření kódu ----- */

.verify__form { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.verify__label { display: block; font-weight: 600; margin-bottom: 8px; }
.verify__row { display: flex; gap: 10px; }
.code-input {
    flex: 1; min-width: 0;
    min-height: 64px !important;
    font: 600 2rem/1 var(--mono) !important;
    letter-spacing: .14em; text-transform: uppercase; text-align: center;
}
.code-input::placeholder { color: #c3cac2; letter-spacing: .14em; }
.verify__result { margin-top: 20px; }
.verify .flash { margin-top: 20px; }
@media (max-width: 479.98px) {
    .verify__row { flex-direction: column; }
    .verify__row .btn { width: 100%; }
}

/* ----- panel poukazu ----- */

.vpanel {
    background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
    border-top: 6px solid var(--state, var(--brand));
}
.vpanel--valid { --state: var(--brand); --state-ink: var(--brand-strong); --state-soft: var(--brand-soft); }
.vpanel--redeemed { --state: var(--redeemed); --state-ink: var(--redeemed); --state-soft: var(--redeemed-soft); }
.vpanel--expired { --state: #d98a00; --state-ink: var(--expired); --state-soft: var(--expired-soft); }
.vpanel--cancelled { --state: var(--cancelled); --state-ink: var(--cancelled); --state-soft: var(--cancelled-soft); }
.vpanel__head { display: flex; align-items: center; gap: 10px; padding: 14px 20px; background: var(--state-soft); color: var(--state-ink); }
.vpanel__head h2 { margin: 0; font-size: 1.2rem; }
.vpanel__body { padding: 20px; }
.vpanel__hero { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.vpanel__code { font: 700 1.6rem/1.1 var(--mono); letter-spacing: .1em; }
.vpanel__title { color: var(--ink-2); margin-top: 6px; }
.vpanel__value { font-size: 2rem; font-weight: 700; color: var(--ink); white-space: nowrap; }
.vpanel__note { background: var(--state-soft); color: var(--state-ink); border-radius: var(--radius-sm); padding: 12px 14px; margin: 16px 0 0; }
.vpanel__actions { display: flex; flex-wrap: wrap; gap: 10px; padding: 0 20px 20px; }
.vpanel__actions .btn--primary { flex: 1 1 240px; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px 20px; margin: 18px 0 0; }
.facts div { min-width: 0; }
.facts dt { color: var(--ink-2); font-size: .85rem; }
.facts dd { margin: 2px 0 0; font-weight: 600; }

/* ----- štítky stavu ----- */

.badge {
    display: inline-block; padding: 3px 10px; border-radius: 999px;
    font-size: .8rem; font-weight: 700; white-space: nowrap;
}
.badge--valid { background: var(--brand-soft); color: var(--brand-strong); }
.badge--redeemed { background: var(--redeemed-soft); color: var(--redeemed); }
.badge--expired { background: var(--expired-soft); color: var(--expired); }
.badge--cancelled { background: var(--cancelled-soft); color: var(--cancelled); }

/* ----- seznamy poukazů ----- */

.vlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.vrow {
    display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px;
    background: var(--card); border-radius: 12px; padding: 14px 16px;
    border: 1px solid transparent; box-shadow: 0 1px 2px rgb(20 40 25 / 6%);
    text-decoration: none; color: var(--ink);
    transition: border-color .15s, box-shadow .15s;
}
.vrow:hover { border-color: #cfe5d4; box-shadow: var(--shadow); color: var(--ink); }
.vrow__code { font: 700 1.05rem var(--mono); letter-spacing: .08em; }
.vrow__main { min-width: 0; display: grid; }
/* název až na 2 řádky – liší se často až koncem (hodnota) */
.vrow__title { font-weight: 600; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.vrow__meta { color: var(--ink-2); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vrow__side { display: grid; justify-items: end; gap: 4px; }
.vrow__value { font-weight: 700; white-space: nowrap; }
@media (max-width: 559.98px) {
    .vrow { grid-template-columns: 1fr auto; gap: 4px 12px; }
    .vrow__code { grid-column: 1; }
    .vrow__main { grid-column: 1 / -1; grid-row: 2; }
    .vrow__side { grid-column: 2; grid-row: 1; display: flex; align-items: center; gap: 8px; }
}
.vlist__action { display: flex; justify-content: flex-end; margin-top: -4px; }

/* ----- filtry, záložky, stránkování ----- */

.filters { display: grid; gap: 12px; margin-bottom: 4px; }
.filters__search { display: flex; gap: 10px; }
.filters__search input { flex: 1; min-width: 0; }
.filters__row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip, .tab {
    display: inline-flex; align-items: center; min-height: 40px; padding: 6px 14px;
    border-radius: 999px; border: 1.5px solid #cfd6ce; background: #fff;
    color: var(--ink); text-decoration: none; font-weight: 600; font-size: .9rem;
}
.chip:hover, .tab:hover { border-color: var(--ink-2); color: var(--ink); }
.chip.is-active, .tab.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }
.select { flex: 0 1 260px; }
.select select { min-height: 40px; padding: 6px 12px; }
.tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.pager { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; margin-top: 20px; }
.pager a[rel="next"] { justify-self: end; }
.pager__info { color: var(--ink-2); }

/* ----- historie ----- */

.timeline { list-style: none; margin: 10px 0 0; padding: 0; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.timeline li { display: grid; grid-template-columns: 150px 1fr; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--line); }
.timeline li:first-child { border-top: 0; }
.timeline__date { color: var(--ink-2); font-size: .9rem; }
@media (max-width: 479.98px) { .timeline li { grid-template-columns: 1fr; gap: 2px; } }

/* ----- potvrzení po uplatnění ----- */

.done {
    display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; align-items: center;
    background: var(--brand-strong); color: #fff; border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
}
.done__icon { width: 48px; height: 48px; grid-row: span 2; }
.done__title { margin: 0; font-size: 1.35rem; }
.done p { margin: 4px 0 0; opacity: .92; }
.done .btn { grid-column: 1 / -1; margin-top: 10px; background: #fff; color: var(--brand-strong); }
.done .btn:hover { background: var(--brand-soft); }

/* ----- dialog (nativní <dialog>, showModal) ----- */

.dialog {
    width: min(460px, calc(100vw - 32px));
    border: 0; border-radius: 20px; padding: 24px;
    color: var(--ink); background: var(--card);
    box-shadow: 0 20px 60px rgb(0 0 0 / 25%);
}
dialog:modal { overscroll-behavior: contain; }
.dialog::backdrop { background: rgb(15 25 18 / 45%); overflow: hidden; overscroll-behavior: contain; }
.dialog__title { margin: 0 0 14px; font-size: 1.35rem; }
.dialog__summary {
    display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: baseline;
    background: var(--brand-soft); border-radius: var(--radius-sm); padding: 14px 16px;
}
.dialog__value { font-size: 1.4rem; font-weight: 700; }
.dialog__name { grid-column: 1 / -1; color: var(--ink-2); font-size: .9rem; }
.dialog__text { margin: 14px 0; }
.dialog__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.dialog__actions .btn { flex: 1; }

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

/* průběžné hledání: během načítání výsledky jen zeslábnou (bez poskakování) */
.results { transition: opacity .15s; }
.results.is-loading { opacity: .55; }
.hint--tight { margin: -4px 0 0; }

/* zaškrtávátko „Zůstat přihlášen“ */
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; line-height: 1.4; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--brand-strong); flex: none; }
.check__hint { display: block; color: var(--ink-2); font-size: .85rem; }
