/* ==========================================================================
   1. LEADERBOARD LAYOUT & CONTAINER
   ========================================================================== */
body {
    justify-content: flex-start !important;
}

.layout,
.leaderboard-layout {
    display: flex;
    gap: 2rem;
    max-width: 1600px;
    width: 100%;
    margin: 5rem auto 3rem;
    padding: 0 2rem;
    align-items: flex-start;
    box-sizing: border-box;
}

/* ==========================================================================
   2. SIDEBAR NAVIGATION
   ========================================================================== */
.sidebar {
    width: 240px;
    flex-shrink: 0;
    position: sticky;
    top: 5.5rem;
    background: var(--bg-light);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sidebar-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-white);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-subtle);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.sidebar-link {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    cursor: pointer !important;
    padding: 0.65rem 0.85rem;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 6px;
    border: 1px solid transparent;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    outline: none;
    text-decoration: none;
}

.sidebar-link:hover {
    color: var(--text-white);
    background: var(--accent-hover);
}

.sidebar-link.active {
    color: var(--text-white);
    background: var(--accent-transparent);
    border-color: var(--accent);
}

/* ==========================================================================
   3. MAIN CONTENT & HEADERS
   ========================================================================== */
.main,
.main-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
    min-height: 700px;
}

.header,
.page-header {
    background: var(--bg-light);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 1.5rem 2rem;
}

.header .title,
.page-header h1 {
    font-size: 1.6rem;
    color: var(--text-white);
    margin-bottom: 0.25rem;
}

.header .subtitle,
.page-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ==========================================================================
   4. TAB PANELS & SEARCH DROPDOWN
   ========================================================================== */
.tab-content,
.view-panel {
    display: none;
    flex-direction: column;
    gap: 1.5rem;
    min-height: 600px;
}

.tab-content.active,
.view-panel.active {
    display: flex;
}

.search-box {
    position: relative;
    width: 100%;
}

.search-box .input {
    width: 100%;
    background: var(--bg-light);
    color: var(--text-white);
    border: 1px solid var(--border-subtle);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.search-box .input:focus {
    border-color: var(--accent);
}

.search-box .dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-light);
    border: 1px solid var(--accent);
    border-radius: 8px;
    max-height: 220px;
    overflow-y: auto;
    z-index: 50;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.search-box .dropdown.open {
    display: block;
}

.search-box .dropdown-item {
    padding: 0.65rem 1rem;
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer !important;
    border-bottom: 1px solid var(--border-subtle);
}

.search-box .dropdown-item:hover {
    background: var(--accent-transparent);
    color: var(--text-white);
}

/* ==========================================================================
   5. PODIUM GRID & CARDS
   ========================================================================== */
.podium,
.podium-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.podium-card {
    background: var(--bg-light);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
}

.podium-card.rank-1 {
    border-color: rgba(255, 215, 0, 0.4);
}

.podium-card .rank,
.podium-card .podium-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
}

.podium-card .avatar,
.podium-card .podium-avatar {
    font-size: 1.6rem;
    margin-bottom: 0.5rem;
}

.podium-card .name,
.podium-card .podium-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-white);
}

.podium-card .stat,
.podium-card .podium-stat {
    font-size: 0.85rem;
    color: var(--accent-light);
    font-weight: 600;
    margin-top: 0.25rem;
}

/* ==========================================================================
   6. LEADERBOARD DATA TABLES
   ========================================================================== */
.table-wrapper,
.table-container {
    background: var(--bg-light);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    overflow-x: auto;
}

.table,
.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.table th,
.leaderboard-table th {
    background: rgba(0, 0, 0, 0.2);
    padding: 0.85rem 1rem;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-subtle);
}

.table td,
.leaderboard-table td {
    padding: 0.85rem 1rem;
    font-size: 0.88rem;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
}

.table tr:last-child td,
.leaderboard-table tr:last-child td {
    border-bottom: none;
}

.table tr:hover td,
.leaderboard-table tr:hover td {
    background: var(--accent-hover);
}

/* ==========================================================================
   7. RESPONSIVE MOBILE SEGMENTED BAR & LAYOUT
   ========================================================================== */
@media (max-width: 768px) {
    .layout,
    .leaderboard-layout {
        flex-direction: column;
        margin-top: 4.25rem;
        padding: 0 1rem;
        gap: 1.25rem;
    }

    .sidebar {
        width: 100%;
        position: sticky;
        top: 4rem;
        background: rgba(26, 26, 31, 0.95);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border: 1px solid var(--border-subtle);
        border-radius: 10px;
        padding: 0.5rem;
        z-index: 90;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    }

    .sidebar-title {
        display: none;
    }

    .sidebar-nav {
        flex-direction: row;
        justify-content: space-between;
        gap: 0.25rem;
        background: rgba(15, 15, 18, 0.6);
        padding: 0.25rem;
        border-radius: 8px;
    }

    .sidebar-link {
        flex: 1;
        text-align: center;
        padding: 0.55rem 0.2rem;
        font-size: 0.78rem;
        border-radius: 6px;
        white-space: nowrap;
    }

    .sidebar-link.active {
        background: var(--accent);
        color: var(--bg-dark);
        font-weight: 700;
        border-color: var(--accent);
    }

    .header,
    .page-header {
        padding: 1.25rem 1rem;
    }

    .header .title,
    .page-header h1 {
        font-size: 1.3rem;
    }

    .podium,
    .podium-grid {
        grid-template-columns: 1fr;
    }
}
