/* Chat Header Styles */
/* Einheitlicher z-index für alle Popups, die über den popupManager laufen */
.popup,
.game-stats-popup,
#games-modal {
    z-index: 2000 !important;
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 12px;
    min-height: 56px;
    /* ÜBERSCHREIBUNG: Einfacher hellblauer Hintergrund ohne Verlauf */
    background: #064af72d !important;
    background-color: #064af72d !important;
    background-image: none !important;
    color: white !important;
    z-index: 32000 !important;
    overflow: hidden !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Kinder dürfen schrumpfen, damit nichts den Header spreizt */
.chat-header > * { min-width: 0 !important; }

.ad-banner {
    flex: 0 0 auto;
    display: flex !important;
    align-items: center;
    height: 100%;
}

.ad-banner img {
    height: 40px;
    width: auto;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    object-fit: contain;
}

.global-marquee {
    flex: 1 1 0;
    flex-shrink: 1;
    align-self: stretch;
    display: flex;
    align-items: center;
    max-width: 100%;
    min-width: 0;
    position: relative;
    margin: 0 12px 0 0;
}


/* Marquee-Container: immer starr, overflow versteckt, Breite fixiert durch Flexbox */
.marquee-text {
    white-space: nowrap;
    overflow: hidden;
    position: relative;
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    flex: 1 1 0;
}


.marquee-text span {
    display: inline-block;
    font-weight: bold;
    /* Farbe wird aus der DB/HTML gesetzt, nicht hier überschrieben */
    font-size: 1.1em;
    padding-left: 100%; /* Startet außerhalb des Containers */
    padding-right: 2em;
    will-change: transform;
    animation: marquee 36s linear infinite;
}


/* Doppelte Definition entfernt, alles oben zusammengefasst */

#marquee-badge {
    display: none;
    position: absolute;
    right: 0;
    top: 0;
    background: #e53935;
    color: #fff;
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 13px;
    font-weight: bold;
    margin: 4px 8px 0 0;
    z-index: 2;
}

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

.header-actions img {
    height: 1.5em;
    width: auto;
    vertical-align: middle;
}

#theme-toggle {
    font-size: 1.5em;
    line-height: 1;
}

.online-time {
    margin-left: 20px;
    display: flex;
    align-items: center;
    flex: 0 0 auto;
}

.online-time .time-icon {
    font-size: 1.2em;
}

.notification-bell {
    display: inline-block;
    position: relative;
    margin: 0 12px;
    cursor: pointer;
}

.notification-bell img {
    height: 26px;
    width: 26px;
    vertical-align: middle;
}

.notification-badge {
    display: none;
    position: absolute;
    top: 0;
    right: 0;
    background: #e53935;
    color: #fff;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 12px;
    min-width: 18px;
    text-align: center;
}

#current-time {
    margin-left: 8px;
    font-size: 1em;
    color: #888;
}

/* Header Settings Button */
.header-settings-btn {
    background: rgba(255, 255, 255, 0.2) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    color: white !important;
    border-radius: 6px !important;
    padding: 8px 12px !important;
    font-size: 16px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 40px !important;
    min-height: 40px !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

.header-settings-btn:hover {
    background: rgba(255, 255, 255, 0.3) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
    transform: scale(1.05) !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2) !important;
}

.header-settings-btn:active {
    transform: scale(0.98) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
}

/* Neue .header-flex-group für flexibles, responsives Layout ergänzt */
.header-flex-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
}

@media (max-width: 900px) {
    .global-marquee { 
        max-width: calc(100vw - 220px); 
    }
    /* Header-Logo immer linksbündig, nicht mittig */
    .chat-header .logo-top {
        justify-content: flex-start !important;
        align-items: center !important;
        display: flex !important;
        flex: 0 0 auto !important;
        margin: 0 !important;
        width: auto !important;
    }
    .chat-header .logo {
        margin: 0 !important;
        height: 36px !important;
        width: auto !important;
        display: block !important;
    }
    /* Header-Actions (Icons) immer sichtbar und nicht verdeckt */
    .chat-header .header-actions {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 2px !important;
        overflow-x: auto !important;
        flex-wrap: nowrap !important;
        white-space: nowrap !important;
        padding-right: 2px !important;
        margin-left: 0 !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    .chat-header .header-actions > * {
        flex: 0 0 auto !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    /* Logo-Banner immer ganz links, nicht mittig */
    .chat-header {
        justify-content: flex-start !important;
    }
    .chat-header .ad-banner {
        order: -1 !important;
        margin-right: 8px !important;
        margin-left: 0 !important;
        justify-content: flex-start !important;
        align-items: center !important;
        display: flex !important;
        flex: 0 0 auto !important;
        min-width: 0 !important;
        max-width: 40vw !important;
    }
    .chat-header .ad-banner img {
        margin: 0 !important;
        height: 32px !important;
        width: auto !important;
        display: block !important;
        object-fit: contain !important;
    }
}

@media (max-width: 800px) {
  .chat-header {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100vw !important;
    min-width: 0 !important;
    max-width: 100vw !important;
    height: 36px !important;
    min-height: 36px !important;
    max-height: 40px !important;
    background: #fffbe7 !important;
    color: #222 !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.07) !important;
    border-bottom: 1.5px solid #e0b800 !important;
    padding: 0 6px !important;
    z-index: 32000 !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    overflow: visible !important;
  }
  .chat-header .ad-banner {
    flex: 0 0 auto !important;
    display: flex !important;
    align-items: center !important;
    height: 100% !important;
    justify-content: flex-start !important;
    }
    .chat-header .ad-banner img {
        height: 28px !important;
        max-height: 28px !important;
  }
  .chat-header .header-actions {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 2px !important;
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
    white-space: nowrap !important;
    padding-right: 2px !important;
    margin-left: 0 !important;
  }
  .chat-header .header-actions > * {
    flex: 0 0 auto !important;
  }
  .global-marquee {
        max-width: 90vw !important;
    margin: 0 4px 0 0 !important;
  }
}

@media (max-width: 700px) {
    .global-marquee { 
        max-width: 120px; 
        margin: 0 4px 0 0; 
    }
    
    .marquee-text span { 
        font-size: 1em; 
    }

    .header-flex-group {
        gap: 4px;
    }
    .header-actions {
        gap: 2px;
        margin-left: 0;
        overflow-x: auto;
        flex-wrap: nowrap;
        white-space: nowrap;
        padding-right: 4px;
        scrollbar-width: thin;
    }
    .header-actions > * {
        flex: 0 0 auto;
    }
    .online-time {
        margin-left: 6px;
    }
    .ad-banner img {
        height: 28px;
    }
}

@media (max-width: 600px) {
    .chat-header .logo-top {
        height: 32px !important;
    }
    .chat-header .logo {
        height: 28px !important;
    }
    .chat-header .header-actions {
        gap: 1px !important;
        padding-right: 2px !important;
    }
    .chat-header .ad-banner {
        max-width: 60vw !important;
    }
    .chat-header .ad-banner img {
        height: 22px !important;
    }
}

@media (max-width: 480px) {
    .header-settings-btn {
        padding: 4px 8px !important;
        font-size: 12px !important;
        min-width: 32px !important;
        min-height: 32px !important;
    }

    .header-flex-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }
    .header-actions {
        gap: 1px;
        padding-right: 2px;
    }
    .header-actions, .online-time {
        margin-left: 0;
    }
    .ad-banner img {
        height: 22px;
    }
}

/* Sound Settings Dropdown */
#sound-settings-dropdown {
    color: #222 !important;
    font-size: 1em;
    font-family: inherit;
}
#sound-settings-dropdown label span {
    color: #222 !important;
    font-weight: 500;
}
#sound-settings-dropdown input[type="checkbox"] {
    accent-color: #064af7;
}

/* Animations */
@keyframes marquee {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-100%);
    }
}

/* =============================
     Mobile-Minimal-Header Overrides
     Ziel: Auf Mobilgeräten Header nicht scrollbar machen und Logo/Marquee ausblenden
     Nur Funktionsbuttons anzeigen
============================= */
@media (max-width: 800px) {
    /* Header selbst darf keine Scrollbars zeigen */
    .chat-header {
        overflow: hidden !important;
        box-sizing: border-box !important;
    }
    /* Insel-Logo, Banner und Lauftext ausblenden */
    .chat-header .ad-banner,
    .chat-header .logo-top,
    .chat-header .logo,
    .global-marquee,
    .marquee-text {
        display: none !important;
        visibility: hidden !important;
    }
    /* Nur die Funktionsbuttons anzeigen – ohne horizontale Scrollbar */
    .chat-header .header-actions {
        overflow: hidden !important; /* statt overflow-x: auto */
        flex-wrap: nowrap !important;
        gap: 4px !important;
        margin-left: 0 !important;
        padding-right: 4px !important;
    }
    .chat-header .header-actions > * {
        flex: 0 0 auto !important;
    }
    .chat-header .header-actions img {
        height: 20px !important;
        width: auto !important;
    }
}

@media (max-width: 600px) {
    .chat-header .header-actions {
        overflow: hidden !important; /* Scrollleisten unterdrücken */
        gap: 3px !important;
    }
    .chat-header .header-actions img {
        height: 18px !important;
    }
}

@media (max-width: 480px) {
    .chat-header .header-actions {
        overflow: hidden !important;
        gap: 2px !important;
        padding-right: 2px !important;
    }
    .chat-header .header-actions img {
        height: 16px !important;
    }
}
