/* Homepage Specific Styles */

/* ========== Hero Section ========== */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    padding: var(--spacing-3xl) 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    margin-bottom: var(--spacing-md);
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
}

.hero-subtitle {
    font-size: var(--text-xl);
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: var(--spacing-md);
}

/* ========== Search Container ========== */
.search-container {
    display: flex;
    max-width: 500px;
    margin: 0 auto;
    background-color: white;
    border-radius: var(--radius-full);
    overflow: hidden;
    box-shadow: var(--shadow-xl);
}

.search-input {
    flex: 1;
    border: none;
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: var(--text-lg);
    color: var(--text-primary);
    background: transparent;
}

.search-input:focus {
    outline: none;
    box-shadow: none;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-btn {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: var(--spacing-md) var(--spacing-lg);
    cursor: pointer;
    font-size: var(--text-xl);
    transition: background-color var(--transition-fast);
}

.search-btn:hover {
    background-color: var(--secondary);
}

.clear-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: var(--spacing-sm);
    font-size: var(--text-lg);
    transition: color var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
}

.clear-btn:hover {
    color: var(--text-primary);
}

/* ========== Filter Section ========== */
.filter-section {
    padding: var(--spacing-2xl) 0;
    background-color: var(--surface);
    border-bottom: 1px solid var(--border);
}

.filter-buttons {
    display: flex;
    justify-content: center;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.filter-btn {
    padding: var(--spacing-sm) var(--spacing-lg);
    background-color: var(--surface-light);
    color: var(--text-secondary);
    border: 2px solid transparent;
    border-radius: var(--radius-full);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.filter-btn:hover {
    background-color: var(--background);
    color: var(--text-primary);
}

.filter-btn.active {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ========== Featured Section ========== */
.section-title {
    text-align: center;
    margin-bottom: var(--spacing-2xl);
    position: relative;
    display: inline-block;
    width: 100%;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: var(--radius-full);
}

.hero .featured-section {
    padding: var(--spacing-sm) 0 0;
}

.hero .section-title {
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.hero .section-title::after {
    background: white;
    /* Make the underline white instead of a dark gradient */
}

.featured-carousel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-lg);
    margin-top: var(--spacing-xl);
}

.featured-carousel .game-thumbnail {
    aspect-ratio: 21/9;
    /* Wider aspect ratio physically shortens the image height */
}

.featured-carousel .game-card-body {
    padding: var(--spacing-sm) var(--spacing-md);
    /* Less vertical white space */
}

.featured-carousel .game-description {
    -webkit-line-clamp: 1;
    /* Squish description to a single line */
    line-clamp: 1;
}

/* ========== Games Section ========== */
.games-section {
    padding: var(--spacing-lg) 0;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--spacing-lg);
    margin-top: var(--spacing-xl);
}

/* ========== Game Card ========== */
.game-card {
    background-color: var(--surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-base);
    cursor: pointer;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.game-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary);
}

.game-thumbnail {
    width: 100%;
    aspect-ratio: 16/9;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.game-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
    background-color: transparent;
}

.game-thumbnail span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.game-card-body {
    padding: var(--spacing-md);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.game-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.game-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.game-category {
    display: inline-block;
    padding: 4px 12px;
    background-color: var(--surface-light);
    color: var(--text-secondary);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    border: 1px solid var(--border);
}

.game-difficulty {
    display: inline-block;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    color: white;
}

.difficulty-easy {
    background-color: #22c55e;
}

.difficulty-medium {
    background-color: #f59e0b;
}

.difficulty-hard {
    background-color: #ef4444;
}


.game-description {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    margin: var(--spacing-sm) 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.play-count {
    color: var(--text-muted);
    font-size: var(--text-xs);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

/* ========== Recently Played Section ========== */
.recent-section {
    padding: var(--spacing-3xl) 0;
    background-color: var(--surface);
}

.recent-games {
    display: flex;
    gap: var(--spacing-lg);
    overflow-x: auto;
    padding: var(--spacing-md) 0;
    scroll-behavior: smooth;
}

.recent-games::-webkit-scrollbar {
    height: 8px;
}

.recent-games::-webkit-scrollbar-track {
    background: var(--surface-light);
    border-radius: var(--radius-full);
}

.recent-games::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: var(--radius-full);
}

.recent-game-card {
    min-width: 200px;
    width: 240px;
    /* Constrain exact card width in the horizontal scroller */
    flex-shrink: 0;
}

/* ========== Responsive Design ========== */
@media (max-width: 1024px) {
    .games-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

@media (max-width: 768px) {
    .hero {
        padding: var(--spacing-2xl) 0;
    }

    .hero-title {
        font-size: clamp(1.5rem, 6vw, 2.5rem);
        white-space: normal;
    }

    .hero-subtitle {
        font-size: var(--text-base);
    }

    .search-container {
        flex-direction: column;
        border-radius: var(--radius-lg);
    }

    .search-input {
        border-bottom: 1px solid var(--border);
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }

    .search-btn {
        border-radius: 0 0 var(--radius-lg) var(--radius-lg);
        padding: var(--spacing-md);
    }

    .filter-buttons {
        justify-content: flex-start;
        overflow-x: auto;
        padding: 0 var(--spacing-md);
        gap: var(--spacing-sm);
    }

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

    .game-thumbnail {
        min-height: 120px;
        max-height: 150px;
    }
}

@media (max-width: 480px) {
    .games-grid {
        grid-template-columns: 1fr 1fr;
    }
}