/* === LEADERBOARD BUTTON ON TEST CARDS === */

.btn-leaderboard {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-leaderboard:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 12px rgba(245, 158, 11, 0.35);
}

.btn-leaderboard i {
    font-size: 0.85rem;
}

/* === LEADERBOARD MODAL === */

.leaderboard-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.25s ease;
}

.leaderboard-overlay.visible {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.leaderboard-container {
    background: white;
    border-radius: 16px;
    width: 95%;
    max-width: 620px;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.leaderboard-header {
    background: linear-gradient(135deg, #12137F 0%, #1e255e 100%);
    color: white;
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.leaderboard-title {
    display: flex;
    align-items: center;
    gap: 14px;
}

.trophy-icon {
    font-size: 2rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.leaderboard-title h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
}

.leaderboard-test-name {
    margin: 2px 0 0;
    font-size: 0.85rem;
    opacity: 0.8;
}

.leaderboard-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.leaderboard-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.leaderboard-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}

.leaderboard-loading,
.leaderboard-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #94a3b8;
    font-size: 1rem;
}

.leaderboard-loading i {
    font-size: 1.5rem;
    margin-bottom: 8px;
    display: block;
}

/* === PODIUM === */

.leaderboard-podium {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
    padding: 16px 0;
}

.podium-item {
    text-align: center;
    padding: 16px 14px;
    border-radius: 14px;
    flex: 1;
    max-width: 180px;
    transition: transform 0.2s;
    position: relative;
}

.podium-item:hover {
    transform: translateY(-3px);
}

.podium-item.gold {
    background: linear-gradient(145deg, #fef9c3, #fde68a);
    border: 2px solid #f59e0b;
    order: 1;
}

.podium-item.silver {
    background: linear-gradient(145deg, #f1f5f9, #e2e8f0);
    border: 2px solid #94a3b8;
    order: 0;
    margin-top: 14px;
}

.podium-item.bronze {
    background: linear-gradient(145deg, #fef3e2, #fed7aa);
    border: 2px solid #f97316;
    order: 2;
    margin-top: 14px;
}

.podium-item.is-you {
    box-shadow: 0 0 0 3px #12137F, 0 4px 12px rgba(50, 61, 151, 0.25);
}

.podium-medal {
    font-size: 2rem;
    margin-bottom: 6px;
}

.podium-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: #1e293b;
    margin-bottom: 4px;
    word-break: break-word;
}

.podium-score {
    font-size: 1.1rem;
    font-weight: 800;
    color: #12137F;
}

.you-badge {
    display: inline-block;
    background: #12137F;
    color: white;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 10px;
    vertical-align: middle;
    font-weight: 700;
}

/* === YOUR RANK === */

.leaderboard-your-rank {
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    border: 1px solid #93c5fd;
    border-radius: 10px;
    padding: 12px 16px;
    text-align: center;
    margin-bottom: 16px;
    font-size: 0.95rem;
    color: #1e40af;
}

.leaderboard-your-rank strong {
    color: #12137F;
    font-size: 1.1rem;
}

/* === TABLE === */

.leaderboard-table-wrapper {
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    margin-bottom: 16px;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.leaderboard-table thead {
    background: #f8fafc;
}

.leaderboard-table th {
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    color: #64748b;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 2px solid #e2e8f0;
}

.leaderboard-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}

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

.leaderboard-table .is-you-row {
    background: linear-gradient(90deg, #eff6ff, #f0fdf4) !important;
    font-weight: 600;
}

.leaderboard-table .is-you-row td {
    border-bottom-color: #93c5fd;
}

.you-badge-small {
    display: inline-block;
    background: #12137F;
    color: white;
    font-size: 0.65rem;
    padding: 1px 5px;
    border-radius: 8px;
    font-weight: 700;
    margin-left: 4px;
}

/* === STATS === */

.leaderboard-stats {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 12px 0 4px;
    font-size: 0.82rem;
    color: #94a3b8;
}

.leaderboard-stats span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.leaderboard-stats i {
    font-size: 0.75rem;
}

/* === RESPONSIVE === */

@media (max-width: 600px) {
    .leaderboard-container {
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .leaderboard-podium {
        flex-direction: column;
        align-items: center;
    }

    .podium-item {
        max-width: 100%;
        width: 100%;
        margin-top: 0 !important;
    }

    .podium-item.gold { order: 0; }
    .podium-item.silver { order: 1; }
    .podium-item.bronze { order: 2; }

    .leaderboard-stats {
        flex-direction: column;
        align-items: center;
        gap: 6px;
    }
}
