/* TV-Guide – shared styles for web and MAUI. Own tg- prefix so it does not collide with the
   Tailwind classes UserInfo brings along. */
:root {
    --tg-bg: #0f141d;
    --tg-panel: #171e2b;
    --tg-panel-2: #1f2838;
    --tg-line: #2a3446;
    --tg-text: #e6e9ef;
    --tg-muted: #8f9bb0;
    --tg-accent: #f5b83d;
    --tg-accent-soft: rgba(245, 184, 61, .16);
    --tg-now: #3a8dde;
    --tg-now-soft: rgba(58, 141, 222, .18);
    --tg-radius: 10px;
}

html, body { margin: 0; background: var(--tg-bg); color: var(--tg-text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

.tg-app { min-height: 100vh; display: flex; flex-direction: column; }
.tg-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; padding: 8px 16px; background: var(--tg-panel); border-bottom: 1px solid var(--tg-line); padding-top: max(8px, env(safe-area-inset-top)); }
.tg-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: .02em; color: var(--tg-accent); white-space: nowrap; }
.tg-brand svg { width: 26px; height: 26px; }
.tg-nav { display: flex; gap: 4px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.tg-nav a { padding: 6px 12px; border-radius: 999px; color: var(--tg-muted); white-space: nowrap; }
.tg-nav a.active { background: var(--tg-accent-soft); color: var(--tg-accent); }
.tg-user { margin-left: auto; }
.tg-main { padding: 16px; max-width: 1400px; width: 100%; box-sizing: border-box; margin: 0 auto; }

.tg-h1 { font-size: 1.5rem; margin: 4px 0 16px; }
.tg-h1 small { display: block; font-size: .85rem; font-weight: 400; color: var(--tg-muted); }
.tg-h2 { font-size: 1.05rem; margin: 18px 0 8px; }
.tg-h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--tg-muted); margin: 16px 0 6px; }
.tg-empty, .tg-meta { color: var(--tg-muted); }
.tg-error { color: #ff8a80; }
.tg-hint { background: var(--tg-accent-soft); border: 1px solid rgba(245,184,61,.35); border-radius: var(--tg-radius); padding: 8px 12px; }
.tg-text { max-width: 70ch; }

.tg-btn { background: var(--tg-panel-2); border: 1px solid var(--tg-line); border-radius: 8px; padding: 7px 14px; cursor: pointer; }
.tg-btn:hover { border-color: var(--tg-accent); }
.tg-btn.is-on { background: var(--tg-accent-soft); border-color: var(--tg-accent); color: var(--tg-accent); }
.tg-btn:disabled { opacity: .45; cursor: default; }
.tg-btn-quiet { background: none; }
.tg-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0; }

/* A program line */
.tg-line { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; }
.tg-line:hover { background: var(--tg-panel-2); }
.tg-line.is-now { background: var(--tg-now-soft); }
.tg-line-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; flex: 1; min-width: 0; }
.tg-time { font-variant-numeric: tabular-nums; color: var(--tg-muted); }
.tg-title { font-weight: 600; }
.tg-sub { color: var(--tg-muted); font-size: .88em; }
.tg-chan { color: var(--tg-accent); font-size: .88em; }
.tg-bell { background: none; border: 0; cursor: pointer; opacity: .25; filter: grayscale(1); font-size: 1rem; padding: 4px; }
.tg-bell.is-on { opacity: 1; filter: none; }

/* Now page */
.tg-now { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.tg-now-card { background: var(--tg-panel); border: 1px solid var(--tg-line); border-radius: var(--tg-radius); padding: 10px; }
.tg-now-card header { display: flex; align-items: center; gap: 10px; font-weight: 700; margin-bottom: 6px; }
.tg-now-card header img { height: 22px; max-width: 60px; object-fit: contain; background: #fff; border-radius: 4px; padding: 2px; }
.tg-progress { height: 3px; background: var(--tg-line); border-radius: 2px; margin: 2px 8px 6px; overflow: hidden; }
.tg-progress div { height: 100%; background: var(--tg-now); }

/* Day selector */
.tg-days { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 8px; }
.tg-days button { background: var(--tg-panel); border: 1px solid var(--tg-line); border-radius: 999px; padding: 5px 12px; white-space: nowrap; cursor: pointer; }
.tg-days button.is-on { background: var(--tg-accent); color: #1a1a1a; border-color: var(--tg-accent); }

/* Program table (TV-Browser style) */
/* flex-start: columns take their content height, otherwise they stretch to the scroll box and the
   sticky channel heads only stick for the first screen. */
.tg-grid { display: flex; align-items: flex-start; overflow: auto; max-height: calc(100vh - 170px); border: 1px solid var(--tg-line); border-radius: var(--tg-radius); background: var(--tg-panel); }
.tg-grid-hours { position: sticky; left: 0; z-index: 3; flex: 0 0 52px; background: var(--tg-panel); border-right: 1px solid var(--tg-line); }
.tg-grid-col { flex: 0 0 190px; border-right: 1px solid var(--tg-line); }
.tg-grid-head { position: sticky; top: 0; z-index: 2; height: 40px; display: flex; align-items: center; gap: 6px; padding: 0 8px; background: var(--tg-panel-2); border-bottom: 1px solid var(--tg-line); font-weight: 700; font-size: .9rem; white-space: nowrap; overflow: hidden; }
.tg-grid-head img { height: 20px; max-width: 48px; object-fit: contain; background: #fff; border-radius: 3px; padding: 1px; }
.tg-grid-body { position: relative; }
.tg-hour { position: absolute; left: 0; right: 0; padding: 2px 6px; font-size: .75rem; color: var(--tg-muted); border-top: 1px solid var(--tg-line); }
.tg-nowline { position: absolute; left: 0; width: 100vw; height: 2px; background: var(--tg-now); z-index: 1; pointer-events: none; }
.tg-cell { position: absolute; left: 3px; right: 3px; overflow: hidden; padding: 3px 6px; box-sizing: border-box; border-radius: 6px; background: var(--tg-panel-2); border: 1px solid var(--tg-line); font-size: .82rem; line-height: 1.25; display: flex; flex-direction: column; }
.tg-cell:hover { border-color: var(--tg-accent); z-index: 2; }
.tg-cell.is-now { background: var(--tg-now-soft); border-color: var(--tg-now); }
.tg-cell.has-bell { box-shadow: inset 3px 0 0 var(--tg-accent); }
.tg-cell .tg-title { font-weight: 600; }

/* Detail */
.tg-detail { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 24px; align-items: start; }
.tg-detail figure { margin: 0; }
.tg-detail img { width: 100%; border-radius: var(--tg-radius); }
.tg-detail figcaption { color: var(--tg-muted); font-size: .75rem; margin-top: 4px; }
.tg-episode { font-size: 1.05rem; margin-top: -8px; }
.tg-facts { display: flex; flex-wrap: wrap; gap: 6px; }
.tg-facts span { background: var(--tg-panel-2); border: 1px solid var(--tg-line); border-radius: 999px; padding: 2px 10px; font-size: .85rem; }

/* Search, favorites, settings */
.tg-search { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.tg-search input:not([type=checkbox]), .tg-filter { flex: 1; min-width: 220px; background: var(--tg-panel); border: 1px solid var(--tg-line); border-radius: 8px; color: var(--tg-text); padding: 8px 12px; font: inherit; }
.tg-list { background: var(--tg-panel); border: 1px solid var(--tg-line); border-radius: var(--tg-radius); padding: 6px 10px; }
.tg-fav { background: var(--tg-panel); border: 1px solid var(--tg-line); border-radius: var(--tg-radius); padding: 4px 10px 10px; margin-bottom: 12px; }
.tg-fav header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tg-settings { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; }
.tg-picked { list-style: none; padding: 0; margin: 0; }
.tg-picked li { display: flex; align-items: center; gap: 6px; padding: 5px 8px; border-bottom: 1px solid var(--tg-line); }
.tg-picked li span { flex: 1; }
.tg-picked button { background: var(--tg-panel-2); border: 1px solid var(--tg-line); border-radius: 6px; cursor: pointer; width: 30px; height: 28px; }
.tg-picked button:disabled { opacity: .3; }
.tg-check { display: flex; align-items: center; gap: 8px; padding: 3px 0; cursor: pointer; }

@media (max-width: 760px) {
    .tg-top { flex-wrap: wrap; gap: 8px; }
    .tg-nav { order: 3; flex-basis: 100%; }
    .tg-main { padding: 12px; }
    .tg-detail, .tg-settings { grid-template-columns: 1fr; }
    .tg-grid-col { flex-basis: 150px; }
    .tg-grid { max-height: calc(100vh - 200px); }
}

/* Mediathek links on the program page */
.tg-mediathek { display: grid; gap: 8px; }
.tg-mt-item { background: var(--tg-panel); border: 1px solid var(--tg-line); border-radius: var(--tg-radius); padding: 8px 12px; }
.tg-mt-item.is-match { border-color: var(--tg-accent); }
.tg-mt-item .tg-actions { margin: 6px 0 0; }
.tg-mt-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.tg-mt-badge { background: var(--tg-accent-soft); color: var(--tg-accent); border-radius: 999px; padding: 1px 8px; font-size: .75rem; }
