/* ==========================================================================
   1. GLOBAL STYLES & LAYOUT-FIX (VERHINDERT TABELLEN-SPRINGEN)
   ========================================================================== */
:root {
    --cm-bg-seite: #d5dae3;
    --cm-bg-karte: #e8ecf1;
    --cm-bg-panel: #dfe4eb;
    --cm-bg-panel-hell: #f0f3f7;
    --cm-bg-weiss: #f6f8fa;
    --cm-text: #2c3138;
    --cm-text-muted: #5f6772;
    --cm-border: #c3cad4;
    --cm-border-hell: #d5dbe3;
    --cm-nav: #2a2e33;
    --cm-akzent: #6b7d3a;
    --cm-schatten: rgba(35, 38, 41, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.5;
    color: var(--cm-text);
    background-color: var(--cm-bg-seite);
    padding: 20px;
    
    /* MANDATORISCHER FIX: Erzwingt permanente Scrollbar gegen Tabellen-Hüpfen */
    overflow-y: scroll;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background: var(--cm-bg-karte);
    padding: 30px;
    border-radius: 8px;
    border: 1px solid var(--cm-border-hell);
    box-shadow: 0 2px 8px var(--cm-schatten);
}

.container-breit {
    max-width: 1400px;
    margin: 0 auto;
    background: var(--cm-bg-karte);
    padding: 30px;
    border-radius: 8px;
    border: 1px solid var(--cm-border-hell);
    box-shadow: 0 2px 8px var(--cm-schatten);
}

h1 {
    text-align: center;
    margin-bottom: 25px;
    color: var(--cm-text);
}

.seiten-logo-zeile {
    text-align: center;
    margin-bottom: 16px;
}

.seiten-logo-oben {
    display: inline-block;
    width: 100px;
    height: 100px;
    object-fit: contain;
}

.seiten-logo-zeile a {
    line-height: 0;
}

.seiten-kopf {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--cm-border-hell);
}

.seiten-kopf-mit-banner {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
}

.seiten-banner-link {
    display: block;
    line-height: 0;
    text-align: center;
}

.seiten-banner {
    display: block;
    width: 100%;
    max-width: 420px;
    height: auto;
    margin: 0 auto;
}

.seiten-untertitel-unter-banner {
    margin: 0;
    text-align: center;
    font-size: 1rem;
    color: var(--cm-text-muted);
}

.seiten-logo-link {
    flex-shrink: 0;
    line-height: 0;
}

.seiten-kopf .seiten-logo-oben {
    width: 72px;
    height: 72px;
}

.seiten-kopf-text {
    min-width: 0;
}

.seiten-haupttitel {
    margin: 0;
    text-align: left;
    font-size: 1.6rem;
    line-height: 1.2;
    color: var(--cm-text);
}

.seiten-untertitel {
    margin: 4px 0 0;
    font-size: 0.95rem;
    color: var(--cm-text-muted);
    font-weight: normal;
}

h2 {
    margin-top: 30px;
    margin-bottom: 15px;
    color: var(--cm-text);
    border-bottom: 2px solid var(--cm-border-hell);
    padding-bottom: 5px;
}

h3 {
    margin-bottom: 10px;
    color: var(--cm-text-muted);
}

/* ==========================================================================
   2. RESPONSIVE NAVIGATION (ZENTRIERT) & INFOBOXEN (STARR SYMMETRISCH)
   ========================================================================== */
.nav-menue {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: var(--cm-nav);
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 20px;
    width: 100%;
}

.nav-zeile {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
}

.nav-zeile-zuschauer {
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.nav-hinweis {
    color: rgba(255, 255, 255, 0.65);
    font-size: 12px;
    font-weight: bold;
    margin-right: 4px;
}

.nav-menue a {
    color: white;
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 3px;
    font-weight: bold;
    font-size: 14px;
    text-align: center;
    transition: background 0.2s;
}

.nav-menue a:hover {
    background: #555;
}

.startseite-aktionen {
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.startseite-aktionen a {
    color: white;
    text-decoration: none;
    padding: 10px 16px;
    border-radius: 3px;
    font-weight: bold;
}

.startseite-aktion-gruen { background: #28a745; }
.startseite-aktion-orange { background: #fd7e14; }
.startseite-aktion-blau { background: #007bff; }
.startseite-aktion-grau { background: #6c757d; }

.startseite-hinweis {
    text-align: center;
}

.spielplan-phase-umschalter {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.spielplan-phase-umschalter a {
    color: white;
    text-decoration: none;
    padding: 10px 16px;
    border-radius: 3px;
    font-weight: bold;
    background: #6c757d;
}

.spielplan-phase-umschalter a.spielplan-phase-aktiv {
    background: #007bff;
    box-shadow: inset 0 0 0 2px #004a99;
}

.spielplan-klapp {
    border: 1px solid var(--cm-border);
    border-radius: 8px;
    margin-bottom: 10px;
    background: var(--cm-bg-weiss);
    overflow: hidden;
}

.spielplan-klapp summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 12px 14px;
    font-weight: bold;
    font-size: 0.95rem;
    background: var(--cm-bg-panel);
    color: var(--cm-text);
}

.spielplan-klapp summary::-webkit-details-marker {
    display: none;
}

.spielplan-klapp summary::before {
    content: "▸ ";
    margin-right: 6px;
    color: var(--cm-text-muted);
}

.spielplan-klapp[open] summary::before {
    content: "▾ ";
}

.spielplan-klapp[open] summary {
    border-bottom: 1px solid var(--cm-border-hell);
}

.spielplan-klapp-inhalt {
    padding: 10px;
}

.spielplan-klapp-inhalt .liveboard-spiel-karte:last-child {
    margin-bottom: 0;
}

.saison-turnier-wechsel {
    margin-bottom: 20px;
}

.saison-turnier-wechsel .sub-info {
    margin: 0;
    width: 100%;
}

.saison-checkliste {
    background: var(--cm-bg-panel-hell);
    border: 1px solid var(--cm-border);
    border-radius: 4px;
    padding: 15px 20px;
    margin-bottom: 20px;
}

.saison-checkliste h2 {
    margin-top: 0;
}

.saison-schritt-liste {
    list-style: none;
    margin: 0;
    padding: 0;
}

.saison-schritt {
    padding: 8px 0;
    border-bottom: 1px solid var(--cm-border-hell);
}

.saison-schritt:last-child {
    border-bottom: none;
}

.saison-schritt-fertig {
    color: #155724;
}

.saison-schritt-offen {
    color: var(--cm-text-muted);
}

.saison-schritt-aktuell {
    font-weight: bold;
    color: var(--cm-text);
}

.saison-phase {
    background: var(--cm-bg-panel-hell);
    border: 1px solid var(--cm-border);
    border-radius: 4px;
    margin-bottom: 15px;
}

.saison-phase-summary {
    padding: 12px 16px;
    font-weight: bold;
    font-size: 1.1rem;
    cursor: pointer;
}

.saison-phase-inhalt {
    padding: 0 16px 16px;
    border-top: 1px solid var(--cm-border-hell);
}

.saison-erfolg-kasten {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    text-align: center;
    padding: 15px;
    font-weight: bold;
    border-radius: 4px;
    margin-bottom: 20px;
}

.saison-spieltag-zeile {
    background: #fdfdfd;
    margin-bottom: 5px;
}

.saison-feld-datum {
    width: 180px;
}

.saison-zentriert {
    text-align: center;
}

.saison-warnung-rot {
    color: #dc3545;
    font-weight: bold;
}

.saison-label-block {
    display: block;
    margin: 10px 0;
}

.saison-btn-blau { background: #007bff; }
.saison-btn-gruen { background: #28a745; }
.saison-btn-orange { background: #fd7e14; }
.saison-btn-lila { background: #9b59b6; }

.aktives-turnier-box, 
.team-anzahl-box {
    width: 100%;
    border-radius: 4px;
    margin-bottom: 20px;
    text-align: center;
    font-weight: bold;
}

.team-anzahl-box {
    height: 54px !important;
    padding: 0 15px !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.aktives-turnier-box {
    min-height: 54px;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.aktives-turnier-inhalt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    line-height: 1.35;
}

.aktives-turnier-wechsel-link {
    font-size: 0.85em;
    font-weight: normal;
    color: #1a5276;
    text-decoration: underline;
}

.aktives-turnier-wechsel-link:hover {
    color: #0d3d56;
}

.aktives-turnier-box {
    background: #c8d8e4;
    color: #2a4555;
    border: 1px solid var(--cm-border);
}

.liveboard-statistik-box {
    width: 100%;
    border-radius: 4px;
    margin-bottom: 20px;
    padding: 10px 15px;
    background: #e8ecef;
    color: #3d4f5c;
    border: 1px solid var(--cm-border);
    text-align: center;
    font-size: 0.95em;
}

.liveboard-statistik-inhalt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    line-height: 1.35;
}

.liveboard-statistik-titel {
    font-weight: bold;
}

.team-anzahl-box {
    background: var(--cm-bg-panel);
    color: var(--cm-text);
    border: 1px solid var(--cm-border);
}

.sub-info {
    font-weight: normal;
    font-size: 0.85em;
    display: block;
    margin-top: 5px;
    color: #555;
    width: 100%;
}

/* ==========================================================================
   3. STANDARD FORMULAR-ELEMENTE (EINGABEN & BLÖCKE)
   ========================================================================== */
.form-block {
    background: var(--cm-bg-panel-hell);
    padding: 15px;
    border-radius: 4px;
    border: 1px solid var(--cm-border);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.form-block-vertikal {
    background: var(--cm-bg-panel-hell);
    padding: 20px;
    border-radius: 4px;
    border: 1px solid var(--cm-border);
    margin-bottom: 20px;
}

input[type="text"],
input[type="number"],
input[type="date"],
select {
    padding: 8px 12px;
    border: 1px solid var(--cm-border);
    border-radius: 4px;
    font-size: 14px;
    background: var(--cm-bg-weiss);
    color: var(--cm-text);
}

.eingabe-text-breit {
    flex: 1;
}

/* ==========================================================================
   4. BUTTONS & AKTIONEN
   ========================================================================== */
input[type="submit"],
button,
.btn {
    background: var(--cm-akzent);
    color: white;
    border: none;
    padding: 9px 18px;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

input[type="submit"]:hover,
button:hover {
    background: #5a6a32;
}

.btn-loeschen {
    background: #dc3545;
}

.btn-loeschen:hover {
    background: #c82333;
}

/* ==========================================================================
   5. ALLGEMEINE TABELLEN-FORMATIERUNG (TEAM-LISTE)
   ========================================================================== */
.team-liste {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 10px;
    background: var(--cm-bg-weiss);
}

.team-liste th,
.team-liste td {
    padding: 10px 12px;
    border: 1px solid var(--cm-border);
    text-align: center !important; /* KORREKTUR: Erzwingt die Zentrierung überall bedingungslos */
    vertical-align: middle;
}

.team-liste th {
    background-color: var(--cm-bg-panel);
    color: var(--cm-text);
    font-weight: bold;
}

.team-liste tr:nth-child(even) {
    background-color: var(--cm-bg-panel-hell);
}

.tabelle-text-links {
    text-align: left !important;
}

/* NEU: Zwingt die erste Spalte auf eine feste Breite für perfekte Symmetrie */
.tabelle-erste-spalte-fix {
    width: 120px !important;
    text-align: center !important;
}

.tabelle-text-klein {
    font-size: 0.9em;
}

.tabelle-text-klein-grau {
    font-size: 0.8em;
    color: #6c757d;
}
/* Spezifischer Selektor, um die globale Zentrierung linksbündig zu überschreiben */
.team-liste td.tabelle-erste-spalte-links,
.team-liste th.tabelle-erste-spalte-links {
    text-align: left !important;
    width: 120px !important;
}
/* ==========================================================================
   6. LIGA-BOARD SPEZIALKLASSEN (AUFSTEIGER-FÄRBUNG OHNE SYMBOLE)
   ========================================================================== */
.zeile-aufsteiger-direkt {
    background-color: #e2f0d9 !important; /* Dezentes Hellgrün */
}

.text-aufsteiger-direkt {
    font-weight: bold;
    color: #385723;
}

.zeile-aufsteiger-nachruecker {
    background-color: #ddebf7 !important; /* Dezentes Hellblau */
}

.text-aufsteiger-nachruecker {
    font-weight: bold;
    color: #1f4e78;
}

.spalte-spieltage { width: 60px; }
.spalte-statistik { width: 45px; }
.spalte-ergebnis { width: 75px; }
.spalte-diff { width: 55px; }
.spalte-punkte { width: 55px; }

.team-liste td a {
    color: inherit;
    text-decoration: none;
}

.team-liste td a:hover {
    text-decoration: underline;
}

.team-umbenennen-form {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.team-umbenennen-feld {
    min-width: 160px;
    flex: 1 1 140px;
    margin: 0;
}

/* ==========================================================================
   7. ERGEBNIS-EINGABE RASTER & SPIELKARTEN
   ========================================================================== */
.spieltag-titel-zentriert {
    text-align: center;
    margin-top: 20px;
    margin-bottom: 15px;
    color: #333;
}

.spiele-raster-layout {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(450px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.ergebnis-spiel-karte {
    background: var(--cm-bg-panel-hell);
    border: 1px solid var(--cm-border);
    border-radius: 6px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 200px;
}

.form-titel-zentriert {
    text-align: center;
    font-weight: bold;
    margin-bottom: 12px;
    color: #555;
    font-size: 0.95em;
}

.form-titel-abstand-oben {
    text-align: center;
    font-weight: bold;
    margin-top: 15px;
    margin-bottom: 5px;
    color: #666;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.saetze-eingabe-reihe {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.saetze-eingabe-reihe input[type="number"] {
    width: 65px;
    text-align: center;
    padding: 5px;
}

.ergebnis-spiel-karte input[type="number"] {
    width: 60px;
    text-align: center;
}

/* ==========================================================================
   8. SYSTEM-MELDUNGEN & ADMIN-WARNBOXEN
   ========================================================================== */
.meldung-erfolg {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    padding: 12px 20px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-weight: bold;
    text-align: center;
}

.meldung-fehler {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    padding: 12px 20px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-weight: bold;
    text-align: center;
}

.platzhalter-text {
    color: #868e96;
    font-style: italic;
    text-align: center;
}

.admin-warnbox {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
    justify-content: space-between;
}

.protokoll-box {
    background: var(--cm-bg-panel);
    border: 1px solid var(--cm-border);
    padding: 15px;
    border-radius: 4px;
    margin-top: 25px;
}

.protokoll-box ul {
    margin-left: 20px;
    margin-top: 10px;
}

/* ==========================================================================
   9. VISUELLER KO-TURNIERBAUM (TURNIERBAUM.PHP)
   ========================================================================== */
.turnierbaum-ansicht {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    overflow-x: auto;
    padding: 20px 10px;
    background: var(--cm-bg-panel);
    border-radius: 8px;
    border: 1px solid var(--cm-border);
}

.spalte-achtelfinale,
.spalte-viertelfinale,
.spalte-halbfinale,
.spalte-finale {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    min-width: 240px;
    flex: 1;
}

.ko-runde-titel {
    text-align: center;
    font-weight: bold;
    background: var(--cm-nav);
    color: white;
    padding: 8px;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.baum-spiel-karte {
    background: var(--cm-bg-weiss);
    border: 1px solid var(--cm-border);
    border-radius: 4px;
    margin: 10px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}

.baum-termin-zeile {
    background: var(--cm-bg-panel);
    font-size: 11px;
    color: #6c757d;
    padding: 4px 8px;
    border-bottom: 1px solid var(--cm-border-hell);
    font-weight: bold;
}

.baum-team-zeile {
    display: flex;
    justify-content: space-between;
    padding: 6px 10px;
    font-size: 13px;
    color: #495057;
}

.baum-team-zeile:not(:last-child) {
    border-bottom: 1px dashed #f1f3f5;
}

.score-anzeige {
    font-weight: bold;
    color: #212529;
    background: var(--cm-bg-panel);
    padding: 0 6px;
    border-radius: 3px;
    min-width: 24px;
    text-align: center;
}

.team-gewinner {
    font-weight: bold;
    color: #155724 !important;
    background-color: #d4edda;
}

.team-gewinner .score-anzeige {
    background: #c3e6cb;
    color: #155724;
}

.spalte-spieltage, .spalte-ko-ergebnis { width: 90px; }
.ko-ergebnis-fett { font-weight: bold; font-size: 1.1em; color: #222; }
.ko-saetze-untertitel { font-size: 0.75em; color: #777; margin-top: 1px; }

/* ==========================================================================
   10. STATUS-KACHELN FÜR KO-TERMIN-ÜBERSICHT (ADMIN-BOARD)
   ========================================================================== */
.ko-termine-status-container {
    background: var(--cm-bg-panel);
    padding: 15px;
    border: 1px solid var(--cm-border);
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-radius: 4px;
}

.ko-termine-status-titel {
    font-weight: bold;
    font-size: 14px;
    text-align: center;
    margin-bottom: 5px;
    color: #333;
}

.ko-termine-kachel-reihe {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
}

.ko-termine-kachel {
    text-align: center;
    font-size: 13px;
    background: var(--cm-bg-weiss);
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid var(--cm-border);
    min-width: 130px;
}

.ko-termine-kachel-titel {
    color: #007bff;
    font-weight: bold;
    margin-bottom: 2px;
}

.ko-termine-kachel-wert {
    font-weight: bold;
    color: #333;
}

.ko-termine-status-offen {
    color: #dc3545;
    font-weight: normal;
}

.archiv-form-block { gap: 10px; flex-wrap: wrap; }
.archiv-select-feld { flex: 1; min-width: 200px; }
.btn-breite-auto { width: auto; margin: 0; }

/* ==========================================================================
   11. STATUS-KACHELN FÜR VORRUNDEN-SPIELTAGE (ADMIN-BOARD)
   ========================================================================== */
.vorrunde-termine-status-container {
    background: var(--cm-bg-panel);
    padding: 15px;
    border: 1px solid var(--cm-border);
    margin-bottom: 25px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-radius: 4px;
}

.vorrunde-kachel-reihe {
    display: flex;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
}

.vorrunde-kachel {
    text-align: center;
    font-size: 12px;
    background: var(--cm-bg-weiss);
    padding: 6px 8px;
    border-radius: 4px;
    border: 1px solid var(--cm-border-hell);
    flex: 1;
    min-width: 110px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.vorrunde-kachel-titel {
    color: #495057;
    font-weight: bold;
    margin-bottom: 2px;
}

.vorrunde-kachel-wert {
    font-weight: bold;
    color: #212529;
}

/* ==========================================================================
   12. DETAIL-TABELLEN-RASTER & SPECIAL BUTTONS (TEAM-DETAILS)
   ========================================================================== */
.spalte-details-tag { width: 25%; text-align: center; }
.spalte-details-begegnung { width: 50%; text-align: center !important; }
.spalte-details-ergebnis { width: 25%; text-align: center; }

.sektion-abstand-ko { margin-top: 40px; }
.zurueck-button-container { text-align: center; }
.btn-zurueck-board { background: #6c757d; text-decoration: none; display: inline-block; }

/* ==========================================================================
   13. FOOTER (Impressum / Datenschutz – externe FKL-Links)
   ========================================================================== */
.pokal-footer {
    margin-top: 30px;
    padding-top: 16px;
    border-top: 1px solid var(--cm-border);
    text-align: center;
    color: var(--cm-text-muted);
    font-size: 13px;
}

.pokal-footer-links {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.pokal-footer-links a {
    color: #495057;
    text-decoration: none;
}

.pokal-footer-links a:hover {
    text-decoration: underline;
    color: #007bff;
}

.pokal-footer-trenner {
    margin: 0 8px;
    color: #adb5bd;
}

.pokal-footer-hinweis {
    font-size: 11px;
    color: #adb5bd;
    margin-bottom: 10px;
}

.footer-checkout {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--cm-bg-panel-hell);
    border: 1px solid var(--cm-border-hell);
    border-left: 2px solid var(--cm-akzent);
    padding: 4px 10px;
    border-radius: 4px;
    margin-top: 4px;
}

.footer-checkout .checkout-logo-link {
    display: inline-flex;
    align-items: center;
    line-height: 0;
}

.footer-checkout .checkout-logo-link:hover .checkout-logo {
    opacity: 0.85;
}

.footer-checkout .checkout-logo {
    height: 24px;
    max-height: 24px;
    width: auto;
    display: block;
    object-fit: contain;
}

.footer-version {
    font-size: 0.65rem;
    color: var(--cm-text-muted);
    font-weight: 600;
    letter-spacing: 0.04em;
}
