/* ==========================================================================
   Tables
   ========================================================================== */

.tb-table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    box-shadow: var(--box-shadow);
    border-radius: 8px;
    overflow: hidden;
    font-size: 12px;
}

.tb-table th {
    background-color: var(--primary-color);
    color: white;
    padding: 12px 8px;
    text-align: left;
    font-weight: 600;
    position: relative;
    cursor: pointer;
    user-select: none;
    text-shadow: var(--team-text-shadow);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.tb-table th:hover {
    /* Remove the hover effect */
}

.tb-table th[data-type="number"] {
    text-align: right;
}

/* Non-sortable columns */
.tb-table th[data-sortable="false"] {
    cursor: default;
}

.tb-table th[data-sortable="false"]::after {
    display: none;
}

.tb-table td {
    padding: 8px;
    border-bottom: 1px solid #e0e0e0;
}

.tb-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.tb-table tr:hover {
    background-color: #e9f5ff;
}

.tb-table .numeric-cell {
    text-align: right;
}

/* Rank column styling */
.tb-table .rank-column {
    text-align: right;
}

.tb-table .rank-cell {
    text-align: right;
    color: #7f8c8d;
    font-weight: bold;
}

.tb-table .team-total {
    font-weight: bold;
    background-color: #f5f5f5;
    border-top: 2px solid #ddd;
}

.tb-table .team-total td:nth-child(2) {
    font-size: 1.1em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tb-table .team-total td:nth-child(n+3) {
    color: #2c5282;
}

/* Sorting indicators */
.tb-table th::after {
    content: '';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 8px solid rgba(255, 255, 255, 0.3);
}

.tb-table th.sorted-asc::after {
    border-bottom: 8px solid white;
}

.tb-table th.sorted-desc::after {
    border-bottom: none;
    border-top: 8px solid white;
}

/* Rotated headers for compact tables */
.rotated-headers thead th {
    height: 140px;
    white-space: nowrap;
    vertical-align: bottom;
    padding: 0;
    text-align: left;
}

.rotated-headers thead th > div {
    width: 100%;
    height: 100%;
    position: relative;
}

.rotated-headers thead th > div > span {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: rotate(-90deg);
    transform-origin: left bottom;
    white-space: nowrap;
}
