/* ========================================
   RESPONSIVE CSS - NEXGAMEHUB
   Mobile First Design
   ======================================== */

/* ==========================================
   BREAKPOINTS
   ========================================== */
/* 
   xs: < 576px   (Mobile portrait)
   sm: ≥ 576px   (Mobile landscape)
   md: ≥ 768px   (Tablette portrait)
   lg: ≥ 992px   (Tablette landscape / petit desktop)
   xl: ≥ 1200px  (Desktop)
   xxl: ≥ 1400px (Large desktop)
*/

/* ==========================================
   BASE RESPONSIVE
   ========================================== */

/* Container fluide */
.container {
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
    margin-right: auto;
    margin-left: auto;
}

@media (min-width: 576px) {
    .container { max-width: 540px; }
}

@media (min-width: 768px) {
    .container { max-width: 720px; }
}

@media (min-width: 992px) {
    .container { max-width: 960px; }
}

@media (min-width: 1200px) {
    .container { max-width: 1140px; }
}

@media (min-width: 1400px) {
    .container { max-width: 1320px; }
}

/* ==========================================
   NAVIGATION RESPONSIVE
   ========================================== */

/* Mobile : Navigation hamburger */
@media (max-width: 991px) {
    .navbar {
        padding: 15px 0;
    }
    
    .nav-links {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #141938;
        padding: 20px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
        z-index: 1000;
    }
    
    .nav-links.active {
        display: flex;
    }
    
    .nav-links a {
        padding: 15px 20px;
        border-bottom: 1px solid #1e2548;
        width: 100%;
        text-align: left;
    }
    
    .nav-links a:last-child {
        border-bottom: none;
    }
    
    .hamburger {
        display: block !important;
        cursor: pointer;
        padding: 10px;
    }
    
    .hamburger span {
        display: block;
        width: 25px;
        height: 3px;
        background: #fff;
        margin: 5px 0;
        transition: 0.3s;
    }
    
    .user-menu {
        flex-direction: column;
        gap: 10px;
    }
}

/* ==========================================
   GRIDS RESPONSIVE
   ========================================== */

/* Grid jeux */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

@media (max-width: 576px) {
    .games-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

@media (min-width: 577px) and (max-width: 768px) {
    .games-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

@media (min-width: 769px) and (max-width: 992px) {
    .games-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Grid stats dashboard */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

@media (max-width: 576px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

/* Grid 2 colonnes */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

@media (max-width: 768px) {
    .grid-2 {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

/* ==========================================
   CARDS RESPONSIVE
   ========================================== */

.game-card,
.stat-card,
.card {
    width: 100%;
    max-width: 100%;
}

.game-card img {
    width: 100%;
    height: auto;
    aspect-ratio: 3/4;
    object-fit: cover;
}

/* ==========================================
   FORMULAIRES RESPONSIVE
   ========================================== */

.form-group {
    margin-bottom: 20px;
}

.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
textarea,
select {
    width: 100%;
    padding: 12px 15px;
    font-size: 16px; /* Évite le zoom sur iOS */
    box-sizing: border-box;
}

@media (max-width: 576px) {
    .form-control,
    input,
    textarea,
    select {
        font-size: 16px; /* Important pour iOS */
        padding: 15px;
    }
}

/* Boutons responsive */
.btn {
    padding: 12px 30px;
    font-size: 16px;
    width: auto;
    display: inline-block;
}

.btn-block {
    width: 100%;
    display: block;
}

@media (max-width: 576px) {
    .btn {
        width: 100%;
        padding: 15px;
    }
    
    .btn-group {
        flex-direction: column;
        gap: 10px;
    }
    
    .btn-group .btn {
        width: 100%;
    }
}

/* ==========================================
   TABLES RESPONSIVE
   ========================================== */

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
    table {
        font-size: 14px;
    }
    
    table th,
    table td {
        padding: 10px 8px;
    }
    
    /* Tables empilées sur mobile */
    .table-stack {
        display: block;
    }
    
    .table-stack thead {
        display: none;
    }
    
    .table-stack tr {
        display: block;
        margin-bottom: 15px;
        border: 1px solid #1e2548;
        border-radius: 8px;
        padding: 15px;
    }
    
    .table-stack td {
        display: block;
        text-align: right;
        padding: 10px;
        border-bottom: 1px solid #1e2548;
    }
    
    .table-stack td:last-child {
        border-bottom: none;
    }
    
    .table-stack td:before {
        content: attr(data-label);
        float: left;
        font-weight: bold;
        color: #94a3b8;
    }
}

/* ==========================================
   MODALES RESPONSIVE
   ========================================== */

.modal-content {
    width: 90%;
    max-width: 600px;
    margin: 20px auto;
}

@media (max-width: 576px) {
    .modal-content {
        width: 95%;
        margin: 10px auto;
        padding: 20px;
    }
    
    .modal-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

/* ==========================================
   SIDEBAR RESPONSIVE
   ========================================== */

@media (max-width: 992px) {
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        height: 100vh;
        width: 280px;
        background: #141938;
        transition: left 0.3s;
        z-index: 1000;
        overflow-y: auto;
    }
    
    .sidebar.active {
        left: 0;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
    }
    
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
    
    .main-content {
        margin-left: 0 !important;
    }
}

/* ==========================================
   TEXTE RESPONSIVE
   ========================================== */

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.75rem;
}

h4 {
    font-size: 1.5rem;
}

@media (max-width: 768px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }
    h4 { font-size: 1.25rem; }
    
    body {
        font-size: 14px;
    }
}

@media (max-width: 576px) {
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    h4 { font-size: 1.1rem; }
}

/* ==========================================
   SPACING RESPONSIVE
   ========================================== */

.section {
    padding: 60px 0;
}

@media (max-width: 768px) {
    .section {
        padding: 40px 0;
    }
}

@media (max-width: 576px) {
    .section {
        padding: 30px 0;
    }
}

/* Padding et margin adaptables */
@media (max-width: 576px) {
    .p-5 { padding: 1.5rem !important; }
    .p-4 { padding: 1rem !important; }
    .py-5 { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }
    .px-5 { padding-left: 1.5rem !important; padding-right: 1.5rem !important; }
}

/* ==========================================
   IMAGES RESPONSIVE
   ========================================== */

img {
    max-width: 100%;
    height: auto;
}

.img-fluid {
    max-width: 100%;
    height: auto;
}

.avatar {
    width: 40px;
    height: 40px;
}

@media (max-width: 576px) {
    .hero-image,
    .banner-image {
        height: 300px;
        object-fit: cover;
    }
}

/* ==========================================
   SEARCH BAR RESPONSIVE
   ========================================== */

.search-container {
    position: relative;
    width: 100%;
    max-width: 500px;
}

@media (max-width: 768px) {
    .search-container {
        max-width: 100%;
    }
}

.search-input {
    width: 100%;
    padding: 12px 45px 12px 15px;
}

/* ==========================================
   FLEX UTILITIES RESPONSIVE
   ========================================== */

@media (max-width: 768px) {
    .flex-md-column {
        flex-direction: column !important;
    }
    
    .flex-md-wrap {
        flex-wrap: wrap !important;
    }
    
    .gap-md-2 {
        gap: 0.5rem !important;
    }
}

@media (max-width: 576px) {
    .flex-sm-column {
        flex-direction: column !important;
    }
    
    .text-sm-center {
        text-align: center !important;
    }
}

/* ==========================================
   DISPLAY UTILITIES
   ========================================== */

/* Cacher sur mobile */
.d-none-mobile {
    display: block;
}

@media (max-width: 768px) {
    .d-none-mobile {
        display: none !important;
    }
}

/* Afficher seulement sur mobile */
.d-mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .d-mobile-only {
        display: block !important;
    }
}

/* ==========================================
   TOAST NOTIFICATIONS RESPONSIVE
   ========================================== */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

@media (max-width: 576px) {
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
    }
    
    .toast {
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* ==========================================
   GAME DETAIL PAGE RESPONSIVE
   ========================================== */

.game-detail-grid {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 40px;
}

@media (max-width: 992px) {
    .game-detail-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
}

/* ==========================================
   PROFILE PAGE RESPONSIVE
   ========================================== */

.profile-header {
    display: flex;
    align-items: center;
    gap: 30px;
}

@media (max-width: 768px) {
    .profile-header {
        flex-direction: column;
        text-align: center;
    }
}

/* ==========================================
   SETTINGS PAGE RESPONSIVE
   ========================================== */

.settings-grid {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 30px;
}

@media (max-width: 992px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
    
    .settings-sidebar {
        display: flex;
        overflow-x: auto;
        gap: 10px;
        padding-bottom: 10px;
    }
    
    .settings-sidebar a {
        white-space: nowrap;
    }
}

/* ==========================================
   PAGINATION RESPONSIVE
   ========================================== */

.pagination {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    justify-content: center;
}

@media (max-width: 576px) {
    .pagination a,
    .pagination span {
        padding: 8px 12px;
        font-size: 14px;
    }
}

/* ==========================================
   FILTERS RESPONSIVE
   ========================================== */

.filters-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .filters-row {
        flex-direction: column;
    }
    
    .filters-row select,
    .filters-row input {
        width: 100%;
    }
}

/* ==========================================
   OVERFLOW & SCROLL
   ========================================== */

/* Empêcher le scroll horizontal */
body {
    overflow-x: hidden;
}

/* Scroll personnalisé */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #0a0e27;
}

::-webkit-scrollbar-thumb {
    background: #4f46e5;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #4338ca;
}

/* ==========================================
   TOUCH OPTIMIZATIONS
   ========================================== */

/* Améliorer le touch sur mobile */
@media (max-width: 768px) {
    a, button, .btn, .clickable {
        min-height: 44px; /* Taille minimum recommandée par Apple */
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Désactiver le tap highlight sur iOS */
    * {
        -webkit-tap-highlight-color: transparent;
    }
}

/* ==========================================
   PRINT STYLES
   ========================================== */

@media print {
    .navbar,
    .sidebar,
    .footer,
    .btn,
    .no-print {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .container {
        max-width: 100%;
    }
}
