/* Vzhled "Pohádkový les": krémový papír, lesní zelená a med. Návrh pro telefon: jeden sloupec,
   ovládací prvky vysoké alespoň 44 px, světlý i tmavý režim podle systému. */
:root {
    --bg: #f7f2e7;
    --surface: #fffdf8;
    --ink: #23332d;
    --muted: #5c6c63;
    --line: #e6dcc6;
    --accent: #2f6b57;
    --accent-strong: #1f4f3e;
    --accent-fg: #ffffff;
    --on-accent-muted: #d4e6dc;
    --soft: #e1ece4;
    --honey: #e8a93a;
    --danger: #a63d2a;
    --danger-soft: #f6ddd6;
    --ok: #14532d;
    --ok-soft: #d6eedd;
    --queued: #6a4a0a;
    --queued-soft: #f3ead3;
    --tile-icon-on-accent: rgba(255, 255, 255, 0.18);
    --tint-1: #fbe9c2;
    --tint-2: #f6d9cd;
    --tint-3: #dde9ee;
    --tint-4: #e1ece4;
    --tint-5: #f3ead3;
    --shadow: 0 10px 24px -14px rgba(35, 51, 45, 0.28);
    --radius: 20px;
    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #14201b;
        --surface: #1b2b25;
        --ink: #eaf1ec;
        --muted: #a5b8ae;
        --line: #2c3f37;
        --accent: #7cc4a6;
        --accent-strong: #a8dcc5;
        --accent-fg: #0f2019;
        --on-accent-muted: #1f4636;
        --soft: #25382f;
        --danger: #ff9c8a;
        --danger-soft: #46231d;
        --ok: #86e0a6;
        --ok-soft: #1d3a2a;
        --queued: #e8c77a;
        --queued-soft: #3a3322;
        --tile-icon-on-accent: rgba(15, 32, 25, 0.14);
        --tint-1: #3b3522;
        --tint-2: #3f2b25;
        --tint-3: #26363d;
        --tint-4: #25382f;
        --tint-5: #35332a;
        --shadow: 0 10px 24px -14px rgba(0, 0, 0, 0.6);
    }
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; }

body {
    background: var(--bg);
    color: var(--ink);
    font-family: "Nunito", ui-rounded, "Segoe UI Variable", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 1.0625rem;
    line-height: 1.5;
    min-height: 100vh;
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
}

h1 { font-size: 2rem; line-height: 1.12; font-weight: 800; letter-spacing: -0.01em; margin: 0 0 0.5rem; text-wrap: balance; }
h1:focus { outline: none; }
h2 { font-size: 1.3rem; line-height: 1.2; font-weight: 800; margin: 0 0 0.9rem; }
p { margin: 0 0 1rem; }
a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
code { font-family: ui-monospace, Consolas, monospace; font-size: 0.9em; }

/* Ikony jsou jednoduché čárové SVG, barvu přebírají z textu. */
.icon { flex: none; width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.icon-fill { fill: currentColor; stroke: none; }

/* Hlavička, menu a spodní navigace jsou v layout.css. */
.logo-mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--honey);
    color: #23332d;
}
.logo-mark .icon { width: 20px; height: 20px; stroke-width: 2; }
.logo-mark.large { width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 0.75rem; }
.logo-mark.large .icon { width: 32px; height: 32px; }

.link-button {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    color: var(--accent);
    text-decoration: underline;
    cursor: pointer;
}

.content {
    max-width: 46rem;
    margin: 0 auto;
    padding: 1.6rem 1.25rem 3.5rem;
}

.lead { color: var(--muted); }
.meta { color: var(--muted); font-size: 0.9rem; }

/* Úvod stránky */
.hero { margin-bottom: 1.6rem; }
.hero p { color: var(--muted); font-size: 1.05rem; margin: 0; }

/* Karty a formuláře */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    max-width: 26rem;
    margin: 1.5rem auto 0;
}
.card h1 { font-size: 1.6rem; text-align: center; }

.field { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 1rem; }
.field label { font-weight: 700; }

input[type="text"], input[type="email"], input[type="password"], select {
    width: 100%;
    min-height: 48px;
    padding: 0.5rem 0.9rem;
    font: inherit;
    color: var(--ink);
    background: var(--surface);
    border: 2px solid var(--line);
    border-radius: 12px;
}
input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus, select:focus { border-color: var(--accent); }

.check { display: flex; align-items: center; gap: 0.6rem; min-height: 44px; margin-bottom: 1rem; }
.check input { width: 1.35rem; height: 1.35rem; accent-color: var(--accent); }

/* Tlačítka */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    min-height: 48px;
    padding: 0.6rem 1.2rem;
    font: inherit;
    font-weight: 800;
    color: var(--accent-fg);
    background: var(--accent);
    border: 1.5px solid var(--accent);
    border-radius: 12px;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.08s ease, background-color 0.15s ease;
}
.button:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.button:active { transform: scale(0.98); }
.button-small { width: auto; min-width: 44px; min-height: 44px; padding: 0 1.1rem; white-space: nowrap; }
.button-secondary { color: var(--ink); background: transparent; border-color: var(--line); font-weight: 700; }
.button-secondary:hover { color: var(--ink); background: var(--soft); border-color: var(--line); }
.button-outline { color: var(--accent); background: transparent; border-color: var(--accent); }
.button-outline:hover, .button-outline[aria-pressed="true"] { color: var(--accent-strong); background: var(--soft); border-color: var(--accent); }
.button-danger { color: #fff; background: var(--danger); border-color: var(--danger); }
.button-danger:hover { color: #fff; background: var(--danger); border-color: var(--danger); filter: brightness(0.92); }
.button-outline-danger { color: var(--danger); background: transparent; border-color: var(--danger); font-weight: 700; }
.button-outline-danger:hover { color: var(--danger); background: var(--danger-soft); border-color: var(--danger); }

/* Správa uživatelů */
.panel-body { padding-bottom: 1.1rem; }
.user-email { overflow-wrap: anywhere; }
.inline-form { padding-top: 0.25rem; }
.inline-form .field { margin-bottom: 0.75rem; }

/* Hlášky */
.alert { padding: 0.75rem 1rem; border-radius: 12px; margin-bottom: 1rem; }
.alert-danger { background: var(--danger-soft); color: var(--danger); }
.alert-success { background: var(--ok-soft); color: var(--ok); }

.text-danger, .validation-message { color: var(--danger); }
.valid.modified:not([type=checkbox]) { outline: 2px solid var(--ok); }
.invalid { outline: 2px solid var(--danger); }

.panel { margin-bottom: 2rem; }

/* Všechna stahování jsou v jedné společné kartě; jednotlivé úlohy jsou řádky oddělené čárou. */
.panel-card {
    padding: 1.1rem 1.1rem 0.25rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.panel-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.25rem; }
.panel-head h2 { margin: 0; }
.count {
    display: inline-grid;
    place-items: center;
    min-width: 26px;
    height: 26px;
    padding: 0 0.5rem;
    border-radius: 99px;
    background: var(--soft);
    color: var(--accent-strong);
    font-size: 0.875rem;
    font-weight: 800;
}

.jobs, .episodes { list-style: none; margin: 0; padding: 0; }
.job { display: grid; gap: 0.65rem; padding: 0.9rem 0; border-top: 1px solid var(--line); }
.job:first-child { border-top: 0; }
.job-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.25rem 1rem; }
.job-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

progress {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 0.65rem;
    border: 0;
    border-radius: 99px;
    background: var(--soft);
    overflow: hidden;
    accent-color: var(--accent);
}
progress::-webkit-progress-bar { background: var(--soft); border-radius: 99px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 99px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 99px; }

.badge {
    display: inline-block;
    padding: 0.1rem 0.75rem;
    color: var(--accent-strong);
    background: var(--soft);
    border-radius: 99px;
    font-size: 0.875rem;
    font-weight: 700;
    white-space: nowrap;
}
.badge-ready { color: var(--ok); background: var(--ok-soft); }
.badge-queued { color: var(--queued); background: var(--queued-soft); }
.badge-failed { color: var(--danger); background: var(--danger-soft); }
.badge-cancelled { color: var(--muted); }

/* Pořady jako dlaždice */
.category-grid { list-style: none; margin: 0 0 1.5rem; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }

.category-tile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
    width: 100%;
    min-height: 118px;
    padding: 0.9rem;
    font: inherit;
    text-align: left;
    color: var(--ink);
    background: var(--surface);
    border: 1.5px solid var(--line);
    border-radius: 18px;
    cursor: pointer;
    transition: transform 0.08s ease, border-color 0.15s ease;
}
.category-tile:hover { border-color: var(--accent); }
.category-tile:active { transform: scale(0.98); }
.category-tile[aria-pressed="true"] { color: var(--accent-fg); background: var(--accent); border-color: var(--accent); }

.tile-icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    color: var(--ink);
    background: var(--tint-1);
}
.tile-icon .icon { width: 24px; height: 24px; }
.category-grid li:nth-child(5n+2) .tile-icon { background: var(--tint-2); }
.category-grid li:nth-child(5n+3) .tile-icon { background: var(--tint-3); }
.category-grid li:nth-child(5n+4) .tile-icon { background: var(--tint-4); }
.category-grid li:nth-child(5n+5) .tile-icon { background: var(--tint-5); }
.category-tile[aria-pressed="true"] .tile-icon { color: var(--accent-fg); background: var(--tile-icon-on-accent); }

.tile-text { display: flex; flex-direction: column; }
.tile-title { font-weight: 800; font-size: 1.05rem; line-height: 1.2; }
.tile-station { color: var(--muted); font-size: 0.875rem; }
.category-tile[aria-pressed="true"] .tile-station { color: var(--on-accent-muted); }

/* Epizody */
.subhead { margin-top: 0.5rem; }
.episodes { display: grid; gap: 0.75rem; margin-bottom: 1rem; }
.episode {
    display: grid;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
}
.episode-row { display: grid; gap: 0.75rem; }
.episode-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.episode-info { display: flex; flex-direction: column; min-width: 0; }
.episode-info strong { font-size: 1.1rem; font-weight: 800; line-height: 1.25; overflow-wrap: anywhere; }

.player { padding: 0.5rem; border-radius: 14px; background: var(--soft); }
.player audio { display: block; width: 100%; height: 44px; }

@media (min-width: 36rem) {
    .episode-row { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
    .episode-actions { justify-content: flex-end; }
}

@media (min-width: 40rem) {
    .category-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
    .button, .category-tile { transition: none; }
}

#blazor-error-ui {
    background: #fff4c2;
    color: #3b2f00;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

.blazor-error-boundary { background: #b32121; padding: 1rem; color: white; }
.blazor-error-boundary::after { content: "Došlo k chybě."; }
