/* semredirector — vzhled nad AppBase: ilustrace, přihlášení, 404, prázdné stavy, animace.
   Jádro tenhle soubor načítá samo (/assets/app/theme.css). Barvy jen přes tokeny jádra,
   takže světlý i tmavý režim sedí bez duplicit. Ilustrace: app/assets/art (viz tools/art). */

:root {
    --sr-teal: #0ea5a4;
    --sr-grad: linear-gradient(135deg, var(--primary) 0%, var(--sr-teal) 100%);
    /* Ilustrace mají průhledné pozadí, ale bílé plochy v nich jsou z části průhledné
       taky (GIMP je nerozezná od pozadí). Na tmavém podkladu je proto podsvítíme. */
    --sr-stage: none;
}
:root[data-theme="dark"] {
    --sr-stage: radial-gradient(closest-side, rgba(226, 232, 240, .9), rgba(226, 232, 240, .55) 62%, rgba(226, 232, 240, 0));
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --sr-stage: radial-gradient(closest-side, rgba(226, 232, 240, .9), rgba(226, 232, 240, .55) 62%, rgba(226, 232, 240, 0));
    }
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}

/* ===== ilustrace ===== */
.sr-art { display: block; background: var(--sr-stage); border-radius: 50%; }
.sr-art img { display: block; width: 100%; height: auto; }
.sr-float .sr-art { animation: srFloat 6s ease-in-out infinite; }
@keyframes srFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

/* ===== piktogram přesměrování (inline SVG z sr_flow_svg) ===== */
.sr-flow { display: block; width: 100%; max-width: 360px; height: auto; margin: 14px 0 4px; overflow: visible; }
.sr-flow-box { fill: var(--surface); stroke: var(--border); stroke-width: 1.5; }
.sr-flow-to { stroke: var(--sr-teal); stroke-width: 2; }
.sr-flow-t { font: 600 12px var(--font); fill: var(--muted); }
.sr-flow-tt { fill: var(--text); }
.sr-flow-line { stroke: var(--primary); stroke-width: 2; stroke-dasharray: 4 5; fill: none; animation: srDash 1s linear infinite; }
.sr-flow-head { stroke: var(--primary); stroke-width: 2.4; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.sr-flow-dot { fill: var(--sr-teal); }
@keyframes srDash { to { stroke-dashoffset: -9; } }

/* ===== logo s vykreslením šipky ===== */
.sr-logo { flex: 0 0 auto; border-radius: 10px; box-shadow: 0 6px 18px color-mix(in srgb, var(--primary) 35%, transparent); }
.sr-logo-p { fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round;
    stroke-dasharray: 1; stroke-dashoffset: 1; animation: srDraw .9s var(--mo-enter, ease-out) .15s forwards; }
.sr-logo-h { animation-delay: .7s; }
.sr-logo-u { stroke-opacity: .55; animation-delay: 1s; }
.sr-logo-dot { transform-origin: 9px 23px; animation: srPop .4s var(--mo-pop, ease-out) both; }
@keyframes srDraw { to { stroke-dashoffset: 0; } }
@keyframes srPop { from { transform: scale(0); } to { transform: scale(1); } }

/* ===== přihlášení (hook login_extra) ===== */
.auth-page:has(.sr-auth-art) { background: var(--bg); background-image: var(--grad-surface, none); }
/* jen průhlednost, žádný transform — ten by z karty udělal kontejner pro position:fixed panelu */
.auth-card:has(.sr-auth-art) { display: flex; flex-direction: column; position: relative; animation: srFade var(--mo-slow, .32s) ease-out both; }
.auth-card:has(.sr-auth-art) .auth-brand { display: none; }
.sr-auth-bye { order: -1; display: flex; gap: 8px; align-items: center; background: var(--success-tint); color: var(--success);
    border-radius: var(--radius); padding: 10px 12px; font-size: 13px; font-weight: 600; margin-bottom: 14px; }
.sr-auth-art { order: -2; margin: -26px -22px 18px; padding: 20px 18px 16px; border-radius: 12px 12px 0 0;
    background: var(--sr-grad); color: #fff; overflow: hidden; position: relative; }
.sr-auth-art::after { content: ''; position: absolute; inset: auto -40px -60px auto; width: 180px; height: 180px; border-radius: 50%;
    background: rgba(255, 255, 255, .08); pointer-events: none; }
.sr-auth-logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; letter-spacing: -.02em; }
.sr-auth-logo .sr-logo { box-shadow: 0 6px 18px rgba(0, 0, 0, .18); }
.sr-auth-pic { display: none; }
.sr-auth-art h2 { font-size: 17px; margin: 12px 0 4px; color: #fff; line-height: 1.3; }
.sr-auth-art p { margin: 0; font-size: 13.5px; line-height: 1.5; opacity: .9; }
.sr-auth-feats, .sr-auth-art .sr-flow { display: none; }
.sr-auth-art .sr-art { background: radial-gradient(closest-side, rgba(255, 255, 255, .95), rgba(255, 255, 255, .6) 60%, rgba(255, 255, 255, 0)); }

@media (min-width: 960px) {
    .auth-page:has(.sr-auth-art) { justify-content: center; padding: 24px 24px 24px calc(50% + 24px); }
    .sr-auth-art { position: fixed; inset: 0 auto 0 0; width: 50%; margin: 0; border-radius: 0; padding: 48px clamp(28px, 5vw, 72px);
        display: flex; align-items: center; justify-content: center; }
    .sr-auth-art::after { width: 520px; height: 520px; inset: auto -160px -200px auto; }
    .sr-auth-in { max-width: 520px; width: 100%; position: relative; z-index: 1; animation: srRise var(--mo-page, .4s) var(--mo-enter, ease-out) both; }
    .sr-auth-pic { display: block; width: min(380px, 70%); margin: 18px auto 6px; }
    .sr-auth-art h2 { font-size: 28px; letter-spacing: -.02em; margin-top: 18px; }
    .sr-auth-art p { font-size: 15.5px; }
    .sr-auth-feats { display: grid; gap: 10px; list-style: none; padding: 0; margin: 20px 0 0; font-size: 14.5px; }
    .sr-auth-feats li { display: flex; gap: 12px; align-items: center; opacity: 0; animation: srRise .5s var(--mo-enter, ease-out) forwards; }
    .sr-auth-feats li:nth-child(1) { animation-delay: .35s; } .sr-auth-feats li:nth-child(2) { animation-delay: .45s; }
    .sr-auth-feats li:nth-child(3) { animation-delay: .55s; } .sr-auth-feats li:nth-child(4) { animation-delay: .65s; }
    .sr-auth-feats i { width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; border-radius: 10px; background: rgba(255, 255, 255, .16); }
    .sr-auth-art .sr-flow { display: block; margin-top: 26px; }
    .sr-auth-art .sr-flow-box { fill: rgba(255, 255, 255, .14); stroke: rgba(255, 255, 255, .35); }
    .sr-auth-art .sr-flow-to { stroke: #fff; }
    .sr-auth-art .sr-flow-t, .sr-auth-art .sr-flow-tt { fill: #fff; }
    .sr-auth-art .sr-flow-line, .sr-auth-art .sr-flow-head { stroke: #fff; }
    .sr-auth-art .sr-flow-dot { fill: #fde68a; }
    .auth-card:has(.sr-auth-art) { max-width: 420px; padding: 34px 30px; }
    .auth-card:has(.sr-auth-art)::before { content: 'Přihlášení'; font-size: 24px; font-weight: 800; letter-spacing: -.02em; order: -3; margin-bottom: 18px; }
}
@keyframes srFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes srRise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ===== samostatná stránka (404 bez přihlášení) ===== */
.sr-solo { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
    padding: 24px 8px 40px; background: var(--bg); background-image: var(--grad-surface, none); }
.sr-solo-brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; color: var(--text); text-decoration: none; margin-bottom: 8px; min-height: 48px; }
.sr-solo-art { width: min(340px, 78vw); margin: 4px auto 0; }
.sr-solo-code, .sr-lost-code { font-size: 13px; font-weight: 800; letter-spacing: .18em; color: var(--primary); margin: 10px 0 2px; }
.sr-solo h1 { font-size: clamp(22px, 5vw, 30px); letter-spacing: -.02em; margin: 0 0 8px; }
.sr-solo p.muted { max-width: 460px; margin: 0 auto; line-height: 1.55; }
.sr-solo-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 18px; }
.sr-solo > * { animation: srRise .45s var(--mo-enter, ease-out) both; }
.sr-solo > :nth-child(2) { animation-delay: .06s; } .sr-solo > :nth-child(3) { animation-delay: .12s; }
.sr-solo > :nth-child(4) { animation-delay: .16s; } .sr-solo > :nth-child(5) { animation-delay: .2s; } .sr-solo > :nth-child(6) { animation-delay: .24s; }

/* ===== 404 / chyba v layoutu ===== */
.sr-lost { display: grid; gap: 8px; align-items: center; justify-items: center; text-align: center; padding: 28px 12px; }
.sr-lost-art { width: min(300px, 70vw); }
.sr-lost h1 { margin: 0 0 6px; font-size: clamp(21px, 4vw, 28px); letter-spacing: -.02em; }
.sr-lost p.muted { max-width: 520px; line-height: 1.55; margin: 0 auto; word-break: break-word; }
.sr-lost .sr-actions { justify-content: center; }
.sr-lost kbd { font: 600 12px var(--mono); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px; background: var(--bg); }
@media (min-width: 860px) {
    .sr-lost { grid-template-columns: minmax(240px, 340px) 1fr; text-align: left; justify-items: start; padding: 36px 32px; gap: 32px; }
    .sr-lost p.muted { margin: 0; }
    .sr-lost .sr-actions { justify-content: flex-start; }
}

/* ===== uvítací panel dashboardu ===== */
.sr-welcome { display: grid; gap: 8px; overflow: hidden; position: relative; background-image: var(--grad-surface, none);
    animation: srRise var(--mo-slow, .32s) var(--mo-enter, ease-out) both; }
.sr-welcome::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--sr-grad); }
.sr-welcome-hi { margin: 0; color: var(--muted); font-size: 14px; font-weight: 600; }
.sr-welcome h2 { font-size: clamp(19px, 3vw, 24px) !important; margin: 2px 0 0; letter-spacing: -.02em; }
.sr-welcome-art { display: none; }
.sr-wave { display: inline-block; transform-origin: 70% 70%; animation: srWave 2.4s ease-in-out 1s 2; }
@keyframes srWave { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(14deg); } 20% { transform: rotate(-8deg); } 40% { transform: rotate(-4deg); } 50% { transform: rotate(10deg); } }
@media (min-width: 860px) {
    .sr-welcome { grid-template-columns: 1fr minmax(260px, 40%); align-items: center; padding: 22px 26px; }
    .sr-welcome-art { display: block; }
    .sr-welcome-art .sr-art { border-radius: 24px; }
    .sr-welcome-art img { max-height: 210px; object-fit: contain; }
}

/* ===== prázdné stavy: ilustrace podle ikony uvnitř .ab-empty =====
   Funguje i pro prázdné stavy jádra a pro ty, které JS dopisuje přes innerHTML
   (čisté CSS, žádné probliknutí). Konkrétní obrázek jde vynutit data-art="…". */
.ab-empty { position: relative; line-height: 1.5; word-break: break-word; }
.ab-empty::before { content: ''; display: block; width: 64px; height: 64px; margin: 0 auto 8px;
    background: url(art/empty.webp) center / contain no-repeat, var(--sr-stage); border-radius: 50%; opacity: .9; }
.ab-empty:has(> i)::before { width: min(170px, 46vw); height: min(150px, 40vw); margin-bottom: 10px; opacity: 1; animation: srRise .5s var(--mo-enter, ease-out) both; }
.ab-empty:has(> i) > i { display: none; }
.ab-empty[style*="padding:12px"]::before { width: 44px; height: 44px; }
.ab-empty:has(.fa-diamond-turn-right)::before, .ab-empty[data-art="domains"]::before { background-image: url(art/empty-domains.webp), var(--sr-stage); }
.ab-empty:has(.fa-qrcode)::before, .ab-empty:has(.fa-link)::before, .ab-empty[data-art="links"]::before { background-image: url(art/empty-links.webp), var(--sr-stage); }
.ab-empty:has(.fa-envelope-open)::before, .ab-empty:has(.fa-envelope)::before, .ab-empty:has(.fa-inbox)::before { background-image: url(art/empty-inbox.webp), var(--sr-stage); }
.ab-empty:has(.fa-chart-column)::before, .ab-empty:has(.fa-chart-line)::before, .ab-empty[data-art="chart"]::before { background-image: url(art/empty-chart.webp), var(--sr-stage); }
.ab-empty:has(.fa-bell)::before, .ab-empty[data-art="bell"]::before { background-image: url(art/empty-bell.webp), var(--sr-stage); }
.ab-empty:has(.fa-circle-check)::before, .ab-empty:has(.fa-shield-halved)::before, .ab-empty[data-art="ok"]::before { background-image: url(art/all-good.webp), var(--sr-stage); }
.ab-empty:has(.fa-calendar-check)::before, .ab-empty:has(.fa-calendar)::before { background-image: url(art/calendar.webp), var(--sr-stage); }
.ab-empty:has(.fa-list-ul)::before, .ab-empty:has(.fa-clock-rotate-left)::before, .ab-empty:has(.fa-list-check)::before, .ab-empty[data-art="events"]::before { background-image: url(art/empty-events.webp), var(--sr-stage); }
.ab-empty:has(.fa-circle-question)::before { background-image: url(art/notfound.webp), var(--sr-stage); }
.ab-empty[data-art="events"]::before, .ab-empty[data-art="domains"]::before, .ab-empty[data-art="chart"]::before,
.ab-empty[data-art="ok"]::before, .ab-empty[data-art="links"]::before, .ab-empty[data-art="bell"]::before { width: min(170px, 46vw); height: min(150px, 40vw); }
.ab-empty .btn { margin-top: 10px; }

/* ===== drobné oživení celého GUI ===== */
.shell > .card, .shell > .stat-grid, .shell > form > .card { animation: srRise var(--mo-slow, .32s) var(--mo-enter, ease-out) both; }
.shell > :nth-child(3) { animation-delay: .03s; } .shell > :nth-child(4) { animation-delay: .06s; }
.shell > :nth-child(5) { animation-delay: .09s; } .shell > :nth-child(6) { animation-delay: .12s; }
.shell > :nth-child(n+7) { animation-delay: .15s; }
.stat { transition: transform var(--mo-instant, .12s) ease, box-shadow var(--mo-fast, .18s) ease, border-color var(--mo-fast, .18s) ease; }
@media (hover: hover) {
    .stat:hover { transform: translateY(-2px); box-shadow: var(--elev2); border-color: color-mix(in srgb, var(--primary) 30%, var(--border)); }
    .sidenav a:hover i, .sidenav a:hover .fa-solid { color: var(--primary); }
}
.stat .v { transition: color var(--mo-base, .24s) ease; }

@media (prefers-reduced-motion: reduce) {
    .sr-float .sr-art, .sr-flow-line, .sr-wave, .sr-welcome, .sr-solo > *, .shell > *, .auth-card, .sr-auth-in, .sr-auth-feats li, .ab-empty::before {
        animation: none !important; opacity: 1 !important; transform: none !important;
    }
    .sr-logo-p { animation: none; stroke-dashoffset: 0; }
    .sr-flow-dot { display: none; }
}

/* ===== dashboard: „všechno běží" ===== */
.sr-allgood { display: flex; align-items: center; gap: 14px; }
.sr-allgood .sr-art { width: 76px; flex: 0 0 76px; }
/* .sr-actions je i v sr_view_styles(), ale tyhle stránky ho nevolají */
.sr-welcome .sr-actions, .sr-lost .sr-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
