/* ========================================
   AMÉLIORATIONS MOBILE CRITIQUES
   Corrections des problèmes de responsive
   ======================================== */

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

/* Logo responsive */
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 24px;
    white-space: nowrap;
}

.logo img {
    height: 40px;
    width: auto;
}

@media (max-width: 576px) {
    .logo {
        font-size: 18px;
    }
    
    .logo img {
        height: 32px;
    }
    
    /* Cacher le texte du logo sur très petit écran */
    .logo-text {
        display: none;
    }
}

/* Header responsive */
.header-container {
    flex-wrap: wrap;
    gap: 15px;
}

@media (max-width: 991px) {
    .header-container {
        padding: 0 15px;
    }
    
    .nav {
        display: none;
        width: 100%;
        flex-direction: column;
        order: 3;
        background: #1e293b;
        padding: 15px;
        border-radius: 10px;
        margin-top: 10px;
    }
    
    .nav.active {
        display: flex;
    }
    
    .nav a {
        padding: 12px 0;
        width: 100%;
        border-bottom: 1px solid #334155;
    }
    
    .nav a:last-child {
        border-bottom: none;
    }
}

/* 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;
    }
}

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

.stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

@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;
    }
    
    .game-card {
        border-radius: 12px;
    }
    
    .game-cover {
        height: 200px;
    }
    
    .game-info {
        padding: 12px;
    }
    
    .game-title {
        font-size: 13px;
    }
}

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

/* ==========================================
   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; /* Critique pour iOS */
        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-title {
        font-size: 32px;
    }
    
    .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-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .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;
    }
}

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

@media (max-width: 768px) {
    .hero {
        min-height: 90vh;
        padding: 100px 15px 60px;
    }
    
    .hero-title {
        font-size: 36px;
    }
    
    .hero-subtitle {
        font-size: 18px;
    }
    
    .hero-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-hero {
        width: 100%;
        padding: 14px 30px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 28px;
    }
    
    .hero-subtitle {
        font-size: 16px;
    }
}

/* ==========================================
   SECTIONS - MOBILE PADDING
   ========================================== */

@media (max-width: 768px) {
    .stats-section,
    .popular-section,
    .features-section,
    .cta-section {
        padding: 60px 15px;
    }
    
    .section-title {
        font-size: 32px;
    }
    
    .section-subtitle {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .section-title {
        font-size: 28px;
    }
}

/* ==========================================
   FEATURES GRID - MOBILE
   ========================================== */

@media (max-width: 768px) {
    .features-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }
    
    .feature-card {
        padding: 30px 25px;
    }
}

/* ==========================================
   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
   ========================================== */

/* Éviter le zoom sur les inputs */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="search"],
textarea,
select {
    font-size: 16px !important;
}

/* Désactiver le bounce scroll */
body {
    overscroll-behavior-y: contain;
}

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

/* Sauf pour les éléments texte */
input,
textarea,
[contenteditable] {
    -webkit-user-select: text;
    user-select: text;
}

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

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

/* Safe area pour iPhone */
@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
   ========================================== */

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

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

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