/* Using variables for easy theme management */
:root {
    --bg-color: #f4f7fa;
    --text-color: #333;
    --card-bg: #ffffff;
    --primary-color: #007bff;
    --primary-hover: #0056b3;
    --navbar-bg: rgba(255, 255, 255, 0.8);
    --shadow-color: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --card-bg: #1e1e1e;
    --primary-color: #00f2ea;
    --primary-hover: #00b8b2;
    --navbar-bg: rgba(20, 20, 20, 0.8);
    --shadow-color: rgba(0, 0, 0, 0.4);
}

/* General Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
    line-height: 1.6;
}

/* Header and Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 5%;
    background-color: var(--navbar-bg);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--shadow-color);
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-color);
    text-decoration: none;
}
.logo span {
    color: var(--primary-color);
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 2rem;
}

.nav-item {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 600;
    padding: 0.5rem 0;
    position: relative;
    transition: color 0.3s;
}
.nav-item:hover, .nav-item.active {
    color: var(--primary-color);
}
.nav-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 3px;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}
.nav-item.active::after {
    width: 100%;
}

.theme-btn {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 4rem 1rem;
}
.hero h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

/* Game Grid */
.games-container {
    padding: 2rem 5%;
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.game-card {
    background-color: var(--card-bg);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 8px 20px var(--shadow-color);
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.game-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 12px 30px var(--shadow-color);
}

.card-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.card-content {
    padding: 1.5rem;
}

.card-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.card-category {
    font-size: 0.9rem;
    color: var(--primary-color);
    font-weight: 600;
}

/* Game View (Popup for playing the game) */
.game-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    transition: opacity 0.3s;
}
.game-view.hidden {
    opacity: 0;
    pointer-events: none;
}

#game-frame {
    width: 90%;
    height: 90%;
    max-width: 1200px;
    background-color: #000;
    border-radius: 10px;
    border: 2px solid var(--primary-color);
}

.close-btn {
    position: absolute;
    top: 2rem;
    right: 2rem;
    background: var(--primary-color);
    color: var(--bg-color);
    border: none;
    font-size: 2rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    line-height: 40px;
    text-align: center;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 1rem;
    margin-top: 2rem;
    border-top: 1px solid var(--shadow-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-links {
        display: none; /* Simple hiding for now, can be replaced with a hamburger menu */
    }
    .hero h1 {
        font-size: 2.5rem;
    }
}