/* Redesign CSS for NoAdsGames */

:root {
    --sidebar-width: 240px;
    --header-height: 60px;
    --bg-dark: #1c1e22;
    --bg-darker: #131518;
    --primary-color: #6c5ce7;
    --text-color: #ffffff;
    --text-muted: #a0a0a0;
}

body {
    background-color: var(--bg-darker);
    color: var(--text-color);
    overflow-x: hidden;
}

/* Layout Wrapper */
.main-wrapper {
    display: flex;
    min-height: 100vh;
    padding-top: var(--header-height);
}

/* Sidebar */
.sidebar-container {
    width: 199px;
    background-color: #0C0D14;
    position: fixed;
    top: 60px;
    /* Below header */
    bottom: 0;
    left: 0;
    overflow-y: auto;
    z-index: 1000;
    padding: 10px 0;
    border-right: none;
    font-family: 'Nunito', sans-serif;
}

.sidebar-container::-webkit-scrollbar {
    width: 6px;
}

.sidebar-container::-webkit-scrollbar-track {
    background: #0C0D14;
}

.sidebar-container::-webkit-scrollbar-thumb {
    background-color: #333;
    border-radius: 3px;
}

.content-wrapper {
    margin-left: 199px;
    flex-grow: 1;
    padding: 20px;
    width: calc(100% - 199px);
    background-color: #0C0D14;
    /* Match sidebar for seamless look if needed, or keep body bg */
}

/* Header Adjustments */
nav.navbar.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    /* Hardcode or use variable if defined */
    background-color: #1c1e22;
    /* Use default or var */
    z-index: 1030;
    border-bottom: 1px solid #2a2a2a;
    padding: 0;
}

nav.navbar.top-nav .container-fluid {
    display: flex;
    align-items: center;
    height: 100%;
    justify-content: space-between;
}

/* Logo */
.site-logo-container {
    margin-right: 20px;
    display: flex;
    align-items: center;
}

/* Navigation Top (Search Bar Area) */
#navb {
    flex-grow: 1;
    display: flex !important;
    /* Force flex */
    align-items: center !important;
    justify-content: space-between !important;
    /* Spread content */
}

/* Reorder Navigation items to center search */
#navb .search-bar {
    order: 1;
    /* Center */
    width: 50%;
    max-width: 600px;
    margin: 0 auto;
}

#navb .navbar-nav {
    order: 2;
    /* Right */
    margin-left: 0 !important;
    flex-direction: row;
    display: flex;
}

#navb .nav-item {
    margin-left: 15px;
}

/* User Profile Header */
.user-profile-header {
    margin-left: 20px;
}

/* Search Input Styling */
.search-bar .form-control {
    border-radius: 20px 0 0 20px !important;
    background: #2a2a2a;
    border: 1px solid #333;
    color: #fff;
    border-right: none;
}

.search-bar .form-control:focus {
    background: #333;
    box-shadow: none;
    border-color: var(--primary-color);
    /* Assumes var is strictly defined or fallback */
}

.search-bar .btn-search {
    border-radius: 0 20px 20px 0 !important;
    background: #2a2a2a;
    /* Match input */
    border: 1px solid #333;
    border-left: none;
    color: #ccc;
}

.search-bar .btn-search:hover {
    background: #333;
    color: #fff;
}

/* Sidebar Links */
.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu li {
    margin-bottom: 2px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 0;
    color: #FFFFFF;
    text-decoration: none;
    height: 34px;
    font-size: 14px;
    font-weight: 700;
    transition: opacity 0.2s;
    border-left: 6px solid transparent;
}

.sidebar-menu a:hover {
    opacity: 0.8;
    background-color: transparent;
    color: #FFFFFF;
}

.sidebar-menu a.active {
    border-left: 6px solid #00bfff;
    color: #00bfff;
    background-color: rgba(0, 191, 255, 0.1);
    /* Light blue tint */
}

.sidebar-menu i,
.sidebar-menu img {
    width: 48px;
    /* Icon container width */
    display: flex;
    justify-content: center;
    align-items: center;
    margin-right: 0;
    font-size: 16px;
}

.sidebar-menu span {
    white-space: nowrap;
}

.sidebar-divider {
    height: 1px;
    background-color: #2a2a2a;
    margin: 10px 15px;
    display: none;
    /* CrazyGames doesn't have visible dividers usually */
}

/* Categories List Specifics */
.categories-menu li {
    padding: 0;
}

.categories-menu a {
    padding: 0;
    display: flex;
    align-items: center;
    height: 34px;
    color: #FFFFFF;
    font-weight: 700;
    font-size: 14px;
}

.sidebar-icon {
    width: 48px;
    height: 100%;
    padding: 8px 14px;
    /* Yields approx 20px icon (48-28=20) */
    box-sizing: border-box;
    display: block;
    object-fit: contain;
    margin: 0;
}

.sidebar-header {
    display: none;
    /* CrazyGames doesn't use headers like 'Menu' or 'Categories' */
}

/* Hide Layout Elements */
.nav-categories {
    display: none !important;
}

/* Container Adjustments */
.container {
    max-width: 1400px;
    /* Wider layout */
}

/* 
   GRID SYSTEM (Modern Layout)
*/
.grid-layout {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    /* Rows adjusted by aspect-ratio of items, removed fixed height */
    gap: 24px !important;
    row-gap: 24px !important;
    column-gap: 24px !important;
    grid-gap: 24px !important;
    /* Legacy fallback */
    margin-bottom: 40px;
}

/* Large Tile (Span 2x2) - DISABLED to force uniform sizes */
.span-2 {
    grid-column: span 1 !important;
    grid-row: span 1 !important;
}

/* Card Styling */
.grid-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #222;
    transition: transform 0.2s, box-shadow 0.2s;
    height: 100%;
    margin-bottom: 0;
    /* Enforce Gombis aspect ratio 5:3 */
    aspect-ratio: 5 / 3;
}

.grid-item:hover {
    transform: none !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    z-index: 5;
}

.list-game {
    height: 100%;
    width: 100%;
    display: block;
    position: relative;
}

.list-thumbnail {
    width: 100%;
    height: 100%;
    padding-bottom: 0;
}

.list-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.grid-item:hover .list-thumbnail img {
    transform: none !important;
}

/* Title Overlay */
.list-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 60px 10px 15px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.7) 40%, transparent 100%);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.2s;
}

.grid-item:hover .list-title {
    opacity: 1;
    transform: translateY(0);
}

.list-title .star-rating {
    display: none;
}

/* Responsive */
@media (max-width: 991px) {
    .sidebar-container {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar-container.active {
        transform: translateX(0);
    }

    .content-wrapper {
        margin-left: 0;
        width: 100%;
    }

    #navb .search-bar {
        width: 100%;
        margin-top: 10px;
    }

    nav.navbar.top-nav {
        height: auto;
    }

    nav.navbar.top-nav .container-fluid {
        flex-wrap: wrap;
    }
}

@media (max-width: 768px) {
    .grid-layout {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        /* Aspect ratio handled by .grid-item automatically */
        gap: 16px !important;
        row-gap: 16px !important;
        column-gap: 16px !important;
        grid-gap: 16px !important;
        /* Legacy fallback */
    }
}

/* Game Bar Styling (CrazyGames Style) */
.game-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #15171e;
    /* Slight contrast from body */
    padding: 6px 15px;
    /* Reduced vertical padding by 50% */
    border-radius: 0 0 12px 12px;
    /* Bottom rounded corners */
    border: 1px solid #2a2a2a;
    border-top: none;
    /* Attaches to game window */
    margin-bottom: 20px;
    height: 48px;
    /* Fixed Slim Height */
}

.game-iframe-container {
    border-radius: 12px 12px 0 0 !important;
    /* Contextual fix for iframe container */
    overflow: hidden;
}

.game-bar-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.game-bar-logo {
    height: 28px;
    width: auto;
    display: block;
}

.game-bar .single-title {
    margin: 0 !important;
    /* Force override */
    padding: 0;
    font-size: 16px;
    /* Slightly smaller text */
    font-weight: 800;
    /* Extra bold for branding match */
    color: #fff;
    line-height: 32px;
    /* Match button height for geometric alignment */
    display: block;
    /* Flex on h1 can be tricky, block + line-height is safer for text */
    align-self: center;
}

.game-bar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    /* Tighter gap */
    height: 100%;
    /* Fill the container to facilitate centering */
}

.stats-vote {
    display: flex;
    align-items: center;
    gap: 8px;
    /* Tighter gap */
    height: 100%;
    /* Force full height so children can center themselves relative to bar */
    margin: 0;
}

.vote-percentage {
    color: #00bfff;
    font-weight: 700;
    font-size: 15px;
}

.vote-icons {
    display: flex;
    align-items: center;
    /* Verify centering */
    gap: 8px;
    height: 100%;
}

.game-bar .icon-vote {
    cursor: pointer;
    background: #2a2a2a;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    /* Soft Square */
    font-size: 14px;
    color: #a0a0a0;
    transition: all 0.2s;
    margin: 0 !important;
    /* Force reset */
    padding: 0 !important;
    /* Force reset */
    line-height: 1 !important;
    /* Prevent font line-height from offsetting icon */
}

.game-bar .icon-vote:hover {
    background: #333;
    color: #fff;
    /* White icon */
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.game-bar .icon-vote#upvote:hover {
    color: #00bfff;
    /* Blue for like */
}

.game-bar .icon-vote#downvote:hover {
    color: #ff4757;
    /* Red for dislike */
}

.game-bar .icon-vote.active#upvote {
    color: #00bfff;
    background: rgba(0, 191, 255, 0.1);
    /* Subtle highlight background */
}

.game-bar .icon-vote.active#downvote {
    color: #ff4757;
    background: rgba(255, 71, 87, 0.1);
    /* Subtle highlight background */
}

.game-actions {
    display: flex;
    align-items: center;
    /* Force vertical center */
    gap: 10px;
    padding-left: 0;
    /* Removed padding */
    border-left: none;
    /* Removed separator */
    height: 100%;
}

.btn-game-action {
    background: #2a2a2a;
    border: none;
    width: 32px;
    /* Reduced size to match votes */
    height: 32px;
    /* Reduced size to match votes */
    border-radius: 6px;
    /* Soft Square instead of Circle */
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    outline: none;
    font-size: 14px;
    margin: 0 !important;
    /* Force reset */
    padding: 0 !important;
    /* Force reset */
    line-height: 1 !important;
}

.btn-game-action:hover {
    background: #00bfff;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 191, 255, 0.3);
}

/* Similar Games Layout */
.similar-games-container {
    margin-top: 30px !important;
    margin-bottom: 30px !important;
}

.similar-games-title {
    font-size: 14px;
    color: #a0a0a0;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.section-separator {
    height: 1px;
    background-color: #2a2a2a;
    margin-bottom: 25px;
    width: 100%;
}

/* Main Big Title */
.main-game-title {
    font-size: 32px;
    color: #fff;
    font-weight: 800;
    margin-bottom: 20px;
    margin-top: 10px;
}

/* Mobile Responsiveness for Game Bar */
@media (max-width: 768px) {
    .game-bar {
        flex-wrap: wrap;
        gap: 15px;
        border-radius: 0 0 12px 12px;
    }

    .game-bar-left {
        width: 100%;
        margin-bottom: 5px;
    }

    .game-bar-right {
        width: 100%;
        justify-content: space-between;
    }

    .game-bar .single-title {
        font-size: 16px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .game-actions {
        border-left: none;
        padding-left: 0;
    }
}