/* Administrace Bruno TV – barvy z tabulí cukrárny (krémová, červená, hnědá). */
:root {
    --bg: #fbf7e8;
    --card: #ffffff;
    --ink: #2b1d14;
    --muted: #7a6a5c;
    --line: #eadfc8;
    --red: #b8121b;
    --red-dark: #8f0d14;
    --brown: #713500;
    --cream: #fef89a;
    --ok: #1d7a3a;
    --warn: #a35d00;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

a { color: var(--red); }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 1.25rem 0 .5rem; }
code { background: #f4eddc; padding: 2px 6px; border-radius: 4px; font-size: .9em; word-break: break-all; }
.select-all { user-select: all; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.ok { color: var(--ok); font-weight: 600; }
.warn { color: var(--warn); font-weight: 600; }
.empty { color: var(--muted); padding: 1rem 0; }

/* ---------- hlavička ---------- */

.top {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .5rem 1rem;
    background: var(--red);
    color: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .15);
}

.brand { display: flex; align-items: center; gap: .5rem; color: #fff; text-decoration: none; font-weight: 700; white-space: nowrap; }
.brand img { width: 34px; height: 34px; border-radius: 50%; background: #fff; }

.nav { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem; margin-left: auto; }
.nav a, .nav .linkish {
    color: #fff;
    text-decoration: none;
    padding: .4rem .6rem;
    border-radius: 6px;
    font: inherit;
    font-size: .92rem;
}
.nav a:hover, .nav .linkish:hover, .nav a.active { background: rgba(255, 255, 255, .18); }
.nav .linkish { background: none; border: 0; cursor: pointer; opacity: .85; }
.nav-toggle { display: none; margin-left: auto; background: none; border: 0; color: #fff; font-size: 1.5rem; cursor: pointer; }
form.inline { display: inline; margin: 0; }

/* ---------- rozvržení ---------- */

.wrap { max-width: 1280px; margin: 0 auto; padding: 1.25rem 1rem 4rem; }
.page-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem 1rem; margin-bottom: 1rem; }
.page-head p { margin: 0; flex-basis: 100%; }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    margin-bottom: 1rem;
}
.card.narrow { max-width: 520px; }

.grid2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 1rem; }
.grid2 > .card { margin-bottom: 0; }
.grid2 + .card, .grid2 + section { margin-top: 1rem; }

.flash { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-weight: 500; }
.flash-ok { background: #e3f4e7; color: #14532d; border: 1px solid #b7e1c1; }
.flash-err { background: #fde8e8; color: #7f1d1d; border: 1px solid #f5bcbc; }
.flash-info { background: #fff7d6; color: #6b4e00; border: 1px solid #f0de9a; }

/* ---------- formuláře ---------- */

label { display: block; margin-bottom: .75rem; font-weight: 600; font-size: .9rem; }
label input, label select, label textarea { display: block; width: 100%; margin-top: .25rem; font-weight: 400; }
input, select, textarea {
    font: inherit;
    color: inherit;
    padding: .45rem .6rem;
    border: 1px solid #d8ccb3;
    border-radius: 6px;
    background: #fff;
    min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(184, 18, 27, .35); border-color: var(--red); }
input[type=checkbox] { width: 1.15rem; height: 1.15rem; accent-color: var(--red); vertical-align: middle; }
label.check { display: inline-flex; align-items: center; gap: .35rem; margin: 0; font-weight: 500; }
.row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; }
.row > input { flex: 1 1 220px; }
.row label { margin: 0; flex: 1 1 260px; }
.grid-form { display: grid; grid-template-columns: 1fr 1.6fr; gap: 0 1rem; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    padding: .5rem .9rem;
    border: 1px solid #d8ccb3;
    border-radius: 7px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}
.btn:hover { border-color: var(--red); }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red-dark); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); border-color: #f0c2c4; }
.btn.small { padding: .3rem .6rem; font-size: .85rem; }
.btn.wide { width: 100%; }

button.icon {
    min-width: 2rem;
    height: 2rem;
    padding: 0 .45rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--muted);
    font: inherit;
    font-size: .9rem;
    cursor: pointer;
}
button.icon:hover { color: var(--ink); border-color: #c9b994; }
button.icon.danger:hover { color: #fff; background: var(--red); border-color: var(--red); }
button.icon.copy { font-size: .8rem; white-space: nowrap; }

/* tlačítko pro Enter ve formuláři – vždy jen „Uložit“, nikdy první šipka */
.default-submit { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.savebar {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem;
    margin: 0 -1rem;
    padding: .75rem 1rem;
    background: rgba(251, 247, 232, .96);
    border-top: 1px solid var(--line);
}

/* ---------- přehled ---------- */

.venue h2 { font-size: 1.25rem; margin: 1.5rem 0 .75rem; }
.screens { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
.screen { margin: 0; display: flex; flex-direction: column; gap: .6rem; }
.screen-head { display: flex; align-items: center; justify-content: space-between; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: auto; }

.pill { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 700; }
.pill-on { background: #dcf3e2; color: var(--ok); }
.pill-off { background: #fde2e2; color: var(--red-dark); }
.pill-never { background: #eee7d6; color: var(--muted); }

.tv {
    position: relative;
    display: block;
    width: 100%;
    padding-top: 56.25%;
    overflow: hidden;
    border-radius: 8px;
    background: #111;
    border: 4px solid #1d1d1d;
}
.tv iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; pointer-events: none; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: .3rem .9rem; margin: 0; font-size: .92rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.shot { width: 100%; border-radius: 8px; border: 1px solid var(--line); }

/* ---------- editor nabídky ---------- */

.editor { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 1rem; align-items: start; }
.preview-pane { position: sticky; top: 4.25rem; }
.preview-pane .muted { margin: .4rem 0 0; font-size: .85rem; }

.sec-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .6rem; }
.sec-name { flex: 1 1 200px; font-weight: 700; font-size: 1.05rem; color: var(--red); }
.tools { display: inline-flex; flex-wrap: wrap; gap: .25rem; justify-content: flex-end; }
.sec.is-hidden, tr.is-hidden { opacity: .55; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; padding: .3rem .35rem; }
td { padding: .25rem .35rem; vertical-align: middle; border-top: 1px solid #f3ecdc; }
td input:not([type=checkbox]) { width: 100%; }
th.num, td.num { text-align: right; width: 7.5rem; }
input.price { text-align: right; font-variant-numeric: tabular-nums; }
td.tools { white-space: nowrap; width: 1%; text-align: right; }
.new-row input { border-style: dashed; background: #fffdf5; }
.items td:first-child { width: 42%; }

/* ---------- reklama a knihovna ---------- */

.playlist .thumb { width: 120px; }
.playlist .thumb img, .playlist .thumb video { width: 110px; height: 62px; object-fit: cover; border-radius: 4px; background: #111; display: block; }
.playlist input[type=date] { width: 100%; min-width: 9rem; }

.library { margin-top: 1rem; }
.library summary { cursor: pointer; font-weight: 600; padding: .5rem 0; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; }
.lib-grid.big { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.lib-item { display: flex; flex-direction: column; gap: .35rem; margin: 0; }
.lib-item img, .lib-item video { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; background: #111; }
.lib-item form { margin: 0; }
.upload { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.upload p { flex-basis: 100%; margin: 0; }

.list td { padding: .45rem .35rem; }

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

body.bare { min-height: 100vh; display: grid; place-items: center; background: var(--cream); }
.bare-wrap { width: min(400px, calc(100% - 2rem)); }
.login { text-align: center; padding: 2rem 1.75rem; }
.login form { text-align: left; margin-top: 1.25rem; }
.login-logo { width: 110px; height: 110px; }

/* ---------- mobil ---------- */

@media (max-width: 1000px) {
    .editor { grid-template-columns: 1fr; }
    .preview-pane { position: static; order: -1; max-width: 520px; }
    .grid2 { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
    .nav-toggle { display: block; }
    .nav { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; align-items: stretch; padding: .5rem; background: var(--red-dark); }
    body.nav-open .nav { display: flex; }
    .grid-form { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .wrap { padding: 1rem .6rem 4rem; }
    .card { padding: .85rem; }
    table, thead, tbody, tr, td { display: block; width: 100%; }
    thead { display: none; }
    tr { padding: .5rem 0; border-top: 1px solid var(--line); }
    td { border: 0; padding: .2rem 0; }
    td[data-label]::before { content: attr(data-label); display: block; font-size: .75rem; color: var(--muted); }
    th.num, td.num { width: 100%; text-align: left; }
    input.price { text-align: left; }
    td.tools { width: 100%; text-align: left; white-space: normal; padding-top: .4rem; }
    .items td:first-child { width: 100%; }
    .playlist .thumb { width: 100%; }
    .playlist .thumb img, .playlist .thumb video { width: 100%; height: auto; aspect-ratio: 16 / 9; }
    .savebar { margin: 0 -.6rem; padding: .75rem .6rem; }
}
