/* Table Styles */
table {
    width: 90%;             /* fill parent, but not wider */
    max-width: 90%;      
    margin: 10px auto;   /* never exceed parent width */
    border-collapse: collapse;
    background-color: black;
    color: white;
    border: 2px solid maroon;
    table-layout: auto;      /* allow natural shrink */
    font-size: clamp(10px, 3.5vw, 18px);
}
.player-info-table{
    font-size: clamp(14px, 10vw, 28px);
} 

#metaHeader{
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 85%;
    margin-left: auto;
    margin-right: auto;
    padding-top: 20px;
}
#filterSection {
    padding-top: 10px;
}
th, td {
    padding: 10px;
    text-align: center;
    border: 1px solid maroon;
    white-space: nowrap;     /* no wrapping */
    overflow: hidden;
    text-overflow: ellipsis;
}
td {
    white-space: nowrap;

}
th {
    background-color: maroon;
    cursor: pointer;
}

/* Body Styles */
body {
    background-color: black;
    color: white;
    font-family: Arial, sans-serif;
    text-align: center;
    min-width: 378px;
}

/* Filters Section */
.filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    height: 71px;
    /* padding: 15px; */
}

.filter-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: maroon;
    padding-top: 10px;
    padding-bottom: 10px;

    border-radius: 8px;
}
h1 {
    /* background-color: maroon; */
    color: white;
    padding: 10px;
    border-radius: 8px;
    width: fit-content;
    margin: 0 auto;
    font-size: 75px;
}
input[type="text"] {
    width: 100px; /* Adjusted for first name (9 chars) */
    padding: 5px;
    margin: 5px;
    border: none;
    border-radius: 5px;
    text-align: center;
    background-color: black;
    color: white;
    border: 1px solid maroon;
}
input[type="text"], .search-input {
    width: 100px;
    padding: 5px;
    margin-top: 5px;
    border: none;
    border-radius: 5px;
    text-align: center;
    background-color: black;
    color: white;
    border: 1px solid maroon;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 5px;
}

.slider {
    width: 70px;
}

.slider-values {
    font-size: 14px;
}
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: maroon;
    padding: 10px;
}
.nav-links {
    display: flex;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-links li {
    padding: 5px 10px;
}

.nav-links a {
    text-decoration: none;
    color: white;
    font-size: 16px;
    padding: 5px 10px;
    border-radius: 5px;
    transition: background-color 0.3s ease;
}

.nav-links a:hover {
    background-color: darkred;
    color: lightsalmon; 
}

/* Hamburger Menu */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
}

.hamburger .line {
    width: 30px;
    height: 3px;
    background-color: white;
}

#categorySelector{
    /* width: 150px; */
    height: 40px;
    border: none;
    border-radius: 5px;  
    text-align: center;
    color: white;
    /* border: 2px solid maroon; */
    background-color: maroon; 
    font-size: 30px;
    /* margin-bottom: 31px; */
    
}

/* #toggleFilterButton{
    height: auto;
    margin-bottom: 31px;
} */
#genderFilter, .num-input {
    width: 60px; /* Narrower for gender select */
    padding: 5px;
    margin-top: 5px;
    border: none;
    border-radius: 5px;
    text-align: center;
    background-color: black;
    color: white;
    border: 1px solid maroon;
}


.num-input {
    width: 50px;
}

.search-input {
    width: 75px; /* Adjusted for first name (9 chars) */
    padding: 5px;
    border: none;
    border-radius: 5px;
    background-color: black;
    color: white;
    border: 1px solid maroon;
}
input[type="text"]#clubFilter {
    width: 75px; /* Adjusted for club (9 chars) */
    padding: 5px;
    margin-top: 5px;
    border: none;
    border-radius: 5px;
    text-align: center;
    background-color: black;
    color: white;
    border: 1px solid maroon;
}
/* Suggestion Box Styles */
.suggestion-box {
    position: absolute;
    width: 200px;
    background-color: black;
    color: white;
    border: 1px solid maroon;
    border-radius: 5px;
    max-height: 150px;
    overflow-y: auto;
    display: none;
}

.suggestion-item {
    padding: 5px;
    cursor: pointer;
}

.suggestion-item:hover {
    background-color: maroon;
}

@media (max-width: 768px) {
    table {
        width: 95%;
    }
    #metaHeader{
        width: 95%;
    }
    .filters {
        flex-direction: column;
        gap: 10px;
        height: auto;
    }

    .filter-container {
        width: 100%;
    }

    .slider, .slider-container, input[type="text"], .num-input, select {
        width: 90%;
    }

    .slider-container {
        flex-direction: column;
    }

    .nav-links {
        display: none;
        flex-direction: column;
        width: 100%;
        position: absolute;
        top: 56px;
        left: 0;
    }

    .nav-links.active {
        display: flex;
        justify-content: space-between;
        align-items: center;
        background-color: black;
    }

    .hamburger {
        display: flex;
    }

    .mobile-hidden-col {
        display: none;
    }
    /* Nested overrides for very small screens */
    @media (max-width: 480px) {
        table {
            width: 100%;
        }
        #metaHeader {
            width: 100%;
        }

        td, th {
            padding: 4px;
        }


        .filters {
            gap: 5px;
        }

        .slider, .slider-container, input[type="text"], .num-input, select {
            width: 90%;
        }

        .slider {
            width: 100%;
        }

        .slider-container {
            flex-direction: column;
        }

        .num-input {
            width: 70px;
        }

        .search-input {
            width: 100%;
        }

        .suggestion-box {
            width: 100%;
        }

        h1 {
            font-size: 35px;
        }
    }
}



.nav-links.active li {
    text-align: center;
    background-color: maroon;
    padding: 10px;
    width: 80%;
}
.nav-links.active a {
    padding: 10px;
    width: 100%;
    text-align: center;
}
.suggestion-container {
    position: relative;
    display: inline-block;
}


.wide-filter-select{
    width: 100px; 
    padding: 5px;
    margin: 5px;
    border: none;
    border-radius: 5px;
    text-align: center;
    background-color: black;
    color: white;
    border: 1px solid maroon;
}
button{
    background-color: maroon;
    color: white;
    padding: 10px 20px;
    border: 1px solid maroon;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    /* margin: 15px auto;
    display: block; */
}


button:hover {
    background-color: darkred;
}
.player-link {
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: color 0.2s ease;
}

.player-link:hover {
    color: maroon;
}
.player-club {
    color: white;
    margin: 0 0 10px 0;
    font-size: clamp(18px, 3vw, 32px); /* smaller, dynamic */
}

.player-rating {
    color: white;
    margin: 0 0 18px 0;
    font-size: clamp(30px, 5vw, 48px); /* larger, dynamic */
}
#header-title {
    display: block;
    text-align: center;
    margin: 0;
    padding: 0;

    max-width: 80%;
    white-space: normal; /* allow wrapping */
    /* word-break: break-word; */
    
    line-height: 1.1;
    font-size: clamp(27px, 5vw, 75px); /* dynamic font size */
}
.match-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 80%;
    margin: 0 auto 20px auto;
    padding-top: 10px;
    /* position: relative; */
}

.match-history-title {
    margin: 0;
    text-align: center;
    flex: 1;
}


.match-history-title {
    margin: 0;
    text-align: left;
    flex: 0;
    white-space: nowrap;
}


/* Score column styling */
.small-column {
    width: clamp(20px, 7vw, 35px);
    text-align: center;
    /* font-size: 0.9em; */
}



.site-footer {
    background-color: #f2f2f2;
    padding: 20px 0;
    font-size: 0.9em;
    color: #333;
    text-align: center;
    border-top: 1px solid #ddd;
    margin-top: 40px;
}

.footer-content {
    width: 90%;
    max-width: 1000px;
    margin: 0 auto;
}

.footer-links {
    margin-top: 10px;
}

.footer-links a {
    margin: 0 10px;
    text-decoration: none;
    color: #333;
}

.footer-links a:hover {
    text-decoration: underline;
}

/* Draw Page */
/* Groups Layout */
.groups-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
    margin: 30px auto;
    width: 90%;
    max-width: 1200px;
}

/* Group Card */
.group-card {
    border: 2px solid maroon;
    border-radius: 8px;
    background-color: black;
    
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}


.group-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(128, 0, 0, 0.5);
}

.group-card h2 {
    margin-block-start: 0;
    margin-block-end: 0;
    color: maroon;
    font-size: clamp(20px, 3vw, 28px);
    padding: 10px;
    background-color: maroon; /* header background */
    color: white;             /* header text */
}
/* Player List inside Groups */
.player-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.player-list li {
    padding: 6px 0;
    border-bottom: 1px solid maroon;
    font-size: clamp(14px, 2.5vw, 20px);
}

.player-list li:last-child {
    border-bottom: none;
}

/* Responsive Tweaks */

#viewToggles {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 20px;
}

/* Knockout Styling */
/* Make font smaller */
.match, .player {
  font-size: 12px; /* set all text to 12px */
}

#bracket-wrapper {
    width: 100%; 
    overflow-x: auto; 
    overflow-y: hidden;
    position: relative;
}
.bracket {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  padding-top: 20px;
  padding-bottom: 20px;
  gap: 25px; /* space between columns */
}

.round {
  display: flex;
  flex-direction: column;
  position: relative;
  gap: var(--match-gap, 10px); /* default gap = 10px */
}
.round.right {
  display: flex;
  flex-direction: column-reverse; /* reverse vertical stacking */
}

.match {
  border: 2px solid maroon;
  /* border-radius: 6px; */
  padding: 6px 12px;
  text-align: left;
  /* width: 195px; */
  width: 155px;

  position: relative;
}

.player {
  display: flex;
  width: 100%; /* full width of the match container */

  justify-content: space-between;
  margin: 2px 0;
}

.player-divider {
  height: 1px;
  background-color: maroon; /* or any colour you prefer */
  margin: 0px 0;           /* spacing above and below line */
}

.score {
  margin-left: 10px;
  color: #aaa;
}
#stage-header {
  display: flex;
  justify-content: flex-start; /* align with bracket columns */
  margin-bottom: 5px;
  margin-left:12.5px;
}

.stage-box {
  /* min-width: 223px; */
  min-width: 183px;
  height: 40px;           /* same height as a match */
  border: 1px solid maroon;
  background-color: maroon;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 25px;     /* match the gap between rounds */
  font-weight: bold;
  font-size: 1em;
  box-sizing: border-box;
}

svg {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  width: 100%;
  height: 100%;
  overflow: visible;
 pointer-events: none;
}


/*  TOurnaments Papge */

#events-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;               /* space between buttons */
  padding: 20px;
  max-width: 900px;
  margin: 0 auto;          /* centre the container */
}
.event-section {
  display: flex;
  flex-direction: column;
  align-items: center; /* centres everything */
  text-align: center;
  margin-top: 30px;
}
.event-description {
  max-width: 900px;
  text-align: center;
  background-color: black;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.event-description h2 {
  margin-bottom: 10px;
  color: #800000;
}

.event-description a {
  color: #800000;
  text-decoration: none;
  font-weight: 500;
}

.event-description a:hover {
  text-decoration: underline;
}
.player-club-groups {
    display: block;      /* forces a new line */
    font-size: 0.9em;    /* optional: slightly smaller */
    color: maroon;       /* keep your colour */
    /* margin-left: 10px;   optional: indent under the name */
}

#events-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

/* Force 2 rows on mobile */
@media (max-width: 768px) {
    #events-container .event {
        flex: 1 1 calc(50% - 12px); /* half width minus gap */
        max-width: 45%;             /* ensures two per row */
    }
}
