@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&family=Rajdhani:wght@400;600;700&family=Share+Tech+Mono&family=Roboto+Mono&family=Special+Elite&display=swap');

/* 
 * Chat-Server HQ - Master Layout (V 3.3 - DbProvider & UI Fix)
 * Fokus: Flexbox-Stabilität, Modal-Scrolling & Help-Grid
 */

:root {
    --accent: #0080ff;
    --text: #ffffff;
    --bg-panel: rgba(0, 0, 0, 0.6);
    --accent-transparent: rgba(0, 128, 255, 0.3);
}

html, body {
    height: 100%; width: 100%;
    margin: 0; padding: 0;
    overflow: hidden; 
    background-color: #000;
}

body { 
    display: flex; flex-direction: column; 
    padding: 15px; box-sizing: border-box; gap: 10px;
    background-size: cover; background-position: center;
    background-attachment: fixed; background-repeat: no-repeat;
    transition: background 0.8s ease-in-out;
    color: var(--text); font-family: 'Segoe UI', Roboto, sans-serif;
}

/* Der Blur-Effekt für den gesamten Inhalt */
body.ws-disconnected #main-wrapper, 
body.ws-disconnected #poker-arena,
body.ws-disconnected .poker-arena-wrapper {
    /* 1. Die Unschärfe (Passe die 10px nach Geschmack an) */
    filter: blur(10px); 

    /* 2. Verhindert Klicks auf die Arena-Elemente */
    pointer-events: none; 
    
    /* 3. Verhindert Text-Auswahl */
    user-select: none; 

    /* 4. Weicher Übergang, wenn es wieder scharf wird */
    transition: filter 0.4s ease-out; 
}

/* --- 2. DAS STYLING FÜR DAS OVERLAY (WIE VORHER, NUR STABILER) --- */

#ws-reconnect-overlay {
    display: none; /* Standard: unsichtbar */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    
    /* Ein dunkler, teiltransparenter Hintergrund (für den Kontrast) */
    background: rgba(0, 0, 0, 0.6); 
    
    /* Gaaaanz weit oben, über allem anderen */
    z-index: 999999; 
    
    /* Zentrierung des Inhalts */
    justify-content: center;
    align-items: center;
    color: white;
}

/* Zeige das Overlay nur, wenn 'ws-disconnected' aktiv ist */
body.ws-disconnected #ws-reconnect-overlay {
    display: flex;
}

/* Die gelb-umrandete Box (Inhalt) */
.reconnect-box {
    text-align: center;
    padding: 40px 60px;
    border: 3px solid #ffc107;
    border-radius: 20px;
    background: #111; /* Dunkler, fester Hintergrund */
    box-shadow: 0 0 40px rgba(255, 193, 7, 0.5);
}

.reconnect-icon {
    font-size: 50px;
    margin-bottom: 20px;
    display: block;
    animation: pulse-warn 1.5s infinite;
}

.reconnect-box h2 {
    margin: 0 0 10px 0;
    font-size: 1.8rem;
}

.reconnect-status {
    font-size: 1.1rem;
    color: #ccc;
}

/* Pulsierende Animation für das Icon */
@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

/* --- HQ AUTH-SYSTEM (DEFAULT LIGHT THEME) --- */
#auth-overlay {
    position: fixed !important;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(255, 255, 255, 0.8); /* Helles Glas-Overlay */
    backdrop-filter: blur(12px);
    z-index: 999999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.auth-card {
    width: 380px;
    padding: 40px;
    background: #ffffff !important; /* Weißer Karten-Hintergrund */
    border: 2px solid var(--accent) !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1), 0 0 20px var(--accent-transparent);
    border-radius: 12px;
    text-align: center;
    animation: auth-pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.auth-card h2, #auth-title {
    color: var(--accent) !important; /* Dein Blau bleibt erhalten */
    font-family: 'Orbitron', sans-serif;
    font-size: 1.6rem;
    margin-bottom: 30px;
    text-transform: uppercase;
    letter-spacing: 3px;
}

.auth-input-group label {
    color: #555 !important; /* Dunkelgrauer Text für Lesbarkeit auf Weiß */
    font-weight: 600;
}

.auth-input {
    width: 100% !important;
    padding: 12px !important;
    background-color: #f9f9f9 !important; /* Ganz helles Grau für Inputs */
    border: 1px solid #ddd !important;
    color: #333 !important; /* Dunkle Schrift in den Feldern */
    box-sizing: border-box !important;
}

.auth-input:focus {
    border-color: var(--accent) !important;
    background-color: #fff !important;
    box-shadow: 0 0 8px var(--accent-transparent);
}

/* Chrome Autofill Fix für helle Felder */
input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 30px #f9f9f9 inset !important;
    -webkit-text-fill-color: #333 !important;
}

.auth-switch {
    color: #777 !important;
}

/* Button bleibt im Akzent-Blau, damit er raussticht */
.auth-card .btn-confirm {
    background: var(--accent) !important;
    color: #ffffff !important;
    border-radius: 6px !important;
}

/* HEADER BEREICH */
.header-container {
    display: flex;
    justify-content: space-between;
    height: 65px;
    flex-shrink: 0; 
    align-items: stretch;
}

#header-left { 
    flex: 4; 
    display: flex; 
    flex-direction: row; 
    align-items: center; 
    justify-content: flex-start; 
    gap: 15px; 
    position: relative; 
    padding-left: 10px;  
}

#header-right { 
    flex: 1; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    min-width: 220px; 
}

#userlist-toggle {
    display: none;
}

/* --- INSIGNIA POSITIONIERUNG (Zentriert mit Triple-Glow) --- */
.insignia-container {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 5px;
}

#insignia {
    max-width: 90%;
    max-height: 55px;
    width: auto;
    height: auto;
    display: none; 
    /* Triple-Glow Filter für schwarze Logos auf Transparenz */
    filter: drop-shadow(0 0 1px rgba(255, 255, 255, 1)) 
            drop-shadow(0 0 5px rgba(200, 200, 200, 1)) 
            drop-shadow(0 0 15px rgba(150, 150, 150, 0.8));
}

.system-title { margin: 0; font-size: 1.4rem; letter-spacing: 1px; }

/* --- 4. MAIN LAYOUT CONTAINER --- */
/* --- BASIS-STRUKTUR (WIEDERHERSTELLUNG) --- */
#main-container {
    display: flex;
    flex: 1;
    gap: 15px;
    overflow: hidden;
    width: 100%;
}

body.theme-matrix {
    background: transparent !important; /* WICHTIG! */
}
#main-container {
    background: transparent; /* Damit man durch den Chat schauen kann */
}

/* In layout.css ergänzen */
body.theme-ufo #main-container, 
body.theme-ufo #chat-wrapper, 
body.theme-ufo #sidebar-wrapper {
    background: rgba(0, 20, 30, 0.4) !important; /* Blau-transparenter Sci-Fi Look */
    border-color: rgba(0, 240, 255, 0.5) !important;
}

#chat-wrapper, #sidebar-wrapper {
    display: flex;
    flex-direction: column;
    position: relative;
    background: var(--bg-panel); /* WICHTIG: Hier docken die Themes an! */
    border: 1px solid rgba(255,255,255,0.1);
    transition: all 0.5s ease;
}

#chat-wrapper { flex: 4; }
#sidebar-wrapper { flex: 1; min-width: 220px; }

#chat {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    scrollbar-width: thin;
}

#sidebar {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.sidebar-title {
    padding: 5px;
}

#user-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.user-entry {
    padding: 5px;
}

/* --- BEAM-EFFEKTE (RAHMEN-ANIMATION) --- */
.beam-top, .beam-bottom, .beam-left, .beam-right {
    position: absolute;
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent);
    z-index: 10;
    opacity: 0.4;
}

.beam-top { top: 0; left: 0; width: 100%; height: 1px; }
.beam-bottom { bottom: 0; left: 0; width: 100%; height: 1px; }
.beam-left { top: 0; left: 0; width: 1px; height: 100%; }
.beam-right { top: 0; right: 0; width: 1px; height: 100%; }

/* --- THEME-SPEZIFISCHE CANVAS LAYER --- */
#matrix-canvas, #ufo-canvas, .theme-overlay {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1 !important;
    pointer-events: none;
}

/* --- 5. INPUT & MESSAGES --- */
#input-wrapper { flex-shrink: 0; position: relative; padding: 10px; }
#input-area { display: flex; gap: 10px; }
#message { 
    flex: 1; padding: 12px; background: rgba(0,0,0,0.5); 
    border: 1px solid var(--accent); color: #fff; outline: none; 
}
#send-btn { background: var(--accent); color: #000; font-weight: bold; border: none; padding: 10px 25px; cursor: pointer; }

.msg { margin-bottom: 12px; animation: fadeIn 0.3s ease-out; padding: 10px; word-wrap: break-word; }

/* --- 6. SCROLLBARS & FX --- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 3px; }

@keyframes auth-pop { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 30px #000 inset !important;
    -webkit-text-fill-color: #fff !important;
}

/* --- MODALS (FIXED FOOTER & SCROLLING CONTENT) --- */
#help-modal {
    display: none; 
    position: fixed;
    z-index: 99999; /* Über dem Chat, unter dem Login */
    left: 0; top: 0;
    width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    justify-content: center;
    align-items: center;
}

#help-modal .modal-body {
    width: 70%;
    max-height: 80vh; /* WICHTIG: Begrenzt das Fenster auf 80% der Bildschirmhöhe */
    background: var(--bg-panel);
    border: 1px solid var(--accent);
    display: flex;
    flex-direction: column; /* Stapelt Title, Content und Footer */
    padding: 30px;
    position: relative;
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
    overflow-y: auto;
}

.modal-title {
    flex-shrink: 0; /* Titel darf nicht kleiner werden */
    margin: 0 0 20px 0;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--accent);
    font-family: 'Orbitron', sans-serif;
    color: var(--accent);
    text-transform: uppercase;
}

#help-content-scroll {
    flex: 1; /* Nimmt den restlichen Platz ein */
    overflow-y: auto; /* Aktiviert das Scrollen NUR hier */
    padding-right: 15px;
    scrollbar-width: thin;
    scrollbar-color: var(--accent) transparent;
}

/* Chrome/Edge/Safari Scrollbar für das Modal */
#help-content-scroll::-webkit-scrollbar { width: 5px; }
#help-content-scroll::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 10px; }

.modal-footer {
    flex-shrink: 0; /* Button-Bereich bleibt immer sichtbar */
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    text-align: center;
}

.modal-close-btn {
    padding: 10px 30px;
    background: var(--accent);
    color: white;
    cursor: pointer;
    border: none;
    font-weight: bold;
    text-transform: uppercase;
}

/* Hilfe Grid-Struktur */
.help-row {
    display: flex;
    flex-direction: row;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    gap: 20px;
}

.help-cmd {
    flex: 0 0 140px;
    font-family: 'Share Tech Mono', monospace;
    color: var(--accent);
    font-weight: bold;
}

.help-desc {
    flex: 1;
    color: var(--text);
    opacity: 0.9;
}

/* James in der Userliste hervorheben */
.user-entry[data-is-bot="true"] {
    color: #ff0000;
}

.user-entry[data-is-bot="true"]::after {
    content: " 🤵" !important;
    display: inline-block;
    margin-left: 5px;
    font-style: normal; /* Damit das Icon nicht kursiv wird, falls der Text kursiv ist */
}

.user-entry[data-is-bot="true"] span {
    color: #ffd700 !important; /* Goldener Punkt für James */
}

/* emojis */
.emoji-img {
    height: 20px;
    position: relative;
    top: 3px;
}