/* Cosmic-Glass Leaderboard Styles */

.leaderboard-container {
    width: calc(100% - 4rem);
    max-width: 1136px;
    margin: 0 auto 2rem auto;
    padding: 1.6rem 1.8rem;
    box-sizing: border-box;
    background: radial-gradient(circle at top, rgba(16, 36, 68, 0.72) 0%, rgba(9, 14, 28, 0.92) 100%);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: 16px;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.52), inset 0 0 24px rgba(56, 189, 248, 0.06);
}

/* Compact Cosmic Season Banner */
.season-banner-card {
    display: none;
    margin-bottom: 1.35rem;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    background: rgba(11, 17, 32, 0.78);
    border: 1px solid rgba(56, 189, 248, 0.32);
    box-shadow: inset 0 0 18px rgba(56, 189, 248, 0.05);
    text-align: center;
}

.season-banner-card.is-visible {
    display: block;
}

.season-banner-card.state-active {
    border-color: rgba(52, 211, 153, 0.55);
    background: linear-gradient(135deg, rgba(6, 78, 59, 0.25), rgba(11, 17, 32, 0.88));
}

.season-banner-card.state-upcoming {
    border-color: rgba(56, 189, 248, 0.55);
    background: linear-gradient(135deg, rgba(12, 74, 110, 0.28), rgba(11, 17, 32, 0.88));
}

.season-banner-card.state-ended,
.season-banner-card.state-none {
    border-color: rgba(148, 163, 184, 0.28);
    background: rgba(15, 23, 42, 0.72);
    padding: 0.85rem 1rem;
}

.season-banner-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px 12px;
}

.season-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    background: rgba(56, 189, 248, 0.14);
    border: 1px solid rgba(56, 189, 248, 0.4);
    color: #bae6fd;
}

.season-banner-card.state-active .season-status-pill {
    background: rgba(16, 185, 129, 0.16);
    border-color: rgba(52, 211, 153, 0.55);
    color: #6ee7b7;
}

.season-banner-card.state-none .season-status-pill {
    background: rgba(148, 163, 184, 0.14);
    border-color: rgba(148, 163, 184, 0.35);
    color: #cbd5e1;
}

.season-banner-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 800;
    color: #f8fafc;
    line-height: 1.3;
    word-break: break-word;
}

.season-banner-card.state-none .season-banner-title {
    font-size: 0.98rem;
    font-weight: 700;
    color: #e2e8f0;
}

.season-banner-sub {
    margin: 0.4rem auto 0 auto;
    font-size: 0.86rem;
    color: #94a3b8;
    line-height: 1.45;
    max-width: 600px;
}

.season-countdown-line {
    margin: 0.55rem 0 0 0;
    font-size: 0.98rem;
    font-weight: 800;
    color: #fbbf24;
    font-variant-numeric: tabular-nums;
}

.season-rewards-images {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 0.75rem auto 0.25rem auto;
}

.season-rewards-images img {
    max-height: 68px;
    border-radius: 8px;
    border: 1px solid rgba(251, 191, 36, 0.55);
    object-fit: cover;
}

.season-rewards-box {
    margin: 0.7rem auto 0 auto;
    max-width: 720px;
    padding: 0.7rem 0.95rem;
    border-radius: 8px;
    background: rgba(7, 11, 22, 0.65);
    border: 1px solid rgba(148, 163, 184, 0.18);
    color: #cbd5e1;
    font-size: 0.86rem;
    line-height: 1.5;
    text-align: left;
    white-space: pre-wrap;
}

/* Toolbar & Collapsible Cosmic League Dropdown */
.leaderboard-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 1.15rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(56, 189, 248, 0.2);
}

.league-selector-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.league-selector-label {
    font-size: 0.92rem;
    font-weight: 700;
    color: #cbd5e1;
}

.league-dropdown {
    position: relative;
    display: inline-block;
    z-index: 60;
}

.league-dropdown-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 220px;
    min-height: 42px;
    padding: 8px 15px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.94), rgba(11, 17, 32, 0.98));
    border: 1px solid rgba(56, 189, 248, 0.5);
    color: #f8fafc;
    font-size: 0.94rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35), inset 0 0 12px rgba(56, 189, 248, 0.08);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.18s ease;
}

.league-dropdown-trigger:hover,
.league-dropdown.open .league-dropdown-trigger {
    border-color: rgba(56, 189, 248, 0.88);
    box-shadow: 0 6px 20px rgba(56, 189, 248, 0.25), inset 0 0 14px rgba(56, 189, 248, 0.15);
    transform: translateY(-1px);
}

.league-trigger-left {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.league-trigger-chevron {
    color: #38bdf8;
    font-size: 0.78rem;
    transition: transform 0.2s ease;
}

.league-dropdown.open .league-trigger-chevron {
    transform: rotate(180deg);
}

.league-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 270px;
    max-width: 90vw;
    max-height: 320px;
    overflow-y: auto;
    padding: 7px;
    border-radius: 13px;
    background: linear-gradient(165deg, rgba(15, 23, 42, 0.98) 0%, rgba(9, 13, 26, 0.99) 100%);
    border: 1px solid rgba(56, 189, 248, 0.48);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.72), 0 0 24px rgba(56, 189, 248, 0.2);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    display: flex;
    flex-direction: column;
    gap: 5px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px) scale(0.97);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
    pointer-events: none;
}

.league-dropdown.open .league-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.league-option-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 9px 11px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: #cbd5e1;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.league-option-btn:hover {
    background: rgba(56, 189, 248, 0.12);
    border-color: rgba(56, 189, 248, 0.28);
    color: #ffffff;
}

.league-option-btn.active {
    background: linear-gradient(90deg, rgba(56, 189, 248, 0.22), rgba(56, 189, 248, 0.08));
    border-color: rgba(56, 189, 248, 0.55);
    color: #f8fafc;
    font-weight: 700;
}

.league-option-left {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.league-option-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.league-option-right {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.league-badge {
    font-size: 0.68rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    background: rgba(148, 163, 184, 0.16);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.25);
}

.league-badge.is-active {
    background: rgba(16, 185, 129, 0.18);
    color: #6ee7b7;
    border-color: rgba(52, 211, 153, 0.45);
}

.league-badge.is-upcoming {
    background: rgba(56, 189, 248, 0.18);
    color: #7dd3fc;
    border-color: rgba(56, 189, 248, 0.45);
}

.league-badge.is-ended {
    background: rgba(245, 158, 11, 0.14);
    color: #fcd34d;
    border-color: rgba(251, 191, 36, 0.38);
}

.league-option-check {
    color: #38bdf8;
    font-weight: 900;
    opacity: 0;
}

.league-option-btn.active .league-option-check {
    opacity: 1;
}

.leaderboard-count-pill {
    font-size: 0.82rem;
    font-weight: 700;
    color: #94a3b8;
    padding: 5px 12px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.22);
    font-variant-numeric: tabular-nums;
}

/* Selected Season Details Box */
.selected-season-details {
    display: none;
    margin-bottom: 1.2rem;
    padding: 0.95rem 1.15rem;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.78);
    border: 1px solid rgba(251, 191, 36, 0.35);
    border-left: 3px solid #fbbf24;
}

.selected-season-details.is-visible {
    display: block;
}

.selected-season-details h3 {
    margin: 0 0 0.35rem 0;
    color: #fbbf24;
    font-size: 1.05rem;
}

.selected-season-details p {
    margin: 0;
    color: #cbd5e1;
    font-size: 0.88rem;
    line-height: 1.48;
    white-space: pre-wrap;
}

/* Table */
.leaderboard-table-wrap {
    width: 100%;
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(7, 11, 22, 0.52);
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    vertical-align: middle;
}

.leaderboard-table thead th {
    background: rgba(15, 23, 42, 0.88);
    color: #fbbf24;
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    border-bottom: 1px solid rgba(56, 189, 248, 0.3);
}

.leaderboard-table tbody tr {
    transition: background 0.16s ease;
}

.leaderboard-table tbody tr:hover {
    background: rgba(56, 189, 248, 0.08);
}

.leaderboard-table tbody tr.top-row-1 {
    background: linear-gradient(90deg, rgba(251, 191, 36, 0.14), transparent);
}

.leaderboard-table tbody tr.top-row-2 {
    background: linear-gradient(90deg, rgba(203, 213, 225, 0.1), transparent);
}

.leaderboard-table tbody tr.top-row-3 {
    background: linear-gradient(90deg, rgba(217, 119, 6, 0.11), transparent);
}

.rank-col {
    width: 68px;
    text-align: center !important;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: #94a3b8;
}

.rank-col.rank-1 { color: #fde047; font-size: 1.05rem; }
.rank-col.rank-2 { color: #e2e8f0; font-size: 1.02rem; }
.rank-col.rank-3 { color: #fdba74; font-size: 1.02rem; }

.player-name-cell {
    font-weight: 700;
    color: #f8fafc;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.league-col {
    color: #94a3b8;
    font-size: 0.86rem;
}

.score-col {
    text-align: right !important;
    color: #38bdf8;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.details-col {
    width: 72px;
    text-align: center !important;
}

.date-col {
    color: #94a3b8;
    font-size: 0.84rem;
    text-align: right !important;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.info-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid rgba(56, 189, 248, 0.45);
    background: rgba(15, 23, 42, 0.88);
    color: #7dd3fc;
    font-weight: 800;
    font-size: 0.9rem;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.info-btn:hover {
    background: rgba(56, 189, 248, 0.22);
    border-color: #38bdf8;
    color: #ffffff;
    transform: translateY(-1px);
}

.leaderboard-empty-cell {
    text-align: center !important;
    padding: 36px 16px !important;
    color: #94a3b8;
    font-size: 0.95rem;
}

/* Cosmic-Glass Modals */
.cosmic-modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(3, 7, 18, 0.82);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1200;
    justify-content: center;
    align-items: center;
    padding: 16px;
}

.cosmic-modal-card {
    background: linear-gradient(165deg, rgba(15, 23, 42, 0.98) 0%, rgba(9, 14, 28, 0.99) 100%);
    border: 1px solid rgba(56, 189, 248, 0.5);
    border-radius: 16px;
    padding: 22px;
    max-width: 520px;
    width: 100%;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: 0 22px 54px rgba(0, 0, 0, 0.75), 0 0 28px rgba(56, 189, 248, 0.2);
    color: #f8fafc;
}

.cosmic-modal-card.compact {
    max-width: 360px;
}

.cosmic-modal-card h3 {
    color: #fbbf24;
    margin: 0 0 6px 0;
    text-align: center;
    font-size: 1.2rem;
}

.stats-modal-meta {
    text-align: center;
    font-size: 0.82rem;
    color: #94a3b8;
    margin-bottom: 14px;
}

.cosmic-modal-close-btn {
    width: 100%;
    margin-top: 16px;
    padding: 11px 16px;
    border-radius: 10px;
    border: 1px solid rgba(56, 189, 248, 0.45);
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.92), rgba(15, 23, 42, 0.96));
    color: #f8fafc;
    font-weight: 700;
    font-size: 0.94rem;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.cosmic-modal-close-btn:hover {
    border-color: #38bdf8;
    background: rgba(56, 189, 248, 0.2);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .leaderboard-container {
        width: calc(100% - 2rem);
        padding: 1.1rem 0.95rem;
    }

    .leaderboard-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .league-selector-group {
        width: 100%;
        justify-content: space-between;
    }

    .league-dropdown {
        flex: 1;
        min-width: 190px;
    }

    .league-dropdown-trigger {
        width: 100%;
        min-width: 0;
    }

    .league-dropdown-menu {
        width: 100%;
        min-width: 240px;
    }

    .leaderboard-count-pill {
        align-self: flex-start;
    }

    .leaderboard-table th,
    .leaderboard-table td {
        padding: 10px 8px;
        font-size: 0.88rem;
    }

    .player-name-cell {
        max-width: 120px;
    }
}

@media (max-width: 680px) {
    .league-col {
        display: none;
    }
}

@media (max-width: 520px) {
    .date-col {
        display: none;
    }
    .rank-col {
        width: 50px;
    }
    .details-col {
        width: 48px;
    }
}
