/* Tennis Pyramiden-System - Vereinsfarben: Weiß und Rot */
:root {
    --primary-red: rgb(228, 6, 19);
    --primary-red-dark: rgb(180, 5, 15);
    --primary-red-light: rgb(255, 50, 60);
    --white: #ffffff;
    --light-gray: #f8f9fa;
    --dark-gray: #343a40;
    --text-dark: #212529;
    --border-color: #dee2e6;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--white) 0%, var(--light-gray) 100%);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    background: linear-gradient(135deg, var(--primary-red) 0%, var(--primary-red-dark) 100%);
    color: var(--white);
    text-align: center;
    padding: 40px 20px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 8px 25px rgba(228, 6, 19, 0.3);
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.header p {
    font-size: 1.2em;
    opacity: 0.9;
    margin-bottom: 20px;
}

.btn {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary-red) 0%, var(--primary-red-dark) 100%);
    color: var(--white);
    padding: 12px 24px;
    text-decoration: none;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(228, 6, 19, 0.3);
    margin: 5px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(228, 6, 19, 0.4);
    background: linear-gradient(135deg, var(--primary-red-light) 0%, var(--primary-red) 100%);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--dark-gray) 0%, #495057 100%);
    box-shadow: 0 4px 15px rgba(52, 58, 64, 0.3);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #495057 0%, var(--dark-gray) 100%);
    box-shadow: 0 6px 20px rgba(52, 58, 64, 0.4);
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9em;
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #e74c3c 0%, #dc3545 100%);
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.4);
}

.content {
    background: var(--white);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.card {
    background: var(--white);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    border: 2px solid var(--border-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(228, 6, 19, 0.15);
    border-color: var(--primary-red);
}

.card h3 {
    color: var(--primary-red);
    margin-bottom: 20px;
    font-size: 1.4em;
    border-bottom: 2px solid var(--primary-red);
    padding-bottom: 10px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-dark);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-red);
    box-shadow: 0 0 0 3px rgba(228, 6, 19, 0.1);
}

.message {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #28a745;
}

.message.message--composer {
    background: #fff3cd;
    color: #856404;
    border-left-color: #ffc107;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.stat-card {
    background: linear-gradient(135deg, var(--primary-red) 0%, var(--primary-red-dark) 100%);
    color: var(--white);
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(228, 6, 19, 0.3);
}

.stat-number {
    font-size: 2em;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9em;
    opacity: 0.9;
}

.challenges {
    background: var(--white);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    border: 2px solid var(--border-color);
}

.challenge {
    background: linear-gradient(135deg, var(--light-gray) 0%, #e9ecef 100%);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 4px solid var(--primary-red);
}

.pyramid {
    background: var(--white);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    border: 2px solid var(--border-color);
    margin-top: 30px;
}

.player {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, var(--light-gray) 0%, #e9ecef 100%);
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    border-left: 4px solid var(--primary-red);
    transition: transform 0.2s ease;
}

.player:hover {
    transform: translateX(5px);
}

.player.champion {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    border-left-color: #ffc107;
}

.player.silver {
    background: linear-gradient(135deg, #c0c0c0 0%, #e5e5e5 100%);
    border-left-color: #6c757d;
}

.player.bronze {
    background: linear-gradient(135deg, #cd7f32 0%, #daa520 100%);
    border-left-color: #8b4513;
}

.position {
    font-size: 1.5em;
    font-weight: bold;
    margin-right: 15px;
    min-width: 40px;
    text-align: center;
}

.player-info {
    flex: 1;
}

.player-name {
    font-weight: bold;
    font-size: 1.1em;
    margin-bottom: 5px;
}

.player-stats {
    font-size: 0.9em;
    color: #495057;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
}

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

th {
    background: linear-gradient(135deg, var(--primary-red) 0%, var(--primary-red-dark) 100%);
    color: var(--white);
    font-weight: 600;
}

tr:hover {
    background: var(--light-gray);
}

.status {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.9em;
    font-weight: 600;
}

.status.active {
    background: #d4edda;
    color: #155724;
}

.status.inactive {
    background: #f8d7da;
    color: #721c24;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: var(--white);
    margin: 5% auto;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    border: 2px solid var(--primary-red);
}

.close {
    color: var(--primary-red);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: var(--primary-red-dark);
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header {
        padding: 20px 10px;
    }
    
    .header h1 {
        font-size: 2em;
    }
    
    .content {
        padding: 20px;
    }
    
    .grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .btn {
        display: block;
        width: 100%;
        margin: 5px 0;
    }
}

/* ---- Öffentliche Pyramide (index.php) ---- */
.pyramid-container { text-align: center; margin: 30px 0; }
.pyramid-row { display: flex; justify-content: center; margin-bottom: 20px; }
a.pyramid-player-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}
a.pyramid-player-card-link:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.9);
    outline-offset: 3px;
    border-radius: 12px;
}
.pyramid-player {
    background: linear-gradient(135deg, rgb(228, 6, 19) 0%, rgb(180, 5, 15) 100%);
    color: white;
    padding: 15px 20px;
    margin: 0 10px;
    border-radius: 10px;
    min-width: 200px;
    box-shadow: 0 4px 15px rgba(228, 6, 19, 0.3);
    transition: transform 0.2s;
    cursor: pointer;
}
.pyramid-player:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(228, 6, 19, 0.4);
}
.pyramid-player .player-position { font-size: 0.9em; opacity: 0.8; margin-bottom: 5px; }
.pyramid-player .player-name { font-weight: bold; margin-bottom: 5px; }
.pyramid-player .player-stats { font-size: 0.8em; opacity: 0.9; color: rgba(255, 255, 255, 0.95); }
.pyramid-player.empty {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: #6c757d;
    border: 2px dashed #dee2e6;
    opacity: 0.7;
}
.pyramid-player.empty:hover {
    transform: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}
.match-result {
    background: #e8f5e8;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #28a745;
    margin-bottom: 10px;
}
.match-score {
    font-family: monospace;
    font-size: 1.1em;
    color: #212529;
}
.challenge-rules {
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    border: 2px solid rgb(228, 6, 19);
    margin-bottom: 20px;
}
.challenge-rules h4 { margin-top: 0; color: rgb(228, 6, 19); }
.challenge-rules ul {
    list-style: none;
    padding-left: 0;
    margin: 10px 0 0 0;
}
.challenge-rules li { margin-bottom: 8px; }
.challenge-rules li:last-child { margin-bottom: 0; }
.category-nav {
    margin-top: 20px;
    padding: 14px 18px;
    background: #fff;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    text-align: center;
}
.category-nav a {
    margin: 4px 10px 4px 0;
    display: inline-block;
    color: #212529;
    text-decoration: none;
    font-weight: 500;
}
.category-nav a:hover {
    color: rgb(180, 5, 15);
    text-decoration: underline;
}
.category-nav a.active {
    font-weight: 700;
    color: rgb(228, 6, 19);
    text-decoration: underline;
}
.pyramid-player.has-pending-match {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.5), 0 4px 15px rgba(228, 6, 19, 0.35);
}
.pyramid-player .pending-match-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 8px;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    font-size: 0.8em;
    font-weight: 600;
}
.pyramid-player .pending-match-badge svg {
    flex-shrink: 0;
    opacity: 0.95;
}
select option:disabled {
    color: #adb5bd;
    background: #f1f3f5;
}
.pyramid-mobile-panel {
    display: none;
    --pm-gap: 3px;
    --pm-cols: 1;
    --pm-chip: calc((100% - (var(--pm-cols) - 1) * var(--pm-gap)) / var(--pm-cols));
}
.pyramid-mobile-compact-title { color: #495057; font-size: 0.88rem; margin: 14px 0 6px; text-align: center; }
.pyramid-mobile-row-wrap {
    margin-bottom: 5px;
    padding: 2px 0;
    width: 100%;
    overflow: visible;
}
.pyramid-mobile-row-inner {
    display: flex;
    gap: var(--pm-gap);
    justify-content: center;
    width: 100%;
    max-width: 100%;
    align-items: stretch;
}
.pyramid-mobile-row-inner > a.pyramid-mobile-chip-link,
.pyramid-mobile-row-inner > .pyramid-mobile-chip.empty {
    flex: 0 0 var(--pm-chip);
    width: var(--pm-chip);
    max-width: var(--pm-chip);
    min-width: 0;
    box-sizing: border-box;
}
a.pyramid-mobile-chip-link { text-decoration: none; color: inherit; display: block; }
.pyramid-mobile-chip {
    width: 100%;
    min-height: 44px;
    padding: 4px 2px;
    background: linear-gradient(135deg, rgb(228, 6, 19) 0%, rgb(180, 5, 15) 100%);
    color: #fff;
    border-radius: 6px;
    text-align: center;
    font-size: 0.7rem;
    line-height: 1.15;
    box-shadow: 0 2px 6px rgba(228, 6, 19, 0.22);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}
.pyramid-mobile-chip .chip-pos { font-weight: 800; font-size: 1rem; line-height: 1; margin-bottom: 2px; }
.pyramid-mobile-chip .chip-sv { font-size: 0.62rem; opacity: 0.92; font-variant-numeric: tabular-nums; }
.pyramid-mobile-chip.empty {
    background: #e9ecef;
    color: #6c757d;
    border: 1px dashed #ced4da;
    box-shadow: none;
    font-size: 0.9rem;
    font-weight: 600;
}
.pyramid-mobile-chip.has-pending { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.9); }
.pyramid-mobile-list-title { margin-top: 20px; margin-bottom: 10px; font-size: 1.1rem; color: #212529; }
.pyramid-mobile-list { list-style: none; padding: 0; margin: 0; }
.pyramid-mobile-list li { margin-bottom: 8px; }
.pyramid-mobile-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    text-decoration: none;
    color: #212529;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.pyramid-mobile-list a .pm-rank {
    flex: 0 0 auto;
    font-weight: 700;
    color: rgb(228, 6, 19);
    font-size: 0.9rem;
    min-width: 2.5rem;
}
.pyramid-mobile-list a .pm-mid { flex: 1; min-width: 0; }
.pyramid-mobile-list a .pm-name { font-weight: 600; }
.pyramid-mobile-list a .pm-meta { font-size: 0.8rem; color: #6c757d; margin-top: 2px; }
.pyramid-mobile-list a .pm-pend {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    line-height: 0;
}
.pyramid-mobile-list a .pm-pend svg { display: block; }
@media (max-width: 720px) {
    .pyramid-visual-desktop { display: none !important; }
    .pyramid-mobile-panel { display: block; }
    .pyramid-container { margin: 16px 0; }
    .pyramid-container > h2 { font-size: 1.35rem; }
}
@media (max-width: 380px) {
    .pyramid-mobile-chip { min-height: 40px; }
    .pyramid-mobile-chip .chip-pos { font-size: 0.88rem; }
    .pyramid-mobile-chip .chip-sv { font-size: 0.55rem; }
}

/* ---- Spielerseite (category_player.php) ---- */
.cp-header-meta { color: rgba(255, 255, 255, 0.95); margin-top: 8px; }
.cp-header-meta strong { color: #fff; }
.cp-chart-wrap { max-width: 720px; margin: 24px 0; min-height: 280px; }
.cp-nav-links { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.match-row { border-bottom: 1px solid #e9ecef; padding: 12px 0; }
.match-row:last-child { border-bottom: none; }
.match-outcome-win { color: #155724; font-weight: 600; }
.match-outcome-loss { color: #721c24; font-weight: 600; }
.history-table { width: 100%; border-collapse: collapse; font-size: 0.95em; }
.history-table th, .history-table td { padding: 8px; text-align: left; border-bottom: 1px solid #dee2e6; vertical-align: top; }
.history-match { font-size: 0.92em; line-height: 1.45; }
.history-match .hid { font-weight: 700; color: #495057; }
.history-match .score { font-family: ui-monospace, monospace; margin-top: 4px; }
.history-match .meta { color: #6c757d; font-size: 0.9em; margin-top: 4px; }

/* ---- Admin Login ---- */
.login-container {
    max-width: 400px;
    margin: 50px auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}
.login-header {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    padding: 30px;
    text-align: center;
}
.login-form { padding: 30px; }
.login-error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
}
.back-link { text-align: center; margin-top: 20px; }
.back-link a { color: #667eea; text-decoration: none; }
.back-link a:hover { text-decoration: underline; }
.btn--block { width: 100%; }

/* ---- Admin Spieler (admin.php) ---- */
.stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}
.stat-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
}
.stat-box .stat-number { font-size: 2em; font-weight: bold; margin-bottom: 5px; }
.stat-box .stat-label { font-size: 0.9em; opacity: 0.9; }
.top-players { background: #fff3cd; padding: 15px; border-radius: 8px; border-left: 4px solid #ffc107; }
.player-rank { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid #ffeaa7; }
.player-rank:last-child { border-bottom: none; }
.rank-number { font-weight: bold; color: #856404; min-width: 30px; }
.cat-badge { display: inline-block; background: #e7f1ff; padding: 4px 8px; border-radius: 6px; margin: 2px 4px 2px 0; font-size: 0.85em; }
.checkbox-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.checkbox-grid label { margin-right: 12px; }
.form-compact { margin-top: 8px; }
.input-narrow { width: 80px; }

/* ---- Admin Ergebnis (admin_challenge_finish.php) ---- */
.score-input { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 15px; }
.score-input input {
    width: 100%;
    padding: 8px;
    border: 2px solid #dee2e6;
    border-radius: 5px;
    text-align: center;
    font-size: 16px;
}
.set-label { font-weight: 600; color: #212529; margin-bottom: 5px; }
.tiebreak-section {
    background: #fff3cd;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #ffc107;
    margin-top: 15px;
}
.game-type-selector { margin-bottom: 15px; }
.game-type-selector label { margin-right: 15px; cursor: pointer; }
.pair-box {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    border-left: 4px solid #667eea;
}
.header-actions { margin-top: 12px; margin-bottom: 0; }

/* ---- Admin Herausforderungen (admin_challenges.php) ---- */
table.ch-wide { min-width: 960px; }
table.ch-wide th, table.ch-wide td { vertical-align: top; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.8em; }
.pill-pending { background: #fff3cd; color: #856404; }
.pill-done { background: #d4edda; color: #155724; }
.pill-other { background: #e2e3e5; color: #383d41; }
.ch-link { color: inherit; text-decoration: none; font-weight: 600; }
.ch-link:hover { text-decoration: underline; color: #0d6efd; }
.btn-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.btn-row form { display: inline; margin: 0; }
.ch-filter-tabs { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; align-items: center; }
.ch-filter-tabs .tab-label { color: #6c757d; font-size: 0.9em; margin-right: 4px; }
.pill-expired { background: #f8d7da; color: #721c24; }

/* ---- Hilfsklassen (ehemals inline) ---- */
.admin-nav-wrap { margin-top: 20px; }
.admin-nav-wrap .nav-inline-icon {
    display: inline-block;
    vertical-align: middle;
    margin-right: 5px;
    line-height: 0;
}
.admin-nav-wrap .nav-inline-icon svg { display: block; }

.challenge-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.challenge-heading--hero {
    justify-content: center;
}
.challenge-heading svg { flex-shrink: 0; }

.chip-pend-icon {
    display: inline-block;
    vertical-align: -0.12em;
    line-height: 0;
}
.chip-pend-icon svg { display: block; }

.intro-box {
    background: #f0f4ff;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    margin-bottom: 16px;
}
.list-plain { list-style: none; padding: 0; }
.list-plain li { margin: 12px 0; }
.slug-note { margin-left: 10px; color: #6c757d; }
.challenge-rules-footnote { margin-bottom: 0; font-size: 0.95em; }
.pending-badge--on-white {
    display: inline-flex;
    margin-top: 8px;
    background: #fff;
    color: #c41e3a;
}
.lead-muted { color: #495057; font-size: 0.95em; margin-bottom: 12px; }
.text-muted { color: #6c757d; }
.text-help { display: block; color: #6c757d; margin-top: 6px; }
.text-help-tight { display: block; color: #6c757d; margin-top: 4px; }
.chart-hint { color: #6c757d; font-size: 0.95em; }
.muted-green { color: #15803d; }
.muted-red { color: #dc2626; }
.muted-gray { color: #64748b; }
.history-subtle { color: #6c757d; font-weight: 400; }
.role-label { color: #6c757d; }
.match-score-tight { font-family: monospace; margin-top: 6px; }
.settings-form { max-width: 640px; }
.section-title { margin-top: 8px; }
.section-title-spaced { margin-top: 28px; }
.blurb { color: #495057; font-size: 0.95em; }
.form-stack { margin-bottom: 24px; }
.form-inline { display: inline; }
.form-test-mail { margin-top: 20px; }
.code-stack { display: block; margin-top: 8px; }
.small { font-size: 0.9em; }
.small--admin { color: #6c757d; }
