/* ========================================
   AMÉLIORATIONS MOBILE CRITIQUES
   Corrections des problèmes de responsive
   NexGameHub - Version améliorée
   ======================================== */

/* ==========================================
   HEADER HOMEPAGE - RESPONSIVE COMPLET
   ========================================== */

/* Container du header */
.header {
    padding: 15px 0;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 0 20px;
}

/* Logo responsive */
.logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.logo img,
.logo-img {
    height: 50px;
    width: auto;
}

/* Menu hamburger - caché par défaut sur desktop */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    z-index: 1001;
}

/* ==========================================
   MOBILE BREAKPOINT < 768px
   ========================================== */

@media (max-width: 768px) {
    /* Afficher le bouton hamburger */
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Header container mobile */
    .header-container {
        position: relative;
        padding: 0 15px;
    }
    
    /* Navigation cachée par défaut */
    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #141938;
        flex-direction: column;
        padding: 20px;
        gap: 0;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
        border-top: 1px solid #1e293b;
        z-index: 1000;
    }
    
    .nav-links.show {
        display: flex;
    }
    
    .nav-links a {
        padding: 15px 10px;
        border-bottom: 1px solid #1e293b;
        font-size: 16px;
    }
    
    .nav-links a:last-child {
        border-bottom: none;
    }
    
    /* Boutons auth dans le menu mobile */
    .auth-buttons {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #141938;
        flex-direction: column;
        padding: 20px;
        gap: 10px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
        border-top: 1px solid #1e293b;
        z-index: 1000;
    }
    
    .auth-buttons.show {
        display: flex;
    }
    
    .auth-buttons .btn {
        width: 100%;
        text-align: center;
        padding: 14px 20px;
    }
    
    /* Logo sur mobile */
    .logo img,
    .logo-img {
        height: 45px;
    }
}

/* ==========================================
   TRÈS PETIT ÉCRAN < 480px
   ========================================== */

@media (max-width: 480px) {
    .logo img,
    .logo-img {
        height: 40px;
    }
}

/* ==========================================
   HERO SECTION - MOBILE RESPONSIVE
   ========================================== */

@media (max-width: 768px) {
    .hero {
        min-height: 100vh;
        padding: 100px 20px 60px;
    }
    
    .hero-content {
        padding: 0 10px;
    }
    
    .hero-title {
        font-size: 32px !important;
        line-height: 1.2;
        margin-bottom: 15px;
    }
    
    .hero-subtitle {
        font-size: 16px !important;
        line-height: 1.5;
        margin-bottom: 30px;
    }
    
    .hero-buttons {
        flex-direction: column;
        gap: 15px;
        width: 100%;
        padding: 0 10px;
    }
    
    .btn-hero {
        width: 100%;
        padding: 14px 24px !important;
        font-size: 16px !important;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: 90px 15px 50px;
    }
    
    .hero-title {
        font-size: 26px !important;
    }
    
    .hero-subtitle {
        font-size: 14px !important;
    }
}

/* ==========================================
   STATS SECTION - MOBILE
   ========================================== */

@media (max-width: 768px) {
    .stats-section {
        padding: 60px 15px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .stat-item {
        padding: 20px 15px;
    }
    
    .stat-icon {
        font-size: 32px;
        margin-bottom: 10px;
    }
    
    .stat-number {
        font-size: 28px;
    }
    
    .stat-label {
        font-size: 14px;
    }
}

@media (max-width: 400px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .stat-item {
        display: flex;
        align-items: center;
        gap: 15px;
        text-align: left;
        padding: 15px 20px;
    }
    
    .stat-icon {
        font-size: 28px;
        margin-bottom: 0;
    }
    
    .stat-number {
        font-size: 24px;
        margin-bottom: 0;
    }
    
    .stat-label {
        font-size: 13px;
    }
}


/* ==========================================
   POPULAR GAMES SECTION - MOBILE
   ========================================== */

@media (max-width: 768px) {
    .popular-section {
        padding: 60px 15px;
    }
    
    .section-title {
        font-size: 28px;
        margin-bottom: 15px;
    }
    
    .section-subtitle {
        font-size: 16px;
        margin-bottom: 40px;
    }
    
    .games-carousel {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .game-card {
        border-radius: 12px;
    }
    
    .game-cover {
        height: 180px;
    }
    
    .game-info {
        padding: 12px;
    }
    
    .game-title {
        font-size: 13px;
    }
    
    .game-year {
        font-size: 12px;
    }
    
    .game-rating {
        font-size: 11px;
        padding: 3px 8px;
    }
}

@media (max-width: 400px) {
    .games-carousel {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .game-cover {
        height: 220px;
    }
    
    .game-title {
        font-size: 15px;
    }
}

/* ==========================================
   FEATURES SECTION - MOBILE
   ========================================== */

@media (max-width: 768px) {
    .features-section {
        padding: 60px 15px;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        margin-top: 40px;
    }
    
    .feature-card {
        padding: 25px 20px;
    }
    
    .feature-icon {
        font-size: 36px;
        margin-bottom: 15px;
    }
    
    .feature-title {
        font-size: 20px;
        margin-bottom: 10px;
    }
    
    .feature-description {
        font-size: 14px;
        line-height: 1.5;
    }
}

/* ==========================================
   CTA SECTION - MOBILE
   ========================================== */

@media (max-width: 768px) {
    .cta-section {
        padding: 60px 20px;
    }
    
    .cta-title {
        font-size: 28px;
        margin-bottom: 15px;
    }
    
    .cta-text {
        font-size: 16px;
        margin-bottom: 30px;
    }
    
    .cta-section .btn-hero {
        width: 100%;
        max-width: 300px;
    }
}

/* ==========================================
   FOOTER - MOBILE
   ========================================== */

@media (max-width: 768px) {
    .footer {
        padding: 30px 15px;
    }
    
    .footer-text {
        font-size: 13px;
    }
    
    .footer-links {
        flex-wrap: wrap;
        gap: 15px;
        justify-content: center;
    }
    
    .footer-links a {
        font-size: 13px;
    }
}

/* ==========================================
   NAVIGATION MOBILE - AMÉLIORATIONS
   ========================================== */

/* Logo responsive navbar */
.navbar .logo {
    display: flex;
    align-items: center;
}

.navbar .logo img,
.navbar .logo-img {
    height: 50px;
    width: auto;
}

@media (max-width: 576px) {
    .navbar .logo img,
    .navbar .logo-img {
        height: 45px;
    }
}

/* Hamburger menu */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    padding: 8px;
    background: none;
    border: none;
}

.mobile-menu-toggle span {
    width: 25px;
    height: 3px;
    background: #fff;
    transition: 0.3s;
    border-radius: 2px;
}

@media (max-width: 991px) {
    .mobile-menu-toggle {
        display: flex;
    }
}


/* ==========================================
   GRILLES RESPONSIVE GÉNÉRALES
   ========================================== */

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

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .stat-value {
        font-size: 28px;
    }
}

/* ==========================================
   GAMES GRID - MOBILE OPTIMISÉ
   ========================================== */

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

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

/* ==========================================
   FORMULAIRES - MOBILE AMÉLIORÉ
   ========================================== */

@media (max-width: 576px) {
    .auth-container {
        padding: 10px;
    }
    
    .auth-card {
        padding: 25px 20px;
    }
    
    .form-group input,
    .form-group textarea,
    .form-group select {
        font-size: 16px !important;
        padding: 14px;
    }
    
    .btn,
    button {
        padding: 14px;
        font-size: 16px;
        width: 100%;
    }
}

/* ==========================================
   FILTRES - MOBILE OPTIMISÉ
   ========================================== */

@media (max-width: 768px) {
    .filters {
        padding: 20px 15px;
    }
    
    .filters-row {
        flex-direction: column;
        gap: 12px;
    }
    
    .filter-group {
        width: 100%;
        min-width: 100%;
    }
    
    .filter-btn,
    .filter-reset {
        width: 100%;
    }
}

/* ==========================================
   PROFILE BANNER - MOBILE
   ========================================== */

@media (max-width: 768px) {
    .profile-banner {
        padding: 30px 20px;
    }
    
    .profile-content {
        flex-direction: column;
        text-align: center;
    }
    
    .profile-avatar {
        width: 100px;
        height: 100px;
    }
    
    .profile-name {
        font-size: 28px;
    }
    
    .profile-meta {
        flex-direction: column;
        gap: 10px;
    }
    
    .profile-actions {
        width: 100%;
        flex-direction: column;
    }
    
    .profile-actions .btn {
        width: 100%;
    }
}

/* ==========================================
   GAME DETAIL - MOBILE
   ========================================== */

.game-header {
    grid-template-columns: 1fr;
}

@media (min-width: 992px) {
    .game-header {
        grid-template-columns: 350px 1fr;
    }
}

@media (max-width: 768px) {
    .game-cover-section {
        position: static;
    }
    
    .game-details-title {
        font-size: 28px;
    }
    
    .game-meta {
        flex-direction: column;
        gap: 15px;
    }
}

/* ==========================================
   COLLECTION - MOBILE
   ========================================== */

@media (max-width: 768px) {
    .game-item {
        flex-direction: column;
        padding: 15px;
    }
    
    .game-cover-small {
        width: 100%;
        height: 200px;
    }
    
    .game-actions {
        width: 100%;
        flex-direction: column;
    }
    
    .game-actions .btn {
        width: 100%;
    }
    
    .game-details {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .game-details {
        grid-template-columns: 1fr;
    }
}


/* ==========================================
   SETTINGS TABS - MOBILE
   ========================================== */

@media (max-width: 768px) {
    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    
    .tabs::-webkit-scrollbar {
        display: none;
    }
    
    .tab {
        padding: 12px 20px;
        white-space: nowrap;
    }
}

/* ==========================================
   USER INFO - MOBILE
   ========================================== */

@media (max-width: 576px) {
    .user-info {
        gap: 10px;
    }
    
    .user-info span {
        display: none;
    }
    
    .avatar {
        width: 36px;
        height: 36px;
    }
}

/* ==========================================
   SEARCH BAR - MOBILE AMÉLIORÉ
   ========================================== */

@media (max-width: 768px) {
    .search-container {
        order: 2;
        width: 100%;
        margin: 10px 0;
    }
    
    .search-input {
        width: 100%;
        font-size: 16px;
    }
}

/* ==========================================
   PAGINATION - MOBILE
   ========================================== */

@media (max-width: 576px) {
    .pagination {
        font-size: 14px;
        gap: 5px;
        flex-wrap: wrap;
    }
    
    .pagination a,
    .pagination span {
        padding: 8px 10px;
        min-width: 36px;
        text-align: center;
    }
}

/* ==========================================
   MODALES - MOBILE FULL SCREEN
   ========================================== */

@media (max-width: 576px) {
    .modal-content {
        width: 100%;
        height: 100%;
        margin: 0;
        border-radius: 0;
        max-width: 100%;
    }
    
    .modal {
        padding: 0;
    }
}

/* ==========================================
   FIXES CRITIQUES iOS
   ========================================== */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="search"],
textarea,
select {
    font-size: 16px !important;
}

body {
    overscroll-behavior-y: contain;
}

* {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

input,
textarea,
[contenteditable] {
    -webkit-user-select: text;
    user-select: text;
}

/* ==========================================
   UTILITIES MOBILE
   ========================================== */

@media (max-width: 576px) {
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .page-title {
        font-size: 28px;
    }
    
    .page-subtitle {
        font-size: 16px;
    }
    
    .card-title {
        font-size: 20px;
    }
}

/* Safe area pour iPhone X+ */
@supports (padding: max(0px)) {
    .header,
    .container,
    .footer {
        padding-left: max(15px, env(safe-area-inset-left));
        padding-right: max(15px, env(safe-area-inset-right));
    }
}

/* ==========================================
   PERFORMANCE MOBILE
   ========================================== */

.game-card,
.stat-card,
.feature-card,
.btn {
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

html {
    scroll-behavior: smooth;
}

@media (max-width: 768px) {
    *,
    *::before,
    *::after {
        animation-duration: 0.2s !important;
        transition-duration: 0.2s !important;
    }
}
