/* --- START OF FILE leaderboard-ui.css --- */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

/* --- LEADERBOARD OVERLAY & PANEL --- */
#leaderboard-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1600;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
    padding: 12px;
    box-sizing: border-box;
    transition: opacity 0.2s;
}

#leaderboard-overlay.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
}

#leaderboard-panel {
    width: 100%;
    max-width: 600px;
    height: 80vh; /* Altura similar al inventario */
    background: #202028;
    border: 4px solid #fff;
    outline: 4px solid #000;
    padding: 20px;
    box-shadow: 12px 12px 0 rgba(0,0,0,0.6);
    font-family: 'Press Start 2P', cursive, monospace;
    color: #fff;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    animation: panelPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Patrón de fondo estilo Inventario */
#leaderboard-panel::before {
    content: "";
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: radial-gradient(#333 15%, transparent 16%), radial-gradient(#333 15%, transparent 16%);
    background-size: 16px 16px;
    opacity: 0.1;
    z-index: 0;
    pointer-events: none;
}

@keyframes panelPop {
    0% { transform: scale(0.8) translateY(20px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

/* --- HEADER --- */
.leaderboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 4px solid #000;
    padding-bottom: 12px;
    margin-bottom: 4px;
    position: relative;
    z-index: 2;
}

.leaderboard-header h2 {
    margin: 0;
    font-size: 16px;
    line-height: 1.5;
    text-shadow: 3px 3px 0 #000; /* Sombra más fuerte */
    color: #fbbf24;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#leaderboard-close {
    background: #ef4444;
    border: 2px solid #fff;
    outline: 2px solid #000;
    color: white;
    width: 36px; height: 36px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Press Start 2P', cursive;
    box-shadow: inset -3px -3px 0 rgba(0,0,0,0.3);
    transition: transform 0.1s;
}

#leaderboard-close:active {
    transform: translateY(2px);
    box-shadow: inset 2px 2px 0 rgba(0,0,0,0.3);
}

/* --- TABS (Estilo Botones Pixelados) --- */
#leaderboard-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
    position: relative;
    z-index: 2;
}

.lb-tab {
    background: #2a2a35;
    color: #94a3b8;
    border: 2px solid #000;
    padding: 10px 12px;
    cursor: pointer;
    font-size: 10px;
    flex: 1;
    text-align: center;
    box-shadow: inset -3px -3px 0 rgba(0,0,0,0.5);
    transition: all 0.1s;
    text-transform: uppercase;
}

.lb-tab:hover {
    background: #333;
    color: #fff;
    transform: translateY(-2px);
}

.lb-tab.active {
    background: #0ea5e9;
    color: #fff;
    border-color: #fff;
    outline: 2px solid #000;
    box-shadow: inset 3px 3px 0 rgba(255,255,255,0.2);
    transform: translateY(0);
    text-shadow: 2px 2px 0 rgba(0,0,0,0.4);
}

/* --- CONTENT AREA & SCROLLBAR --- */
#leaderboard-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    padding-right: 8px;
    position: relative;
    z-index: 2;
    flex: 1; /* Ocupa el espacio restante */
}

/* Scrollbar personalizada igual al inventario */
#leaderboard-content::-webkit-scrollbar { width: 12px; }
#leaderboard-content::-webkit-scrollbar-track { background: #000; border-left: 2px solid #fff; }
#leaderboard-content::-webkit-scrollbar-thumb { background: #fff; border: 2px solid #000; box-shadow: inset -2px -2px 0 #aaa; }

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.leaderboard-list.hidden { display: none; }

/* --- ROW STYLING (Estilo Tarjeta) --- */
.leaderboard-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #000;
    border: 2px solid #444;
    border-left-width: 6px; /* Borde izquierdo más grueso para indicar rango */
    padding: 12px;
    font-size: 11px;
    position: relative;
    box-shadow: inset 3px 3px 0 rgba(255,255,255,0.05);
    transition: transform 0.1s, background 0.1s;
}

.leaderboard-row:hover {
    background: #111;
    transform: translateX(4px); /* Pequeño desplazamiento al hacer hover */
    border-color: #666;
}

/* Rank Number styling */
.leaderboard-row .rank { 
    color: #64748b; 
    width: 40px; 
    text-align: center;
    font-size: 10px;
    background: #222;
    padding: 4px 0;
    border: 1px solid #444;
    margin-right: 12px;
}

/* Name styling */
.leaderboard-row .name { 
    flex: 1; 
    color: #fff; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    white-space: nowrap; 
    text-shadow: 1px 1px 0 #000;
}

/* Value/Score styling */
.leaderboard-row .value { 
    color: #0ea5e9; 
    text-align: right; 
    min-width: 80px; 
    font-family: 'Courier New', monospace; /* Fuente monoespaciada para números alineados */
    font-weight: bold;
    letter-spacing: -0.5px;
}

/* --- TOP 3 RANKS (Special Effects) --- */

/* RANK 1: GOLD */
.leaderboard-row:nth-child(1) {
    background: linear-gradient(90deg, rgba(251, 191, 36, 0.15) 0%, transparent 100%);
    border-color: #fbbf24;
    border-left: 6px solid #fbbf24;
    margin-bottom: 4px; /* Separación extra para el #1 */
}
.leaderboard-row:nth-child(1) .rank {
    background: #fbbf24;
    color: #000;
    border-color: #fff;
    font-weight: bold;
    animation: pulseGold 2s infinite;
}
.leaderboard-row:nth-child(1) .name { color: #fbbf24; }
.leaderboard-row:nth-child(1)::after {
    content: "👑";
    position: absolute;
    right: -5px; top: -10px;
    font-size: 20px;
    transform: rotate(15deg);
    filter: drop-shadow(2px 2px 0 #000);
}

/* RANK 2: SILVER */
.leaderboard-row:nth-child(2) {
    border-left-color: #e2e8f0;
    background: linear-gradient(90deg, rgba(226, 232, 240, 0.1) 0%, transparent 100%);
}
.leaderboard-row:nth-child(2) .rank {
    background: #cbd5e1;
    color: #0f172a;
    border-color: #fff;
}
.leaderboard-row:nth-child(2) .name { color: #e2e8f0; }

/* RANK 3: BRONZE */
.leaderboard-row:nth-child(3) {
    border-left-color: #d97706;
    background: linear-gradient(90deg, rgba(217, 119, 6, 0.1) 0%, transparent 100%);
}
.leaderboard-row:nth-child(3) .rank {
    background: #d97706;
    color: #fff;
    border-color: #fdba74;
}
.leaderboard-row:nth-child(3) .name { color: #fdba74; }

/* Animation for Rank 1 Badge */
@keyframes pulseGold {
    0% { transform: scale(1); box-shadow: 0 0 0 rgba(251, 191, 36, 0.4); }
    50% { transform: scale(1.1); box-shadow: 0 0 10px rgba(251, 191, 36, 0.7); }
    100% { transform: scale(1); box-shadow: 0 0 0 rgba(251, 191, 36, 0.4); }
}

/* --- FOOTER --- */
.leaderboard-footer { 
    text-align: center; 
    color: #64748b; 
    font-size: 9px; 
    padding-top: 12px; 
    border-top: 4px solid #000;
    margin-top: 4px;
    background: #18181b;
    padding-bottom: 4px;
    border: 2px solid #333; /* Look de caja de status */
    position: relative;
    z-index: 2;
}

.small-note { 
    opacity: 0.7; 
    display: block;
    margin-top: 4px;
    font-style: italic;
}

/* --- RESPONSIVE --- */
@media (max-width: 600px) {
    #leaderboard-panel { 
        max-width: 96%; 
        padding: 12px;
        height: 70vh;
    }
    .leaderboard-header h2 { font-size: 12px; }
    .lb-tab { padding: 8px 4px; font-size: 8px; }
    .leaderboard-row { font-size: 10px; padding: 10px 8px; }
    .leaderboard-row .rank { width: 24px; margin-right: 8px; }
}

/* --- END OF FILE leaderboard-ui.css --- */