/* ========== RESET & BASE ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(145deg, #f6f9fc 0%, #eef2f5 100%);
    color: #1a2a3a;
    line-height: 1.4;
    padding: 2rem 1.5rem;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* ========== HEADER ========== */
.header {
    text-align: center;
    margin-bottom: 3rem;
    position: relative;
}

.header h1 {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    letter-spacing: -0.5px;
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.header h1 i {
    background: none;
    background-clip: unset;
    -webkit-background-clip: unset;
    color: #2a5298;
    font-size: 2.5rem;
}

.sub {
    color: #4a627a;
    font-size: 1.1rem;
    margin-top: 0.6rem;
    font-weight: 400;
    border-top: 1px solid rgba(42, 82, 152, 0.2);
    display: inline-block;
    padding-top: 0.6rem;
}

/* ========== CONTROLS (búsqueda + filtros) ========== */
.controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2.5rem;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(8px);
    padding: 0.8rem 1.8rem;
    border-radius: 60px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03), 0 1px 2px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.search-box {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 40px;
    padding: 0.3rem 0.8rem 0.3rem 1.2rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid #dce5ec;
    transition: all 0.2s;
    flex: 1;
    max-width: 450px;
    min-width: 250px;
}

.search-box i {
    color: #7e95b0;
    font-size: 1rem;
}

.search-box input {
    border: none;
    padding: 0.7rem 0.5rem 0.7rem 0.8rem;
    font-size: 0.95rem;
    width: 100%;
    font-family: 'Inter', monospace;
    background: transparent;
    outline: none;
}

.search-box:focus-within {
    border-color: #2a5298;
    box-shadow: 0 0 0 3px rgba(42, 82, 152, 0.1);
}

.filter-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-btn {
    background: white;
    border: none;
    padding: 0.5rem 1.2rem;
    border-radius: 40px;
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    transition: 0.2s;
    color: #2c3e58;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid #cfdfed;
    font-family: inherit;
}

.filter-btn i {
    margin-right: 6px;
    font-size: 0.8rem;
}

.filter-btn.active {
    background: #1e3c72;
    color: white;
    border-color: #1e3c72;
    box-shadow: 0 6px 12px rgba(30, 60, 114, 0.2);
}

.filter-btn:hover:not(.active) {
    background: #e9f0f5;
    border-color: #b9d0e2;
    transform: translateY(-1px);
}

/* ========== GRID DE JUEGOS ========== */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

/* ========== TARJETA DE JUEGO ========== */
.game-card {
    background: #ffffff;
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 20px 30px -12px rgba(0, 0, 0, 0.1);
    transition: all 0.35s cubic-bezier(0.2, 0.9, 0.4, 1.1);
    backdrop-filter: blur(0px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

.game-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 28px 36px -14px rgba(0, 0, 0, 0.2);
}

/* zona imagen */
.card-img {
    position: relative;
    background: #11161c;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.game-card:hover .card-img img {
    transform: scale(1.03);
}

/* etiqueta de categoría flotante */
.game-cat {
    position: absolute;
    top: 14px;
    left: 14px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.25rem 0.9rem;
    border-radius: 30px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    border: 1px solid rgba(255, 255, 255, 0.25);
    z-index: 2;
}

/* contenido */
.card-content {
    padding: 1.3rem 1.2rem 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.game-title {
    font-size: 1.45rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #0a1c2f;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.game-title i {
    color: #3b6ba5;
    font-size: 1.2rem;
    opacity: 0.7;
}

.game-description {
    font-size: 0.85rem;
    line-height: 1.45;
    color: #3a546d;
    margin: 0.5rem 0 0.8rem 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;  /* Propiedad estándar para compatibilidad futura */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ========== NUEVOS ESTILOS PARA META-INFORMACIÓN (PLATAFORMA) ========== */
.game-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 0.8rem;
    align-items: center;
}

.platform-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    border-radius: 40px;
    padding: 0.25rem 0.9rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: white;
    width: fit-content;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.platform-badge i {
    font-size: 0.7rem;
}

/* badge tecnología SNC Games */
.tech-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #eef3fa;
    border-radius: 40px;
    padding: 0.25rem 0.9rem;
    font-size: 0.7rem;
    font-weight: 500;
    color: #1e3c72;
    width: fit-content;
}

.tech-badge i {
    font-size: 0.75rem;
}

/* ========== ESTADOS DE CARGA Y ERROR ========== */
.loading-state,
.error-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 48px;
    font-size: 1.1rem;
}

.loading-state i {
    font-size: 2.5rem;
    color: #2a5298;
    margin-bottom: 1rem;
    display: block;
}

.loading-state p {
    color: #4a627a;
}

.error-state i {
    font-size: 2.5rem;
    color: #dc3545;
    margin-bottom: 1rem;
    display: block;
}

.error-state {
    color: #721c24;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
}

/* footer nota */
.footer-note {
    text-align: center;
    margin-top: 3.5rem;
    padding: 1rem;
    font-size: 0.8rem;
    color: #6f8fae;
    border-top: 1px solid #d4e2ef;
}

/* mensaje cuando no hay resultados */
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 48px;
    font-size: 1.2rem;
    color: #4f6f8f;
}

.no-results i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: block;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .controls {
        flex-direction: column;
        align-items: stretch;
        border-radius: 30px;
    }
    
    .search-box {
        max-width: 100%;
    }
    
    .search-box input {
        width: 100%;
    }
    
    .filter-buttons {
        justify-content: center;
    }
}

@media (max-width: 640px) {
    body {
        padding: 1rem;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .games-grid {
        gap: 1.2rem;
    }
    
    /* Ajuste para móvil en game-meta */
    .game-meta {
        flex-direction: column;
        align-items: flex-start;
    }
    
    /* ========== BOTÓN VOLVER ========== */
    .back-button {
        position: absolute;
        left: 20px;
        top: 50%;
        transform: translateY(-50%);
        background: rgba(255, 255, 255, 0.9);
        border: 1px solid #cfdfed;
        border-radius: 40px;
        padding: 0.4rem 1rem;
        font-size: 0.9rem;
        font-weight: 500;
        color: #1e3c72;
        cursor: pointer;
        transition: all 0.2s ease;
        display: inline-flex;
        align-items: center;
        gap: 8px;
        backdrop-filter: blur(4px);
        font-family: inherit;
        z-index: 10;
    }
    
    .back-button:hover {
        background: white;
        border-color: #2a5298;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        transform: translateY(-50%) scale(1.02);
    }
    
    .back-button i {
        font-size: 0.9rem;
    }
    
    /* Responsive: en móviles el botón va arriba centrado */
    @media (max-width: 640px) {
        .back-button {
            position: static;
            transform: none;
            margin-bottom: 1rem;
            align-self: flex-start;
        }
        .header {
            display: flex;
            flex-direction: column;
            align-items: center;
        }
    }
}