/* Mobile Grid Layout Override - Ensures 2 columns on mobile, 4 on Samsung Fold open */

/* Override for all mobile devices - maintain 2 columns */
@media (max-width: 768px) {
    .games-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
        padding: 0.5rem !important;
    }
}

/* Maintain 2 columns even on very small screens */
@media (max-width: 500px) {
    .games-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.6rem !important;
        padding: 0.4rem !important;
    }
}

/* Extra small screens - still keep 2 columns */
@media (max-width: 400px) {
    .games-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
        padding: 0.3rem !important;
    }
    
    /* Adjust game cards for very small screens with 2 columns */
    .game-card {
        min-height: 300px !important;
        padding: 0.5rem !important;
        font-size: 0.8rem !important;
    }
    
    .game-title {
        font-size: 0.8rem !important;
        line-height: 1.2 !important;
        margin-bottom: 0.4rem !important;
    }
    
    .game-platform {
        padding: 0.2rem 0.4rem !important;
        font-size: 0.65rem !important;
        margin-bottom: 0.4rem !important;
    }
    
    .action-btn {
        padding: 0.5rem 0.4rem !important;
        font-size: 0.7rem !important;
        min-height: 36px !important;
    }
    
    .link-btn {
        padding: 0.4rem 0.3rem !important;
        font-size: 0.65rem !important;
        min-height: 32px !important;
    }
    
    .star {
        font-size: 0.9rem !important;
        margin: 0 1px !important;
    }
}

/* Ensure Samsung Fold closed state gets exactly 2 columns */
@media screen and (min-width: 344px) and (max-width: 374px) and (min-height: 882px) and (max-height: 932px) {
    .games-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
        padding: 0.25rem !important;
        margin: 0 0.25rem !important;
    }
    
    .game-card {
        min-height: 260px !important;
        padding: 0.5rem !important;
    }
    
    .game-title {
        font-size: 0.75rem !important;
        line-height: 1.2 !important;
    }
    
    .action-btn {
        padding: 0.4rem 0.5rem !important;
        font-size: 0.6rem !important;
        min-height: 32px !important;
    }
}

/* Ensure Samsung Fold open state gets exactly 4 columns */
@media screen and (min-width: 1812px) and (max-width: 1892px) and (min-height: 1344px) and (max-height: 1394px) {
    .games-grid {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 1.5rem !important;
        padding: 1rem !important;
        margin: 0 1rem !important;
        max-width: 1600px !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
}

/* For tablets and larger mobile devices - keep 2 columns */
@media (min-width: 769px) and (max-width: 1024px) {
    .games-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 1rem !important;
        padding: 1rem !important;
    }
}

/* For desktop screens (but not Samsung Fold) - default layout */
@media (min-width: 1025px) and (max-width: 1811px) {
    .games-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 1.5rem !important;
        padding: 1rem !important;
    }
}

/* Override any single column layouts from other CSS files */
.games-grid {
    display: grid !important;
}

/* Ensure no CSS overrides the grid layout we want */
body.samsung-fold-closed .games-grid {
    grid-template-columns: repeat(2, 1fr) !important;
}

body.samsung-fold-open .games-grid {
    grid-template-columns: repeat(4, 1fr) !important;
}

/* For regular mobile (not Samsung Fold) */
@media (max-width: 768px) and not screen and (min-width: 344px) and (max-width: 374px) and (min-height: 882px) and (max-height: 932px) and not screen and (min-width: 1812px) and (max-width: 1892px) and (min-height: 1344px) and (max-height: 1394px) {
    .games-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Important override to ensure specifications are met */
@media (max-width: 768px) {
    .games-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Final override for very specific requirements */
.games-grid[style*="grid-template-columns: 1fr"] {
    grid-template-columns: repeat(2, 1fr) !important;
}
