:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --text: #172033;
    --text-muted: #657089;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --success: #15803d;
    --danger: #dc2626;
    --warning: #d97706;
    --border: #dce3ee;
    --shadow: 0 12px 32px rgba(23, 32, 51, 0.08);
    --radius: 14px;
    --radius-small: 9px;
    --max-width: 1180px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    margin: 0 auto;
    max-width: var(--max-width);
    min-height: 100vh;
    padding: 32px 24px 60px;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.08), transparent 28%),
        var(--bg);
    color: var(--text);
    font-family:
        Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
        "Segoe UI", sans-serif;
    line-height: 1.55;
}

h1,
h2,
h3 {
    margin-top: 0;
    color: var(--text);
    line-height: 1.2;
}

h1 {
    margin-bottom: 24px;
    font-size: clamp(2rem, 5vw, 3rem);
    letter-spacing: -0.04em;
}

h2 {
    margin-top: 36px;
    margin-bottom: 18px;
    font-size: clamp(1.35rem, 3vw, 1.8rem);
}

h3 {
    margin-top: 24px;
    margin-bottom: 14px;
    font-size: 1.1rem;
}

p {
    color: var(--text-muted);
}

hr {
    height: 1px;
    margin: 34px 0;
    border: 0;
    background: var(--border);
}

/* Links und Navigation */
a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-hover);
}

body > a,
nav a {
    display: inline-block;
    margin: 0 8px 10px 0;
}

/* Einheitliche obere Navigation */
.top-navigation {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 0 0 24px 0;
}

.top-navigation a {
    display: inline-block;
    margin: 0;
    text-decoration: none;
}

.top-navigation button {
    min-width: 120px;
}

/* Kartenwirkung für Hauptbereiche */
body > form,
body > table,
body > ul {
    margin-bottom: 28px;
}

form {
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

form[style*="display:inline"],
form[style*="display: inline"] {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

/* Admin-Aktionsbuttons, z.B. Fixtures laden */
.admin-action-form {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 5px 8px 5px 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.admin-action-form select {
    width: auto;
    min-width: 140px;
    flex: 0 0 auto;
    margin: 0;
}

.admin-action-form button {
    white-space: nowrap;
}

label {
    display: inline-block;
    margin-bottom: 7px;
    color: var(--text);
    font-weight: 650;
}

/* Abstand zwischen Formularfeldern */
.form-group {
    margin-bottom: 16px;
}

.form-group:last-child {
    margin-bottom: 0;
}

input,
select,
textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-small);
    outline: none;
    background: #fff;
    color: var(--text);
    font: inherit;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background-color 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

input[type="checkbox"],
input[type="radio"] {
    width: 18px;
    min-height: 18px;
    margin-right: 8px;
    accent-color: var(--primary);
    vertical-align: middle;
}

input[type="number"] {
    max-width: 140px;
}

textarea {
    min-height: 120px;
    resize: vertical;
}

/* Buttons */
button,
input[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 16px;
    border: 0;
    border-radius: var(--radius-small);
    background: var(--primary);
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
    transition:
        transform 0.15s ease,
        background-color 0.2s ease,
        box-shadow 0.2s ease;
}

button:hover,
input[type="submit"]:hover {
    transform: translateY(-1px);
    background: var(--primary-hover);
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.24);
}

button:active,
input[type="submit"]:active {
    transform: translateY(0);
}

button:disabled,
input[type="submit"]:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

/* Löschen-Buttons automatisch rot */
button[type="submit"]:has(+ input[name="delete_user"]),
form:has(input[name="delete_user"]) button {
    background: var(--danger);
    box-shadow: 0 8px 18px rgba(220, 38, 38, 0.16);
}

form:has(input[name="delete_user"]) button:hover {
    background: #b91c1c;
}
.danger-button {
    background: var(--danger);
    box-shadow: 0 8px 18px rgba(220, 38, 38, 0.16);
}

.danger-button:hover {
    background: #b91c1c;
    box-shadow: 0 10px 22px rgba(220, 38, 38, 0.22);
}


/* Tabellen */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

th,
td {
    padding: 14px 16px;
    border: 0 !important;
    border-bottom: 1px solid var(--border) !important;
    text-align: left;
    vertical-align: middle;
}

th {
    background: var(--surface-soft);
    color: var(--text);
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

tr:last-child td {
    border-bottom: 0 !important;
}

tbody tr {
    transition: background-color 0.15s ease;
}

tbody tr:hover {
    background: #f8fbff;
}

td form {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

td input {
    min-width: 140px;
}

/* Listen */
ul {
    padding: 20px 24px 20px 44px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

li {
    margin: 8px 0;
}

/* Flash-Meldungen – überschreibt auch vorhandene Inline-Stile */
body > p[style*="background"] {
    margin: 0 0 22px;
    padding: 14px 16px !important;
    border: 1px solid #86efac !important;
    border-radius: var(--radius-small);
    background: #f0fdf4 !important;
    color: #166534 !important;
    box-shadow: 0 8px 22px rgba(21, 128, 61, 0.09);
    font-weight: 650;
}

/* Hilfsklassen für spätere Seiten */
.container {
    width: 100%;
    margin: 0 auto;
}

.card {
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.muted {
    color: var(--text-muted);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 9px;
    border-radius: 999px;
    background: #e8eefc;
    color: #1e40af;
    font-size: 0.82rem;
    font-weight: 750;
}

.badge-success {
    background: #dcfce7;
    color: var(--success);
}

.badge-danger {
    background: #fee2e2;
    color: var(--danger);
}

/* Tipp-Eingabe */
.tip-inputs {
    display: grid;
    grid-template-columns: 85px 20px 85px;
    align-items: center;
    justify-content: start;
    gap: 8px;
    width: fit-content;
    max-width: 100%;
    margin-bottom: 14px;
}

.tip-inputs input[type="number"] {
    width: 85px;
    min-width: 0;
    max-width: 85px;
    margin: 0;
    text-align: center;
}

.tip-separator {
    width: 20px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 700;
}


/* Systemsteuerung */
.system-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    margin-top: 16px;
}

.system-actions form {
    margin: 0;
}


/* Warnhinweis Admin */
.admin-warning {
    margin: 12px 0 18px;
    padding: 14px 16px;
    border: 1px solid #f59e0b;
    border-radius: var(--radius-small);
    background: #fffbeb;
    color: #92400e;
    font-weight: 650;
}

/* Rangliste */
.ranking-table td:first-child {
    white-space: nowrap;
}
.rank-medal {
    font-size: 1.3rem;
}
.trend-up,
.trend-down,
.trend-same {
    margin-left: 6px;
    font-weight: 700;
}

.round-points {
    color: var(--success);
    font-weight: 700;
}

.no-points {
    color: var(--text-muted);
}

/* Dauer-Tipp Felder */
.auto-tip-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
}

.auto-tip-field {
    display: flex;
    flex-direction: column;
    width: 140px;
}

.auto-tip-field input {
    width: 100%;
}

/* Mobile */
@media (max-width: 760px) {

    body {
        padding: 22px 14px 44px;
    }

    h1 {
        margin-bottom: 18px;
    }

    form {
        padding: 18px;
    }

    /* Navigation: immer 2 Buttons pro Reihe */
    .top-navigation {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        width: 100%;
        margin-bottom: 22px;
    }

    .top-navigation a {
        display: block;
        width: 100%;
        margin: 0;
    }

    .top-navigation button {
        width: 100%;
        min-width: 0;
    }

    /* Tabellen bleiben horizontal scrollbar */
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    th,
    td {
        padding: 12px;
    }

    td form {
        min-width: 230px;
    }

    td input {
        min-width: 120px;
    }

    button,
    input[type="submit"] {
        min-height: 40px;
        padding: 9px 13px;
    }

    /* Mehr Abstand zwischen normalen Formularfeldern */
    .form-group {
        margin-bottom: 18px;
    }

    form > input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]) {
        margin-bottom: 12px;
    }

    form > select,
    form > textarea {
        margin-bottom: 12px;
    }

    /* Systemsteuerung: jede Funktion eigene Zeile */
    .system-actions {
        display: grid;
        grid-template-columns: 1fr;
        gap: 16px;
        width: 100%;
    }

    .system-actions form {
        display: flex !important;
        width: 100%;
        margin: 0;
        padding: 0;
        border: 0;
        background: transparent;
        box-shadow: none;
    }

    .system-actions form > button {
        width: 100%;
    }

    /* Fixtures-Auswahl: Saison und Button untereinander */
    .system-actions .admin-action-form {
        display: grid !important;
        grid-template-columns: 1fr;
        gap: 10px;
        width: 100%;
    }

    .system-actions .admin-action-form select,
    .system-actions .admin-action-form button {
        width: 100%;
        min-width: 0;
        margin: 0;
    }

    /* Tippfelder bewusst kompakt halten */
    .tip-inputs {
        grid-template-columns: 76px 18px 76px;
        gap: 8px;
        width: fit-content;
        max-width: 100%;
    }

    .tip-inputs input[type="number"] {
        width: 76px;
        min-width: 0;
        max-width: 76px;
        margin: 0;
        font-size: 16px;
    }

    .tip-separator {
        width: 18px;
    }
}


/* Sehr kleine Smartphones */
@media (max-width: 480px) {

    .top-navigation {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .top-navigation button {
        padding-left: 8px;
        padding-right: 8px;
        font-size: 0.92rem;
    }

    .tip-inputs {
        grid-template-columns: 70px 16px 70px;
        gap: 7px;
    }

    .tip-inputs input[type="number"] {
        width: 70px;
        max-width: 70px;
    }

    .tip-separator {
        width: 16px;
    }
	    .auto-tip-fields {
        display: grid;
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .auto-tip-field {
        width: 100%;
    }
}
/* public zoomen */
.kleine-seite ul {
	margin-top: 1px;
	margin-bottom: 2px;
	padding-top: 2px;
    padding-bottom: 2px;
}

.kleine-seite h2 {
    margin-top: 2px;
    margin-bottom: 2px;
}

.kleine-seite p {
    margin-top: 1px;
    margin-bottom: 1px;
}

.kleine-seite hr {
    margin-top: 2px;
    margin-bottom: 2px;
}

.kleine-seite .ranking-table th,
.kleine-seite .ranking-table td {
    padding-top: 1px;
    padding-bottom: 1px;
}