/* ver: 23 */
/* ========== AI LEADERBOARD STYLES ========== */      
/* Dataconomy-themed styles for AI Model Leaderboard */

/* === FULL VIEWPORT WIDTH: break out of DC .container === */
.ai-leaderboard-container {
    position: relative;
    z-index: 1;
    width: 100vw !important;
    max-width: 100vw !important;
    margin-left: calc(-50vw + 50%) !important;
    padding: 20px 30px;
    box-sizing: border-box;
}

.leaderboard-header {
    text-align: center;
    margin-bottom: 30px;
}

.leaderboard-header h1 {
    font-size: 2.5em;
    font-weight: 700;
    color: #000;  /* Changed to black */
    margin-bottom: 10px;
}

.leaderboard-header p {
    color: #555;
    margin: 5px 0;
    font-size: 0.92em;
    line-height: 1.6;
}

.attribution {
    font-size: 0.9em;
    font-style: italic;
}

.attribution a {
    color: #0073aa;
    text-decoration: none;
    font-weight: 500;
}

.attribution a:hover {
    text-decoration: underline;
}

/* Tabs - DC themed */
.leaderboard-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 25px;
    background: #f5f9fc;
    padding: 12px 20px;
    border-radius: 8px;
    justify-content: center;
}

.tab-btn {
    padding: 8px 16px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    color: #333;
    transition: all 0.3s;
}

.tab-btn:hover {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

.tab-btn.active {
    background: #0073aa;
    color: white;
    border-color: #0073aa;
    font-weight: 600;
}

/* Column Groups - DC themed */
.column-groups {
    margin-bottom: 20px;
    padding: 12px 20px;
    background: #f5f9fc;
    border-radius: 8px;
    text-align: center;
}

.column-groups label {
    margin-right: 20px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    color: #333;
}

.column-groups input[type="checkbox"] {
    margin-right: 5px;
    cursor: pointer;
}

/* Inline Header Filters */
.th-filter-wrap {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.filter-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    cursor: pointer;
    opacity: 0.4;
    transition: opacity 0.2s;
    flex-shrink: 0;
    vertical-align: middle;
}

.filter-icon:hover {
    opacity: 1;
}

.filter-icon.active {
    opacity: 1;
}

.filter-icon svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

.filter-icon.active svg {
    fill: #4fc3f7;
}

/* Filter Popover */
.filter-popover {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 10px;
    z-index: 1000;
    min-width: 180px;
    display: none;
}

.filter-popover.open {
    display: block;
}

.filter-popover-row {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-bottom: 8px;
}

.filter-popover select {
    padding: 4px 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.85em;
    background: #fff;
    color: #333;
}

.filter-popover input[type="number"] {
    width: 80px;
    padding: 4px 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.85em;
    color: #333;
}

.filter-popover-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

.filter-popover .apply-btn {
    padding: 4px 10px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8em;
    font-weight: 600;
}

.filter-popover .apply-btn:hover {
    background: #005a87;
}

.filter-popover .clear-btn {
    padding: 4px 10px;
    background: #eee;
    color: #333;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8em;
}

.filter-popover .clear-btn:hover {
    background: #ddd;
}

/* Active Filters Bar */
.active-filters-bar {
    padding: 8px 20px;
    background: #e8f4fd;
    border-radius: 6px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 15px;
}

.active-filters-label {
    font-weight: 600;
    color: #333;
}

.active-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: #0073aa;
    color: #fff;
    border-radius: 4px;
    font-size: 15px;
}

.active-filter-tag .remove-filter {
    cursor: pointer;
    font-weight: bold;
    margin-left: 4px;
    opacity: 0.8;
}

.active-filter-tag .remove-filter:hover {
    opacity: 1;
}

.clear-all-btn {
    padding: 3px 10px;
    background: transparent;
    color: #d9534f;
    border: 1px solid #d9534f;
    border-radius: 4px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
}

.clear-all-btn:hover {
    background: #d9534f;
    color: #fff;
}

/* Make th position relative for popover */
.leaderboard-table thead th {
    position: relative;
}

/* Loading/Error States */
.loading-state, .error-state {
    text-align: center;
    padding: 40px;
    font-size: 1.1em;
    color: #666;
}

.error-state {
    color: #d9534f;
    background: #fef5f5;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
}

/* Table Container */
#tableContainer {
    overflow-x: auto;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    position: relative;
}

/* Table Styles - DC themed */
.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.leaderboard-table thead th {
    background: #333;
    color: white;
    padding: 14px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 15px;
    /* sticky removed — JS clone handles it; CSS sticky breaks with overflow-x:auto */
    z-index: 100;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    border-right: 1px solid #555;
}

.leaderboard-table thead th:last-child {
    border-right: none;
}

.leaderboard-table thead th:hover {
    background: #0073aa;
}

.leaderboard-table thead th.sortable::after {
    content: ' ↕';
    opacity: 0.3;
}

.leaderboard-table thead th.sorted-asc::after {
    content: ' ↑';
    opacity: 1;
}

.leaderboard-table thead th.sorted-desc::after {
    content: ' ↓';
    opacity: 1;
}

.leaderboard-table tbody tr {
    border-bottom: 1px solid #eee;
    transition: background 0.2s;
}

.leaderboard-table tbody tr:hover {
    background: #f5f9fc;
}

.leaderboard-table tbody td {
    padding: 12px;
    font-size: 15px;
    color: #000;  /* Changed to black */
}

.leaderboard-table tbody td.number {
    text-align: right;
    font-family: 'Open Sans', Helvetica, Arial, sans-serif;
    font-weight: 500;
}

/* Model Name Column - No wrap, wider */
.leaderboard-table tbody td:first-child,
.leaderboard-table thead th:first-child {
    white-space: nowrap;
    min-width: 250px;
    max-width: 350px;
}

/* Column Group Headers */
.group-header {
    background: #0073aa !important;
    text-align: center;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: white !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .ai-leaderboard-container {
    position: relative;
    z-index: 1;
        padding: 10px 0;
    }
    
    .leaderboard-header h1 {
        font-size: 1.8em;
    }
    
    .leaderboard-tabs {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 5px;
        justify-content: center;
    }
    
    .tab-btn {
        width: auto;
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .column-groups {
        padding: 10px 15px;
    }
    
    .column-groups label {
        display: inline-flex;
        align-items: center;
        margin: 4px 8px;
        font-size: 13px;
        white-space: nowrap;
    }
    
    .leaderboard-table {
        font-size: 1em;
    }
    
    .leaderboard-table thead th,
    .leaderboard-table tbody td {
        padding: 8px 6px;
    }
    
    .leaderboard-table tbody td:first-child,
    .leaderboard-table thead th:first-child {
        min-width: 120px;
        max-width: 160px;
        white-space: normal !important;
        word-break: break-word;
    }
}

@media (max-width: 480px) {
    .leaderboard-header h1 {
        font-size: 1.5em;
    }
    
    .leaderboard-table thead th,
    .leaderboard-table tbody td {
        padding: 6px 4px;
        font-size: 1em;
    }
    
    .leaderboard-table tbody td:first-child,
    .leaderboard-table thead th:first-child {
        min-width: 100px;
        max-width: 130px;
        white-space: normal !important;
        word-break: break-word;
    }
}


/* Alignment: model name left, all other columns center */
.leaderboard-table thead th {
    text-align: center;
}
.leaderboard-table tbody td {
    text-align: center;
}
.leaderboard-table thead th:first-child {
    text-align: left;
}
.leaderboard-table tbody td:first-child {
    text-align: left;
}



/* Media tables (non-LLM): auto-width columns, no stretch */
.media-table-wrap .leaderboard-table {
    width: auto;
}
.media-table-wrap .leaderboard-table th,
.media-table-wrap .leaderboard-table td {
    width: auto;
    white-space: nowrap;
    padding-left: 20px;
    padding-right: 20px;
}



/* FORCE correct text colors */
.ai-leaderboard-container .leaderboard-table tbody td,
.ai-leaderboard-container .leaderboard-table tbody td.number,
#tableContainer table td {
    color: #000 !important;
}
.ai-leaderboard-container .leaderboard-table thead th,
#tableContainer table th {
    color: #fff !important;
}



/* Media tables: rank column narrow, elo fills rest */
.media-table-wrap .leaderboard-table {
    width: 100%;
}
/* first-child in media = model name now (rank removed) */
.media-table-wrap .leaderboard-table th:first-child,
.media-table-wrap .leaderboard-table td:first-child {
    width: 280px;
    min-width: 200px;
    white-space: nowrap;
    text-align: left;
}
.media-table-wrap .leaderboard-table th:nth-child(2),
.media-table-wrap .leaderboard-table td:nth-child(2) {
    width: auto;
    white-space: nowrap;
}


/* === MEDIA-FIX: remove body row backgrounds, keep header only === */
.leaderboard-table tbody tr {
    background: #fff !important;
}
.leaderboard-table tbody tr:hover {
    background: #f5f9fc !important;
}
/* Media table last-col bar override removed */
.media-table-wrap .leaderboard-table th:last-child,
.media-table-wrap .leaderboard-table td:last-child {
    width: auto;
    background: transparent;
    color: #000 !important;
}
.media-table-wrap .leaderboard-table thead th:last-child {
    background: #333;
    color: #fff !important;
}


/* === FIX2: Media tables layout === */
/* Media table: no background on any body cells */
.media-table-wrap .leaderboard-table tbody td {
    background: transparent !important;
    color: #000 !important;
}
/* Media table: spacer column fills remaining width */
.media-table-wrap .leaderboard-table {
    width: 100%;
    table-layout: fixed;
}
/* col-rank removed from media tables */
.media-table-wrap .leaderboard-table th.col-name,
.media-table-wrap .leaderboard-table td.col-name {
    width: 280px;
    white-space: nowrap;
    text-align: left;
}
.media-table-wrap .leaderboard-table th.col-creator,
.media-table-wrap .leaderboard-table td.col-creator {
    width: 150px;
    white-space: nowrap;
}
.media-table-wrap .leaderboard-table th.col-elo,
.media-table-wrap .leaderboard-table td.col-elo {
    width: 280px;
}
.media-table-wrap .leaderboard-table th.col-ci95,
.media-table-wrap .leaderboard-table td.col-ci95 {
    width: 120px;
}
.media-table-wrap .leaderboard-table th.col-appearances,
.media-table-wrap .leaderboard-table td.col-appearances {
    width: 140px;
}
.media-table-wrap .leaderboard-table th.col-released,
.media-table-wrap .leaderboard-table td.col-released {
    width: 120px;
}
.media-table-wrap .leaderboard-table th.col-spacer,
.media-table-wrap .leaderboard-table td.col-spacer {
    width: auto;
    border: none;
}
.media-table-wrap .leaderboard-table thead th.col-spacer {
    background: #333;
}
.media-table-wrap .leaderboard-table tbody td.col-spacer {
    background: transparent !important;
}


/* === NUCLEAR: body cell text BLACK, header text WHITE === */
.leaderboard-table tbody td,
.leaderboard-table tbody td.number,
.leaderboard-table tbody td.col-rank,
.leaderboard-table tbody td.col-name,
.leaderboard-table tbody td.col-creator,
.leaderboard-table tbody td.col-elo,
.leaderboard-table tbody td.col-ci95,
.leaderboard-table tbody td.col-appearances,
.leaderboard-table tbody td.col-released,
.leaderboard-table tbody td.col-spacer,
table.leaderboard-table tbody td,
#tableContainer td,
#tableContainer .leaderboard-table td {
    color: #000 !important;
}
.leaderboard-table thead th,
table.leaderboard-table thead th,
#tableContainer th,
#tableContainer .leaderboard-table th {
    color: #fff !important;
}
/* Bold model names in all tabs */
.leaderboard-table td.col-name {
    font-weight: 700 !important;
}


/* === SEO TEXT: smaller font + read more === */
.leaderboard-seo-text p {
    font-size: 0.92em;
    line-height: 1.6;
    color: #555;
}

.seo-expandable {
    max-height: 0 !important;
    overflow: hidden !important;
    transition: max-height 0.4s ease, opacity 0.3s ease;
    opacity: 0;
}

.seo-expandable.expanded {
    max-height: 600px !important;
    overflow: visible !important;
    opacity: 1;
}



.seo-read-more {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    color: #0073aa;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 0;
    margin-top: 4px;
    transition: color 0.2s;
    letter-spacing: 0.02em;
}

.seo-read-more:hover {
    color: #005a87;
}

.seo-read-more .rm-arrow {
    transition: transform 0.3s ease;
}

.seo-read-more.expanded .rm-arrow {
    transform: rotate(180deg);
}

.seo-read-more.expanded .rm-text::after {
    content: '';
}



/* Hide old seo-collapsed class */
.seo-collapsed {
    display: none;
}


/* Sticky: group header row — handled by JS clone now */
/* CSS sticky removed: doesn't work with overflow-x:auto on #tableContainer */


/* JS-based sticky header clone */
.sticky-header-clone {
    position: fixed;
    top: var(--navbar-height, 60px);
    z-index: 999;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    pointer-events: none;
    display: none;
}
.sticky-header-clone table {
    margin: 0;
}
.sticky-header-clone th {
    pointer-events: auto;
}







/* === FROZEN FIRST COLUMN (Model Name) === */
.leaderboard-table thead th:first-child,
.leaderboard-table tbody td:first-child {
    position: sticky;
    left: 0;
    z-index: 50;
    background: #fff;
    border-right: 2px solid #ddd;
}
.leaderboard-table thead th:first-child {
    background: #333;
    z-index: 150;
    border-right: 2px solid #555;
}
.leaderboard-table tbody tr:hover td:first-child {
    background: #f5f9fc;
}

/* Sticky clone: also freeze first column */
.sticky-header-clone th:first-child {
    position: sticky;
    left: 0;
    z-index: 150;
    background: #333;
    border-right: 2px solid #555;
}


/* === v22: Model header blue, model name cells slight gray === */
.leaderboard-table thead th:first-child {
    background: #0073aa !important;
    z-index: 150;
    border-right: 2px solid #005a87;
}
.sticky-header-clone th:first-child {
    background: #0073aa !important;
    border-right: 2px solid #005a87;
}
.leaderboard-table tbody td:first-child {
    background: #f7f8fa !important;
}
.leaderboard-table tbody tr:hover td:first-child {
    background: #edf4f9 !important;
}



/* === v23: Desktop model column auto-width to longest name === */
@media (min-width: 769px) {
    .leaderboard-table tbody td:first-child,
    .leaderboard-table thead th:first-child {
        max-width: none !important;
        width: auto !important;
        white-space: nowrap !important;
    }
    .media-table-wrap .leaderboard-table th.col-name,
    .media-table-wrap .leaderboard-table td.col-name {
        width: auto !important;
        white-space: nowrap !important;
    }
}

