/* ==========================================================================
   Base & Layout Alignment
   ========================================================================== */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: #0b0f19;
    color: #f3f4f6;
    font-family: 'Inter', sans-serif;
}

/* Prevent horizontal overflow on the page */
main {
    max-width: 1440px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    overflow-x: hidden;
}

.flex-1 {
    min-width: 0;
}

/* ==========================================================================
   Navigation
   ========================================================================== */
.navbar {
    background-color: rgba(15, 23, 42, 0.95);
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   Games Grid & Cards (Flicker-Free Optimization)
   ========================================================================== */
#main-games-grid {
    min-height: 280px;
    contain: layout style;
    content-visibility: auto;
}

.game-card {
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1rem;
    overflow: hidden;
    background: #12141f;
    transform: translateZ(0);
    backface-visibility: hidden;
    will-change: transform;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.game-card:hover {
    transform: translateY(-2px);
    border-color: rgba(6, 182, 212, 0.5);
}

.game-card-placeholder {
    display: block;
    width: 100%;
    min-height: 250px;
    border-radius: 1rem;
    background: linear-gradient(135deg, rgba(27, 31, 40, 0.8), rgba(18, 20, 27, 0.9));
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* ==========================================================================
   Sidebar Category Menu
   ========================================================================== */
#category-menu .cat-btn {
    position: relative;
    overflow: hidden;
    transition: all 0.2s ease;
}

#category-menu .cat-btn:hover {
    transform: translateX(4px);
    border-color: rgba(6, 182, 212, 0.25);
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.12);
}

#category-menu .cat-btn.active {
    background: rgba(6, 182, 212, 0.18);
    border-color: rgba(6, 182, 212, 0.35);
    color: #22d3ee;
}

#category-menu .cat-btn .icon-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.04);
}

/* ==========================================================================
   Tags Filter Bar
   ========================================================================== */
#tags-filter-bar {
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#tags-filter-bar::-webkit-scrollbar {
    display: none;
}

.tag-pill {
    cursor: pointer;
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: #e5e7eb;
}

.tag-pill.active {
    background: #06b6d4 !important;
    color: #090d16 !important;
    border-color: #22d3ee !important;
}

/* ==========================================================================
   Pagination Controls
   ========================================================================== */
#pagination-controls button {
    transition: all 0.2s ease;
}

#pagination-controls button:hover:not(:disabled) {
    background: rgba(6, 182, 212, 0.14);
    color: white;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 768px) {
    .game-card {
        min-height: 200px;
    }

    #main-games-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 480px) {
    #main-games-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .game-card {
        min-height: 170px;
    }
}