/* Estilos para las tarjetas flip de juegos destacados */
*, *:before, *:after {
    box-sizing: border-box;
}

.flip-cards-container {
    display: flex;
    margin: 2rem auto;
    justify-content: center;
    align-items: flex-start;
    flex-wrap: wrap;
    max-width: 1400px;
    gap: 1.5rem;
    padding: 1rem;
}

.game-card {
    color: inherit;
    cursor: pointer;
    width: calc(16.66% - 1.5rem); /* 6 por fila en desktop */
    min-width: 200px;
    height: 300px;
    perspective: 1000px;
    position: relative;
    transition: transform 0.3s ease;
    text-decoration: none !important;
    transform-style: preserve-3d;
}

.game-card * {
    pointer-events: none;
}

/* Asegurar que el contenedor de las tarjetas mantenga el 3D */
.flip-cards-container {
    transform-style: preserve-3d;
}

/* Responsive: 4 cards en tablets */
@media screen and (max-width: 1200px) {
    .game-card {
        width: calc(25% - 1.5rem); /* 4 por fila */
    }
}

/* Responsive: 3 cards en móviles grandes */
@media screen and (max-width: 768px) {
    .game-card {
        width: calc(33.33% - 1.5rem); /* 3 por fila */
        height: 280px;
    }
}

/* Responsive: 2 cards en móviles (todas las pantallas pequeñas) */
@media screen and (max-width: 600px) {
    .game-card {
        width: calc(50% - 0.5rem); /* 2 por fila */
        min-width: 0;
        max-width: 180px;
        height: 200px;
    }
    .flip-cards-container {
        gap: 0.5rem;
        padding: 0.25rem;
        justify-content: space-evenly;
    }

    .card-back {
        padding: 0.75rem 0.25rem;
    }

    .game-title {
        font-size: 0.75rem;
        padding: 0 0.25rem;
        -webkit-line-clamp: 2;
        line-height: 1.2;
    }

    .price-special {
        font-size: 1rem;
    }

    .price-original {
        font-size: 0.65rem;
    }

    .offer-label {
        font-size: 0.55rem;
        padding: 0.2rem 0.4rem;
    }

    .discount-badge {
        font-size: 0.6rem;
        padding: 3px 6px;
        top: 6px;
        right: 6px;
    }

    .console-badge {
        font-size: 0.55rem;
        padding: 3px 6px;
        bottom: 6px;
        left: 6px;
    }
}

.card-front,
.card-back {
    display: flex;
    border-radius: 8px;
    background-position: center;
    background-size: cover;
    text-align: center;
    justify-content: center;
    align-items: center;
    position: absolute;
    height: 100%;
    width: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform-style: preserve-3d;
    transition: ease-in-out 600ms;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.card-front {
    background-size: cover;
    background-position: center;
    font-size: 1.2rem;
    font-weight: 600;
    color: #fff;
    overflow: hidden;
    position: absolute;
    z-index: 2;
    transform: rotateY(0deg);
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.card-front::before {
    position: absolute;
    display: block;
    content: '';
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15), rgba(118, 75, 162, 0.15));
    z-index: 1;
}

.card-front img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.discount-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: bold;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(245, 87, 108, 0.4);
}

.console-badge {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.7rem;
    font-weight: 600;
    z-index: 2;
}

.game-card:hover .card-front {
    transform: rotateY(180deg);
    z-index: 0 !important;
}

.game-card:nth-child(even):hover .card-front {
    transform: rotateY(-180deg);
    z-index: 0 !important;
}

.card-back {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transform: rotateY(-180deg);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    z-index: 1;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.game-card:hover .card-back {
    transform: rotateY(0deg);
    z-index: 100 !important;
}

.game-card:nth-child(even) .card-back {
    transform: rotateY(180deg);
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    z-index: 1;
}

.game-card:nth-child(even):hover .card-back {
    transform: rotateY(0deg);
    z-index: 100 !important;
}

.card-back-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    justify-content: center;
    align-items: center;
    padding: 0;
    z-index: 10;
    position: relative;
    gap: 1rem;
}

.game-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 0;
    line-height: 1.3;
    text-align: center;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    padding: 0 1rem;
}

.game-description {
    display: none;
}

.price-section {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.price-original {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: line-through;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.price-special {
    font-size: 1.5rem;
    font-weight: 900;
    color: #ffffff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    letter-spacing: 0.5px;
}

.offer-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.95);
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    background: rgba(255, 255, 255, 0.15);
    padding: 0.3rem 0.6rem;
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

/* Paginación */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 2rem 0;
    gap: 0.5rem;
}

.pagination-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.pagination-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-info {
    color: #fff;
    font-weight: 600;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
}

/* Animación de entrada */
.game-card {
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Delay progresivo para las cards */
.game-card:nth-child(1) { animation-delay: 0.1s; }
.game-card:nth-child(2) { animation-delay: 0.15s; }
.game-card:nth-child(3) { animation-delay: 0.2s; }
.game-card:nth-child(4) { animation-delay: 0.25s; }
.game-card:nth-child(5) { animation-delay: 0.3s; }
.game-card:nth-child(6) { animation-delay: 0.35s; }
.game-card:nth-child(7) { animation-delay: 0.4s; }
.game-card:nth-child(8) { animation-delay: 0.45s; }
.game-card:nth-child(9) { animation-delay: 0.5s; }
.game-card:nth-child(10) { animation-delay: 0.55s; }
.game-card:nth-child(11) { animation-delay: 0.6s; }
.game-card:nth-child(12) { animation-delay: 0.65s; }

/* Estado de carga */
.loading-state {
    text-align: center;
    padding: 3rem;
    color: #fff;
}

.loading-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
