:root {
    --primary: #8B0000; /* Dark Red - TC Stadtparkish */
    --primary-dark: #660000;
    --secondary: #1a2a3a; /* Dark Blue/Grey */
    --accent: #FFD700; /* Golden/Yellow for Winners */
    --bg-light: #f5f7fa;
    --text-dark: #333;
    --text-light: #fff;
    --danger: #dc3545;
    --success: #28a745;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --radius: 8px;
    --font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    padding-bottom: 60px; /* Space for sticky nav if needed or just bottom buffer */
}

/* Header */
header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--text-light);
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow);
}

header h1 {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

header p {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Container */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

/* Tabs/Navigation */
.nav-tabs {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
    background: #fff;
    padding: 10px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.nav-btn {
    background: none;
    border: none;
    padding: 10px 15px;
    font-size: 1rem;
    color: var(--secondary);
    cursor: pointer;
    font-weight: 600;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

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

/* Sections */
.section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Cards */
.card {
    background: #fff;
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

/* Form Styles */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

select, input[type="text"], input[type="number"], input[type="password"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: var(--radius);
    font-size: 1rem;
    background: #f9f9f9;
}

.btn {
    display: inline-block;
    width: 100%;
    padding: 12px;
    background: var(--secondary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: background 0.2s;
}

.btn:hover {
    opacity: 0.9;
}

.btn-primary { background: var(--primary); }
.btn-danger { background: var(--danger); }
.btn-success { background: var(--success); }

/* Leaderboard Table */
table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    background-color: #fafafa;
    color: var(--secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
}

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

.rank-cell {
    font-weight: bold;
    color: var(--primary);
    width: 40px;
    text-align: center;
}

/* Result Sets Input */
.sets-input {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.set-input-group {
    display: flex;
    align-items: center;
    gap: 5px;
}

.set-input-group input {
    width: 60px;
    text-align: center;
}

.set-label {
    font-size: 0.8rem;
    color: #777;
    margin-bottom: 2px;
}

/* History Items */
.history-item {
    border-left: 4px solid var(--secondary);
    padding-left: 15px;
    margin-bottom: 15px;
}

.history-date {
    font-size: 0.8rem;
    color: #888;
}

.history-match {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 5px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.winner {
    color: var(--success);
}
.loser {
    color: #666;
}

.history-score {
    font-family: monospace;
    background: #eee;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9rem;
}

/* Admin Specific */
.admin-badge {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--secondary);
    color: #fff;
    padding: 10px 15px;
    border-radius: 50px;
    font-size: 0.8rem;
    box-shadow: var(--shadow);
    text-decoration: none;
    z-index: 100;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.alert-box {
    padding: 10px;
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
    border-radius: var(--radius);
    margin-bottom: 15px;
    display: none;
}

@media (max-width: 600px) {
    .nav-btn {
        padding: 8px 10px;
        font-size: 0.9rem;
    }
    
    th, td {
        padding: 10px 5px;
        font-size: 0.9rem;
    }
    
    .history-match {
        flex-direction: column;
        align-items: flex-start;
    }
}
