
/* Global Resets & Font */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    margin: 0; /* Belangrijk: body margin op 0 voor fixed positionering van deco */
    background-color: #4d4d4d; /* Heel lichtgrijs voor de pagina achtergrond */
    color: #212529; /* Donkergrijs/bijna zwart voor standaard tekst */
    display: flex;
    justify-content: center;
    position: relative; /* Nodig voor z-index context als .container geen z-index heeft */
    min-height: 100vh; /* Zorg dat body altijd vol viewport is */
}
.container {
    width: 100%;
    margin: 20px; /* Behoud container margin voor ruimte binnen body padding */
    background: #ffffff; /* Wit voor de hoofdcontainer */
    padding: 25px 30px;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1); /* Iets prominentere schaduw */
    position: relative; /* Zodat het boven de decoraties kan komen indien nodig */
    z-index: 1; /* Zorgt dat de container boven de fixed decoraties ligt */
}
/* --- Side Decorations --- */
.side-decoration {
    flex-basis: 25%;
    min-width: 200px;
    background: linear-gradient(to bottom, #4a4a4a, #2c2c2c);
    color: #f0f0f0;
    box-sizing: border-box;
    overflow-y: auto; /* BELANGRIJK: scrollbar voor decoratie als content langer is dan hoogte */
    box-shadow: inset 0 0 15px rgba(0,0,0,0.5);
    /* height: 100vh; /* NIET NODIG, flex stretch doet dit al. */
    /* We voegen display: flex en flex-direction: column toe om interne elementen
       (zoals slideshow en text-content) beter te beheren qua hoogte. */
    display: flex;
    flex-direction: column;
}

.left-decoration {
    left: 0;
    border-right: 2px solid #cc0000; /* Rode accentlijn */
}

.right-decoration {
    right: 0;
    border-left: 2px solid #cc0000; /* Rode accentlijn */
}

/* Slideshow Styling */
.slideshow-container {
    width: 100%; /* Volledige breedte van .side-decoration */
    height: 98%; /* Vaste hoogte voor de slideshow, pas aan naar wens */
    position: relative;
    overflow: hidden; /* Zorgt dat slides niet buiten container vallen */
    margin-bottom: 15px; /* Ruimte tussen slideshow en tekst */
}

.slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Zorgt dat afbeelding de container vult zonder vervorming */
    opacity: 0;
    transition: opacity 1s ease-in-out; /* Fade effect van 1 seconde */
    border: none; /* Verwijder eventuele default border van img */
}

.slide.active {
    opacity: 1;
    z-index: 1; /* Zorgt dat actieve slide boven andere (uitfadende) slides komt */
}


.decoration-text-content { /* Nieuwe container voor tekst */
    padding: 0 20px 20px 20px; /* Padding voor de tekst, niet voor slideshow */
    text-align: center;
}

.decoration-text-content h2 {
    color: #cc0000;
    border-bottom: 1px solid #555;
    padding-bottom: 5px;
    font-size: 1.5em; /* Iets kleiner voor in de zijbalk */
    margin-bottom: 10px;
}
.decoration-text-content p {
    font-size: 0.9em;
    color: #d0d0d0;
}


/* Media Query om decoraties alleen op brede schermen te tonen */
@media (min-width: 1750px) { /* Pas dit breakpoint aan naar wens */
    .side-decoration {
        display: block; /* Of flex, grid, afhankelijk van interne layout */
    }
}


/* Typography */
h1, h2, h3, h4 {
    color: #1a1a1a; /* Zwart voor koppen */
    margin-top: 0;
    margin-bottom: 20px;
}
h1 {
    font-size: 2.4em;
    text-align: center;
    color: #cc0000; /* Rood voor de hoofdtitel */
    margin-bottom: 30px;
    font-weight: 700;
}
h2 { /* Hoofd h2 styling (binnen .container) */
    font-size: 1.8em;
    border-bottom: 2px solid #e0e0e0; /* Lichtere border */
    padding-bottom: 12px;
    text-align: center;
    font-weight: 600;
}
h3 {
    font-size: 1.4em;
    text-align: center;
    color: #333333;
    font-weight: 600;
}
h4 {
    font-size: 1.1em;
    color: #444444;
    margin-bottom: 12px;
    font-weight: 500;
}

/* Header Buttons (Navigatie) */
.header-buttons {
    text-align: center;
    margin-bottom: 30px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    color: white;
    text-decoration: none;
}

.header-buttons button {
    background-color: #333333; /* Donkergrijs/Zwart voor navigatieknoppen */
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 500;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.header-buttons button:hover:not(:disabled) {
    background-color: #cc0000; /* Rood bij hover */
    transform: translateY(-2px);
}
.header-buttons button:disabled {
    background-color: #b0b0b0; /* Lichter grijs voor disabled */
    color: #777777;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Input Groups & General Buttons */
.input-group {
    display: flex;
    margin-bottom: 20px;
    max-width: 450px;
    margin-left: auto;
    margin-right: auto;
}

.input-group input[type="text"] {
    flex-grow: 1;
    padding: 12px 15px;
    border: 1px solid #cccccc;
    border-radius: 6px 0 0 6px;
    font-size: 1em;
    transition: border-color 0.2s ease;
}
.input-group input[type="text"]:focus {
    outline: none;
    border-color: #cc0000; /* Rode border bij focus */
    box-shadow: 0 0 0 2px rgba(204,0,0,0.2);
}

/* Algemene knopstyling (binnen secties) */
button {
    background-color: #cc0000; /* Primair rood voor actieknoppen */
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    margin-left: 5px; /* Behoud marge voor consistentie */
    transition: background-color 0.2s ease, transform 0.2s ease;
}
.input-group button { /* Knop direct na input */
    border-radius: 0 6px 6px 0;
    margin-left: -1px; /* Overlap border */
}

button:hover:not(:disabled) {
    background-color: #a30000; /* Donkerder rood bij hover */
    transform: translateY(-1px);
}
button:disabled {
     background-color: #cccccc;
     color: #777777;
     cursor: not-allowed;
     opacity: 0.7;
}

#player-setup button, #tournament-options button, #data-management button, #pool-phase button {
    margin-right: 10px;
    margin-bottom: 10px;
}
#tournament-options, #pool-phase {
    text-align: center;
    margin-top: 20px;
}


/* Player List */
ul#playerList {
    list-style-type: none;
    padding-left: 0;
    max-width: 100%;
    margin: 20px auto 30px auto;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

ul#playerList li {
    background: #f9f9f9;
    padding: 10px 15px;
    border-radius: 4px;
    border-left: 4px solid #cc0000;
    font-size: 1.05em;
    min-width: 250px; /* Iets breder voor checkbox en knop */
    box-sizing: border-box;
    display: flex; /* Voor uitlijning naam en knop */
    justify-content: space-between;
    align-items: center;
}

ul#playerList li.player-inactive {
    border-left-color: #aaaaaa;
    background-color: #e9e9e9;
}

ul#playerList li.player-inactive .player-name-display {
    text-decoration: line-through;
    color: #777777;
}

.player-active-toggle {
    margin-right: 10px;
    cursor: pointer;
    transform: scale(1.2); /* Maakt de checkbox iets groter */
}
.player-active-toggle:disabled {
    cursor: not-allowed;
}

ul#playerList li .player-name-display { /* Span om de naam */
    flex-grow: 1; /* Neemt de meeste ruimte */
    text-align: left;
    margin-right: 10px; /* Ruimte tussen naam en knop */
}

ul#playerList li button.remove-player-btn {
    background-color: #e74c3c; /* Rood */
    color: white;
    border: none;
    padding: 4px 10px;
    font-size: 0.9em;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    margin-left: 5px; /* Overruled de algemene button margin-left */
    margin-right: 0;
    flex-shrink: 0; /* Zorgt dat knop niet krimpt */
    line-height: 1; /* Voor betere verticale uitlijning van 'X' */
    transition: background-color 0.2s ease, transform 0.1s ease;
}

ul#playerList li button.remove-player-btn:hover:not(:disabled) {
    background-color: #c0392b; /* Donkerder rood */
    transform: translateY(-1px);
}

ul#playerList li button.remove-player-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    opacity: 0.7;
}


.hidden {
    display: none !important;
}

.info {
    font-size: 0.9em;
    color: #555555;
    text-align: center;
    margin-top: 15px;
    background-color: #f0f0f0;
    padding: 8px;
    border-radius: 4px;
}

/* Pool Styling */
#pools-container {
    display: flex;
    flex-wrap: wrap;
    gap: 25px;
    justify-content: center;
    margin-bottom: 25px;
}

.pool {
    border: 1px solid #d0d0d0;
    padding: 20px;
    border-radius: 8px;
    background-color: #fdfdfd; /* Bijna wit */
    min-width: 350px;
    margin-bottom: 20px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.pool h3 {
    margin-top: 0;
    color: #cc0000; /* Rood voor poule titels */
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}
.pool ul { /* Spelerlijst binnen een poule */
    list-style-type: none;
    padding: 0;
    margin-bottom: 15px;
}
.pool ul li {
    padding: 8px 10px;
    background-color: #ffffff;
    border: 1px solid #eeeeee;
    margin-bottom: 4px;
    border-radius: 4px;
}

.pool-match {
    margin-bottom: 12px;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background-color: #ffffff;
    display: grid;
    grid-template-columns: 1fr auto auto auto 1fr auto;
    align-items: center;
    gap: 8px;
}
.pool-match label {
    text-align: right;
    font-weight: 500;
}
.pool-match label:nth-of-type(2) {
    text-align: left;
}
.pool-match input[type="number"] {
    width: 50px;
    padding: 6px;
    text-align: center;
    border: 1px solid #cccccc;
    border-radius: 4px;
}
.pool-match .vs {
    font-weight: bold;
    color: #555555;
}
.pool-match button { /* Opslaan knop in poule */
    padding: 6px 10px;
    font-size: 0.9em;
    background-color: #28a745; /* Groen voor opslaan score, voor contrast */
}
.pool-match button:hover:not(:disabled) {
    background-color: #218838;
}
.pool-match .winner-text {
    color: #28a745; /* Groen voor "Gespeeld" */
    font-weight: bold;
    grid-column: span 2;
    text-align: right;
}

/* NEW: Styles for live score display on main.html */
.pool-match .live-score {
    font-weight: bold;
    color: #007bff; /* Blue for live scores */
    font-size: 1.1em;
    text-align: center; /* Center align for better visual */
}
/* Ensure the grid layout is consistent when live scores are present */
.pool-match.live-scoring {
    grid-template-columns: 1fr auto 1fr auto; /* Adjusted for live score display */
}


/* Bracket Styling */
.brackets-container {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 30px;
    margin-top: 25px;
    overflow-x: auto;
    padding-bottom: 20px;
}

.bracket-column {
    flex: 1;
    min-width: 420px;
    padding: 20px;
    border: 1px solid #c0c0c0; /* Iets donkerdere border */
    border-radius: 8px;
    background-color: #f9f9f9; /* Lichtgrijs voor de kolom */
    overflow-x: auto; /* <<< TOEGEVOEGD VOOR HORIZONTAAL SCROLLEN BINNEN DE KOLOM */
}
.bracket-column h3 { /* Winnaars/Verliezersbracket titel */
    margin-top:0;
    color: #1a1a1a;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
}

.bracket {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    min-width: min-content; /* Belangrijk: de bracket wordt zo breed als zijn inhoud (de rondes) */
}

.round {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
    margin-right: 60px; /* Meer ruimte tussen rondes */
    min-height: 120px;
}
.round:last-child {
    margin-right: 15px;
}
.round h4 { /* Ronde titel */
    color: #cc0000; /* Rood voor ronde nummer */
    font-weight: 600;
}

.match {
    background-color: #ffffff;
    border: 1px solid #cccccc;
    padding: 15px;
    margin-bottom: 35px;
    border-radius: 6px;
    width: 280px; /* Iets breder voor leesbaarheid */
    box-shadow: 0 2px 5px rgba(0,0,0,0.08);
}
.round > .match:last-child {
    margin-bottom: 0;
}

.player-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    min-height: 28px;
}

.player-line .player-name {
    flex-grow: 1;
    font-size: 1em;
}
.player-line .score-display, .player-line .score-input {
    width: 45px;
    padding: 5px;
    text-align: center;
    margin-left: 10px;
    border: 1px solid #dddddd;
    border-radius: 4px;
    font-size: 0.95em;
}
.player-line .score-display {
    background-color: #f0f0f0;
    font-weight: 500;
}
.player-line .score-input:focus {
    outline: none;
    border-color: #cc0000;
}

/* NEW: Style for live scores in bracket matches */
.player-line .live-score-small {
    font-weight: bold;
    color: #007bff; /* Blue for live scores */
    font-size: 0.95em; /* Match input size */
    margin-left: 10px; /* Align with input */
    background-color: #e6f3ff; /* Light blue background */
    padding: 5px;
    border-radius: 4px;
    min-width: 45px;
    text-align: center;
}


.vs-separator {
    text-align: center;
    font-weight: 500;
    color: #777777;
    margin: 4px 0;
    font-size: 0.85em;
}

.match button.save-score-button { /* Opslaan knop in bracket */
    display: block;
    width: 100%;
    margin-top: 12px;
    background-color: #28a745; /* Groen voor consistentie met poule */
    font-size: 0.95em;
    padding: 8px 12px;
}
.match button.save-score-button:hover:not(:disabled) {
    background-color: #218838;
}

.winner .player-name { font-weight: 700; color: #1a1a1a; /* Zwart en bold voor winnaar */ }
.loser .player-name { color: #888888; text-decoration: line-through; }
.tbd .player-name, .player-name.tbd { font-style: italic; color: #aaaaaa; }

.winner-display { /* Kampioen van bracket */
    text-align: center;
    font-size: 1.2em;
    padding: 18px;
    background-color: #ffe6e6; /* Lichtrood voor kampioen display */
    border: 1px solid #cc0000; /* Rode border */
    color: #a30000; /* Donkerrood tekst */
    margin-top: 15px;
    border-radius: 6px;
    font-weight: 600;
}

/* Leaderboard Styling */
#leaderboard-content {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 25px;
    margin-top: 25px;
}
.leaderboard-table-container {
    flex: 1;
    min-width: 320px;
}
.leaderboard-table-container h3 { /* Titel boven tabel */
    text-align: left;
    color: #1a1a1a;
    border-bottom: 2px solid #cc0000; /* Rode border onder titel */
    padding-bottom: 8px;
    font-size: 1.3em;
}
table.leaderboard {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    font-size: 0.95em;
    box-shadow: 0 3px 8px rgba(0,0,0,0.07);
    border-radius: 6px;
    overflow: hidden; /* Voor border-radius op tabel */
}
table.leaderboard th, table.leaderboard td {
    border: 1px solid #e0e0e0;
    padding: 10px 12px;
    text-align: left;
}
table.leaderboard th {
    background-color: #333333; /* Zwarte header voor tabel */
    color: white;
    font-weight: 600;
}
table.leaderboard tr:nth-child(even) td {
    background-color: #f9f9f9; /* Zebra striping */
}
table.leaderboard tr:hover td {
    background-color: #ffebeb; /* Lichte rode hover op rijen */
}

/* Tournament Winner Announcement */
#tournament-winner-announcement {
    margin-top: 35px;
    padding: 25px;
    background-color: #1a1a1a; /* Zwarte achtergrond */
    color: #ffffff; /* Witte tekst */
    border: 2px solid #cc0000; /* Rode border */
    border-radius: 8px;
    text-align: center;
}
#tournament-winner-announcement h2 {
    color: #cc0000; /* Rode titel */
    font-size: 1.8em;
}
#overall-winner-name {
    font-size: 1.4em;
    font-weight: 600;
    line-height: 1.5;
}
#overall-winner-name .winner-text { /* Als je specifieke winnaars wilt highlighten */
    color: #ffdddd; /* Heel lichtrood voor nadruk */
}

.pool-match .schrijver-info,
.match .schrijver-info {
    grid-column: 1 / -1; /* Zorg dat het de volledige breedte van de match grid inneemt */
    text-align: center;
    font-size: 0.85em;
    color: #555;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #eee;
}
/* Utility & Info Text */
.error-bracket, .no-matches-info {
    color: #555555;
    text-align: center;
    padding: 25px;
    font-style: italic;
    background-color: #f9f9f9;
    border-radius: 6px;
    border: 1px dashed #cccccc;
}

/* Settings Section Styling */
#settings-section {
    padding: 20px;
    border-top: 1px solid #e0e0e0;
    margin-top: 30px;
}

.settings-category {
    margin-bottom: 25px;
    padding: 15px;
    background-color: #fdfdfd;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
}

.settings-category h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #cc0000;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
    text-align: left; /* Anders dan andere h3s */
    font-size: 1.3em;
}

.setting-item {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    gap: 10px; /* Ruimte tussen label en input */
}

.setting-item label {
    flex-basis: 250px; /* Vaste breedte voor labels */
    flex-shrink: 0;
    font-weight: 500;
    color: #333;
}

.setting-item input[type="number"] {
    padding: 8px 10px;
    border: 1px solid #cccccc;
    border-radius: 5px;
    font-size: 0.95em;
    width: 80px; /* Vaste breedte voor input */
    text-align: center;
    transition: border-color 0.2s ease;
}
.setting-item input[type="number"]:focus {
    outline: none;
    border-color: #cc0000;
    box-shadow: 0 0 0 2px rgba(204,0,0,0.2);
}


/* Scrollbar styling (optioneel, werkt in WebKit browsers) */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}
::-webkit-scrollbar-thumb {
    background: #cc0000;
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: #a30000;
}

.setting-item select {
    padding: 8px 10px;
    border: 1px solid #cccccc;
    border-radius: 5px;
    font-size: 0.95em;
    min-width: 120px; /* Zodat de select niet te smal is */
    background-color: white;
    flex-grow: 1; /* Laat select groeien als er ruimte is */
}
.setting-item input[type="number"].narrow {
    width: 80px; /* Voor inputs die minder breed hoeven */
}

#scorer-session-management {
    margin-top: 30px;
    padding: 20px;
    border-top: 1px solid #e0e0e0;
    text-align: center;
}
#scorer-session-management h2 {
    text-align: center; /* Overruled algemene H2 */
    margin-bottom: 15px;
}
#startScorerSessionButton {
    background-color: #007bff; /* Blauw voor onderscheid */
    margin-bottom: 15px;
    padding: 10px 18px;
}
#startScorerSessionButton:hover:not(:disabled) {
    background-color: #0056b3;
}
#startScorerSessionButton:disabled {
    background-color: #b0b0b0;
    opacity: 0.7;
}
#sessionCodeDisplay {
    font-size: 1.8em;
    font-weight: bold;
    color: #555;
    padding: 10px;
    background-color: #f0f0f0;
    border-radius: 6px;
    display: inline-block;
    min-width: 100px;
    margin-bottom: 10px;
}
#scorerStatusDisplay {
    font-size: 0.95em;
    margin-top: 5px;
    min-height: 20px; /* Voorkom layout shifts */
}
.info-text { color: #31708f; }
.success-text { color: #3c763d; }
.error-text { color: #a94442; }

.status-message {
    margin-top: 15px;
    font-size: 0.9em;
    padding: 10px;
    border-radius: 4px;
    text-align: center;
}
.status-success {
    background-color: #e6ffe6; /* Lichter voor main.html */
    border: 1px solid #5cb85c;
    color: #3c763d;
}
.status-error {
    background-color: #f2dede; /* Lichter voor main.html */
    border: 1px solid #ebccd1;
    color: #a94442;
}
.status-info {
    background-color: #e7f3fe; /* Lichter voor main.html */
    border: 1px solid #bce8f1;
    color: #31708f;
}

/* Styling voor de admin's match claim status (optioneel) */
#adminMatchClaims ul {
    list-style-type: none;
    padding: 0;
}
#adminMatchClaims li {
    background-color: #f8f9fa;
    padding: 8px;
    margin-bottom: 5px;
    border-radius: 4px;
    font-size: 0.9em;
}
