/* KIPTV Medien-Theme (SPEC_REDESIGN_MEDIEN.md, Abschnitt A1).
   Belegt nur die vorhandenen CSS-Variablen neu und glättet ein paar Bausteine.
   Wird nach den Inline-Stilen geladen und gewinnt deshalb bei gleicher Spezifität. */

:root {
  --background: #f5f5f7; --foreground: #1d1d1f;
  --card: #ffffff; --card-foreground: #1d1d1f;
  --popover: #ffffff; --popover-foreground: #1d1d1f;
  --primary: #007aff; --primary-foreground: #ffffff;
  --secondary: #e9e9ee; --secondary-foreground: #1d1d1f;
  --muted: #f2f2f5; --muted-foreground: #6e6e73;
  --accent: #ececf0; --accent-foreground: #1d1d1f;
  --destructive: #ff3b30; --destructive-foreground: #ffffff;
  --border: rgba(0,0,0,0.09); --input: rgba(0,0,0,0.12); --ring: #007aff; --radius: 0.625rem;
  --sidebar: #fbfbfd; --sidebar-foreground: #1d1d1f;
  --sidebar-primary: #007aff; --sidebar-accent: rgba(0,122,255,0.10); --sidebar-border: rgba(0,0,0,0.08);
  --glass: rgba(251,251,253,0.72);
}
.dark {
  --background: #0b0b0d; --foreground: #f2f2f7;
  --card: #1c1c1e; --card-foreground: #f2f2f7;
  --popover: #2c2c2e; --popover-foreground: #f2f2f7;
  --primary: #0a84ff; --primary-foreground: #ffffff;
  --secondary: #2c2c2e; --secondary-foreground: #f2f2f7;
  --muted: #232326; --muted-foreground: #8e8e93;
  --accent: #2c2c2e; --accent-foreground: #f2f2f7;
  --destructive: #ff453a; --destructive-foreground: #ffffff;
  --border: rgba(255,255,255,0.08); --input: rgba(255,255,255,0.12); --ring: #0a84ff;
  --sidebar: #0f0f11; --sidebar-foreground: #e5e5ea;
  --sidebar-primary: #ffffff; --sidebar-accent: rgba(10,132,255,0.18); --sidebar-border: rgba(255,255,255,0.07);
  --glass: rgba(22,22,24,0.72);
}

/* Schrift: Systemschrift (SF Pro auf Apple-Geräten), Inter als Ersatz */
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif;
  background: var(--background); color: var(--foreground);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .text-2xl, .text-3xl, .text-xl { letter-spacing: -0.015em; }

/* Kopfzeile als Glas */
body > div > div > header.fixed, header.fixed.bg-card {
  background: var(--glass) !important;
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--border) !important;
}

/* Logo ohne Regenbogenverlauf */
.logo-gradient {
  background: none; -webkit-text-fill-color: currentColor; color: var(--foreground);
  letter-spacing: -0.02em;
}

/* Seitenleiste: ruhiger, aktive Zeile mit Akzent-Symbol */
aside.fixed { border-right: 0.5px solid var(--sidebar-border) !important; }
aside nav a { border-radius: 8px; font-weight: 500; }
aside nav a i { opacity: 0.85; }
aside nav a.bg-sidebar-accent i { color: var(--primary) !important; opacity: 1; }
aside nav a:not(.bg-sidebar-accent):hover { background: var(--accent); }
.sidebar-group-label { font-size: 0.6875rem; letter-spacing: 0.06em; opacity: 0.55; }

/* Flächen, Karten, Ränder */
.bg-card.rounded-lg, .bg-card.rounded-xl, .bg-card.rounded-2xl { border-color: var(--border); }
.dark .shadow-sm, .dark .shadow-lg { box-shadow: 0 1px 0 rgba(255,255,255,0.03) inset, 0 8px 24px rgba(0,0,0,0.35) !important; }

/* Eingabefelder und Auswahllisten */
input, select, textarea { border-radius: 8px; }
.dark input, .dark select, .dark textarea { background-color: rgba(118,118,128,0.24) !important; border-color: transparent !important; }
input:focus, select:focus, textarea:focus { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 35%, transparent) !important; }

/* Primärknöpfe: eine Akzentfarbe */
.bg-primary, .bg-blue-500, .bg-blue-600 { background-color: var(--primary) !important; }
.hover\:bg-blue-600:hover, .hover\:bg-blue-700:hover { background-color: color-mix(in srgb, var(--primary) 85%, black) !important; }

/* Poster und Kacheln: weichere Ecken, leichtes Anheben */
[class*="aspect-[2/3]"], .aspect-\[2\/3\] { border-radius: 10px; }
.group:hover [class*="aspect-[2/3]"] { transform: scale(1.03); }
[class*="aspect-[2/3]"] { transition: transform .25s ease; }

/* Kennzahlen auf dem Dashboard ohne Bunt */
[x-data="dashboardView"] .text-3xl.font-bold { color: var(--foreground) !important; font-weight: 650; letter-spacing: -0.02em; }

/* Tabellenkopf leiser */
.dark table th { background-color: transparent !important; font-weight: 600; letter-spacing: 0.02em; }

/* Bildlaufleiste */
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--muted-foreground) 35%, transparent); }

/* Logo ist ein Link, ohne Unterstreichung */
header a, header a:hover { text-decoration: none; color: inherit; }

/* ═══ Startseite, Radio, Mini-Player (md-*) ═══ */
.md-start { padding-bottom: 2rem; }
.md-held { position: relative; height: 380px; overflow: hidden; margin-bottom: 0.5rem; }
/* Klein weichzeichnen, dann vergrößern: kostet einen Bruchteil von blur(40px) auf voller Fläche */
.md-held-bg { position: absolute; left: 0; top: 0; width: 10%; height: 10%; transform-origin: 0 0; transform: scale(10.5);
  background-size: cover; background-position: center 25%; filter: blur(3px) saturate(1.3); opacity: 0.55; }
.md-held-schatten { position: absolute; inset: 0;
  background: linear-gradient(90deg, var(--background) 0%, color-mix(in srgb, var(--background) 70%, transparent) 50%, transparent 100%),
              linear-gradient(0deg, var(--background) 0%, transparent 45%); }
.md-held-poster { position: absolute; right: 6%; top: 36px; width: 196px; aspect-ratio: 2/3; object-fit: cover;
  border-radius: 12px; box-shadow: 0 24px 60px rgba(0,0,0,0.45); }
.md-held-text { position: absolute; left: 40px; bottom: 40px; max-width: min(560px, 55%); }
.md-kicker { font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--primary); }
.md-held h1 { font-size: 40px; line-height: 1.08; font-weight: 700; letter-spacing: -0.025em; margin: 8px 0 10px; }
.md-meta { display: flex; gap: 14px; font-size: 13px; color: var(--muted-foreground); }
.md-plot { font-size: 14px; line-height: 1.5; color: var(--muted-foreground); margin-top: 12px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.md-knoepfe { display: flex; gap: 10px; margin-top: 20px; }
.md-knopf-hell, .md-knopf-glas, .md-knopf-akzent, .md-knopf-klein { border-radius: 9px; font-weight: 600; font-size: 14px;
  padding: 10px 20px; display: inline-flex; align-items: center; gap: 6px; transition: transform .15s, background .15s; }
.md-knopf-hell { background: var(--foreground) !important; color: var(--background); }
.md-knopf-glas { background: color-mix(in srgb, var(--muted-foreground) 25%, transparent) !important; color: var(--foreground); }
.md-knopf-akzent { background: var(--primary) !important; color: #fff; }
.md-knopf-klein { padding: 6px 12px; font-size: 12.5px; background: var(--accent) !important; color: var(--foreground); white-space: nowrap; }
.md-knopf-hell:hover, .md-knopf-glas:hover, .md-knopf-akzent:hover { transform: scale(1.03); }

.md-reihe { padding: 0 40px; margin-top: 30px; }
.md-reihe-kopf { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.md-reihe-kopf h2 { font-size: 20px; font-weight: 650; letter-spacing: -0.015em; }
.md-reihe-kopf a { font-size: 13px; color: var(--primary); cursor: pointer; text-decoration: none; }
.md-schiene { display: flex; gap: 16px; overflow-x: auto; padding: 4px 2px 14px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.md-schiene > * { scroll-snap-align: start; flex-shrink: 0; }

.md-poster { width: 150px; text-align: left; color: var(--foreground); }
.md-poster img { width: 150px; aspect-ratio: 2/3; object-fit: cover; border-radius: 10px; background: var(--muted);
  box-shadow: 0 1px 2px rgba(0,0,0,0.2); transition: transform .25s ease, box-shadow .25s ease; display: block; }
.md-poster:hover img { transform: scale(1.04); box-shadow: 0 14px 34px rgba(0,0,0,0.35); }
.md-poster-titel { font-size: 13px; margin-top: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.md-poster-info { font-size: 12px; color: var(--muted-foreground); }

.md-live { width: 240px; text-align: left; background: var(--card); border: 0.5px solid var(--border); border-radius: 14px;
  padding: 14px; color: var(--foreground); transition: transform .15s; }
.md-live:hover { transform: translateY(-2px); }
.md-live-kopf { display: flex; align-items: center; gap: 10px; }
.md-live-kopf img { width: 44px; height: 44px; object-fit: contain; border-radius: 10px; background: var(--muted); padding: 4px; }
.md-live-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.md-live-marke { font-size: 11.5px; color: var(--muted-foreground); display: flex; align-items: center; gap: 5px; }
.md-live-marke i { width: 6px; height: 6px; border-radius: 50%; background: var(--destructive); display: inline-block; }
.md-live-sendung { font-size: 12.5px; color: var(--muted-foreground); margin-top: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.md-balken { height: 3px; border-radius: 2px; background: var(--accent); margin-top: 8px; overflow: hidden; }
.md-balken i { display: block; height: 100%; background: var(--primary); }

.md-radio-kachel { width: 168px; background: var(--card); border: 0.5px solid var(--border); border-radius: 14px; padding: 16px 12px;
  text-align: center; color: var(--foreground); transition: transform .15s, border-color .15s; }
.md-radio-kachel:hover { transform: translateY(-2px); }
.md-radio-kachel img { width: 72px; height: 72px; object-fit: contain; border-radius: 14px; background: var(--muted); margin: 0 auto; display: block; }
.md-radio-kachel.ist-an { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--card)); }
.md-radio-name { font-size: 14px; font-weight: 600; margin-top: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.md-radio-titel { font-size: 12px; color: var(--muted-foreground); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 1.2em; }

.md-radio { padding: 32px 40px; }
.md-radio-kopf { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.md-radio-kopf h1 { font-size: 32px; font-weight: 700; letter-spacing: -0.025em; }
.md-segment { margin-left: auto; display: flex; padding: 2px; border-radius: 9px; background: color-mix(in srgb, var(--muted-foreground) 20%, transparent); }
.md-segment button { padding: 6px 16px; border-radius: 7px; font-size: 13px; color: var(--foreground); }
.md-segment button.an { background: var(--card) !important; box-shadow: 0 1px 3px rgba(0,0,0,0.2); font-weight: 600; }
.md-raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 16px; }
.md-raster .md-radio-kachel { width: auto; }
.md-suchzeile { display: flex; gap: 10px; }
.md-suchfeld { width: 100%; max-width: 480px; padding: 10px 14px; font-size: 14px; border: 0.5px solid var(--input);
  background: var(--card); color: var(--foreground); margin-bottom: 16px; }
.md-liste { background: var(--card); border: 0.5px solid var(--border); border-radius: 14px; overflow: hidden; }
.md-liste:empty { display: none; }
.md-zeile { display: flex; align-items: center; gap: 14px; padding: 10px 16px; border-bottom: 0.5px solid var(--border); }
.md-zeile:last-child { border-bottom: 0; }
.md-zeile.ist-an { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.md-zeile-haupt { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; text-align: left; color: var(--foreground); font-size: 14px; }
.md-zeile-haupt img { width: 36px; height: 36px; object-fit: contain; border-radius: 8px; background: var(--muted); flex-shrink: 0; }
.md-zeile-info { font-size: 12px; color: var(--muted-foreground); }
.md-zeile-tags { font-size: 12px; color: var(--muted-foreground); white-space: nowrap; }
.md-stern { font-size: 18px; color: var(--muted-foreground); padding: 4px; }
.md-stern.an { color: var(--primary); }
.md-hinweis { font-size: 13px; color: var(--destructive); margin-bottom: 12px; }
.md-leer { color: var(--muted-foreground); font-size: 14px; padding: 24px 0; }

.md-mini { position: fixed; left: calc(16rem + 24px); right: 24px; bottom: 20px; z-index: 44; height: 64px;
  display: flex; align-items: center; gap: 12px; padding: 0 16px; border-radius: 16px;
  background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px);
  border: 0.5px solid var(--border); box-shadow: 0 16px 44px rgba(0,0,0,0.35); }
.md-mini > img { width: 42px; height: 42px; object-fit: contain; border-radius: 9px; background: var(--muted); }
.md-mini-text { min-width: 0; flex: 1; }
.md-mini-name { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.md-mini-titel { font-size: 12.5px; color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.md-mini-knoepfe { display: flex; align-items: center; gap: 10px; color: var(--foreground); }
.md-mini-knoepfe button { font-size: 22px; color: var(--foreground); width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; }
.md-mini-knoepfe button:hover { background: var(--accent) !important; }
.md-mini-laut-symbol { color: var(--muted-foreground); margin-left: 8px; }
.md-mini input[type=range] { width: 110px; accent-color: var(--primary); }
.md-eq { display: inline-flex; gap: 2px; align-items: flex-end; height: 12px; }
.md-eq b { width: 3px; background: var(--primary); border-radius: 1px; animation: md-eq 0.9s ease-in-out infinite; }
.md-eq b:nth-child(2) { animation-delay: .2s; } .md-eq b:nth-child(3) { animation-delay: .4s; }
@keyframes md-eq { 0%,100% { height: 4px; } 50% { height: 12px; } }
body.md-radio-an main { padding-bottom: 100px; }
/* KI-Knopf rechts unten nicht verdecken */
body.md-radio-an .md-mini { right: 96px; }

@media (max-width: 768px) {
  .md-held { height: 300px; } .md-held-poster { display: none; } .md-held-text { left: 20px; max-width: 90%; }
  .md-reihe, .md-radio { padding-left: 16px; padding-right: 16px; }
  .md-mini { left: 12px; right: 12px; bottom: 12px; }
  body.md-radio-an .md-mini { right: 12px; }
  .md-mini input[type=range], .md-mini-laut-symbol { display: none; }
}

/* Live TV als Kacheln (A4) */
.md-ansicht-leiste { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px 4px; }
.md-ansicht-leiste .md-segment { margin-left: auto; }
.md-ansicht-leiste .md-segment button { display: inline-flex; align-items: center; gap: 6px; }
.md-live-raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; padding: 12px 20px 24px; }
.md-live-kachel { width: auto; cursor: pointer; }
.md-live-kopf-text { min-width: 0; flex: 1; }
.md-live-kachel .md-live-name { max-width: none; }
.md-herz { font-size: 18px; color: var(--muted-foreground); padding: 2px; opacity: 0; transition: opacity .15s; }
.md-live-kachel:hover .md-herz, .md-herz.an { opacity: 1; }
.md-herz.an { color: var(--destructive); }

/* Audio: Bereiche, Musik-Archiv, Quellen (Hausradio-Quellen Q4) */
.md-radio-kopf .md-segment button { display: inline-flex; align-items: center; gap: 6px; }
.md-unterleiste { display: flex; margin: -8px 0 20px; }
.md-segment-klein { margin-left: 0; }
.md-segment-klein button { padding: 5px 12px; font-size: 12.5px; }
.md-suchzeile .md-suchfeld { margin-bottom: 0; }
.md-suchzeile { margin-bottom: 18px; align-items: center; }
.md-alben { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 18px; }
.md-album { text-align: left; color: var(--foreground); }
.md-album-bild { position: relative; aspect-ratio: 1; border-radius: 10px; background: var(--muted); overflow: hidden;
  display: grid; place-items: center; box-shadow: 0 1px 2px rgba(0,0,0,0.2); transition: transform .2s ease; }
.md-album-bild i { font-size: 40px; color: var(--muted-foreground); }
.md-album-bild img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.md-album:hover .md-album-bild { transform: scale(1.03); }
.md-album-kopf { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.md-album-text { flex: 1; min-width: 0; }
.md-album-text h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.015em; }
.md-nummer { width: 26px; text-align: right; color: var(--muted-foreground); font-size: 13px; flex-shrink: 0; }
.md-zeile.ist-an .md-nummer { color: var(--primary); }
.md-dienst-karte { display: flex; gap: 20px; background: var(--card); border: 0.5px solid var(--border); border-radius: 14px;
  padding: 24px; max-width: 720px; }
.md-dienst-karte > i { font-size: 44px; }
.md-dienst-karte h2 { font-size: 18px; font-weight: 650; margin-bottom: 8px; }
.md-dienst-karte p { font-size: 14px; color: var(--muted-foreground); line-height: 1.5; margin-bottom: 8px; }
.md-abschnitt { font-size: 17px; font-weight: 650; margin: 28px 0 12px; }
.md-quelle-form { display: flex; flex-direction: column; gap: 10px; max-width: 520px; }
.md-quelle-form .md-suchfeld { margin-bottom: 0; }
.md-quelle-form .md-knopf-akzent { align-self: flex-start; }
.md-quelle-symbol { font-size: 22px; color: var(--muted-foreground); width: 36px; text-align: center; flex-shrink: 0; }
.md-knopf-akzent:disabled, .md-knopf-klein:disabled { opacity: 0.45; cursor: default; transform: none; }
.md-web-bild { width: 64px !important; height: 36px !important; object-fit: cover !important; border-radius: 6px; }
.md-web-hinweis { margin-top: 12px; }

/* Radio-Favoriten: Stern zum Entfernen (N1c) */
.md-fav-huelle { position: relative; }
.md-raster .md-fav-huelle .md-radio-kachel { width: 100%; }
.md-fav-weg { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; background: var(--card); color: var(--primary);
  border: 0.5px solid var(--border); opacity: 0; transition: opacity .15s, transform .15s; }
.md-fav-huelle:hover .md-fav-weg, .md-fav-weg:focus-visible { opacity: 1; }
.md-fav-weg:hover { transform: scale(1.08); }
@media (hover: none) { .md-fav-weg { opacity: 1; } }

/* Podcasts und KI-Kurator (F-neu-alb N3/N4) */
.md-podcast img { aspect-ratio: 1/1; }
.md-raster .md-podcast, .md-raster .md-podcast img { width: 100%; }
.md-podcast-kopf { display: flex; gap: 16px; align-items: center; margin: 14px 0; }
.md-podcast-kopf img { width: 96px; height: 96px; border-radius: 12px; object-fit: cover; background: var(--muted); }
.md-podcast-kopf h2 { font-size: 20px; font-weight: 600; }
.md-folge-knopf { font-size: 26px; color: var(--primary); flex-shrink: 0; }
.md-kurator { background: var(--card); border: 0.5px solid var(--border); border-radius: 14px; padding: 16px; margin-bottom: 20px; }
.md-kurator-kopf { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.md-kurator h2 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.md-kurator summary { cursor: pointer; margin-top: 12px; font-size: 13px; color: var(--muted-foreground); }
.md-kurator-sperre { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
.md-kurator-sperre label { font-size: 12px; color: var(--muted-foreground); display: flex; flex-direction: column; gap: 6px; }
.md-kurator-sperre textarea { background: var(--secondary); color: var(--foreground); border: 0.5px solid var(--border); border-radius: 8px; padding: 8px; font-size: 13px; }
.md-kurator-knoepfe { display: flex; gap: 8px; margin-top: 10px; }
.md-kurator-alarm { color: #d4380d; font-size: 13px; margin-top: 6px; }
@media (max-width: 700px) { .md-kurator-sperre { grid-template-columns: 1fr; } .md-kurator-kopf { flex-direction: column; } }

/* Start: eine Zeile je Reihe, ausklappbar */
.md-klapp { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--kachel, 150px), 1fr)); gap: 22px 16px; padding: 4px 2px 8px; }
.md-klapp > .md-poster, .md-klapp > .md-live, .md-klapp > .md-radio-kachel { width: auto; min-width: 0; }
.md-klapp > .md-poster img { width: 100%; }
.md-klapp .md-live-name { max-width: none; }
.md-reihe-aktionen { display: flex; gap: 18px; align-items: baseline; }
.md-mehr { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; color: var(--primary); background: none; border: 0; padding: 0; cursor: pointer; }
.md-mehr i { font-size: 16px; }
