/* Sticky Team column - header */
table th:first-child {
    width: 200px;
    white-space: nowrap;
    text-align: center;
    position: sticky;
    left: 0;
    z-index: 1;
    background-color: #0d83d1;
}

/* Sticky Team column - body */
table tbody td:first-child {
    width: 200px;
    white-space: nowrap;
    text-align: center;
    position: sticky;
    left: 0;
    z-index: 1;
    background-color: #f1f1f1;
}

/* General table styling */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    font-size: 16px;
    text-align: center;
    table-layout: fixed;
}

th, td {
    padding: 10px;
    border: 1px solid #ddd;
    word-wrap: break-word;
    text-align: center;
    vertical-align: middle;
}

th {
    background-color: #0d83d1;
    color: white;
    text-align: center;
    vertical-align: middle;
    white-space: normal;
}

/* Non-Team columns */
th:not(:first-child), td:not(:first-child) {
    min-width: 75px;
    text-align: center;
    vertical-align: middle;
}

/* Main data tables */
#fullSeasonTable, #weeklyTable, #positionTable, #weeklypositionTable {
    width: 100%;
    table-layout: auto;
}

/* Smaller tables */
#survivorTable {
    width: 50%;
    table-layout: auto;
}

#constructionTable, #userLeagueTable {
    width: 70%;
    table-layout: auto;
}

/* User league table sticky column */
#userLeagueTable th:first-child {
    width: 250px;
    text-align: center;
    position: sticky;
    left: 0;
    z-index: 1;
    background-color: #0d83d1;
}

#userLeagueTable td:first-child {
    width: 250px;
    white-space: normal;
    word-wrap: break-word;
    text-align: center;
    position: sticky;
    left: 0;
    z-index: 1;
    background-color: #f1f1f1;
}

/* Row hover */
table tr:hover {
    background-color: #f1f1f1;
}

/* Sortable tables */
.sortable th {
    cursor: pointer;
}

table.dataTable th {
    padding-right: 0px;
    white-space: normal;
}

th.sorting, th.sorting_asc, th.sorting_desc {
    white-space: normal;
}

/* Table header font consistency */
#weeklyTable th, #fullSeasonTable th, #positionTable th, #weeklypositionTable th {
    font-size: 1em;
    padding: 10px;
}

/* Survivor table styles */
#survivorTable tr.eliminated {
    background-color: #f8d7da;
}

#survivorTable tr.winner {
    background-color: #d4edda;
}

/* Section border for position table group separators */
.section-border {
    border-left: 3px solid #0d83d1 !important;
}

/* Week button container */
.week-select-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    flex-direction: column;
}

.spinner-border {
    width: 3rem;
    height: 3rem;
    margin-bottom: 20px;
}

.loading-text {
    color: #fff;
    font-size: 1.2rem;
    font-weight: bold;
}

/* Tooltip */
.tooltip-copied {
    background-color: #333;
    color: #fff;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 14px;
    z-index: 9999;
    white-space: nowrap;
    display: inline-block;
    position: absolute;
    opacity: 1;
    transition: opacity 0.5s ease-in-out;
    pointer-events: none;
}

/* --- Mobile Responsive --- */

@media (max-width: 768px) {
    table {
        font-size: 13px;
    }

    th, td {
        padding: 6px;
    }

    table th:first-child,
    table tbody td:first-child {
        width: 120px;
    }

    th:not(:first-child), td:not(:first-child) {
        min-width: 60px;
    }

    #survivorTable,
    #constructionTable {
        width: 100%;
    }

    #seasonToggle {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    table {
        font-size: 12px;
    }

    th, td {
        padding: 4px;
    }

    table th:first-child,
    table tbody td:first-child {
        width: 100px;
    }
}
