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

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

#upgrades-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1200;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
    padding: 10px;
    box-sizing: border-box;
    transition: opacity 0.2s;
}

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

#upgrades-panel {
    width: 95%;
    max-width: 800px; /* Más ancho para permitir 2 columnas */
    height: auto;
    max-height: 90vh;
    background: #1a1a20;
    border: 4px solid #ffffff;
    outline: 4px solid #000000;
    box-shadow: 0 0 0 100vh rgba(0,0,0,0.5); /* Oscurece todo lo de atrás */
    display: flex;
    flex-direction: column;
    padding: 20px;
    color: white;
    font-family: 'Press Start 2P', cursive, monospace;
    animation: panelPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

/* Fondo decorativo "vivo" */
#upgrades-panel::before {
    content: "";
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: 
        linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px),
        linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 30px 30px;
    z-index: 0;
    pointer-events: none;
}

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

.upgrades-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 4px solid #000;
    padding-bottom: 15px;
    margin-bottom: 15px;
    position: relative;
    z-index: 2;
    background: rgba(26, 26, 32, 0.9);
}

.upgrades-header h2 {
    margin: 0;
    font-size: 18px; /* Un poco más grande */
    line-height: 1.5;
    color: #60a5fa;
    text-shadow: 3px 3px 0 #000;
    text-transform: uppercase;
    letter-spacing: 1px;
}

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

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

/* --- GRID LAYOUT (Para evitar scroll) --- */
#upgrades-list {
    flex: 1;
    overflow-y: auto; /* Scroll solo si es absolutamente necesario */
    padding: 5px;
    display: grid;
    /* Crea columnas automáticas de mínimo 320px */
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); 
    gap: 16px;
    align-content: start; /* Pega los items arriba */
    position: relative;
    z-index: 2;
}

#upgrades-list::-webkit-scrollbar { width: 8px; }
#upgrades-list::-webkit-scrollbar-track { background: #000; }
#upgrades-list::-webkit-scrollbar-thumb { background: #444; border: 1px solid #000; }

/* --- ITEM CARD CON DEGRADADO --- */

.upgrade-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 2px solid #444;
    border-left-width: 6px;
    border-left-color: #60a5fa;
    
    /* DEGRADADO DE IZQUIERDA A DERECHA */
    background: linear-gradient(90deg, #0f172a 0%, #1e293b 100%);
    background-size: 200% 100%;
    
    box-shadow: 4px 4px 0 rgba(0,0,0,0.4);
    position: relative;
    transition: transform 0.1s, border-color 0.2s, background-position 0.3s;
    overflow: hidden;
}

/* Efecto de brillo "vivo" que pasa por la carta */
.upgrade-item::after {
    content: "";
    position: absolute;
    top: 0; left: -100%; width: 50%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
    transform: skewX(-20deg);
    animation: shinePass 6s infinite ease-in-out; /* Lento y sutil */
    pointer-events: none;
}

@keyframes shinePass {
    0% { left: -100%; }
    20% { left: 200%; } /* Pasa rápido */
    100% { left: 200%; } /* Espera antes de volver a pasar */
}

.upgrade-item:hover {
    transform: translateY(-2px);
    border-color: #94a3b8;
    background-position: 100% 0; /* Mueve el degradado al hacer hover */
    z-index: 3;
}

/* Estado Maxed */
.upgrade-item.maxed {
    border-color: #fbbf24;
    background: linear-gradient(90deg, #451a03 0%, #78350f 100%);
}
.upgrade-item.maxed .upgrade-name { color: #fbbf24; }

.upgrade-icon-container {
    width: 42px;
    height: 42px;
    background: #000;
    border: 2px solid #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: inset 2px 2px 0 rgba(0,0,0,0.5);
    flex-shrink: 0;
}

.upgrade-icon {
    font-size: 20px;
    filter: drop-shadow(0 0 5px rgba(255,255,255,0.4));
}

.upgrade-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0; /* Evita que el texto rompa el grid */
}

.upgrade-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.upgrade-name {
    font-size: 11px;
    color: #e2e8f0;
    text-shadow: 1px 1px 0 #000;
    white-space: nowrap;
}

.upgrade-level {
    font-size: 7px;
    color: #fbbf24;
    background: rgba(0,0,0,0.5);
    padding: 2px 5px;
    border-radius: 2px;
}

.upgrade-desc {
    font-size: 8px;
    color: #94a3b8;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- BARRA DE PROGRESO VIVA --- */

.upgrade-bar-bg {
    width: 100%;
    height: 8px;
    background: #000;
    border: 1px solid #444;
    margin-top: 5px;
    position: relative;
    overflow: hidden;
}

.upgrade-bar-fill {
    height: 100%;
    /* Patrón rayado animado */
    background-image: linear-gradient(
        45deg, 
        #22c55e 25%, 
        #4ade80 25%, 
        #4ade80 50%, 
        #22c55e 50%, 
        #22c55e 75%, 
        #4ade80 75%, 
        #4ade80 100%
    );
    background-size: 20px 20px;
    animation: barStripes 1s linear infinite;
    width: 0%;
    transition: width 0.3s ease-out;
    box-shadow: 0 0 10px rgba(74, 222, 128, 0.3);
}

@keyframes barStripes {
    0% { background-position: 0 0; }
    100% { background-position: 20px 0; }
}

.upgrade-item.maxed .upgrade-bar-fill {
    background-image: linear-gradient(45deg, #d97706 25%, #fbbf24 25%, #fbbf24 50%, #d97706 50%, #d97706 75%, #fbbf24 75%, #fbbf24 100%);
    box-shadow: 0 0 10px rgba(251, 191, 36, 0.3);
}

/* --- BOTONES DE ACCIÓN --- */

.upgrade-btn {
    width: 70px;
    height: 42px;
    margin-left: 8px;
    border: none;
    outline: 2px solid #000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-family: inherit;
    text-transform: uppercase;
    transition: all 0.1s;
    flex-shrink: 0;
}

/* Botón bloqueado */
.upgrade-btn.locked {
    background: #334155;
    color: #64748b;
    box-shadow: inset 2px 2px 0 rgba(0,0,0,0.3);
    cursor: not-allowed;
}

/* Botón disponible (Animado) */
.upgrade-btn.affordable {
    background: #22c55e;
    color: #022c22;
    /* Sombra 3D */
    box-shadow: inset -2px -2px 0 rgba(0,0,0,0.3), inset 2px 2px 0 rgba(255,255,255,0.4), 3px 3px 0 #000;
    animation: btnPulse 1.5s infinite alternate; /* Late para llamar la atención */
}

@keyframes btnPulse {
    0% { transform: scale(1); filter: brightness(1); }
    100% { transform: scale(1.03); filter: brightness(1.1); }
}

.upgrade-btn.affordable:active {
    transform: scale(0.95) translateY(2px);
    box-shadow: inset 2px 2px 0 rgba(0,0,0,0.3), 0 0 0 #000;
    animation: none;
}

.upgrade-btn.maxed-btn {
    background: transparent;
    border: 2px solid #fbbf24;
    color: #fbbf24;
    cursor: default;
    box-shadow: none;
    outline: none;
    animation: none;
}

.btn-label { font-size: 6px; margin-bottom: 2px; }
.btn-cost { font-size: 9px; font-weight: bold; }

/* --- FOOTER --- */

.upgrades-footer {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 4px solid #000;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #fbbf24;
    text-shadow: 2px 2px 0 #000;
}

@media (max-width: 700px) {
    #upgrades-list {
        /* En móvil volvemos a una columna, aquí sí habrá un poco de scroll si hay muchos items */
        grid-template-columns: 1fr; 
    }
    .upgrade-name { font-size: 10px; }
}

/* --- UniFish Optimizer Accent --- */
#upgrades-panel {
    border-color: #7c3aed;
    box-shadow: 0 0 0 4px #000, 0 0 28px rgba(124, 58, 237, 0.35), 0 0 0 100vh rgba(0,0,0,0.5);
}

#upgrades-panel::after {
    content: "V4 HOOK OPTIMIZER";
    position: absolute;
    right: 18px;
    bottom: 12px;
    color: rgba(0, 245, 255, 0.22);
    font-size: 10px;
    letter-spacing: 1px;
    pointer-events: none;
}

.upgrades-header h2 {
    color: #00f5ff;
}

.upgrades-header h2::after {
    content: "  LIQUIDITY MODULES";
    color: #d946ef;
    font-size: 8px;
}

.upgrade-item {
    border-left-color: #00f5ff;
    background: linear-gradient(90deg, rgba(15, 23, 42, 0.98), rgba(49, 46, 129, 0.86));
}

.upgrade-item:hover {
    border-color: #00f5ff;
    box-shadow: 0 0 14px rgba(0,245,255,0.25), 4px 4px 0 rgba(0,0,0,0.4);
}

.upgrade-level,
.upgrade-btn {
    border: 1px solid #00f5ff;
}

.upgrade-btn.affordable {
    background: linear-gradient(180deg, #22d3ee, #7c3aed);
    color: #fff;
}
