/* Game Catalog Styles - Optimized for v3.0 */
@import url("frameforge-ui.css");

.games-header {
    min-height: 45vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 120px 20px 90px;
    text-align: center;
    background: radial-gradient(ellipse at top, rgb(99 102 241 / 12%) 0%, transparent 70%);
    position: relative;
    overflow: hidden;
}

.games-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: 
        radial-gradient(circle at 30% 20%, rgb(99 102 241 / 8%) 0%, transparent 50%),
        radial-gradient(circle at 70% 80%, rgb(6 182 212 / 6%) 0%, transparent 50%);
    pointer-events: none;
}

.header-content {
    max-width: 850px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.games-header h1 {
    font-size: 3.5rem;
    font-weight: 900;
    margin-bottom: 20px;
    background: linear-gradient(135deg, var(--text) 20%, var(--primary-light) 80%);
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.games-header p {
    font-size: 1.15rem;
    color: var(--text-secondary);
    margin-bottom: 48px;
    line-height: 1.6;
}

#totalCount {
    color: var(--primary-light);
    font-weight: 800;
    text-shadow: 0 0 20px rgb(99 102 241 / 40%);
}

/* Search Container */
.search-container {
    position: relative;
    max-width: 500px;
    margin: 0 auto;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 24px;
}

#gameSearch {
    width: 100%;
    padding: 14px 16px 14px 52px;
    background: var(--bg-input);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 1rem;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--shadow);
}

#gameSearch:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

/* Games Grid */
.games-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px 80px;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 24px;
    min-height: 400px;
}

/* Game Card Link Wrapper */
.game-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
    border-radius: var(--radius-lg);
    outline: none;
}

.game-card-link:focus-visible .game-card {
    box-shadow: 0 0 0 2px var(--primary);
}

/* Game Card */
.game-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 16px rgb(0 0 0 / 30%);
    position: relative;
    cursor: pointer;
}

.game-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgb(99 102 241 / 5%) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.game-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: var(--border-bright);
    background: rgb(25 25 38 / 80%);
    box-shadow: 0 16px 48px rgb(0 0 0 / 50%), 0 0 0 1px rgb(99 102 241 / 20%) inset;
}

.game-card:hover::before {
    opacity: 1;
}

.game-artwork {
    position: relative;
    aspect-ratio: 2/3;
    overflow: hidden;
    background: linear-gradient(135deg, rgb(20 20 32 / 80%) 0%, rgb(30 30 45 / 80%) 100%);
}

.game-artwork img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.game-card:hover .game-artwork img {
    transform: scale(1.15);
}

.game-artwork img.fallback {
    object-fit: contain;
    padding: 40px;
    filter: grayscale(1) opacity(0.15);
}

.game-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    padding: 5px 12px;
    background: rgb(0 0 0 / 75%);
    backdrop-filter: blur(12px);
    border-radius: 24px;
    font-size: 0.7rem;
    font-weight: 800;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    border: 1px solid rgb(255 255 255 / 15%);
    box-shadow: 0 4px 12px rgb(0 0 0 / 40%);
}

.game-info {
    padding: 18px;
    background: linear-gradient(180deg, rgb(15 15 24 / 60%) 0%, rgb(20 20 32 / 80%) 100%);
}

.game-info h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0 0 6px;
    color: var(--text);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    letter-spacing: -0.01em;
}

.game-info p {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0;
    font-family: 'JetBrains Mono', Consolas, monospace;
    background: rgb(99 102 241 / 8%);
    padding: 4px 8px;
    border-radius: 6px;
    display: inline-block;
}

/* State Indicators */
.loader,
.no-results,
.error-box {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 100px 20px;
    text-align: center;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgb(99 102 241 / 10%);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

.no-results .material-symbols-rounded,
.error-box .material-symbols-rounded {
    font-size: 64px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.no-results a {
    color: var(--primary-light);
    text-decoration: none;
}

.no-results a:hover {
    text-decoration: underline;
}

.error-box .material-symbols-rounded {
    color: var(--danger);
}

/* Crowdsource Banner */
.crowdsource-banner {
    background: linear-gradient(135deg, rgb(99 102 241 / 8%), rgb(6 182 212 / 8%));
    backdrop-filter: var(--glass-blur);
    border: 1px solid rgb(99 102 241 / 20%);
    border-radius: var(--radius-xl);
    padding: 28px 36px;
    margin: 0 auto 48px;
    max-width: 900px;
    display: flex;
    align-items: center;
    gap: 28px;
    box-shadow: 0 8px 32px rgb(0 0 0 / 30%);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.crowdsource-banner::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgb(99 102 241 / 5%) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.35s;
}

.crowdsource-banner:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 48px rgb(99 102 241 / 20%);
    border-color: rgb(99 102 241 / 40%);
}

.crowdsource-banner:hover::before {
    opacity: 1;
}

.crowdsource-icon {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 8px 24px var(--primary-glow);
    position: relative;
    z-index: 1;
}

.crowdsource-icon .material-symbols-rounded {
    color: white;
    font-size: 32px;
}

.crowdsource-text {
    position: relative;
    z-index: 1;
}

.crowdsource-text h3 {
    margin: 0 0 8px;
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
}

.crowdsource-text p {
    margin: 0;
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Responsive */
@media (width <= 768px) {
    .games-header h1 {
        font-size: 2.25rem;
    }

    .games-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }

    .crowdsource-banner {
        flex-direction: column;
        text-align: center;
        padding: 24px;
    }
}

/* API Credits Footer */
.api-credits {
    text-align: center;
    padding: 20px;
    margin-top: 20px;
}

.api-credits p {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    padding: 10px 20px;
    border-radius: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.api-credits a {
    color: var(--primary-light);
    text-decoration: none;
    font-weight: 700;
    transition: all 0.2s ease;
}

.api-credits a:hover {
    color: var(--primary);
    text-shadow: 0 0 10px var(--primary-glow);
}