/**
 * layout.css 
 * Grundstruktur & Modernes Glassmorphism Design
 * FIX: Sidebar-Zentrierung, korrekte Breite & Anti-Blau-Schutz
 */

:root {
    --sidebar-width: 80px;
    --bg-dark: #0a0b0d;
    --primary-color: #e10600; /* Racing-Rot */
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-muted: rgba(255, 255, 255, 0.6);
    --app-padding: 40px;
}

/* RESET & BASIS */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    color: #ffffff;
    font-family: 'Inter', 'Segoe UI', sans-serif;
    overflow-x: hidden;
    display: flex;
    min-height: 100vh;
}

/* ANTI-BLAU LINK SCHUTZ */
a, a:visited, a:active, a:focus {
    color: #ffffff;
    text-decoration: none;
    transition: 0.3s ease;
}

a:hover {
    color: var(--primary-color);
}

/* ZONE 1: SIDEBAR (FIXIERT & ZENTRIERT) */
.app-sidebar, .sidebar {
    width: var(--sidebar-width);
    background-color: rgba(5, 6, 8, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center; /* Zentriert Logo & Nav horizontal */
    padding: 25px 0;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    border-right: 1px solid var(--glass-border);
    z-index: 1000;
    backdrop-filter: blur(15px);
}

.sidebar-logo {
    text-align: center;
    margin-bottom: 30px;
    font-weight: bold;
    font-size: 12px;
    color: #fff;
    width: 100%;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.sidebar-nav a {
    width: 100%;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-align: center;
}

.sidebar-nav a i {
    font-size: 22px;
    margin-bottom: 5px;
    color: var(--primary-color);
}

.sidebar-nav a:hover {
    color: #ffffff;
    background: var(--glass-bg);
    box-shadow: inset 3px 0 0 var(--primary-color);
}

/* Login/Status Icon ganz unten in Sidebar */
.sidebar-nav a:last-child {
    margin-top: auto;
}

/* Logo */
.sidebar-logo #sb-logo {
    width: 40px;
    height: auto;
}

/* Sidebar Footer (Login / Logout / Usercounter) */
.sidebar-footer {
    position: absolute; /* Fixiert den Block am unteren Rand der Sidebar */
    bottom: 0px;      /* 30px Abstand zum unteren Bildschirmrand */
    left: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.sidebar-footer .auth-area {
    margin-bottom: 10px; /* Abstand zwischen Logout-Icon und Zahl */
    display: flex;
    justify-content: center;
}

.sidebar-footer .auth-area i {
    font-size: 20px;
    color: var(--text-muted);
}

.live-counter {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
}

.sidebar-footer a {
    color: var(--text-muted);
    transition: 0.3s;
}

.sidebar-footer a:hover {
    color: var(--primary-color) !important;
}

.sidebar-footer a i {
    font-size: 22px !important;
    color: #9b9b9c !important; /* Ein dunkleres, dezentes Grau wie im Original */
    transition: all 0.2s ease-in-out !important;
}

.sidebar-footer a:hover::before {
    background: #9b9b9c !important; /* Grauer Balken beim Logout */
    box-shadow: 2px 0 10px rgba(155, 155, 156, 0.3) !important;
}

/* ZONE 2: HAUPTBEREICH (APP-MAIN) */
.app-main {
    flex: 1;
    padding-left: var(--sidebar-width); /* Schafft Platz für Sidebar */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
}

/* INHALTS-CONTAINER */
.app-content-inner {
    padding: var(--app-padding);
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* HERO VIDEO BEREICH */
.hero-header-video {
    position: relative;
    width: 100%;
    height: 450px;
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 40px;
    background: #000;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    flex-shrink: 0;
}

.hero-header-video iframe {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* CONTENT GRID */
.main-content-grid {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 20px;
    width: 100%;
}

/* GLASS-CARDS */
.glass-card, .modern-news-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 20px;
}

/* ZONE 3: FOOTER */
.app-footer-bar {
    width: 100%;
    margin-top: auto;
    padding: 30px var(--app-padding);
    border-top: 1px solid var(--glass-border);
    background-color: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
}

.footer-content p {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
}

/* SCROLLBAR */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary-color); }

/* RESPONSIVE */
@media (max-width: 1100px) {
    .main-content-grid {
        grid-template-columns: 1fr;
    }
}

/* --- NEUE KLASSEN FÜR DEN HINTERGRUND (background.php) --- */

.main-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1; /* Liegt hinter dem Content */
    overflow: hidden;
    background-color: var(--bg-dark); /* Fallback falls Bild nicht lädt */
}

.bg-image-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.35; /* Macht das Bild dezent, damit Weißer Text lesbar ist */
}

.slider-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Erzeugt einen sanften Verlauf zu den Rändern hin */
    background: radial-gradient(circle at center, transparent 0%, var(--bg-dark) 90%);
}

/* Styling für die Quick-Navigation über den News */
.quick-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 25px; /* Erzeugt den Abstand zwischen den einzelnen Karten/Links */
    margin-bottom: 25px;
    width: 100%;
}

.quick-nav .nav-card {
    display: flex;
    align-items: center;
    gap: 10px; /* Abstand zwischen Icon und Text innerhalb der Karte */
    color: var(--text-muted) !important;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.quick-nav .nav-card i {
    color: var(--primary-color); /* Racing-Rot für die Icons */
    font-size: 1.1rem;
    transition: transform 0.3s ease;
}

.quick-nav .nav-card:hover {
    color: #ffffff !important;
}

.quick-nav .nav-card:hover i {
    transform: scale(1.2); /* Kleiner Effekt beim Drüberfahren */
}

/* ==========================================================================
   MODERN MOBILE NAVIGATION (V2.1 - Mit Overlay, Labels & Navigation-States)
   ========================================================================== */

/* 1. Globale Vorbereitung (Desktop & Mobile) */
.nav-label, 
.sidebar-overlay {
    display: none;
}

/* Schriftart für die gesamte Sidebar */
.app-sidebar {
    font-family: 'Inter', 'Segoe UI', sans-serif !important;
    padding-left: 0 !important; /* WICHTIG: Sidebar Padding links weg für Full-Width */
    padding-right: 0 !important;
}

/* NAVIGATION STATES (Desktop & Mobile) */

.sidebar-nav a {
    position: relative;
    display: flex;
    align-items: center;
    border-left: 4px solid transparent; /* Etwas dickerer Balken (4px) für bessere Sichtbarkeit */
    transition: all 0.2s ease;
    padding: 20px 25px !important; /* Dein gewünschtes Padding jetzt hier im Link */
    width: 100%;
    text-decoration: none;
}

/* HOVER-Zustand: Racing-Rot */
.sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.05);
    border-left-color: #e10600 !important;
}

.sidebar-nav a:hover i {
    color: #e10600 !important;
    text-shadow: 0 0 10px rgba(225, 6, 0, 0.4);
}

/* ACTIVE-Zustand: Weiß (Full Width Effekt) */
.sidebar-nav a.active {
    background: rgba(255, 255, 255, 0.1) !important; /* Etwas helleres Grau für aktive Zeile */
    border-left-color: #ffffff !important;
    color: #ffffff !important;
}

.sidebar-nav a.active i {
    color: #ffffff !important;
}

/* Spezialfall: Hover auf Active */
.sidebar-nav a.active:hover {
    border-left-color: #e10600 !important;
}

@media (max-width: 1024px) {
    /* 2. Das dunkle Hintergrund-Overlay */
    .sidebar-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.85); 
        backdrop-filter: blur(5px);
        z-index: 998;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease-in-out;
    }

    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    /* 3. Die Sidebar als breiter Drawer */
    .app-sidebar {
        width: 280px !important; 
        left: -280px !important; 
        align-items: flex-start !important; 
        padding: 30px 0 !important; /* Oben/Unten Padding bleibt, Seiten auf 0 */
        background: rgba(10, 11, 13, 0.98) !important;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        box-shadow: 5px 0 25px rgba(0,0,0,0.5);
        z-index: 1000 !important;
    }

    .app-sidebar.active {
        left: 0 !important;
    }

    /* Logo-Anpassung (Padding manuell hinzugefügt, da Sidebar-Padding weg ist) */
    .app-sidebar .sidebar-logo {
        padding-left: 20px;
        margin-bottom: 5px;
        margin-top: 10px;
    }

    .app-sidebar .sidebar-logo #sb-logo {
        width: 80px !important;
        margin-right: 15px;
        margin-bottom: 5px;
    }

    /* 4. Navigation-Links */
    .sidebar-nav {
        align-items: flex-start !important;
        width: 100%;
        margin-top: 20px;
    }

    .sidebar-nav a {
        flex-direction: row !important; 
        justify-content: flex-start !important;
        padding: 18px 25px !important; /* Leicht angepasst für mobile Griffigkeit */
        gap: 15px;
        font-family: 'Inter', 'Segoe UI', sans-serif !important;
    }

    .sidebar-nav a i {
        margin-bottom: 0 !important;
        width: 25px;
        text-align: center;
        font-size: 20px;
    }

    .nav-label {
        display: inline-block !important; 
        font-size: 16px;
        color: #fff;
        font-family: 'Inter', 'Segoe UI', sans-serif !important;
        font-weight: 500; 
    }

    /* Login/Logout Bereich */
    .sidebar-footer {
        padding: 20px 0; /* Seiten-Padding auf 0 */
        width: 100%;
        align-items: flex-start !important;
    }

    .sidebar-footer .auth-area a {
        display: flex;
        align-items: center;
        gap: 15px;
        width: 100%;
        padding: 15px 25px; /* Padding hier sorgt für bündigen Abschluss */
        text-decoration: none;
        font-family: 'Inter', 'Segoe UI', sans-serif !important;
    }

    /* 5. Hauptbereich & Top-Bar */
    .app-main {
        padding-left: 0 !important;
    }

    .app-content-inner {
        padding: 20px;
        margin-top: 65px; 
    }

    .mobile-top-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 60px;
        background: rgba(15, 16, 18, 0.95);
        backdrop-filter: blur(15px);
        border-bottom: 1px solid var(--glass-border);
        padding: 0 20px;
        z-index: 900;
    }

    .menu-toggle {
        font-size: 24px;
        color: var(--primary-color);
        cursor: pointer;
    }

    .mobile-logo img {
        height: 35px;
    }

    /* 6. Grid auf einspaltig */
    .main-content-grid {
        grid-template-columns: 1fr !important;
        gap: 15px;
    }

    /* --- PUNKT 1: QUICK-LINKS EINZEILIG --- */
    .quick-nav {
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: stretch !important;
        padding: 15px 8px !important;
        gap: 8px !important; /* Mehr Platz durch Archiv-Ausblendung */
        width: 100% !important;
    }

    /* Blendet den Archiv-Link spezifisch aus */
    .nav-card[href*="Leagues-Archiv"] {
        display: none !important;
    }

    .nav-card {
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        text-decoration: none !important;
        padding: 5px 0 !important;
    }

    .nav-card i {
        font-size: 19px !important; /* Etwas größer, da mehr Platz */
        margin-bottom: 6px !important;
        color: var(--primary-color) !important;
    }

    .nav-card span {
        font-size: 10px !important; /* Wieder lesbarer */
        text-transform: uppercase;
        font-weight: 700;
        color: #fff !important;
        white-space: nowrap !important;
    }

    /* --- PUNKT 2: SPIELE-LOGOS (Bleibt Slider-Logik) --- */
    .history-strip {
        overflow: hidden !important;
        width: 100% !important;
        padding: 15px 0 !important;
        background: transparent !important;
        margin-top: 20px !important;
    }

    .game-logos {
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        /* Hier saß der Grauschleier-Übeltäter: */
        filter: none !important;
        -webkit-filter: none !important;
        
        width: 100% !important;
        justify-content: flex-start !important;
        transition: transform 1.2s cubic-bezier(0.45, 0.05, 0.55, 0.95) !important;
    }

    /* --- DIE BILDER: 31% BREITE + AUTOMATISCHER ABSTAND --- */
    .game-logos img {
        /* 31% * 3 = 93%. Wir haben also 7% Puffer für Abstände */
        flex: 0 0 31% !important;
        width: 31% !important;
        max-width: 31% !important;
        
        /* Wir nutzen margin-right für den Puffer, außer beim jeweils 3. Logo */
        margin-right: 3.5% !important; 
        
        height: auto !important;
        max-height: 30px !important;
        object-fit: contain !important;
        box-sizing: border-box !important;

        /* Sicherheitshalber auch hier Filter aus */
        filter: none !important;
        -webkit-filter: none !important;
        opacity: 1 !important;
    }

    /* Jedes 3. Logo (Ende der Seite) bekommt keinen rechten Abstand */
    .game-logos img:nth-child(3n) {
        margin-right: 0 !important;
    }

    /* Wir löschen eventuelle Abstände vom ersten Logo */
    .game-logos img:first-child {
        margin-left: 0 !important;
    }

    /* --- PUNKT 3: COMMUNITY STATS (Neu: JS-gesteuertes Einblenden) --- */
    .stats-container {
        /* Kein nowrap mehr, da das JS die Items via display steuert */
        display: flex !important;
        flex-wrap: wrap !important; 
        justify-content: center !important;
        width: 100% !important;
        /* Transform/Transition hier entfernen, da kein horizontales Band mehr */
        transform: none !important; 
        transition: none !important;
    }

    .stat-item {
        /* Jedes Item nimmt 50% Breite ein, damit 2 nebeneinander stehen */
        flex: 0 0 50% !important; 
        width: 50% !important;
        max-width: 50% !important;
        /* Das JS setzt display: flex oder none, daher hier nur Styling */
        /*flex-direction: column !important;*/
        /*align-items: center !important;*/
        padding: 15px 5px !important;
        box-sizing: border-box !important;
    }

    .stat-label {
        font-size: 10px !important;
        white-space: nowrap !important;
        text-transform: uppercase !important;
        letter-spacing: 0.3px;
    }

    .archiv-container {
        padding: 0px !important;
    }
}

/* Desktop-Sicherung */
@media (min-width: 1025px) {
    .mobile-top-bar {
        display: none;
    }
}