/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700;900&display=swap');

:root {
    --primary: #000000;       /* Schwarz */
    --secondary: #ffffff;     /* Weiß */
    --bg-body: #f4f4f4;       /* Hellgrau Hintergrund */
    --bg-card: #ffffff;       /* Weiß Karten */
    --text-main: #222222;     /* Text Dunkel */
    --text-muted: #666666;    /* Text Grau */
    --accent-date: #e65100;   /* Orange für Datum */
    --border-color: #e0e0e0;
}

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

/* NOTFALL-SCHUTZ: Bilder dürfen nie breiter sein als ihr Platz */
img { max-width: 100%; height: auto; }

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
}

/* --- HEADER --- */
header {
    background-color: var(--secondary);
    padding: 10px 20px;
    border-bottom: 3px solid var(--primary);
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.nav-logo { height: 45px; width: auto; }

nav ul { list-style: none; display: flex; gap: 20px; }
nav a {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.9rem;
    padding-bottom: 5px;
}
nav a:hover, nav a.active { border-bottom: 2px solid var(--primary); }

/* --- MAIN --- */
main { max-width: 900px; margin: 2rem auto; padding: 0 10px; }

/* Seiten Titel */
.page-header {
    display: flex;
    align-items: center;
    margin-bottom: 30px;
}
.page-header h1 {
    font-weight: 900; 
    text-transform: uppercase; 
    margin: 0; 
    font-size: 2rem;
    color: var(--primary);
    line-height: 1;
}
.page-header-logo {
    height: 50px !important;
    width: auto !important;
    margin-right: 15px;
}

h1 { font-weight: 900; text-transform: uppercase; margin-bottom: 20px; font-size: 2rem; color: var(--primary); }

.card {
    background: var(--bg-card);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    padding: 20px;
    margin-bottom: 20px;
}
.card h2 { margin-bottom: 15px; border-bottom: 1px solid #eee; padding-bottom: 10px; }

/* --- REGEL-SEITE STYLING (Das hat gefehlt!) --- */
.rules-sub-header {
    color: var(--primary);
    border-bottom: 2px solid var(--accent-date);
    display: inline-block;
    padding-bottom: 5px;
    margin-top: 25px;
    margin-bottom: 15px;
    font-size: 1.2rem;
    font-weight: bold;
}
.rules-list { list-style: none; padding: 0; }
.rules-list li {
    background: #f8f8f8;
    border-left: 4px solid var(--primary); /* Schwarzer Balken */
    padding: 12px 15px;
    margin-bottom: 10px;
    border-radius: 0 4px 4px 0;
    font-size: 0.95rem;
    line-height: 1.4;
}

/* --- STARTSEITE LOGOS --- */
.team-list { list-style: none; padding: 0; }
.team-list li {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
    font-weight: bold;
}
.team-logo-small {
    width: 40px !important;
    height: 40px !important;
    object-fit: contain;
    margin-right: 15px;
    flex-shrink: 0;
}

/* --- FILTER TABS --- */
.filter-tabs { display: flex; gap: 5px; margin-bottom: 20px; flex-wrap: wrap; }
.filter-btn {
    background: var(--secondary);
    border: 1px solid #ccc;
    color: var(--text-main);
    padding: 8px 16px;
    text-transform: uppercase;
    font-weight: bold;
    font-size: 0.8rem;
    cursor: pointer;
    border-radius: 2px;
}
.filter-btn.active {
    background-color: var(--primary);
    color: var(--secondary);
    border-color: var(--primary);
}

/* --- TABELLE (Desktop) --- */
.bundesliga-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin-bottom: 2rem;
    background: var(--bg-card);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.bundesliga-table thead th {
    background-color: var(--primary);
    color: var(--secondary);
    text-align: center;
    font-size: 0.75rem;
    text-transform: uppercase;
    padding: 12px 8px;
}
.bundesliga-table thead th.th-team { text-align: left; padding-left: 15px; }

.bundesliga-table tbody tr { border-bottom: 1px solid var(--border-color); }
.bundesliga-table td { padding: 12px 8px; text-align: center; vertical-align: middle; }

/* Spalten Desktop */
.td-rank { font-weight: bold; color: #666; width: 40px;}
.td-team { text-align: left !important; display: flex; align-items: center; font-weight: bold; }
.td-team img { width: 30px !important; height: 30px !important; object-fit: contain; margin-right: 12px; } 
.td-points { font-weight: 900; font-size: 1rem; color: var(--primary); }

/* --- SPIELPLAN --- */
.matchday-selector-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--primary);
    color: var(--secondary);
    padding: 10px 15px;
    border-radius: 4px 4px 0 0;
    margin-top: 40px;
}
.matchday-nav-btn { background: none; border: none; color: white; font-size: 1.5rem; cursor: pointer; }
.matchday-nav-btn[style*="visibility: hidden"] { cursor: default; }

.matchday-select {
    background: transparent; color: white; border: none;
    font-size: 1.1rem; font-weight: bold; text-align: center; cursor: pointer;
    appearance: none;
}
.matchday-select option { color: black; }

/* --- SPIEL-LISTE --- */
.match-list { 
    background-color: var(--bg-card); 
    border: 1px solid var(--border-color);
    border-top: none; 
    border-radius: 0 0 4px 4px; 
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.match-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 10px;
    border-bottom: 1px solid var(--border-color);
    min-height: 80px; 
}
.match-row:last-child { border-bottom: none; }

.match-team {
    flex: 1; 
    display: flex;
    align-items: center;
    font-weight: bold;
    font-size: 0.95rem;
}
.match-team.home { justify-content: flex-end; text-align: right; }
.match-team.away { justify-content: flex-start; text-align: left; }

/* LOGOS FIXIEREN (Verhindert "Explosion") */
.match-team img { 
    width: 35px !important; 
    height: 35px !important; 
    object-fit: contain; 
    flex-shrink: 0; 
}
.match-team.home img { margin-left: 15px; }
.match-team.away img { margin-right: 15px; }

/* Mittelteil */
.match-center {
    width: 130px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.match-date-label {
    font-size: 0.8rem;
    color: var(--accent-date);
    font-weight: bold;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.match-score-box {
    background-color: #f2f2f2;
    padding: 6px 0;
    border-radius: 4px;
    text-align: center;
    width: 90px;
    border: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.score-line-main { font-weight: 900; font-size: 1.1rem; color: #000; line-height: 1.2; }
.score-line-sub { font-size: 0.75rem; color: #666; border-top: 1px solid #ccc; margin-top: 2px; padding-top: 2px; }
.match-vs { font-size: 1rem; color: #aaa; font-weight: normal; }

/* --- MOBILE OPTIMIERUNG --- */
@media (max-width: 600px) {
    
    /* 1. Header & Titel Mobil: Logo verstecken */
    .page-header-logo { display: none !important; }
    .page-header { justify-content: center; text-align: center; }
    
    /* 2. TABELLE MOBIL (Grid - Punkte an Stelle 3!) */
    .bundesliga-table thead { display: block; } /* Header anzeigen! */
    
    .bundesliga-table thead tr,
    .bundesliga-table tbody tr {
        display: grid;
        /* Spalten: Platz | Team | PKT | Sp | Tore | Diff */
        grid-template-columns: 25px 1fr 35px 25px 55px 25px; 
        gap: 3px;
        align-items: center;
        padding: 8px 2px;
        border-bottom: 1px solid #ddd;
    }

    .bundesliga-table thead th {
        padding: 5px 0;
        font-size: 0.65rem;
        border: none;
        background: transparent;
        color: #000;
        text-transform: uppercase;
        font-weight: 900;
    }

    /* ZUORDNUNG ÜBERSCHRIFTEN (Header) */
    .th-rank { grid-column: 1; text-align: center; }
    .th-team { grid-column: 2; text-align: left; }
    
    /* WICHTIG: Punkte Überschrift an Pos 3 */
    .th-points { grid-column: 3; color: var(--primary); text-align: center; }
    
    .th-matches { grid-column: 4; }
    .th-goals { grid-column: 5; }
    .th-diff { grid-column: 6; }

    /* ZUORDNUNG DATEN (Body) */
    .td-rank { grid-column: 1; text-align: center; }
    .td-team { grid-column: 2; padding-left: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;}
    
    /* WICHTIG: Punkte Daten an Pos 3 */
    .td-points { 
        grid-column: 3; 
        text-align: center; 
        font-weight: 900;
        background-color: #eee;
        border-radius: 4px;
        padding: 2px 0;
        color: #000;
    }
    
    .td-matches { grid-column: 4; text-align: center; color: #666;}
    .td-matches::after { content: ""; } 
    .td-goals { grid-column: 5; text-align: center; font-family: monospace; font-size: 0.8rem; }
    .td-diff { grid-column: 6; text-align: center; color: #888; font-size: 0.8rem; }

    /* Team Logos klein */
    .td-team img { width: 20px !important; height: 20px !important; margin-right: 5px; }


    /* 3. Spielplan Mobil */
    .match-row { padding: 10px 5px; min-height: auto;}
    .match-team { font-size: 0.8rem; flex-direction: column; text-align: center;}
    .match-team.home { flex-direction: column-reverse; }
    .match-team.away { flex-direction: column-reverse; }
    
    .match-team img { width: 30px !important; height: 30px !important; }
    .match-team.home img { margin-left: 0; margin-bottom: 5px; }
    .match-team.away img { margin-right: 0; margin-bottom: 5px; }
    
    .match-center { width: 90px; }
    .match-score-box { width: 75px; padding: 4px 0; }
    .score-line-main { font-size: 0.95rem; }
}

footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border-color);
    margin-top: 30px;
}