/* styles.css - Pixel Art Retro Aesthetic */
:root {
    /* Retro 8-bit Palette */
    --bg-dark: #222034;
    --bg-surface: #323c39;
    --primary-frog: #6daa2c;
    /* Classic froggy green */
    --primary-frog-hover: #8fde5d;
    --text-main: #ffffff;
    --text-muted: #9badb7;
    --border-color: #14121d;
    --highlight: #fbf236;
    --shadow-color: #14121d;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Press Start 2P', cursive;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    /* Pixel Grid Background */
    background-image:
        linear-gradient(45deg, #14121d 25%, transparent 25%, transparent 75%, #14121d 75%, #14121d),
        linear-gradient(45deg, #14121d 25%, transparent 25%, transparent 75%, #14121d 75%, #14121d);
    background-size: 32px 32px;
    background-position: 0 0, 16px 16px;
    /* Keep pixel art crisp */
    image-rendering: pixelated;
}

/* Typography */
h1,
h2,
h3,
h4 {
    text-transform: uppercase;
    text-shadow: 4px 4px 0px var(--shadow-color);
    letter-spacing: 2px;
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 80px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 5%;
    background: var(--bg-surface);
    border-bottom: 4px solid var(--border-color);
    box-shadow: 0 4px 0 var(--shadow-color);
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
}

.frog-icon {
    font-size: 2rem;
    /* Pixel art blocky shadow */
    filter: drop-shadow(4px 4px 0 var(--shadow-color));
}

.logo h1 {
    font-size: 1.5rem;
    color: var(--primary-frog);
}

nav {
    display: flex;
    gap: 20px;
}

.nav-btn {
    background: var(--bg-surface);
    border: 4px solid var(--border-color);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 12px 16px;
    box-shadow: 4px 4px 0 var(--shadow-color);
    transition: transform 0.1s, box-shadow 0.1s;
    text-transform: uppercase;
}

.nav-btn:active {
    transform: translate(4px, 4px);
    box-shadow: 0 0 0 var(--shadow-color);
}

.nav-btn.active {
    color: var(--bg-dark);
    background: var(--primary-frog);
}

/* Main Container */
.container {
    padding: 120px 5% 60px;
    max-width: 1400px;
    margin: 0 auto;
}

/* Hero Section */
.hero {
    margin-bottom: 60px;
    padding: 40px;
    background: var(--bg-surface);
    border: 6px solid var(--border-color);
    box-shadow: 8px 8px 0 var(--shadow-color);
    position: relative;
    text-align: center;
}

.hero-content h2 {
    font-size: 2rem;
    margin-bottom: 24px;
    color: var(--highlight);
}

.hero-content p {
    font-size: 0.9rem;
    color: var(--text-main);
    line-height: 1.8;
    max-width: 800px;
    margin: 0 auto;
}

/* Layout with Sidebar */
.layout-with-sidebar {
    display: flex;
    gap: 40px;
    align-items: flex-start;
}

.main-content {
    flex-grow: 1;
    min-width: 0;
    /* Prevents flex items from overflowing */
}

.sidebar {
    width: 320px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 40px;
}

/* Advertisement Banners */
.ad-banner {
    background: #000;
    border: 4px solid var(--border-color);
    box-shadow: 8px 8px 0 var(--shadow-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    /* Diagonal warning stripes for retro feel */
    background-image: repeating-linear-gradient(45deg,
            #111,
            #111 10px,
            #000 10px,
            #000 20px);
}

.ad-label {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--highlight);
    color: var(--bg-dark);
    font-size: 0.5rem;
    padding: 4px 8px;
    border-bottom-left-radius: 4px;
    font-weight: bold;
    z-index: 2;
    border-bottom: 2px solid var(--border-color);
    border-left: 2px solid var(--border-color);
}

.ad-content {
    color: #444;
    font-size: 0.8rem;
    text-align: center;
    padding: 20px;
    z-index: 1;
    text-shadow: 1px 1px 0 #000;
}

.top-ad {
    width: 100%;
    height: 120px;
    margin-bottom: 40px;
}

.side-ad {
    width: 100%;
}

.side-ad:nth-child(1) {
    height: 250px;
}

.side-ad:nth-child(2) {
    height: 600px;
}

/* Library Section */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    flex-wrap: wrap;
    gap: 20px;
}

.section-header h3 {
    font-size: 1.5rem;
    color: var(--primary-frog);
}

#search-input {
    background: var(--bg-dark);
    border: 4px solid var(--border-color);
    color: var(--text-main);
    padding: 12px;
    font-family: inherit;
    font-size: 0.8rem;
    width: 300px;
    box-shadow: 4px 4px 0 var(--shadow-color);
}

#search-input:focus {
    outline: none;
    background: var(--bg-surface);
    border-color: var(--highlight);
}

/* Game Grid */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 40px;
}

/* Game Card */
.game-card {
    background: var(--bg-surface);
    border: 4px solid var(--border-color);
    box-shadow: 8px 8px 0 var(--shadow-color);
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
}

.game-card:hover {
    transform: translate(-4px, -4px);
    box-shadow: 12px 12px 0 var(--shadow-color);
    border-color: var(--highlight);
}

.game-card:active {
    transform: translate(8px, 8px);
    box-shadow: 0 0 0 var(--shadow-color);
}

.game-image {
    height: 160px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 4rem;
    border-bottom: 4px solid var(--border-color);
    /* Pixelated rendering for potential images */
    image-rendering: pixelated;
}

.placeholder-icon {
    filter: drop-shadow(4px 4px 0 var(--shadow-color));
}

.pixelated {
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    image-rendering: pixelated;
    font-family: 'Press Start 2P', monospace;
    text-shadow: 2px 2px 0 #000;
    display: inline-block;
    transform: scale(1.5);
}

/* Flat retro background colors for placeholders */
.bg-gradient-1 {
    background: #d95763;
}

.bg-gradient-2 {
    background: #597dce;
}

.bg-gradient-3 {
    background: #6daa2c;
}

.bg-gradient-4 {
    background: #d77bba;
}

.game-info {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.game-info h4,
.game-title {
    font-size: 1rem;
    margin-bottom: 12px;
    color: var(--highlight);
    text-shadow: 2px 2px 0 var(--shadow-color);
}

.game-info p {
    color: var(--text-muted);
    font-size: 0.7rem;
    margin-bottom: 24px;
    line-height: 1.5;
    flex-grow: 1;
}

.play-btn {
    width: 100%;
    padding: 16px;
    background: var(--primary-frog);
    border: 4px solid var(--border-color);
    box-shadow: 4px 4px 0 var(--shadow-color);
    color: var(--bg-dark);
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    text-transform: uppercase;
    font-weight: bold;
}

.game-card:hover .play-btn {
    background: var(--highlight);
}

/* Game Modal Overlay */
.game-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(34, 32, 52, 0.9);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    /* Hard pixel show/hide */
    transition: none;
}

.game-modal.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    width: 100%;
    height: 100vh;
    background: var(--bg-dark);
    border: none;
    box-shadow: none;
    display: flex;
    flex-direction: column;
}

.modal-header {
    height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    background: var(--bg-dark);
    border-bottom: 4px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1rem;
    color: var(--primary-frog);
    text-shadow: 2px 2px 0 var(--shadow-color);
}

.close-btn {
    background: #d95763;
    border: 4px solid var(--border-color);
    box-shadow: 4px 4px 0 var(--shadow-color);
    color: var(--text-main);
    font-size: 1.2rem;
    cursor: pointer;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    line-height: 1;
    /* fix font alignment */
}

.close-btn:active {
    transform: translate(4px, 4px);
    box-shadow: 0 0 0 var(--shadow-color);
}

.iframe-container {
    flex-grow: 1;
    position: relative;
    background: #000;
    /* iframe bg */
}

#game-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    /* optional: pixelated upscaling for canvas games */
    image-rendering: pixelated;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .container {
        padding: 100px 3% 40px;
    }
    
    .games-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 20px;
    }

    .sidebar {
        width: 250px;
    }

    .game-modal {
        padding: 0;
    }
    
    .modal-content {
        height: 100%;
        width: 100%;
    }
}


@media (max-width: 768px) {
    .navbar {
        height: 70px;
        padding: 0 15px;
    }

    .logo h1 {
        font-size: 1rem;
    }

    .container {
        padding-top: 90px;
    }

    .hero {
        padding: 20px;
        margin-bottom: 30px;
    }

    .hero-content h2 {
        font-size: 1.2rem;
    }

    .hero-content p {
        font-size: 0.7rem;
    }

    .layout-with-sidebar {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        order: 2; /* Sidebar below games on mobile */
    }

    .main-content {
        order: 1;
        width: 100%;
    }

    .modal-header {
        height: 60px;
        padding: 0 15px;
    }

    .close-btn {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }


    .side-ad {
        max-width: 100%;
        height: auto;
        min-height: 200px;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    #search-input {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .navbar {
        padding: 0 10px;
    }

    .logo {
        gap: 8px;
    }

    .frog-icon {
        font-size: 1.5rem;
    }

    .nav-btn {
        padding: 8px 10px;
        font-size: 0.6rem;
    }

    .games-grid {
        grid-template-columns: 1fr;
    }

    .game-card {
        max-width: 100%;
    }
}