@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg-body: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --bg-card-hover: rgba(51, 65, 85, 0.8);
    --bg-glass: rgba(15, 23, 42, 0.6);
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: #ec4899;
    --accent: #22d3ee;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.08);
    --glass-border: 1px solid rgba(255, 255, 255, 0.08);
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --radius-lg: 1rem;
    --radius-md: 0.75rem;
    --radius-sm: 0.5rem;
}

/* --- Global Reset & Base --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    outline: none;
}

html,
body {
    max-width: 100% !important;
    overflow-x: hidden !important;
    background-color: var(--bg-body);
    font-family: var(--font-body);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    /* Premium dark gradient background */
    background-image:
        radial-gradient(circle at 0% 0%, rgba(99, 102, 241, 0.15), transparent 40%),
        radial-gradient(circle at 100% 100%, rgba(236, 72, 153, 0.15), transparent 40%);
    background-attachment: fixed;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

img,
iframe {
    max-width: 100%;
    height: auto;
    display: block;
}

ul {
    list-style: none;
}

button {
    cursor: pointer;
    border: none;
    font-family: inherit;
}

/* --- Layout Utilities --- */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

@media (min-width: 768px) {
    .container {
        padding: 0 2rem;
    }
}

.section-title {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: #fff;
    position: relative;
}

.section-title::before {
    content: '';
    display: block;
    width: 6px;
    height: 32px;
    background: linear-gradient(to bottom, var(--primary), var(--secondary));
    border-radius: 4px;
}

/* --- Components --- */
/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    transition: var(--transition);
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #818cf8);
    color: white;
    box-shadow: 0 4px 15px -3px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.6);
}

/* Glass Card */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: var(--glass-border);
    border-radius: var(--radius-lg);
}

/* --- Header & Navbar --- */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: var(--glass-border);
    padding: 1rem 0;
    transition: var(--transition);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo img {
    max-height: 48px;
}

/* Nav Menu */
.nav-menu {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.nav-link {
    padding: 0.6rem 1rem;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.95rem;
}

.nav-link:hover,
.nav-link.active {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.icon-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    transition: var(--transition);
}

.icon-btn:hover {
    background: var(--primary);
    color: white;
    transform: rotate(10deg);
}

.mobile-toggle {
    display: none;
}

/* Hidden on desktop */

/* Mobile Nav Drawer */
@media (max-width: 900px) {
    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: #1e293b;
        flex-direction: column;
        justify-content: flex-start;
        padding: 5rem 1.5rem;
        transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
        z-index: 99;
    }

    .nav-menu.active {
        right: 0;
    }

    .nav-link {
        width: 100%;
        display: block;
        padding: 1rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    .mobile-toggle {
        display: flex;
        z-index: 101;
    }
}

/* --- Hero & Categories --- */
.categories-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 3rem;
    justify-content: center;
}

.category-item a {
    display: inline-block;
    padding: 0.6rem 1.25rem;
    background: var(--bg-card);
    border: var(--glass-border);
    border-radius: 2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.category-item a:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* --- Game Cards --- */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

/* Mobile grid adjust */
@media (max-width: 480px) {
    .games-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }
}

.game-card {
    display: block;
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    aspect-ratio: 1/1;
    /* Square cards */
    background: var(--bg-card);
    transition: var(--transition);
    border: var(--glass-border);
}

.game-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: var(--shadow-lg);
    border-color: rgba(99, 102, 241, 0.5);
    z-index: 10;
}

.product__item__pic {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    position: relative;
}

.product__item__pic::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, transparent 60%);
    opacity: 0.8;
    transition: var(--transition);
}

.game-card:hover .product__item__pic::before {
    opacity: 0.6;
}

.product__item__title {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 1rem;
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    z-index: 2;
}

/* --- Popular Slider --- */
.popular__product {
    padding: 2rem 0 0 0;
}

.popular-slider-container {
    position: relative;
    margin-bottom: 3rem;
}

.popular-slider {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 1rem 0.5rem 2rem 0.5rem;
    /* Space for shadow */
    scrollbar-width: none;
}

.popular-slider::-webkit-scrollbar {
    display: none;
}

.slider-item {
    min-width: 200px;
    flex-shrink: 0;
}

.slider-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.slider-nav:hover {
    background: var(--primary);
}

.slider-nav.prev {
    left: -20px;
}

.slider-nav.next {
    right: -20px;
}

/* --- Game Page Layout --- */
.game-page-container {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 2rem;
    margin-top: 2rem;
}

@media (max-width: 1024px) {
    .game-page-container {
        grid-template-columns: 1fr;
    }
}

.game-main-section {
    width: 100%;
}

.game-header {
    margin-bottom: 1.5rem;
}

.game-title {
    font-family: var(--font-heading);
    font-size: 2.25rem;
    font-weight: 700;
    background: linear-gradient(to right, #fff, #cbd5e1);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.game-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.game-frame-container {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    /* 16:9 Aspect Ratio */
    background: #000;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.game-frame-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.game-description {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius-lg);
    border: var(--glass-border);
    margin-top: 2rem;
    backdrop-filter: blur(10px);
}

.game-description h3 {
    color: white;
    margin-bottom: 1rem;
    font-family: var(--font-heading);
}

.game-description .text-muted {
    color: #cbd5e1;
}

.game-sidebar {
    width: 100%;
}

.related-games-sidebar {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: var(--glass-border);
}

.related-game {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.related-game:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(5px);
}

.related-game-img {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    object-fit: cover;
}

.related-game-title {
    font-weight: 600;
    color: white;
    font-size: 0.95rem;
    margin-bottom: 0.2rem;
}

.related-game-category {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* --- Footer --- */
.footer {
    background: rgba(15, 23, 42, 0.9);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding: 4rem 0 2rem 0;
    margin-top: 4rem;
    position: relative;
    backdrop-filter: blur(20px);
}

.footer-links li a {
    color: var(--text-muted);
    transition: var(--transition);
}

.footer-links li a:hover {
    color: var(--primary);
    text-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

.copyright {
    color: #64748b;
    font-size: 0.9rem;
}

/* --- Search Modal --- */
.search-model {
    display: none;
    position: fixed;
    width: 100%;
    height: 100%;
    left: 0;
    top: 0;
    background: rgba(15, 23, 42, 0.95);
    z-index: 9999;
    backdrop-filter: blur(15px);
}

.search-model-form input {
    width: 500px;
    max-width: 100%;
    font-size: 2rem;
    border: none;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
    background: transparent;
    color: white;
    padding: 1rem 0;
    text-align: center;
}

.search-close-switch {
    position: absolute;
    width: 50px;
    height: 50px;
    background: #333;
    color: #fff;
    text-align: center;
    border-radius: 50%;
    font-size: 20px;
    line-height: 50px;
    top: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    /* Above results */
    right: 30px;
    /* Instead of left: 50% */
}

/* Load More Button */
.load-more-btn {
    display: block;
    margin: 2rem auto;
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 3rem;
    border-radius: 2rem;
    font-weight: 600;
    transition: var(--transition);
    letter-spacing: 0.5px;
}

.load-more-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
}