/* General Body & Font Styling */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    background-color: #1a1a2e;
    color: #e0e0e0;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

a {
    color: #ff6347;
    text-decoration: none;
    transition: color 0.3s;
}

a:hover {
    color: #ff8a75;
}

/* Header */
header {
    background-color: #162447;
    padding: 1rem 0;
    border-bottom: 2px solid #ff6347;
    position: sticky;
    top: 0;
    z-index: 1000;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-link {
    display: flex;
    align-items: center;
    font-weight: bold;
    color: #e0e0e0;
}

.logo {
    height: 40px;
    margin-right: 15px;
    transition: height 0.3s ease; /* Add this line */
}

.nav-link {
    font-size: 1.1rem;
    font-weight: bold;
}

/* Main Content */
main {
    padding: 2rem 0;
}

/* Controls: Search and Filter */
.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    gap: 20px;
}

#searchInput {
    flex-grow: 1;
    padding: 12px;
    font-size: 1rem;
    border-radius: 5px;
    border: 1px solid #333;
    background-color: #2a2a3e;
    color: #e0e0e0;
}

.filter-buttons button {
    padding: 10px 20px;
    margin-left: 10px;
    border: none;
    background-color: #333;
    color: #e0e0e0;
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.3s;
}

.filter-buttons button.active,
.filter-buttons button:hover {
    background-color: #ff6347;
}

/* Game Grid */
#game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.game-card {
    background-color: #1f4068;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
}

.game-card a {
    display: block;
    color: inherit;
}

.game-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

.card-content {
    padding: 1rem;
}

.card-content h3 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    color: #fff;
}

.card-content p {
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.category-tag {
    display: inline-block;
    background-color: #ff6347;
    color: #fff;
    padding: 0.3rem 0.6rem;
    border-radius: 5px;
    font-size: 0.8rem;
    font-weight: bold;
}


/* Game Page */
#game-area {
    background-color: #162447;
    padding: 2rem;
    border-radius: 10px;
    text-align: center;
}

#game-area h2 {
    color: #ff6347;
}

/* The actual game embed - you might need to style this further */
.game-embed {
    width: 100%;
    /* A common aspect ratio for games */
    aspect-ratio: 16 / 9;
    background-color: #000;
    border: none;
    border-radius: 5px;
}


/* Footer */
footer {
    background-color: #162447;
    padding: 1.5rem 0;
    margin-top: 2rem;
    border-top: 2px solid #333;
    text-align: center;
}

footer .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

footer nav a {
    margin-left: 20px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-buttons {
        margin-top: 1rem;
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .filter-buttons button {
        margin-left: 0;
    }

    footer .container {
        flex-direction: column;
    }
    footer nav {
        margin-top: 10px;
    }
}

/* Styling for the container holding multiple category tags */
.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 5px; /* This creates space between the tags */
}


/* --- Dropdown Filter Styles --- */
.filter-dropdown {
    position: relative;
    width: 250px; /* Adjust width as needed */
}

.filter-toggle-btn {
    width: 100%;
    padding: 10px 15px;
    background-color: #333;
    color: #e0e0e0;
    border: 1px solid #555;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1rem;
}

.filter-toggle-btn:hover {
    background-color: #ff6347;
}

.filter-toggle-btn svg {
    transition: transform 0.2s ease-in-out;
}

.filter-dropdown.is-open .filter-toggle-btn svg {
    transform: rotate(180deg);
}

.filter-menu {
    display: none; /* Hidden by default */
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: #2a2a3e;
    border: 1px solid #555;
    border-radius: 5px;
    z-index: 10;
    margin-top: 5px;
    max-height: 300px;
    overflow-y: auto;
    padding: 5px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.5);
}

.filter-dropdown.is-open .filter-menu {
    display: block; /* Shown when dropdown is open */
}

.filter-menu label {
    display: block;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 3px;
    color: #e0e0e0;
}

.filter-menu label:hover {
    background-color: #1f4068;
}

.filter-menu label input {
    margin-right: 10px;
}

#clear-filters-btn {
    width: 100%;
    background: #ff6347;
    border: none;
    color: white;
    padding: 10px;
    margin-top: 5px;
    border-radius: 3px;
    cursor: pointer;
}


/* The actual game embed */
.game-embed {
    width: 100%;
    /* A common aspect ratio for games */
    aspect-ratio: 16 / 9;
    background-color: #000; /* Shows a black box while loading */
    border: none;
    border-radius: 5px;
}


/* --- Game Page Header Collapse --- */
#collapse-header-btn {
    display: flex; /* Now visible on all screens */
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    padding: 0;
    justify-content: center;
    align-items: center;
}

#collapse-header-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

#collapse-header-btn .icon-expand {
    display: none; /* The "down arrow" is hidden initially */
}

/* This is the state when the header is collapsed */
#game-page-header.header-collapsed {
    transform: translateY(-100%);
    padding-bottom: 0;
}

#game-page-header.header-collapsed #collapse-header-btn {
    transform: translateY(calc(100% + 10px)); /* Move button down to be visible */
    background-color: #ff6347;
}

#game-page-header.header-collapsed .icon-collapse {
    display: none; /* Hide the "up arrow" */
}

#game-page-header.header-collapsed .icon-expand {
    display: block; /* Show the "down arrow" */
}

#game-page-header {
    transition: transform 0.3s ease-in-out;
}

/* Style for when the title is hidden, making the logo larger */
.logo-link.title-hidden .logo {
    height: 100px; /* Increase the height */
    margin-right: 0; /* Remove the margin since there's no title */
}