/* MOBILE PERFECT - Alle Probleme gelöst */
:root {
  --unified-bg: rgba(15, 25, 45, 0.75);
  --unified-border: rgba(0, 255, 255, 0.3);
  --primary-color: #00ffff;
  --secondary-color: #00ccff;
  --text-color: #ffffff;
  --text-secondary: #cccccc;
}

/* ── GLOBALER SCROLLBAR – sichtbar auf Desktop und Mobile ── */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--unified-border) rgba(20,20,20,0.6);
}
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-track {
  background: rgba(20,20,20,0.6);
  border-radius: var(--card-radius);
}
*::-webkit-scrollbar-thumb {
  background: var(--unified-border);
  border-radius: var(--card-radius);
  border: 1px solid rgba(20,20,20,0.4);
}
*::-webkit-scrollbar-thumb:hover { background: var(--primary-color); }
/* Mobile: Scrollbar bleibt sichtbar und verschwindet nicht */
@media (max-width: 768px) {
  * {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  *::-webkit-scrollbar { width: 5px; height: 5px; display: block; }
  *::-webkit-scrollbar-track { background: rgba(20,20,20,0.6); }
  *::-webkit-scrollbar-thumb { background: var(--unified-border); border-radius: var(--card-radius); }
}

/* GLOBAL: ALLE Widget-, Poll- und Content-Texte in Systemfarbe */
.card p, .card span:not(.nav-tab):not(.player-btn):not(.btn-label):not([class*="btn"]),
.card div:not(.card-header), .card label, .card li, .card small,
.widget-text, .no-data-msg, .poll-no-data, .poll-message,
.poll-widget *, .wishbox-widget *, .partners-widget *, .news-widget *,
.stream-label, .stream-value,
.umfrage-leer, .no-poll,
#widget-poll p, #widget-poll span, #widget-poll div, #widget-poll label,
#widget-poll .poll-option-label, #widget-poll .poll-result-label,
[class*="no-data"], [class*="keine"], [class*="empty-state"],
p.text-muted, span.text-muted, div.text-muted {
  color: var(--primary-color) !important;
}
/* Ausnahmen: Buttons, Badges, Live-Badge */
.btn, .player-btn, .nav-tab,
.show-badge-live, .status-badge { color: inherit !important; }

* { box-sizing: border-box; margin: 0; padding: 0; }

/* BACKGROUND - WIRKLICH KOMPLETT FIXED */
html {
  height: 100%;
  background: #000;
}

body { 
  font-family: Arial, sans-serif; 
  color: var(--text-color); 
  overflow: hidden;
  min-height: 100vh;
  position: relative;
  /* Hintergrundbild wird dynamisch per PHP/DB gesetzt – kein Hardcode hier */
}

/* Verhindere Zoom-Effekte */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  /* kein hardcoded bg.png – body-background gilt */
  z-index: -1;
  pointer-events: none;
}

/* HEADER - Volle Breite auf Desktop, Stack auf Mobile */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 100px;
  background: var(--unified-bg);
  border-bottom: var(--card-border-w) solid var(--unified-border);
  backdrop-filter: blur(5px);
  z-index: 1000;
  padding: 15px 0;
}

.container {
  max-width: 100%;
  margin: 0 auto;
  padding: 0 20px;
}

.header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
  padding: 0;
}

.header-left {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 15px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 15px;
  text-decoration: none;
}

.logo-image {
  width: 100px;
  height: auto;
  object-fit: contain;
}

.logo-text h1 {
  font-size: 28px;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0;
}

.logo-text p {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 5px 0 0;
}

/* BURGER MENU - Versteckt auf Desktop */
.burger-menu {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 10px;
}

.burger-menu span {
  width: 30px;
  height: 3px;
  background: var(--primary-color);
  border-radius: var(--card-radius);
  transition: 0.3s;
}

.burger-menu.active span:nth-child(1) {
  transform: rotate(45deg) translate(8px, 8px);
}

.burger-menu.active span:nth-child(2) {
  opacity: 0;
}

.burger-menu.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -7px);
}

.header-right {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  padding-left: 40px;
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  list-style: none;
  justify-content: flex-end;
}

.main-nav a {
  color: var(--primary-color);
  text-decoration: none;
  padding: 8px 15px;
  border-radius: var(--card-radius);
  transition: 0.3s;
  white-space: nowrap;
}

.main-nav a:hover {
  background: rgba(0, 255, 255, 0.1);
  color: var(--primary-color);
}

/* SHOUTBOX - Desktop normal, Mobile vereinfacht */
.shoutbox-bar {
  position: fixed;
  top: 100px;   /* Standard: unter Header */
  left: 0;
  right: 0;
  height: 50px;
  background: var(--unified-bg);
  border-bottom: var(--card-border-w) solid var(--unified-border);
  backdrop-filter: blur(5px);
  z-index: 999;
  transition: top 0.2s ease, bottom 0.2s ease;
}
/* Shoutbox UNTEN (Desktop): über dem Footer */
body.shoutbox-bottom .shoutbox-bar {
  top: auto;
  bottom: 70px;  /* über dem Desktop-Footer (70px) */
  border-bottom: none;
  border-top: var(--card-border-w) solid var(--unified-border);
}

.shoutbox-flex {
  display: flex;
  align-items: center;
  height: 100%;
  gap: 20px;
}

.shoutbox-left {
  flex: 0 0 auto;
  font-size: 18px;
  font-weight: bold;
  color: var(--primary-color);
}

.shoutbox-middle {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  color: var(--primary-color);
  text-align: left;
  padding: 0 20px;
}

.shoutbox-right {
  flex: 0 0 auto;
  display: flex;
  gap: 10px;
}

/* MAIN CONTENT */
.main-content-wrapper {
  position: fixed;
  top: 150px;   /* 100px Header + 50px Shoutbox */
  left: 0;
  right: 0;
  bottom: 70px;
  overflow-y: auto;
  overflow-x: hidden;
}
/* Shoutbox AUS: Content direkt unter Header */
body.no-shoutbox .main-content-wrapper {
  top: 102px;   /* nur Header */
}
/* Shoutbox UNTEN: Content direkt unter Header, Footer+Shoutbox unten */
body.shoutbox-bottom .main-content-wrapper {
  top: 102px;
  bottom: 120px;  /* 70px footer + 50px shoutbox */
}

.main-content {
  max-width: 95%;
  margin: 0 auto;
  padding: 20px;
}

.widgets-container {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.widget-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 30px;
}

.widget-row:has(.card:only-child) {
  grid-template-columns: 1fr;
}

/* CARDS - NUR EINE Linie */
.card {
  background: var(--unified-bg);
  border: var(--card-border-w) solid var(--unified-border);
  border-radius: var(--card-radius);
  padding: 20px;
  backdrop-filter: blur(5px);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: var(--card-border-w) solid var(--unified-border);
}

.card-header h2 {
  font-size: 20px;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0;
  border: none;
}

/* WISHBOX - Status rechtsbündig in Header */
.wishbox-status {
  font-size: 14px;
  padding: 4px 12px;
  border-radius: var(--card-radius);
  font-weight: bold;
  transition: 0.3s;
}

.wishbox-offline {
  background: rgba(255, 0, 0, 0.2);
  color: #ff0000;
  border: 1px solid #ff0000;
}

.wishbox-online-greetings {
  background: rgba(0, 255, 0, 0.2);
  color: #00ff00;
  border: 1px solid #00ff00;
}

.wishbox-online-full {
  background: rgba(0, 255, 255, 0.2);
  color: #00ffff;
  border: 1px solid #00ffff;
}

/* NEWS - Mit Archiv */
.news-header, .special-shows-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.news-list, .special-shows-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.news-item, .special-show-item {
  background: var(--unified-bg);
  border: var(--card-border-w) solid var(--unified-border);
  border-radius: var(--card-radius);
  padding: 15px;
  transition: 0.3s;
}

.news-item:hover, .special-show-item:hover {
  border-color: var(--primary-color);
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.2);
}

.news-date, .special-show-date {
  color: var(--primary-color);
  font-size: 12px;
  margin-bottom: 8px;
}

.news-title {
  color: var(--text-color);
  font-size: 16px;
  font-weight: bold;
  margin: 0 0 8px;
}

.news-excerpt {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}

.special-show-item h4 {
  color: var(--primary-color);
  margin: 0 0 8px;
  font-size: 16px;
}

/* BUTTONS */
.btn {
  padding: 8px 16px;
  border: none;
  border-radius: var(--card-radius);
  cursor: pointer;
  font-size: 14px;
  transition: 0.3s;
  font-weight: 500;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-primary {
  background: var(--primary-color);
  color: #000;
}

.btn-primary:hover {
  background: var(--secondary-color);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-color);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* FOOTER */
.social-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 70px;
  background: var(--unified-bg);
  border-top: var(--card-border-w) solid var(--unified-border);
  backdrop-filter: blur(5px);
  z-index: 998;
  padding: 10px 0;
}

.footer-flex {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 100%;
}

.social-links {
  display: flex;
  gap: 20px;
  list-style: none;
}

.social-link {
  color: var(--text-color);
  transition: 0.3s;
}

.social-link:hover {
  color: var(--primary-color);
  transform: scale(1.1);
}

.social-link svg {
  width: 24px;
  height: 24px;
}

.footer-copy {
  font-size: 12px;
  color: var(--primary-color);
}

/* MODAL */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 10000;
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: var(--unified-bg);
  border: var(--card-border-w) solid var(--unified-border);
  border-radius: var(--card-radius);
  padding: 30px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: var(--card-border-w) solid var(--unified-border);
}

.modal-header h2 {
  margin: 0;
  color: var(--primary-color);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-color);
  font-size: 28px;
  cursor: pointer;
}

.modal-close:hover {
  color: var(--primary-color);
}

.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  color: var(--text-secondary);
}

.form-input {
  width: 100%;
  padding: 10px;
  background: rgba(0, 0, 0, 0.3);
  border: var(--card-border-w) solid var(--unified-border);
  border-radius: var(--card-radius);
  color: var(--text-color);
}

.form-input:focus {
  outline: none;
  border-color: var(--primary-color);
}

textarea.form-input {
  min-height: 100px;
  resize: vertical;
  font-family: inherit;
}

/* ===============================================
   MOBILE RESPONSIVE - Optimiert für kleine Screens
   =============================================== */

@media (max-width: 1024px) {
  .widget-row { 
    grid-template-columns: 1fr; 
  }
}

@media (max-width: 768px) {

  /* ── HEADER ──────────────────────────────────────────────── */
  .site-header {
    position: fixed; top: 0; left: 0; right: 0;
    height: auto;
    padding: 8px 0;
    z-index: 1000;
    /* overflow: visible ist PFLICHT damit das Menü nach unten klappt */
    overflow: visible;
    background: var(--unified-bg);
    backdrop-filter: blur(5px);
  }
  .container { padding: 0 10px; }

  /* Erste Zeile: Logo links, Burger IMMER rechts */
  .header-flex {
    display: flex;
    flex-wrap: wrap;           /* zweite Zeile = aufgeklapptes Menü */
    align-items: center;
    gap: 0;
    justify-content: flex-start;
    padding: 4px 0;
  }

  /* Bug 1 FIX: Logo nimmt den verfügbaren Platz, Burger klebt an den rechten Rand */
  .header-left {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
  }
  .logo { gap: 8px; }
  .logo-image { width: 40px; height: 40px; flex-shrink: 0; object-fit: contain; }
  .logo-text { min-width: 0; }
  .logo-text h1 { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .logo-text p  { display: none; }

  /* Bug 1 FIX: Burger – flex: 0 0 auto + margin-left: auto drückt ihn ans rechte Ende */
  .burger-menu {
    display: flex !important;
    flex: 0 0 auto;
    margin-left: auto;
    order: 2;
    padding: 10px;
    cursor: pointer;
  }

  /* Bug 2 FIX: Menü ist Teil des normalen Header-Flows (width:100%, order:3)
     → header wächst beim Öffnen, JS misst danach die echte Höhe
     flex:none !important überschreibt die Desktop-Regel flex:1 1 0%          */
  .header-right {
    flex: none !important;
    order: 3;
    width: 100% !important;
    flex-basis: 100% !important;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease, padding 0.35s ease;
    background: var(--unified-bg);
    border-radius: 0 0 8px 8px;
    padding: 0 10px;
    /* Kein Overlay – bleibt im normalen Dokument-Flow */
    position: static !important;
  }
  .header-right.active {
    max-height: 600px;
    padding: 8px 10px;
    border-top: var(--card-border-w) solid var(--unified-border);
    /* overflow: visible damit User-Dropdown nicht abgeschnitten wird */
    overflow: visible;
  }

  .main-nav { flex-direction: column; gap: 4px; width: 100%; list-style: none; padding: 0; margin: 0; }
  .main-nav li { width: 100%; }
  .main-nav a {
    display: block; width: 100%; padding: 10px 12px; font-size: 14px;
    background: rgba(0,0,0,0.3); border-radius: var(--card-radius);
    border: 1px solid rgba(0,255,255,0.2);
    color: var(--primary-color) !important;
    text-decoration: none; transition: 0.2s;
  }
  .main-nav a:hover { background: rgba(0,255,255,0.1); border-color: var(--primary-color); }

  /* Bug 2 FIX: Content-Wrapper bekommt top via JS NACH der Transition
     → Transition auf top damit er sanft nach unten rutscht              */
  body.shoutbox-top .main-content-wrapper,
  body.no-shoutbox  .main-content-wrapper {
    transition: top 0.35s ease;
  }

  /* ── SHOUTBOX ─────────────────────────────────────────────── */
  .shoutbox-bar {
    position: fixed; left: 0; right: 0;
    height: auto; min-height: 40px;
    padding: 6px 0; z-index: 999;
    transition: top 0.35s ease;
  }
  body.shoutbox-top .shoutbox-bar           { top: 60px; }
  body.shoutbox-top.menu-open .shoutbox-bar { top: var(--menu-height, 60px); }
  body.shoutbox-bottom .shoutbox-bar {
    top: auto; bottom: 60px;
    z-index: 999;
    border-top: var(--card-border-w) solid var(--unified-border);
    border-bottom: none;
  }

  .shoutbox-flex  { flex-direction: row; gap: 8px; align-items: center; padding: 0 10px; }
  .shoutbox-left  { display: none; }
  .shoutbox-middle{ display: none; }
  .shoutbox-right { flex: 0 0 auto; display: flex; gap: 6px; }
  .shoutbox-right .btn { font-size: 11px; padding: 6px 8px; white-space: nowrap; }

  /* ── MAIN CONTENT ────────────────────────────────────────── */
  /* top/bottom kommen per JS; Transition sorgt fürs sanfte Verschieben */
  .main-content-wrapper {
    position: fixed; left: 0; right: 0;
    overflow-y: auto; overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    top: 60px;    /* JS-Fallback */
    bottom: 60px; /* JS-Fallback */
  }
  .main-content-wrapper { padding: 0; box-sizing: border-box; }
  .main-content {
    padding: 10px 12px 8px;
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    box-sizing: border-box;
  }
  .widgets-container { gap: 12px; }
  .widget-row { gap: 12px; }
  .card { margin-bottom: 12px; }

  /* ── FOOTER ──────────────────────────────────────────────── */
  .social-footer {
    position: fixed; bottom: 0; left: 0; right: 0;
    height: 60px !important; padding: 4px 0;
    z-index: 1000;
    background: var(--unified-bg);
    border-top: var(--card-border-w) solid var(--unified-border);
  }
  .footer-flex {
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 2px !important;
    padding: 2px 8px !important;
  }
  .social-links { gap: 14px !important; }
  .social-link svg { width: 16px !important; height: 16px !important; }
  .footer-copy-row {
    display: flex !important; flex-wrap: nowrap !important;
    gap: 6px !important; justify-content: center !important;
  }
  .footer-copy      { font-size: 9px !important; white-space: nowrap !important; }
  .footer-link-item { font-size: 9px !important; white-space: nowrap !important; flex-shrink: 0 !important; }
}