/* ==========================================================================
   Tippspiel 2027 – Stadion-Design
   Nur Systemschriften (keine externen Webfonts, datenschutzfreundlich).
   ========================================================================== */

:root {
    --pitch-dark: #0b3d23;      /* Rasen dunkel: Navigation, Tabellenköpfe */
    --pitch: #14632f;           /* Rasen: Buttons, Akzente */
    --pitch-light: #e8f3ec;     /* Rasen hell: Zebra-Zeilen, Hover */
    --gold: #f2c230;            /* Pokal-Gold: Akzentlinie, Platz 1 */
    --silver: #c0c6cc;
    --bronze: #cd8a4f;
    --ink: #1c2421;             /* Text */
    --muted: #66706b;
    --line: #d5ddd8;            /* Rahmen */
    --page-bg: #eef1ef;
    --link: #14632f;

    /* Trefferfarben (Rangliste, Legende, Anleitung) */
    --col-tendenz: #7b8794;
    --col-exact: #f0a020;
    --col-joker-exact: #d62d2d;

    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-display: "Arial Narrow", "Roboto Condensed", "Helvetica Neue Condensed", "Segoe UI", system-ui, sans-serif;
}

/* Grundlayout ------------------------------------------------------------- */
* { box-sizing: border-box; }

/* Basis-Schriftgröße: kompakt auf Mobilgeräten, größer auf großen Bildschirmen */
html { font-size: 100%; }
@media (min-width: 900px) { html { font-size: 125%; } }
@media (min-width: 1400px) { html { font-size: 150%; } }

body {
    margin: 0;
    font-family: var(--font);
    color: var(--ink);
    background:
        repeating-linear-gradient(90deg, rgba(20, 99, 47, 0.025) 0 80px, transparent 80px 160px),
        var(--page-bg);
    line-height: 1.45;
}

.page {
    max-width: 1400px;
    margin: 1.5em auto;
    padding: 1.5em 2em 2em;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(11, 61, 35, 0.08);
}

h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 800;
    letter-spacing: 0.02em;
    color: var(--pitch-dark);
}
h1 {
    text-transform: uppercase;
    margin-top: 0.2em;
    padding-bottom: 0.25em;
    border-bottom: 4px solid var(--gold);
    display: inline-block;
}
h2 { margin-top: 1.4em; }

a { color: var(--link); }

/* Sprungziele (#round-…, #playerid_…) nicht unter der fixierten Navigation verstecken */
[id] { scroll-margin-top: 90px; }
a:hover { color: var(--pitch-dark); }

/* Navigation ("Stadionbanner") -------------------------------------------- */
.site-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.2em 0.4em;
    padding: 0.55em 1.5em;
    background: linear-gradient(180deg, #145a32 0%, var(--pitch-dark) 100%);
    border-bottom: 4px solid var(--gold);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    position: sticky;
    top: 0;
    z-index: 20;
}
.site-nav a {
    color: #fff;
    text-decoration: none;
    font-family: var(--font-display);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.35em 0.7em;
    border-radius: 6px;
}
.site-nav > a:hover,
.site-nav .nav-dropdown > a:hover,
.site-nav .nav-dropdown:focus-within > a { background: rgba(255, 255, 255, 0.12); color: var(--gold); }

.site-nav .brand {
    font-size: 1.15em;
    font-weight: 900;
    letter-spacing: 0.06em;
    margin-right: 0.8em;
    padding-left: 0;
}
.site-nav .brand:hover { background: none; }
.brand-ball { display: inline-block; transition: transform 0.4s; }
.site-nav .brand:hover .brand-ball { transform: rotate(180deg); }
.brand-year { color: var(--gold); }

.nav-user { margin-left: auto; }

/* Dropdowns in der Navigation (Administration, Info, Spielermenü) */
.nav-dropdown { position: relative; display: inline-block; }
.nav-dropdown-content {
    display: none;
    position: absolute;
    left: 0;
    top: 100%;
    z-index: 30;
    min-width: 13em;
    padding: 0.4em 0;
    background: #fff;
    border-top: 3px solid var(--gold);
    border-radius: 0 0 8px 8px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
}
.nav-user .nav-dropdown-content { left: auto; right: 0; }
.site-nav .nav-dropdown-content a {
    display: block;
    margin: 0;
    padding: 0.45em 1.1em;
    border-radius: 0;
    color: var(--ink);
    font-family: var(--font);
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
}
.site-nav .nav-dropdown-content a:hover { background: var(--pitch-light); color: var(--pitch-dark); }
.nav-dropdown-form { margin: 0.3em 0 0; padding-top: 0.3em; border-top: 1px solid var(--line); }
.nav-dropdown-form button {
    display: block;
    width: 100%;
    padding: 0.45em 1.1em;
    border: none;
    border-radius: 0;
    background: none;
    color: var(--ink);
    font: inherit;
    font-weight: 500;
    text-align: left;
    text-transform: none;
    letter-spacing: 0;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: none;
}
.nav-dropdown-form button:hover { background: var(--pitch-light); }
.nav-dropdown-form small { color: var(--muted); }
.nav-dropdown:hover .nav-dropdown-content,
.nav-dropdown:focus-within .nav-dropdown-content { display: block; }

/* Fußzeile */
.site-footer {
    text-align: center;
    color: var(--muted);
    font-size: 0.75em;
    padding: 0 0 2em;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* Tabellen ("Anzeigetafel") ------------------------------------------------ */
table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    max-width: 800px;
    margin-top: 1em;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}
th, td {
    border: none;
    border-bottom: 1px solid var(--line);
    padding: 8px 10px;
    text-align: left;
}
tbody tr:last-child td { border-bottom: none; }
th {
    background: var(--pitch-dark);
    color: #fff;
    font-family: var(--font-display);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.85em;
}
th a { color: var(--gold); }
tbody tr:nth-child(even) td { background-color: #f6faf7; }
tbody tr:hover td { background-color: var(--pitch-light); }
tfoot th, tfoot td { background: #f0f4f1; color: var(--ink); border-top: 2px solid var(--pitch-dark); }

/* Formulare --------------------------------------------------------------- */
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="datetime-local"], select, textarea {
    font: inherit;
    padding: 0.35em 0.55em;
    border: 1px solid #b9c4bd;
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--pitch);
    box-shadow: 0 0 0 3px rgba(20, 99, 47, 0.18);
}
input[readonly] { background: #f2f4f3; color: var(--muted); }
input[type="checkbox"] { accent-color: var(--pitch); width: 1.1em; height: 1.1em; vertical-align: middle; }

button {
    font: inherit;
    font-family: var(--font-display);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.4em 1.2em;
    color: #fff;
    background: linear-gradient(180deg, #1b7a3b, var(--pitch));
    border: none;
    border-radius: 999px;
    box-shadow: 0 2px 0 var(--pitch-dark);
    cursor: pointer;
}
button:hover { background: var(--pitch-dark); }
button:active { transform: translateY(1px); box-shadow: none; }
button:disabled { background: #b8c2bc; box-shadow: none; cursor: not-allowed; }
/* Link-artige Buttons (z.B. "Löschen", "Als aktiv setzen") bleiben schlicht */
button.link-button {
    background: none;
    box-shadow: none;
    color: var(--link);
    text-transform: none;
    letter-spacing: 0;
    font-family: var(--font);
    font-weight: normal;
    padding: 0;
    border-radius: 0;
}

/* Utility-Klassen ---------------------------------------------------------- */
.text-center { text-align: center !important; }

/* Container für breite, scrollbare Tabellen (Rangliste, Rundenansicht) */
.table-container {
    width: 100%;
    overflow-x: auto;
    margin-top: 20px;
}
.table-container table {
    width: auto;
    min-width: 100%;
}

/* Vertikal scrollbare Rangliste mit angepinntem Tabellenkopf */
.table-container.sticky-header {
    max-height: 75vh;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
}
.table-container.sticky-header table {
    border: none;
    border-radius: 0;
    overflow: visible;
    margin-top: 0;
}
.table-container.sticky-header thead th {
    position: sticky;
    top: 0;
    z-index: 5;
}

/* Rangliste --------------------------------------------------------------- */
td.tipp-cell { text-align: center !important; position: relative; font-weight: 700; }
td.tipp-cell.col_exact { background-color: var(--col-exact) !important; color: #fff; }        /* Exaktes Ergebnis */
td.tipp-cell.col_tendenz { background-color: var(--col-tendenz) !important; color: #fff; }    /* Richtige Tendenz */
td.tipp-cell.col_joker_exact { background-color: var(--col-joker-exact) !important; color: #fff; } /* Exakt mit Joker */

/* Platz-Plakette, Gold/Silber/Bronze für die Top 3 */
.rank-badge {
    display: inline-block;
    min-width: 2em;
    padding: 0.1em 0.4em;
    border-radius: 999px;
    font-weight: 800;
    text-align: center;
}
tr.rank-1 .rank-badge { background: var(--gold); color: #3d2d00; }
tr.rank-2 .rank-badge { background: var(--silver); color: #23292e; }
tr.rank-3 .rank-badge { background: var(--bronze); color: #fff; }
tr.me td:not(.tipp-cell) { background-color: #fff6d6 !important; font-weight: 700; }

.round-filter { margin-bottom: 20px; }
.joker-icon {
    width: 1.1em;
    height: 1.1em;
    vertical-align: text-bottom;
    margin-left: 4px;
}
th.game-header { white-space: normal; }

/* Legende */
.legend {
    margin: 20px 0;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-left: 5px solid var(--pitch);
    border-radius: 8px;
    background-color: #f7faf8;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}
.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.2);
}

/* Kleine Bildschirme ------------------------------------------------------- */
@media (max-width: 700px) {
    .page { margin: 0.3em; padding: 0.8em; border-radius: 6px; }
    .site-nav { padding: 0.4em 0.5em; position: static; font-size: 0.85em; }
    .nav-user { margin-left: 0; }

    /* Formulare: Label über dem Feld statt daneben */
    .form-group label {
        display: block;
        width: auto;
        text-align: left;
        margin: 0 0 0.2em;
    }
    .form-group button:first-of-type {
        margin-left: 0;
    }
    .form-actions {
        margin-left: 0;
        justify-content: center;
    }

    /* Tabellen: kompaktere Zellen, volle Breite */
    th, td { padding: 5px 6px; }

    h1 { font-size: 1.3em; }
    h2 { font-size: 1.1em; }
}
