/* ========== SIDEBAR DRAWER ========== */

/* Hamburger Menu Button */
.menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 22px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 101;
    position: relative;
}

.menu-toggle span {
    display: block;
    width: 100%;
    height: 3px;
    background: white;
    border-radius: 3px;
    transition: all 0.3s ease;
}

.menu-toggle.active span:nth-child(1) {
    transform: translateY(10px) rotate(45deg);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: translateY(-10px) rotate(-45deg);
}

/* Drawer Overlay */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(2px);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.drawer-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Drawer */
.drawer {
    position: fixed;
    top: 0;
    right: 0;
    left: auto;
    width: 280px;
    height: 100vh;
    background: var(--bg-card);
    box-shadow: -4px 0 30px rgba(0, 0, 0, 0.5);
    z-index: 999;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    /* Allow scrolling for leaderboard */
}

.drawer.active {
    transform: translateX(0);
}

/* Drawer Header */
.drawer-header {
    background: var(--gradient-primary);
    padding: 25px 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.drawer-user-info {
    display: flex;
    gap: 15px;
    align-items: center;
    flex: 1;
}

.drawer-avatar {
    width: 55px;
    height: 55px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.drawer-user-info h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 5px;
    color: white;
}

.drawer-user-info p {
    font-size: 12px;
    opacity: 0.9;
    color: white;
}

.drawer-close {
    width: 35px;
    height: 35px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.drawer-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Drawer Navigation */
.drawer-nav {
    padding: 10px 0;
    flex: 0 0 auto;
    /* Don't grow or shrink, just take natural height */
    overflow: visible;
    /* Let content flow */
}

.drawer-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s;
    font-weight: 500;
    font-size: 15px;
    position: relative;
}

.drawer-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 100%;
    background: var(--accent-purple);
    transform: scaleY(0);
    transition: transform 0.3s;
}

.drawer-item:hover,
.drawer-item.active {
    background: rgba(168, 85, 247, 0.1);
    color: white;
}

.drawer-item.active::before {
    transform: scaleY(1);
}

.drawer-icon {
    font-size: 22px;
    width: 28px;
    text-align: center;
}

.drawer-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 10px 20px;
}

/* Drawer Footer */
.drawer-footer {
    padding: 20px;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    font-size: 12px;
}

.drawer-footer p {
    margin: 5px 0;
}

/* LEADERBOARD STYLES */
.leaderboard-section {
    padding: 20px 15px;
    background: rgba(0, 0, 0, 0.2);
    margin-top: 10px;
    flex-shrink: 0;
    min-height: 400px;
    /* Ensure space is reserved even if content is slow */
    display: block;
    /* Ensure it renders */
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.leaderboard-title {
    font-size: 14px;
    font-weight: 700;
    color: white;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.podium-container {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 10px;
    margin-bottom: 25px;
}

.podium-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
}

.podium-rank-1 {
    order: 2;
    margin-bottom: 10px;
}

.podium-rank-2 {
    order: 1;
}

.podium-rank-3 {
    order: 3;
}

.podium-avatar-wrapper {
    position: relative;
    margin-bottom: -10px;
    z-index: 2;
}

.podium-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid white;
    background: #333;
    object-fit: cover;
}

.rank-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 12px;
}

.podium-base {
    width: 70px;
    border-radius: 8px 8px 0 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 15px;
    position: relative;
}

.podium-rank-1 .podium-base {
    height: 90px;
    background: linear-gradient(180deg, #f9a8d4 0%, rgba(249, 168, 212, 0.1) 100%);
    box-shadow: 0 0 20px rgba(236, 72, 153, 0.3);
}

.podium-rank-2 .podium-base {
    height: 70px;
    background: linear-gradient(180deg, #fdba74 0%, rgba(253, 186, 116, 0.1) 100%);
}

.podium-rank-3 .podium-base {
    height: 60px;
    background: linear-gradient(180deg, #fcd34d 0%, rgba(252, 211, 77, 0.1) 100%);
}

.podium-name {
    font-size: 10px;
    font-weight: 700;
    margin-top: 5px;
    color: white;
}

.podium-score {
    font-size: 9px;
    opacity: 0.8;
    color: white;
}

.crown-icon {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%) rotate(15deg);
    font-size: 20px;
    filter: drop-shadow(0 0 5px gold);
    z-index: 3;
}

.podium-rank-num {
    font-size: 30px;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.4);
    position: absolute;
    bottom: 5px;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.ld-rank {
    width: 20px;
    font-size: 13px;
    font-weight: 700;
    color: #94a3b8;
}

.ld-user {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.ld-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #333;
}

.ld-name {
    font-size: 12px;
    color: white;
    font-weight: 500;
}

.ld-amount {
    font-size: 12px;
    font-weight: 700;
    color: #ef4444;
    /* Reddish for list as per image */
}

/* Mobile Responsive for Drawer */
@media (max-width: 480px) {
    .drawer {
        width: 260px;
    }

    .drawer-avatar {
        width: 50px;
        height: 50px;
        font-size: 22px;
    }

    .drawer-user-info h3 {
        font-size: 15px;
    }

    .drawer-item {
        padding: 13px 18px;
        font-size: 14px;
    }

    .drawer-icon {
        font-size: 20px;
    }
}