/* Base container fixes */
html, body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
}

/* Games Grid Container */
.games-container {
    display: flex;
    gap: 15px;
    padding: 15px;
    max-width: 1920px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

/* Category Navigation */
.category-nav {
    width: 180px;
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 10px;
    height: fit-content;
    box-sizing: border-box;
}

.category-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.category-nav li {
    margin-bottom: 8px;
}

.category-nav li:last-child {
    margin-bottom: 0;
}

.category-nav a {
    display: flex;
    align-items: center;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    color: #fff;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 14px;
}

.category-nav a:hover, 
.category-nav a.active {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
}

.category-nav .category-icon {
    width: 20px;
    height: 20px;
    margin-right: 10px;
}

/* Games Grid */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
    flex: 1;
    align-content: flex-start;
}

/* Game Card */
.game-card {
    position: relative;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.3s ease;
    display: none; /* Hide all cards by default */
}

.game-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.game-card.game-card-appear {
    display: block; /* Show cards when they have this class */
    animation: gameCardAppear 0.3s ease forwards;
}

.game-thumbnail {
    position: relative;
    padding-top: 133.33%; /* 3:4 Aspect ratio */
    background-size: cover;
    background-position: center;
}

.game-badges {
    position: absolute;
    top: 8px;
    left: 8px;
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    max-width: calc(100% - 16px);
}

.game-badge {
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    line-height: 1;
}

.game-badge.hot {
    background: linear-gradient(45deg, #ff6b6b, #ff4757);
    color: white;
}

.game-badge.new {
    background: linear-gradient(45deg, #1dd1a1, #10ac84);
    color: white;
}

.game-badge.pg {
    background: linear-gradient(45deg, #5352ed, #3742fa);
    color: white;
}

.game-info {
    padding: 8px;
}

.game-title {
    margin: 0;
    font-size: 13px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

/* Provider Label */
.provider-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 3px;
    line-height: 1.2;
}

/* Animation for filtering */
@keyframes gameCardAppear {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .games-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 12px;
    }
}

@media (max-width: 991px) {
    .category-nav {
        width: 160px;
    }
}

@media (max-width: 768px) {
    .games-container {
        flex-direction: column;
        padding: 10px;
        gap: 10px;
        width: 100%;
        margin: 0;
        max-width: 100%;
        overflow: hidden;
        position: relative;
    }

    .category-nav {
        width: 100%;
        padding: 8px;
        margin: 0;
        overflow: hidden;
        position: relative;
    }

    .category-nav ul {
        display: flex;
        overflow-x: auto;
        padding: 0 0 5px 0;
        gap: 8px;
        margin: 0;
        width: 100%;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        position: relative;
        max-width: 100%;
    }

    .games-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 10px;
        width: 100%;
        margin: 0;
        padding: 0;
        max-width: 100%;
        overflow: hidden;
    }

    .game-card {
        width: 100%;
        margin: 0;
        max-width: 100%;
    }

    .game-thumbnail {
        width: 100%;
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    body {
        min-width: 320px;
    }

    .games-container {
        padding: 8px;
        min-width: 320px;
    }

    .games-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 8px;
    }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    html, body {
        width: 100%;
        overflow-x: hidden;
        position: relative;
    }

    .games-container {
        width: 100%;
        overflow-x: hidden;
        position: relative;
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
    }

    .category-nav ul {
        -webkit-overflow-scrolling: touch;
        max-width: 100vw;
    }
}

/* Additional fixes for horizontal scroll prevention */
* {
    max-width: 100vw;
    box-sizing: border-box;
}