/* =========================================
   Apocalipsis Bet - Premium UI Styles
   v1.0 - Optimization Refactor
   ========================================= */

/* --- GRID SYSTEM V2 (Responsive & Premium) --- */

.apoc-grid-v2 {
    display: grid;
    /* Por defecto (Desktop) comportamiento fluido */
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
    width: 100%;
    margin-top: 15px;
}

.apoc-item-v2 {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100% !important;
    /* Forzado para sobreecribir estilos legacy */
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    margin: 0 !important;
}

.apoc-item-v2__block {
    position: relative;
    width: 100% !important;
    padding-bottom: 100% !important;
    /* Aspect Ratio 1:1 Forzado */
    height: 0 !important;
    overflow: hidden !important;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    background: #2a1b3d;
    /* Placeholder */
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.apoc-item-v2__block:hover {
    transform: translateY(-3px);
    border-color: #ffd700;
    box-shadow: 0 8px 20px rgba(255, 215, 0, 0.3);
    /* Premium glow */
}

.apoc-item-v2__img {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
    max-width: none !important;
    min-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

.apoc-item-v2__panel {
    margin-top: 8px;
    text-align: center;
    padding: 0 4px;
}

.apoc-item-v2__title {
    font-size: 13px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
    margin: 0;
    font-family: 'Roboto', sans-serif;
    /* Asegurar fuente moderna */
}

/* Botón Jugar (Overlay) */
.apoc-item-v2__btn {
    position: absolute;
    bottom: 10%;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: linear-gradient(90deg, #ffb347 0%, #ff6b6b 100%);
    color: #1a0731;
    font-weight: 700;
    font-size: 12px;
    padding: 6px 16px;
    border-radius: 20px;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: all 0.3s ease;
}

.apoc-item-v2__block:hover .apoc-item-v2__btn {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* === MÓVIL REGLAS === */
@media (max-width: 768px) {
    .apoc-grid-v2 {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px !important;
        padding: 0 4px;
    }

    .apoc-item-v2__title {
        font-size: 10px;
        margin-top: 4px;
    }
}

/* --- LAST PLAYED POPUP --- */

.last-played-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    /* Premium glass effect */
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.last-played-popup-content {
    background: linear-gradient(135deg, #2a1b3d 0%, #4a148c 100%);
    padding: 30px;
    border-radius: 20px;
    /* Mas redondeado */
    border: 1px solid rgba(255, 215, 0, 0.5);
    /* Borde sutil */
    text-align: center;
    position: relative;
    max-width: 90%;
    width: 400px;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.2);
    animation: popupFadeIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    /* Bouncy premium feel */
}

@keyframes popupFadeIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.last-played-title {
    color: #fff;
    margin-bottom: 20px;
    font-family: 'Cinzel', serif;
    font-size: 1.6rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.last-played-game-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 25px;
}

.last-played-img {
    width: 140px;
    height: 140px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 15px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
}

.last-played-name {
    color: #ffd700;
    font-size: 1.3rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.last-played-btn {
    border: none;
    padding: 12px 25px;
    border-radius: 50px;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.2s, box-shadow 0.2s;
    width: 100%;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.last-played-btn:active {
    transform: scale(0.95);
}

.play-btn {
    background: linear-gradient(90deg, #ffb347, #ff6b6b);
    color: #1a0731;
    font-size: 1rem;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

.play-btn:hover {
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.6);
    transform: translateY(-2px);
}

.stop-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #bbb;
    font-size: 0.75rem;
    padding: 8px 20px;
    width: auto;
}

.stop-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.4);
}

.last-played-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s;
}

.last-played-close:hover {
    color: #fff;
}