@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --primary: #cc0000;
    --primary-hover: #aa0000;
    --bg-main: #f8fafc;
    --bg-container: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 12px;
    --line-color: #cbd5e1;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    line-height: 1.5;
}

/* Sticky Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: 56px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 1rem;
}

.site-logo {
    height: 36px;
    width: auto;
}

/* Tab Navigation */
.site-nav {
    position: sticky;
    top: 56px;
    z-index: 99;
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.site-nav::-webkit-scrollbar {
    display: none;
}

.site-nav a {
    flex-shrink: 0;
    padding: 0 1rem;
    height: 44px;
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
}

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

.site-nav a.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.site-nav a.nav-cta {
    color: var(--primary);
    font-weight: 700;
}

.container {
    max-width: 860px;
    margin: 0 auto;
    padding: 2rem 1.25rem;
}

h1,
h2,
h3 {
    color: var(--primary);
    margin-top: 0;
}

h1 {
    font-size: 2.25rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 2rem;
    background: linear-gradient(to right, #cc0000, #ff3333);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
}

/* Legacy button-container — hidden, navigation now in .site-nav */
.button-container {
    display: none;
}

/* Standalone action buttons (e.g. form submit area) */

.button,
.link,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    background-color: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.button:hover,
.link:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.form-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 1.5rem;
}

/* Tables */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 1.5rem 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

th,
td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background-color: #f1f5f9;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

td {
    font-size: 0.95rem;
}

tr:last-child td {
    border-bottom: none;
}

tr:nth-child(even) {
    background-color: #f8fafc;
}

/* Modus & Info sections */
.modus,
.ergebnisse,
.gruppe {
    margin-bottom: 3rem;
}

/* Homepage sections */
.home-section {
    margin-bottom: 2.5rem;
}

.home-section:last-child {
    margin-bottom: 0;
}

.home-section h2 {
    margin-top: 0;
}

ul {
    padding-left: 1.5rem;
    color: var(--text-muted);
}

li {
    margin-bottom: 0.5rem;
}

/* Form Tabs (Submit Page) */
.form-tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 2rem;
    gap: 0;
}

.form-tab {
    padding: 0.75rem 1.25rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
    user-select: none;
}

.form-tab:hover {
    color: var(--primary);
}

.form-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.form-panel {
    display: none;
}

.form-panel.active {
    display: block;
}

/* Spielplan Highlight Box */
.spielplan-box {
    background: #fff8f8;
    border: 1px solid #fcc;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 0.5rem;
}

.spielplan-box:last-child {
    margin-bottom: 0;
}

.spielplan-datum {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.spielplan-match {
    font-size: 1rem;
    font-weight: 600;
    margin: 0.25rem 0 0.1rem;
}

.spielplan-gruppe {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Forms (Submit Page) */
label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-main);
}

select,
input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background-color: #fcfcfc;
    margin-bottom: 1.25rem;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

select:focus,
input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(204, 0, 0, 0.15);
}

/* Brackets (Hauptrunde Page) */
.turnier-wrapper {
    max-width: 1200px;
    margin: 4rem auto;
    background: white;
    padding: 3rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.bracket {
    display: flex;
    justify-content: center;
    gap: 50px;
    padding: 40px 20px;
    overflow-x: auto;
}

.round {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
}

.match {
    position: relative;
    display: flex;
    flex-direction: column;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 200px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.competitor {
    padding: 10px 15px;
    font-size: 0.9rem;
    color: var(--text-main);
    border-bottom: 1px solid var(--border);
}

.competitor:last-child {
    border-bottom: none;
}

.competitor.winner {
    background-color: #fff0f0;
    font-weight: 600;
    color: var(--primary);
}

.competitor.placeholder {
    color: var(--text-muted);
    font-style: italic;
}

.score {
    float: right;
    font-weight: 700;
    color: var(--primary);
}

/* Bracket Connectors */
.round:not(:last-child) .match::after {
    content: '';
    position: absolute;
    width: 25px;
    height: 2px;
    left: 100%;
    top: 50%;
    background: var(--line-color);
}

.round:not(:first-child) .match::before {
    content: '';
    position: absolute;
    width: 25px;
    height: 2px;
    right: 100%;
    top: 50%;
    background: var(--line-color);
}

.round .match:not(:only-child):nth-child(odd)::after {
    transform: translateY(16px);
}

.round .match:not(:only-child):nth-child(even)::after {
    transform: translateY(-16px);
}

.round.winner-col .match {
    border: none;
    background: none;
    box-shadow: none;
    justify-content: center;
}

.round.winner-col .competitor {
    text-align: center;
    font-size: 1.1rem;
    color: var(--primary);
    font-weight: 700;
}

/* Standings top-2 highlight */
tr.qualifiziert td {
    background-color: #fff0f0;
    font-weight: 600;
    color: var(--primary);
}

/* Spielerbörse Akkordeon */
.akkordeon-section {
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.akkordeon-header {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.25rem;
    background: #f1f5f9;
    border: none;
    border-radius: 0;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
    box-shadow: none;
    text-align: left;
    transition: background 0.15s;
}

.akkordeon-header:hover {
    background: #e2e8f0;
    transform: none;
}

.akkordeon-count {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-left: auto;
}

.akkordeon-chevron {
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: transform 0.2s;
    flex-shrink: 0;
}

.akkordeon-header.collapsed .akkordeon-chevron {
    transform: rotate(-180deg);
}

.akkordeon-body {
    padding: 0.75rem;
    background: #fff;
}

/* Spielerbörse Cards */
.boerse-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    box-shadow: var(--shadow);
}

.boerse-card.offen {
    border-left: 4px solid #22c55e;
}

.boerse-card.angefragt {
    border-left: 4px solid #f59e0b;
    background: #fffbeb;
}

.boerse-card-spieler {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.2rem;
}

.boerse-card-datum {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.2rem;
}

.boerse-card-zeitraum {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}

.boerse-card-notiz {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 0.5rem;
}

.boerse-card-status {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 99px;
    margin-bottom: 0.75rem;
}

.boerse-card-status.offen {
    background: #dcfce7;
    color: #16a34a;
}

.boerse-card-status.angefragt {
    background: #fef3c7;
    color: #b45309;
}

.boerse-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.boerse-inline-form {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.badge-nicht-bestaetigt {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 99px;
    background: #fef3c7;
    color: #b45309;
    margin-left: 0.4rem;
    vertical-align: middle;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .container {
        padding: 1.25rem 1rem;
    }

    h1 {
        font-size: 1.5rem;
        margin-bottom: 1.25rem;
    }

    h2 {
        font-size: 1.2rem;
    }

    .bracket {
        justify-content: flex-start;
    }

    .turnier-wrapper {
        padding: 1.25rem 0.75rem;
        margin: 1rem 0;
    }
}