/* =====================================================================
   Vstupní stránky: přihlášení, obnova hesla, registrace, souhlasy a stavové stránky.
   Načítá je views/auth/_head.php spolu s theme-azure.css, takže mají stejné tokeny
   jako aplikace po přihlášení. Modrý panel má stejný přechod jako boční menu a je
   na stejném místě (vlevo), přihlášením se vzhled nemění. Portál má vlastní pravidla
   v zakaznik-portal.css, protože si barvy přebíjí podle firmy.
   ===================================================================== */

body.theme-azure { --vstup-pruh: #1d4ed8; --vstup-okraj: 1.25rem; }
/* Pruh má barvu stavového řádku (theme-color), navazuje na něj bez hrany. */
:root[data-theme="dark"] body.theme-azure { --vstup-pruh: #0c1527; }

/* --- Značka: na telefonu modrý pruh přes celou šířku --- */
.auth-brand { display: flex; align-items: center; gap: .55rem; color: var(--text-strong); text-decoration: none; }
.auth-brand:hover { color: var(--text-strong); text-decoration: none; }
.auth-brand-znak { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 36px; height: 36px; border-radius: 10px; background: var(--az-grad-primary); color: #fff; }
.auth-brand-name { font-size: 1.05rem; font-weight: 700; letter-spacing: -.01em; }

.vstup-obsah > .auth-brand,
.auth-card > .auth-brand {
    padding: calc(.7rem + env(safe-area-inset-top, 0px)) max(var(--vstup-okraj), env(safe-area-inset-right, 0px)) .7rem max(var(--vstup-okraj), env(safe-area-inset-left, 0px));
    background: var(--vstup-pruh); color: #fff;
}
.vstup-obsah > .auth-brand:hover,
.auth-card > .auth-brand:hover { color: #fff; }
.vstup-obsah > .auth-brand .auth-brand-znak,
.auth-card > .auth-brand .auth-brand-znak { width: 32px; height: 32px; background: none; }
:root[data-theme="dark"] .vstup-obsah > .auth-brand,
:root[data-theme="dark"] .auth-card > .auth-brand { border-bottom: 1px solid var(--border); }

/* --- Přihlášení: formulář, panel, patička. Pořadí v DOM = pořadí na telefonu. --- */
.vstup { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 1fr; grid-template-areas: "obsah" "panel" "paticka"; background: var(--surface); }
.vstup-obsah { grid-area: obsah; min-width: 0; }
.vstup-panel { grid-area: panel; min-width: 0; }
.vstup > .auth-footer { grid-area: paticka; }
.vstup-formular { width: 100%; max-width: 384px; margin: 0 auto; padding: 1.5rem var(--vstup-okraj) 1.75rem; box-sizing: border-box; }
.vstup-formular h1 { font-size: 1.6rem; letter-spacing: -.02em; margin: 0 0 .3rem; }
.vstup-podnadpis { color: var(--text-muted); font-size: .95rem; margin: 0 0 1.35rem; }

/* Sdílený formulář (views/auth/_login_form.php). */
.auth-login-form { text-align: left; }
.auth-login-form .form-group { margin-bottom: .9rem; }
.vstup-radek { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .35rem 1rem; margin: 0 0 1.1rem; font-size: .9rem; }
.auth-remember { align-items: center; font-size: inherit; color: var(--text); }
.auth-remember input { margin: 0; }
.vstup-radek a { font-weight: 500; white-space: nowrap; }
.passkey-login { margin-top: .6rem; }
.vstup-ucet { margin: 1.35rem 0 0; font-size: .92rem; color: var(--text-muted); }
.vstup-ucet a { font-weight: 600; white-space: nowrap; }

/* --- Panel: co aplikace umí --- */
.vstup-panel { padding: 2rem var(--vstup-okraj) 2.25rem; background: var(--az-sidebar-grad), var(--sidebar-bg); color: var(--sidebar-text); }
.vstup-panel-znacka { display: none; }
.vstup-panel h2 { margin: 0 0 .6rem; font-size: 1.45rem; font-weight: 700; line-height: 1.2; letter-spacing: -.02em; color: #fff; }
.vstup-panel-text { margin: 0 0 1.35rem; font-size: .95rem; line-height: 1.5; }
.vstup-vyhody { list-style: none; margin: 0; padding: 0; display: grid; gap: .95rem; }
.vstup-vyhody li { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: .75rem; align-items: start; }
.vstup-vyhoda-ikona { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; background: rgba(255,255,255,.12); color: #fff; }
.vstup-vyhody strong { display: block; font-size: .95rem; font-weight: 600; color: #fff; }
.vstup-vyhody small { display: block; font-size: .85rem; line-height: 1.4; color: var(--sidebar-text); }
.vstup-ukazka { display: grid; grid-template-columns: 56px minmax(0, 1fr) 20px; gap: .85rem; align-items: center; margin-top: 1.5rem; padding: .7rem .85rem .7rem .7rem; border: 1px solid rgba(255,255,255,.18); border-radius: 14px; background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
.vstup-ukazka:hover { background: rgba(255,255,255,.16); color: #fff; text-decoration: none; }
.vstup-ukazka:focus-visible,
.vstup-ukazka-btn:focus-visible,
.vstup-panel-znacka:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.vstup-ukazka img { display: block; width: 56px; height: 76px; object-fit: cover; object-position: top; border-radius: 8px; }
.vstup-ukazka strong { display: block; font-size: .95rem; font-weight: 600; color: #fff; }
.vstup-ukazka small { display: block; margin-top: .1rem; font-size: .8rem; line-height: 1.4; color: var(--sidebar-text); }
.vstup-ukazka svg { color: #fff; opacity: .85; }
.vstup-ukazka-btn { display: inline-flex; align-items: center; gap: .45rem; margin-top: 1.25rem; padding: .6rem 1rem; border: 1px solid rgba(255,255,255,.35); border-radius: 10px; color: #fff; font-size: .92rem; font-weight: 600; text-decoration: none; }
.vstup-ukazka-btn:hover { background: rgba(255,255,255,.12); color: #fff; text-decoration: none; }

/* --- Patička --- */
.auth-footer { width: 100%; box-sizing: border-box; padding: 1rem var(--vstup-okraj) calc(1.1rem + env(safe-area-inset-bottom, 0px)); text-align: center; color: var(--text-muted); font-size: .78rem; line-height: 1.5; }
.auth-footer a { color: var(--text-muted); }
.auth-footer a:hover { color: var(--text); }
.auth-footer p { margin: .25rem 0 0; }
.auth-footer-links { display: flex; justify-content: center; flex-wrap: wrap; gap: .1rem .9rem; }

/* --- Ostatní stránky: jedna karta. Na telefonu bez rámu, přes celou šířku. --- */
.auth-shell { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--surface); }
.auth-card { flex: 1 0 auto; box-sizing: border-box; width: 100%; padding: 1.5rem var(--vstup-okraj) 1.5rem; background: var(--surface); }
.auth-card > .auth-brand { margin: -1.5rem calc(var(--vstup-okraj) * -1) 1.5rem; }
.auth-card h1 { margin: 0 0 .4rem; font-size: 1.5rem; letter-spacing: -.02em; }
.auth-card > p, .auth-card form > p { font-size: .95rem; line-height: 1.5; }
.auth-card .form-group { margin-bottom: .95rem; }
.auth-card .form-row { gap: .75rem; }
/* Hvězdička u skoro každého pole nic neříká: označuje se to, co je nepovinné. */
.auth-card .form-label-required::after,
.vstup-formular .form-label-required::after { content: none; }
.vstup-nepovinne { font-weight: 400; color: var(--text-muted); }
.auth-links { list-style: none; margin: 1.1rem 0 0; padding: 0; display: flex; flex-direction: column; align-items: flex-start; gap: .5rem; font-size: .92rem; }
.vstup-poznamka { margin: 1rem 0 0; font-size: .85rem; color: var(--text-muted); }

/* Stavový odznak: kulatý, aby se nezaměňoval se značkou. */
.vstup-stav { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; margin-bottom: .85rem; border-radius: 50%; background: var(--primary-soft); color: var(--primary-soft-text); }
.vstup-stav--ok { background: var(--soft-success-bg); color: var(--success-600); }
.vstup-stav--pozor { background: var(--soft-warning-bg); color: var(--warning-600); }
.vstup-stav--chyba { background: var(--soft-danger-bg); color: var(--danger-600); }

/* Sbalené údaje o firmě v registraci: nepovinné, předvyplňují se do první firmy. */
.vstup-sbalit { margin: .2rem 0 1rem; border: 1px solid var(--border); border-radius: 12px; }
.vstup-sbalit > summary { display: flex; flex-wrap: wrap; align-items: center; gap: .1rem .5rem; min-height: 46px; box-sizing: border-box; padding: .55rem .85rem; font-size: .92rem; font-weight: 600; color: var(--text); cursor: pointer; list-style: none; }
.vstup-sbalit > summary::-webkit-details-marker { display: none; }
.vstup-sbalit > summary small { margin-left: auto; font-size: .82rem; font-weight: 400; color: var(--text-muted); }
.vstup-sbalit > summary svg { color: var(--text-muted); transition: transform .15s; }
.vstup-sbalit[open] > summary svg { transform: rotate(90deg); }
.vstup-sbalit-obsah { padding: .2rem .85rem .85rem; }
.vstup-dva { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }

/* Kroky po registraci. */
.reg-steps { list-style: none; margin: 1rem 0 0; padding: 0; counter-reset: krok; }
.reg-steps li { display: flex; gap: .75rem; align-items: flex-start; padding: .65rem 0; border-top: 1px solid var(--border); }
.reg-steps li:first-child { border-top: 0; }
.reg-steps li::before {
    counter-increment: krok; content: counter(krok);
    flex: 0 0 1.6rem; height: 1.6rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    background: var(--surface-3); color: var(--text-muted); font-size: .8rem; font-weight: 700;
}
.reg-steps li.is-now::before { background: var(--brand-600); color: #fff; }
.reg-steps strong { display: block; color: var(--text-strong); }
.reg-steps .text-muted { font-size: .85rem; }

/* --- Širší displej: karta s rámem na klidném pozadí --- */
@media (min-width: 640px) {
    .auth-shell { align-items: center; justify-content: center; gap: 1rem; padding: calc(1.5rem + env(safe-area-inset-top, 0px)) 1rem 1rem; background: var(--bg-gradient), var(--bg); }
    .auth-card { flex: 0 0 auto; max-width: 440px; padding: 1.75rem 2rem 1.9rem; border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); }
    .auth-card.mw-720 { max-width: 720px; }
    .auth-card > .auth-brand { margin: 0 0 1.35rem; padding: 0; background: none; color: var(--text-strong); }
    .auth-card > .auth-brand:hover { color: var(--text-strong); }
    .auth-card > .auth-brand .auth-brand-znak { width: 36px; height: 36px; background: var(--az-grad-primary); }
    :root[data-theme="dark"] .auth-card > .auth-brand { border-bottom: 0; }
    .auth-shell > .auth-footer { max-width: 560px; padding: .25rem 1rem 1rem; }
}

/* --- Počítač: panel vlevo jako boční menu, formulář vpravo, bez rolování --- */
@media (min-width: 1000px) {
    .vstup { grid-template-columns: minmax(0, 11fr) minmax(0, 10fr); grid-template-rows: minmax(0, 1fr) auto; grid-template-areas: "panel obsah" "panel paticka"; }
    .vstup-obsah { display: flex; flex-direction: column; justify-content: center; }
    .vstup-obsah > .auth-brand { display: none; }
    .vstup-formular { padding: 2rem var(--vstup-okraj); }
    .vstup-panel { display: flex; flex-direction: column; padding: 2rem clamp(2.5rem, 5vw, 5rem) 2.5rem; }
    .vstup-panel-znacka { display: flex; align-items: center; gap: .6rem; color: #fff; font-size: 1.1rem; font-weight: 700; letter-spacing: -.01em; text-decoration: none; }
    .vstup-panel-znacka:hover { color: #fff; text-decoration: none; }
    .vstup-panel-znacka .auth-brand-znak { background: rgba(255,255,255,.14); }
    .vstup-panel-stred { flex: 1 0 auto; display: flex; flex-direction: column; justify-content: center; max-width: 520px; padding: 2rem 0; }
    .vstup-panel h2 { margin-bottom: .85rem; font-size: clamp(2rem, 3vw, 2.6rem); line-height: 1.12; }
    .vstup-panel-text { margin-bottom: 1.85rem; font-size: 1.05rem; }
    .vstup-vyhody { gap: 1.1rem; }
    .vstup-ukazka { margin-top: 1.9rem; }
}

:root[data-theme="dark"] .vstup-ukazka { border-color: rgba(255,255,255,.14); background: rgba(255,255,255,.07); }
