/* premium_ranking.css - Premium Leaderboard */

/* =====================
   CONTAINER
   ===================== */
.ranking-container {
    display: flex;
    flex-direction: row;
    gap: 32px;
    padding: 28px 24px;
    background: var(--surface);
    border-radius: 28px;
    box-shadow: var(--shadow-premium, 0 10px 40px -10px rgba(0,0,0,0.1));
    border: 1px solid var(--border);
    min-height: 480px;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    margin-top: 10px;
    margin-bottom: 30px;
}

/* Stars */
.ranking-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(1px 1px at 15% 25%, rgba(255, 255, 255, 0.6) 100%, transparent),
        radial-gradient(1px 1px at 38% 68%, rgba(255, 255, 255, 0.5) 100%, transparent),
        radial-gradient(2px 2px at 58% 18%, rgba(255, 215, 0, 0.35) 100%, transparent),
        radial-gradient(1px 1px at 75% 55%, rgba(255, 255, 255, 0.5) 100%, transparent),
        radial-gradient(2px 2px at 88% 38%, rgba(255, 215, 0, 0.35) 100%, transparent),
        radial-gradient(1px 1px at 25% 80%, rgba(255, 255, 255, 0.4) 100%, transparent),
        radial-gradient(1px 1px at 65% 85%, rgba(255, 255, 255, 0.3) 100%, transparent);
    background-size: 160px 160px;
    pointer-events: none;
    z-index: 0;
    opacity: 0.1; /* default to subtle for light themes */
}
[data-theme="dark"] .ranking-container::before,
[data-theme="military"] .ranking-container::before,
[data-theme="grey"] .ranking-container::before {
    opacity: 0.8;
}

/* =====================
   LIST SIDE
   ===================== */
.ranking-list-side {
    flex: 1;
    max-width: 380px;
    background: var(--surface-2, rgba(0,0,0,0.03));
    border-radius: 22px;
    padding: 22px 18px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 1;
}

.ranking-list-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
    margin-bottom: 16px;
    max-height: 360px;
    overflow-y: auto;
    padding-right: 4px;
}

.ranking-list-container::-webkit-scrollbar {
    width: 4px;
}

.ranking-list-container::-webkit-scrollbar-track {
    background: transparent;
}

.ranking-list-container::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

.ranking-item {
    display: flex;
    align-items: center;
    background: var(--surface);
    border-radius: 14px;
    padding: 11px 14px;
    gap: 14px;
    border: 1px solid var(--border-soft);
    transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
}

.ranking-item:hover {
    transform: translateY(-2px);
    background: var(--surface-2, var(--border-soft));
    box-shadow: var(--shadow-sm);
}

.rank-pos {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.rank-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 2px solid var(--border);
    flex-shrink: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rank-info {
    flex: 1;
    min-width: 0;
}

.rank-name {
    color: var(--text-main);
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rank-alias {
    color: var(--text-muted);
    font-size: 10px;
}

.rank-pts {
    font-weight: 800;
    color: var(--text-main);
    font-size: 14px;
    text-align: right;
    white-space: nowrap;
}

.rank-pts span {
    font-size: 9px;
    color: var(--text-muted);
    margin-left: 3px;
    font-weight: 600;
}

/* "Ver más" button */
.btn-ver-mas {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 99px;
    padding: 11px 20px;
    font-size: 12px;
    font-weight: 600;
    width: 100%;
    cursor: pointer;
    transition: all 0.25s;
    margin-top: 4px;
}

.btn-ver-mas:hover {
    background: var(--surface-2, var(--border-soft));
    color: var(--text-main);
    border-color: var(--border);
}

/* =====================
   PODIUM
   ===================== */
.podium-side {
    flex: 1;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 0;
    min-height: 430px;
    z-index: 1;
    padding-bottom: 20px;
    padding-right: 0;
}

.podium-block-3d {
    width: 108px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    --depth: 32px;
}

/* ---------- Front face ---------- */
.podium-face-front {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 8px;
    padding-bottom: 8px;
    gap: 4px;
    position: relative;
    background: var(--metal-front);
    box-shadow: -14px 14px 28px rgba(0, 0, 0, 0.55);
}

/* Rank number inside face */
.podium-rank-num {
    font-size: 52px;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.88);
    font-family: 'Outfit', sans-serif;
    line-height: 1;
    display: block;
}

/* Username inside face, below the number */
.podium-face-username {
    font-size: 11px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.65);
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 94%;
    text-align: center;
    display: block;
}

/* Top face (3D illusion) */
.podium-face-front::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 0;
    width: 100%;
    height: var(--depth);
    background: var(--metal-top);
    transform-origin: bottom left;
    transform: skewX(-45deg);
}

/* Right face (3D illusion) */
.podium-face-front::after {
    content: '';
    position: absolute;
    top: 0;
    left: 100%;
    width: var(--depth);
    height: 100%;
    background: var(--metal-side);
    transform-origin: top left;
    transform: skewY(-45deg);
}

/* ---------- Floating user info above block ---------- */
.podium-user-data {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: absolute;
    top: -148px;
    left: 50%;
    transform: translateX(-50%);
    width: 160px;
    z-index: 10;
}

.podium-avatar-wrapper-3d {
    position: relative;
    margin-bottom: 10px;
}

.podium-crown-premium {
    position: absolute;
    top: -28px;
    left: 50%;
    transform: translateX(-50%);
    color: #fbbf24;
    filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.7));
    z-index: 2;
}

/* Avatar circle */
.podium-avatar-premium {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.podium-avatar-premium img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.podium-pts-premium {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
}
.podium-pts-val {
    font-weight: 800;
    font-size: 18px;
    color: var(--text-main);
    line-height: 1;
}

.podium-label-premium {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
    text-align: center;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* =====================
   RANK COLORS
   ===================== */

/* 1st - Gold */
.podium-block-3d.first {
    z-index: 3;
    --metal-front: #27272a;
    --metal-top: #3f3f46;
    --metal-side: #18181b;
}

.podium-block-3d.first .podium-face-front {
    height: 190px;
}

.podium-block-3d.first .podium-rank-num {
    color: #fbbf24;
}

.podium-block-3d.first .podium-face-username {
    color: rgba(251, 191, 36, 0.8);
}

.podium-block-3d.first .podium-avatar-premium {
    width: 88px;
    height: 88px;
    border: 4px solid #fbbf24;
    box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.15), 0 0 30px rgba(251, 191, 36, 0.4);
}

.podium-block-3d.first .podium-user-data {
    top: -172px;
}

/* 2nd - Silver */
.podium-block-3d.second {
    z-index: 2;
    --metal-front: #3f3f46;
    --metal-top: #52525b;
    --metal-side: #27272a;
    margin-left: 32px;
    /* balances the margin-right of the 3rd block to perfectly center the 1st block */
}

.podium-block-3d.second .podium-face-front {
    height: 148px;
}

.podium-block-3d.second .podium-rank-num {
    color: #e4e4e7;
}

.podium-block-3d.second .podium-avatar-premium {
    border: 3px solid #e4e4e7;
    box-shadow: 0 0 0 3px rgba(228, 228, 231, 0.1), 0 0 20px rgba(228, 228, 231, 0.25);
}

/* 3rd - Bronze */
.podium-block-3d.third {
    z-index: 1;
    --metal-front: #451a03;
    --metal-top: #78350f;
    --metal-side: #291102;
    margin-right: 32px;
    /* room for 3D right face without shifting whole podium */
}

.podium-block-3d.third .podium-face-front {
    height: 116px;
}

.podium-block-3d.third .podium-rank-num {
    color: #f59e0b;
}

.podium-block-3d.third .podium-avatar-premium {
    border: 3px solid #b45309;
    box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.1), 0 0 20px rgba(180, 83, 9, 0.3);
}

/* =====================   MOBILE RESPONSIVE
   podium top → list bottom
   ===================== */
@media (max-width: 768px) {

    .ranking-container {
        flex-direction: column-reverse;
        /* podium-side (2nd in DOM) shows first */
        padding: 14px 10px 10px;
        gap: 10px;
        min-height: unset;
        border-radius: 22px;
        margin-bottom: 84px;
    }

    /* List panel */
    .ranking-list-side {
        max-width: 100%;
        width: 100%;
        padding: 14px 12px;
        border-radius: 18px;
    }

    .ranking-list-container {
        max-height: none;
        overflow-y: visible;
        margin-top: 12px;
        margin-bottom: 10px;
        padding-right: 0;
    }

    .ranking-item {
        padding: 10px 12px;
        gap: 12px;
        border-radius: 12px;
    }

    .rank-name {
        font-size: 12px;
    }

    .rank-pts {
        font-size: 13px;
    }

    /* Podium panel — NO scale, sizes set directly */
    .podium-side {
        width: 100%;
        min-height: 310px;
        /* enough room for avatars + crown floating above blocks */
        padding: 0;
        padding-bottom: 10px;
        justify-content: center;
        transform: none;
        margin-bottom: 0;
    }

    /* Block widths & balance */
    .podium-block-3d {
        width: 96px;
        --depth: 22px;
    }

    .podium-block-3d.third {
        margin-right: 22px;
    }

    /* override desktop value */
    .podium-block-3d.second {
        margin-left: 22px;
    }

    /* balance center on mobile */

    /* Face heights */
    .podium-block-3d.first .podium-face-front {
        height: 144px;
    }

    .podium-block-3d.second .podium-face-front {
        height: 108px;
    }

    .podium-block-3d.third .podium-face-front {
        height: 84px;
    }

    /* Rank numbers */
    .podium-rank-num {
        font-size: 38px;
    }

    .podium-face-username {
        font-size: 10px;
    }

    /* Avatars */
    .podium-avatar-premium {
        width: 54px;
        height: 54px;
    }

    .podium-block-3d.first .podium-avatar-premium {
        width: 68px;
        height: 68px;
    }

    /* User-data floating above blocks
       Calculation: face height + top = must fit inside min-height(310px)
       1st: face=138 → block is at the bottom, user-data top = -135px from block top
            block top ≈ 310 - 138 = 172px → user-data y = 172 - 135 = 37px ✓
       2nd/3rd: top = -115px → block top ≈ 310 - 98 = 212px → y = 212-115 = 97px ✓ */
    .podium-user-data {
        top: -115px;
        width: 110px;
    }

    .podium-block-3d.first .podium-user-data {
        top: -135px;
    }

    .podium-pts-val {
        font-size: 13px;
    }

    .podium-label-premium {
        font-size: 9px;
    }

    .podium-crown-premium {
        top: -20px;
    }
}