/* ========================== */
/*         GENERAL            */
/* ========================== */

body {
    font-family: Arial, sans-serif;
    margin: 10px;
    background-color: #D2B48C;
    color: black;
}

.container {
    max-width: 90%;
    margin: 0 auto;
    padding: 5px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* ========================== */
/*         TABLE STYLES       */
/* ========================== */

.table-container {
    overflow-x: auto;
    max-width: 100%;
}

table {
    width: auto;
    margin: 0 auto;
    border-collapse: collapse;
    white-space: nowrap;
}

th, td {
    padding: 4px 6px;
    font-size: 13px;
    border: 1px solid #A67B5B;
    text-align: center;
}

th {
    padding: 6px;
    font-size: 14px;
    background-color: #A67B5B;
    color: black;
    cursor: pointer;
    position: sticky;
    top: 0;
}

th:hover {
    background-color: #8B5A2B;
}

tr.highlight {
    background-color: yellow !important;
    font-weight: bold;
}

tr:nth-child(even) { background-color: #F0E4D7; }
tr:nth-child(odd) { background-color: #E6D2BA; }

/* Positive & Negative Formatting */
.positive { color: green; font-weight: bold; }
.negative { color: red; font-weight: bold; }
.red {color: red;font-weight: bold; }

/* ========================== */
/*  Set minimum width for Player column  */
/* ========================== */
th:nth-child(5), td:nth-child(5) {
    min-width: 150px; /* Adjust width as needed */
    max-width: 250px; /* Optional: prevents excessive stretching */
    overflow: hidden;
    text-overflow: ellipsis; /* Ensures text doesn't overflow */
    white-space: nowrap;
}

/* ========================== */
/*       CONTROL SECTIONS     */
/* ========================== */

/* Main controls container */
.controls-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    margin-bottom: 10px;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    gap: 330px;
}

/* Ratings + Search group (Align Left) */
.controls-section.ratings-search {
    display: flex;
    align-items: center;
    gap: 5px;
    flex: 1;
    justify-content: flex-start;
}

/* Adds space ONLY after the last Ratings button */
.ratings-spacer {
    width: 160px; /* Adjust to control space between Ratings and Search */
    flex-shrink: 0; /* Prevents it from collapsing */
}

/* Export Buttons (Align Right) */
.controls-section.export-buttons {
    display: flex;
    align-items: center;
    gap: 5px;
    flex: 1;
    justify-content: flex-end;
}

/* Search Bar */
#search {
    width: 200px;
    max-width: 100%;
    text-align: center;
    padding: 5px;
    font-size: 12px;
}

/* ========================== */
/*          BUTTONS           */
/* ========================== */

.ctrl-btn {
    padding: 5px 10px;
    font-size: 13px;
    background-color: #28a745;
    color: white;
    border: none;
    cursor: pointer;
    height: 30px;
    min-width: 50px;
    text-align: center;
    white-space: nowrap;
}

.ctrl-btn:hover {
    background-color: #218838;
}

/* Highlight the active button */
.ctrl-btn.active-btn {
    background-color: #1e7e34;
    font-weight: bold;
    border: 2px solid #155724;
}

/* Filter Buttons */
.filter-btn {
    font-size: 13px;
    background: none;
    border: none;
    cursor: pointer;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    width: 100%;
    flex-wrap: wrap;
}

.pagination button {
    padding: 4px 8px;
    border: none;
    background-color: #A67B5B;
    color: black;
    cursor: pointer;
    font-size: 13px;
}

.pagination button:hover { background-color: #8B5A2B; }
.pagination button:disabled { background-color: #ccc; cursor: not-allowed; }

/* Rows Per Page */
.rows-per-page-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 15px;
}

#rowsPerPageSelect {
    padding: 5px;
    font-size: 14px;
    cursor: pointer;
}

/* ========================== */
/*         TOOLTIPS           */
/* ========================== */

/* Ensure tooltips appear correctly on inputs */
.tooltip-btn,
.tooltip-btn[type="text"] {
    position: relative;
}

/* Tooltip styling */
.tooltip-btn::after {
    content: attr(data-tooltip);
    visibility: hidden;
    width: 220px;
    background-color: #fff;
    color: black;
    text-align: left;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid black;
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.2);
    font-size: 13px;
    line-height: 1.4;
    white-space: normal;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    pointer-events: none;
    z-index: 1000;
}

/* Show tooltip on hover (for buttons) */
.tooltip-btn:hover::after {
    visibility: visible;
    opacity: 1;
}

/* Show tooltip when input is focused */
.tooltip-btn:focus::after {
    visibility: visible;
    opacity: 1;
}

/* ========================== */
/*       RESPONSIVENESS       */
/* ========================== */

@media screen and (max-width: 768px) {
    table { font-size: 12px; }
    th, td { padding: 5px; white-space: nowrap; }

    .controls-container {
        flex-direction: column;
        align-items: center;
        gap: 10px;
        width: 100%;
    }

    .controls-section {
        width: 100%;
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
    }

    .ctrl-btn, .filter-btn {
        width: 45%;
        max-width: 250px;
        margin: 5px;
    }

    .search-container input {
        width: 90%;
        max-width: 300px;
        margin-top: 5px;
    }

    .table-container {
        overflow-x: auto;
        width: 100%;
    }

    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .filter-btn {
        font-size: 15px;
        padding: 5px 5px;
        min-width: 5px;
    }
}

/* ========================== */
/*        MISC STYLES         */
/* ========================== */

h2, p {
    margin: 5px 0;
    text-align: center;
}

.filter-menu {
    position: absolute;
    display: none;
    background: white;
    border: 1px solid #A67B5B;
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.2);
    padding: 8px;
    z-index: 1000;
}

.filter-menu input {
    width: 100%;
    padding: 4px;
    margin-bottom: 4px;
    border: 1px solid #A67B5B;
}

/* Highlight active filter buttons */
.filter-btn.active-filter {
    background-color: #FFD700;
    font-weight: bold;
    border: 2px solid #DAA520;
}

.trophy {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 1px;
    vertical-align: middle;
    margin-bottom: 3px; /* Nudges it up */
}

.gold-trophy {
    content: url('images/gold_trophy.png');
}

.silver-trophy {
    content: url('images/silver_trophy.png');
}

.bronze-trophy {
    content: url('images/bronze_trophy.png');
}

.fourth-place-ribbon {
    content: url('images/fourth_place.png');
}

.sf-icon {
    content: url('images/semi_finalist.png');
}

.player-link {
    color: inherit; /* Matches the table text color */
    text-decoration: none; /* Removes underline */
    font-weight: bold; /* Optional: Make it bold */
}

.player-link:hover {
    text-decoration: underline; /* Adds underline on hover */
    color: #8B5A2B; /* Optional: Make it stand out a bit */
}

.yt-icon {
    width: 14px;
    height: 14px;
    vertical-align: middle;
    margin-left: 1px;
    margin-bottom: 2px; /* Nudges it up */
}
