@charset "UTF-8";

/*************************
 * LIGHT/DARK MODE SETUP *
 *************************/

:root {
    --background-gradient-start: light-dark(#87ceeb, #143f80);
    --background-color: light-dark(white, black);
    --text-color: light-dark(black, white);

    --tournament-list-link-color: light-dark(blue, #57b9ff);

    --top-button-border: light-dark(#333, #ccc);
    --top-button-background-color: light-dark(#e48640, #e48640);
    --top-button-text-color: light-dark(black, black);
    --top-button-checked-background-color: light-dark(#ffa940, #ffa940);
    --top-button-checked-text-color: light-dark(black, black);
    --top-button-disabled-background-color: light-dark(#888888, #888888);
    --top-button-disabled-text-color: light-dark(black, black);

    --select-background-color: light-dark(#362a58, #362a58);
    --select-text-color: light-dark(white, white);

    --match-player-final-position-text-color: light-dark(blue /*#06402b*/, #0f0);
    --match-round-note-text-color: light-dark(#c77, #f99);
    --match-superscript-text-color: light-dark(#d55, #f66);

    --positions-list-background-color: light-dark(#eee, #002332);
    --positions-list-open-background-color: light-dark(#bbb, #004764);

    --lightbox-background-color: light-dark(white, #2f4f4f);
    --lightbox-text-color: light-dark(black, white);

    --save-button-border: light-dark(#333, #ccc);
    --save-button-background-color: light-dark(#04aa6d, #04aa6d);
    --save-button-text-color: light-dark(white, white);

    --schedule-symbol-direness-none-color: light-dark(black, white);
    --schedule-symbol-direness-low-color: light-dark(#ffcc00, yellow);
    --schedule-symbol-direness-medium-color: light-dark(orange, orange);
    --schedule-symbol-direness-high-color: light-dark(red, red);
}

[data-theme="light"] {
    color-scheme: light;
}

[data-theme="dark"] {
    color-scheme: dark;
}

/*********************
 * MISC/EXPERIMENTAL *
 *********************/

select#draw-select,
select#section-select {
    background-color: var(--select-background-color);
    color: var(--select-text-color);
    margin-left: 3px;
    margin-right: 3px;
}

div.tournament-list-name {
    color: var(--tournament-list-link-color);
    text-decoration: underline;
    cursor: pointer;
}

div#sections-and-matches-control {
}

span#schedule-symbol {
    font-size: 85%;
}

span#schedule-symbol[data-direness="none"] {
    opacity: 0%;
    color: var(--schedule-symbol-direness-none-color);
}

span#schedule-symbol[data-direness="low"] {
    opacity: 100%;
    color: var(--schedule-symbol-direness-low-color);
}

span#schedule-symbol[data-direness="medium"] {
    opacity: 100%;
    color: var(--schedule-symbol-direness-medium-color);
}

span#schedule-symbol[data-direness="high"] {
    opacity: 100%;
    color: var(--schedule-symbol-direness-high-color);
}

/*
div[id^="bracketry-wrapper-bracket-"] {
    height: 700px;
    max-height: 90vh;
}
*/

/*******************
 * FONT/ICON SETUP *
 *******************/

.dosis-class {
    font-family: "Dosis", sans-serif;
    font-optical-sizing: auto;
    font-weight: 200;
    font-style: normal;
}

* {
    font-size: 100%;
    font-family: Dosis;
}

.material-symbols-outlined {
    font-variation-settings:
        "FILL" 0,
        "wght" 400,
        "GRAD" 0,
        "opsz" 16;
}

/*************************
 * HIGH-LEVEL GRID SETUP *
 *************************/

body {
    height: 100vh;
    margin: 0;
    display: grid;
    grid-template-rows: auto 1fr; /* Define two rows: one for header (auto height), one for content (fills the rest) */
    grid-template-columns: 1fr; /* Ensures a single column layout that takes available width */
    overflow-x: hidden; /* Prevent horizontal body scroll if anything overflows */

    background-color: var(--background-color);
    color: var(--text-color);
}

div#header {
    background-image: linear-gradient(to bottom, var(--background-gradient-start), var(--background-color));
    color: var(--text-color);
    padding: 1rem;
    text-align: center;
    overflow-x: hidden; /* Important: Prevents header content from creating horizontal scroll */
}

div.lower-header {
    margin-top: 1rem;
}

div#tournament-list {
    display: flex;
    justify-content: center;
}

div#search-tournament-input-container-control {
    padding-top: 1rem;
}

input#search-tournament-input {
    background-color: white;
    color: black;
}

div#content {
    overflow-y: auto; /* Make ONLY this div scrollable */
    padding: 1rem;
}

div#draws-tab-in-header-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

/*********************************
 * HORIZONTAL RADIO BUTTON SETUP *
 *********************************/

.horizontal-radio-button-group {
    display: flex; /* Arranges the buttons and labels in a row */
    align-items: center; /* Keeps them vertically aligned */
    justify-content: center;
    width: 100%;
    /* CRITICAL: This is essential for the ellipsis to work.
    If the flex items (labels) together are wider than their container,
    this prevents the whole group from causing a scrollbar and forces them to shrink. */
    overflow: hidden;
    flex-wrap: nowrap; /* Ensures buttons stay on one line and are forced to shrink */
}

.horizontal-radio-button-group input[type="radio"] {
    /* Hide the default radio button */
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 0;
    height: 0;
    margin: 0;
    position: absolute;
}

.horizontal-radio-button-group label {
    padding: 0px 8px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--top-button-border);
    cursor: pointer;
    background-color: var(--top-button-background-color);
    color: var(--top-button-text-color);
    transition: all 0.2s ease-in-out;
    margin-right: 5px; /* Add some space between buttons */

    /* Flex item properties for ALL labels (except header-option3) */
    flex-grow: 0; /* Labels should not grow to fill extra space */
    flex-shrink: 0; /* CRITICAL: These labels will resist shrinking.
    They will try to maintain their full content width. */
    white-space: nowrap; /* Their text stays on one line (will be clipped by group's overflow:hidden if too wide) */

    /* Important: Remove overflow:hidden and text-overflow:ellipsis from here.
    We only want these for the specific "Tournament" button. */
}

.horizontal-radio-button-group input[type="radio"]:checked + label {
    /*text-decoration: underline;*/
    background-color: var(--top-button-checked-background-color);
    color: var(--top-button-checked-text-color);
}

.horizontal-radio-button-group input[type="radio"]:disabled + label {
    background-color: var(--top-button-disabled-background-color);
    color: var(--top-button-disabled-text-color);
    cursor: not-allowed;
    opacity: 0.7;
    box-shadow: none;
    pointer-events: none;
}

.horizontal-radio-button-group input[type="radio"]:disabled:checked + label {
    /* If a disabled option was checked on page load, this ensures its disabled style takes precedence */
    background-color: var(--top-button-disabled-background-color);
    color: var(--top-button-disabled-text-color);
    box-shadow: none;
}

/****************************************
 * ELLIPSIS SETUP FOR TOURNAMENT BUTTON *
 ****************************************/

/* --- SPECIFIC ELLIPSIS TARGET (Only for the "Tournament" button) --- */
label[for="header-option3"] {
    flex-shrink: 1; /* CRITICAL: This label IS allowed to shrink */
    min-width: 0; /* CRITICAL: Allows this label to shrink below its content size */

    /* Apply ellipsis properties directly to this specific label */
    white-space: nowrap; /* Force text on a single line within this label */
    overflow: hidden; /* Clip any text that overflows this label */
    text-overflow: ellipsis; /* Displays the "..." when clipped */
}

/* Ensure the div inside the specific label behaves correctly */
#radio-button-tournament-title {
    display: block; /* Ensure it behaves as a block-level element within the label */
    width: 100%; /* Takes the full width of its parent label (which is now clipped) */
    /* Remove explicit overflow/text-overflow from here, as the parent label handles it */
    white-space: inherit; /* Inherit from parent label */
    overflow: inherit; /* Inherit from parent label */
    text-overflow: inherit; /* Inherit from parent label */
}

#tournament-list-ul {
    max-width: 700px;
    list-style-type: none; /* Removes the bullet */
    padding: 0; /* Removes default browser padding on the ul */
    margin: 0; /* Removes default browser margin */
}

/* Base styling for the list item container */
.tournament-list-li {
    padding: 1rem 0; /* Add some vertical spacing */
    /* 6) A horizontal bar should separate each item */
    border-bottom: 1px solid #ccc; /* Light grey horizontal line */
}

/* Optional: Remove the border from the very last list item */
.tournament-list-li:last-child {
    border-bottom: none;
}

/* 2) Ensure the name is on its own line */
.tournament-list-name {
    /* This is a block-level element by default, so it will take the full width */
    font-weight: bold; /* Optional: make the name stand out */
    margin-bottom: 0.5rem; /* Add some space below the name */
}

/* Create a container for the second line to position
  the dates and city. We can do this by targeting the
  common parent, which is the .tournament-list-li
*/
.tournament-list-li {
    /* We will use Flexbox on a conceptual 'second line' by grouping
     the dates and city. A simple way is to make the li a flex container
     and wrap the second-line elements.
     A more direct way without changing HTML is to use Flexbox
     on the li and have the name take full width, then the next items
     can be on the next 'line'.
    */
    display: flex;
    flex-wrap: wrap; /* Allows items to wrap to the next line */
    justify-content: space-between; /* Key for alignment */
    align-items: center; /* Vertically aligns items in each row */
}

/* Force the name to take the full width of the first line */
.tournament-list-name {
    width: 100%;
}

/* 3) Dates should be on the second line, left-aligned */
.tournament-list-dates {
    /* Since its parent (.tournament-list-li) uses justify-content: space-between,
     and this is the first item on the second line, it will naturally
     align to the left. */
    flex-grow: 1; /* Allows it to take up available space */
}

/* 4) City should be on the second line, right-aligned */
.tournament-list-city {
    /* This will be pushed to the right by the space-between on the parent */
    text-align: right; /* Aligns the text content to the right */
}

/* 5) Ignore tournament-list-venue */
.tournament-list-venue {
    display: none;
}

/*******************
 * BRACKETRY SETUP *
 *******************/

span.match-player-final-position {
    margin-left: 0.5rem;
    font-size: 75%;
    color: var(--match-player-final-position-text-color);
}

div.round-container {
    width: 100%;
}

div.round-title {
}

div.round-note {
    text-align: center;
    font-size: 70%;
    color: var(--match-round-note-text-color);
}

span.superscript {
    font-size: 70%;
    color: var(--match-superscript-text-color);
    vertical-align: super;
    margin-right: 0.3rem;
}

/************************
 * POSITIONS-LIST SETUP *
 ************************/

div#positions-list-container-control {
}

div#positions-list-inner-container {
    display: flex;
    justify-content: center;
}

div#positions-list {
    max-width: 700px;
    width: 100%;
}

div.positions-list-match-container .bracket-root {
    min-width: 300px;
    min-height: 90px;
}

div.positions-list-match-container {
    display: flex;
    justify-content: center;
    padding-top: 10px;
    padding-bottom: 10px;
}

#positions-list summary {
    display: flex;
    align-items: center;
    padding: 10px;
    background-color: var(--positions-list-background-color);
    list-style: none;
    cursor: pointer;
    width: 100%;
}

#positions-list summary::-webkit-details-marker {
    display: none;
}

#positions-list summary::before {
    content: "\25BA"; /* ► */
    margin-right: 0.5rem; /* Space between arrow and content */
    font-size: 0.8em;
    transition: transform 0.2s;
}

#positions-list details[open] > summary::before {
    transform: rotate(90deg);
}

#positions-list .positions-list-name {
    width: 55%;
    text-align: center;
    padding: 0 5px;
}

#positions-list .positions-list-rating {
    width: 20%;
    text-align: center;
    padding: 0 5px;
}

#positions-list .positions-list-text {
    width: 25%;
    text-align: center;
    padding: 0 5px;
}

/* Optional: Style for when the details is open */
#positions-list details[open] > summary {
    background-color: var(--positions-list-open-background-color);
    border-bottom: none; /* Remove separator above the open content */
}

/***********************
 * ENTRANTS LIST SETUP *
 **********************/

div#entrants-message {
    color: var(--text-color);
    text-align: center;
}

div#entrants-entries {
    padding: 10px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

div#entrants-entry {
    width: 100%;
    display: flex;
    padding: 10px;
    justify-content: center;
}

span.entrants-entry-number {
    width: 10%;
    display: inline-block;
    text-align: center;
}

span.entrants-entry-name {
    width: 80%;
    display: inline-block;
    text-align: center;
}

span.entrants-entry-rating {
    width: 10%;
    display: inline-block;
    text-align: center;
}

/******************
 * LIGHTBOX SETUP *
 ******************/

div.ginlined-content {
    background-color: var(--lightbox-background-color);
}

button.glightbox-button-hidden {
    display: none !important;
}

div#lightbox-disclaimer-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

div#lightbox-disclaimer {
    color: var(--lightbox-text-color);
    text-align: center;
}

div#lightbox-settings {
    color: var(--lightbox-text-color);
    height: 100%;
    width: 100%;
}

div#settings-checkboxes label {
    float: left;
}

div#settings-checkboxes ul {
    margin: 0;
    list-style: none;
    float: left;
    padding-inline-start: 0px;
}

div#settings-footer {
    padding: 80px;
    text-align: center;
}

button#settings-save-button {
    border: 1px solid var(--save-button-border);
    padding: 8px;
    cursor: pointer;
    background-color: var(--save-button-background-color);
    color: var(--save-button-text-color);
}

div#lightbox-match-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
}

div#lightbox-match-info div#match-section {
    width: 100%;
    text-align: center;
}

div#lightbox-match-info div#match-section div#match-name {
    font-size: 175%;
    padding: 5px;
}

div#lightbox-match-info div#previous-match-section {
    text-align: center;
    padding: 15px;
    display: flex;
    justify-content: center;
}

div#lightbox-match-info div#previous-match-section div#previous-match-text-and-data-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

div#lightbox-match-info div#previous-match-section .bracket-root {
    min-width: 250px;
    min-height: 90px;
}

div#lightbox-match-info div#player-section {
    display: flex;
    width: 100%;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 10px;
}

div#lightbox-match-info div.player-section-row {
    flex: 1;
    text-align: center;
    display: flex;
    width: 100%;
    justify-content: center;
    align-items: center;
}

div#lightbox-match-info div.player-section-row span {
    flex: 1;
}

div#lightbox-match-info div.player-section-row span#left-player-name,
div#lightbox-match-info div.player-section-row span#right-player-name {
    font-size: 150%;
}

div#lightbox-match-info div#current-match-section {
    text-align: center;
    padding: 15px;
    display: flex;
    justify-content: center;
}

div#lightbox-match-info div#current-match-section .bracket-root {
    min-width: 250px;
    min-height: 90px;
}
