/* --- MODERN SIDEBAR STYLES --- */
.sidebar {
    height: 100%; 
    width: 250px; 
    position: fixed; 
    z-index: 1000; 
    top: 0;
    left: 0;
    background-color: #000033; 
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    overflow-x: hidden; 
    padding-top: 20px;
    
    /* 1. HIDDEN BY DEFAULT: Move it off-screen */
    transform: translateX(-100%); 
    
    /* 2. NEW: This is the smooth animation */
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94); 

    /* 3. NEW: This tells the GPU to get ready */
    will-change: transform;
}

/* 4. NEW: This class is added by JS to open the sidebar */
.sidebar-open .sidebar {
    transform: translateX(0);
}

.sidebar-header {
    padding: 10px 20px 20px 32px;
    color: #ffffff;
    font-size: 1.5rem;
    text-align: left;
    white-space: nowrap;
}

/* (Sidebar links are unchanged) */
.nav-links { list-style: none; padding: 0; margin: 0; }
.nav-link { display: block; padding: 10px 15px 10px 32px; text-decoration: none; font-size: 1.2rem; color: #cccccc; transition: 0.3s; white-space: nowrap; }
.nav-link:hover { background-color: #1a1a7c; color: #ffffff; }
.nav-link.active { background-color: #3e3eff; color: #ffffff; border-left: 4px solid #ffffff; padding-left: 28px; }
.nav-link.disabled { color: #5a5a7b; cursor: not-allowed; }
.nav-link.disabled:hover { background-color: transparent; color: #5a5a7b; }
.sidebar .close-btn { position: absolute; top: 5px; right: 15px; font-size: 36px; color: #ffffff; text-decoration: none; }
.sidebar .close-btn:hover { color: #3e3eff; }

/* The "hamburger" menu button (☰) */
.open-nav-btn {
    font-size: 30px;
    cursor: pointer;
    background-color: transparent;
    color: white;
    padding: 0; 
    border: none;
    margin-bottom: 10px;
    transition: color 0.2s;
}
.open-nav-btn:hover {
    color: #3e3eff;
}


/* --- Main Content Area --- */
.main-content {
    padding: 20px;
    padding-top: 60px; /* Make room for hamburger btn */
    
    /* 1. NEW: This transition *must* match the sidebar's 0.4s */
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    margin-left: 0; /* Default state */

    /* 2. NEW: Tell the GPU to get ready */
    will-change: transform;
}

/* 3. NEW: This rule "pushes" the content when the sidebar is open */
.sidebar-open .main-content {
    transform: translateX(250px);
}


/* --- PAGE STYLES --- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0; 
    background: linear-gradient(135deg, #0d0d5b, #000020);
    background-attachment: fixed;
    /* NEW: This prevents a horizontal scrollbar during animation */
    overflow-x: hidden;
}

.header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 20px; 
}

.logo {
    height: 40px; 
    margin-right: 15px; 
}

h1 {
    color: #ffffff;
    margin: 0; 
}

#searchInput {
    width: 90%;
    max-width: 600px;
    display: block;
    margin: 20px auto 30px auto;
    padding: 12px 15px;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

#loading {
    text-align: center;
    font-size: 18px;
    color: #cccccc; 
}

#galleryContainer {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;

    /* NEW: Add a fade-in animation for when the data loads */
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

/* --- OPTIMIZED Individual Game Card --- */
.gameCard {
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    text-align: center;
    padding: 10px;
    transition: transform 0.2s;
    will-change: transform;
    cursor: pointer;
}

.gameCard:hover {
    transform: translateY(-5px);
    /* NEW: Re-adding a subtle shadow on *hover* is cheap */
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
}

.gameCard img {
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    border-radius: 4px;
    background-color: #eee;
}

.gameCard h3 {
    font-size: 1rem;
    color: #222;
    margin: 10px 0 5px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- GO TO TOP BUTTON STYLES (NOW WITH FADE) --- */
#goToTopBtn {
    /* NEW: Use opacity & visibility for fade-in/out */
    opacity: 0;
    visibility: hidden;
    
    position: fixed; 
    bottom: 30px;
    right: 30px;
    z-index: 99; 
    border: none;
    outline: none;
    background-color: #1a1a7c; 
    color: white;
    cursor: pointer;
    padding: 10px;
    border-radius: 50%; 
    font-size: 18px; 
    width: 50px;
    height: 50px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    
    /* NEW: Add transitions for the fade */
    transition: background-color 0.2s, opacity 0.3s, visibility 0.3s;
}

#goToTopBtn:hover {
    background-color: #3e3eff; 
}



/* --- NEW: Loader for Infinite Scroll --- */
.loader-bottom-hidden {
    display: none;
}
#loader-bottom {
    text-align: center;
    font-size: 18px;
    color: #cccccc;
    padding: 20px;
}

/* --- NEW: Footer Styles --- */
.site-footer {
    padding: 30px 20px;
    background-color: #000020; /* Darker than the background */
    color: #8a8a9e; /* Faded purple-gray text */
    text-align: center;
    font-size: 0.9rem;
    border-top: 1px solid #3e3eff;
}

.site-footer p {
    margin: 5px 0;
    line-height: 1.5;
}

/* For app pages, we need to add the sidebar margin */
.sidebar-open .site-footer {
    margin-left: 250px;
}

/* --- NEW: "No Results" Styles --- */
.no-results-hidden {
    display: none; /* Hidden by default */
} 
#noResults {
    text-align: center;
    color: #cccccc;
    padding: 40px;
}
