/* CORRECTIONS URGENTES MOBILE - NE PAS SUPPRIMER */

/* 1. FORCER L'AFFICHAGE DU TEXTE MÊME SANS I18N */
[data-i18n]:empty::after {
    content: attr(data-i18n);
    text-transform: capitalize;
    opacity: 0.8;
}

/* Textes par défaut pour les éléments critiques */
h1[data-i18n="index_title"]:empty::after {
    content: "Test Ennéagramme";
}

p[data-i18n="index_subtitle"]:empty::after {
    content: "Découvrez votre type de personnalité";
}

.cta-button[data-i18n="index_start_test"]:empty::after {
    content: "Commencer le test";
}

/* 2. SUPPRIMER LE TOGGLE DARK MODE (sauf sur homepage) */
body:not(.homepage) .dark-mode-toggle,
body:not(.homepage) [data-action="toggleDarkMode"],
body:not(.homepage) #darkModeToggle,
.theme-toggle,
.theme-switcher {
    display: none !important;
}

/* Exception pour la homepage */
body.homepage .dark-mode-toggle,
.main-header .dark-mode-toggle {
    display: flex !important;
}

/* 3. SIDEBAR À GAUCHE (PAS À DROITE) */
.mobile-sidebar {
    left: -100% !important;
    right: auto !important;
    transform: none !important;
    transition: left 0.3s ease !important;
}

.mobile-sidebar.active {
    left: 0 !important;
    transform: none !important;
}

/* 4. CORRECTIONS AFFICHAGE MOBILE */
@media (max-width: 768px) {
    /* Corriger le logo illisible */
    .nav-logo img {
        width: 100px !important;
        height: auto !important;
        filter: none !important;
        opacity: 1 !important;
    }
    
    /* Supprimer le doublon Ina1000 */
    .nav-logo span {
        display: none !important;
    }
    /* Corriger le padding qui cache le contenu */
    body {
        padding-top: 60px !important; /* Au lieu de calc() qui peut causer des problèmes */
    }
    
    /* Assurer que le contenu principal est visible */
    .main-container {
        margin-top: 1rem !important;
        padding: 1rem !important;
        min-height: auto !important;
    }
    
    /* Titre principal visible */
    h1 {
        font-size: 1.8rem !important;
        margin-bottom: 1rem !important;
        color: var(--clr-heading, #111827) !important;
        display: block !important;
        visibility: visible !important;
    }
    
    /* Sous-titre visible */
    .subtitle {
        font-size: 1rem !important;
        color: var(--clr-subheading, #4b5563) !important;
        display: block !important;
        visibility: visible !important;
        margin-bottom: 1.5rem !important;
    }
    
    /* Bouton CTA visible et cliquable */
    .cta-button {
        display: inline-block !important;
        visibility: visible !important;
        padding: 1rem 2rem !important;
        background: var(--clr-accent, #818cf8) !important;
        color: white !important;
        border-radius: 8px !important;
        text-decoration: none !important;
        font-weight: 600 !important;
        margin: 2rem auto !important;
        text-align: center !important;
        min-height: 50px !important;
        line-height: 1.5 !important;
    }
    
    /* Centrage des boutons CTA sur mobile */
    .hero-section .flex,
    .final-cta,
    .hero-section > div {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        width: 100% !important;
        flex-direction: column !important;
    }
    
    .hero-section button,
    .final-cta button,
    button[data-action="startTest"],
    .btn-primary {
        margin: 1rem auto !important;
        display: block !important;
        width: 90% !important;
        max-width: 350px !important;
        min-height: 60px !important;
        font-size: 1.125rem !important;
        font-weight: 600 !important;
        padding: 1rem 2rem !important;
    }
    
    /* Instructions visibles */
    .instructions {
        display: block !important;
        visibility: visible !important;
        margin: 2rem 0 !important;
    }
    
    .instructions h2 {
        font-size: 1.3rem !important;
        margin-bottom: 1rem !important;
        color: var(--clr-heading, #111827) !important;
    }
    
    .instructions ul {
        padding-left: 1.5rem !important;
    }
    
    .instructions li {
        margin-bottom: 0.5rem !important;
        color: var(--clr-text, #1f2937) !important;
    }
    
    /* Navigation mobile fixe en bas */
    .mobile-nav {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        background: var(--clr-bg-box, white) !important;
        border-top: 1px solid var(--clr-border, #e5e7eb) !important;
        z-index: 1000 !important;
        display: flex !important;
        justify-content: space-around !important;
        padding: 0.5rem 0 !important;
    }
    
    /* Menu hamburger position correcte */
    .mobile-menu-toggle {
        position: fixed !important;
        top: 1rem !important;
        left: 1rem !important; /* À gauche, pas à droite */
        z-index: 1001 !important;
        background: var(--clr-bg-box, white) !important;
        border: 1px solid var(--clr-border, #e5e7eb) !important;
        border-radius: 8px !important;
        padding: 0.5rem !important;
        width: 40px !important;
        height: 40px !important;
    }
    
    /* Logo centré sur mobile */
    .nav-logo {
        position: fixed !important;
        top: 1rem !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        z-index: 1000 !important;
    }
    
    /* Supprimer l'espace vide avant le footer */
    .footer {
        margin-top: 2rem !important; /* Au lieu de 6rem */
    }
    
    /* Ajuster l'espace après le bouton CTA */
    .cta-button {
        margin-bottom: 2rem !important;
    }
}

/* 5. FORCER LA VISIBILITÉ DU CONTENU */
main > * {
    opacity: 1 !important;
    visibility: visible !important;
}

/* 6. TEXTE PAR DÉFAUT POUR LA NAVIGATION */
.nav-link[data-i18n]:empty::after,
.mobile-nav-link span[data-i18n]:empty::after {
    content: attr(data-i18n);
    text-transform: capitalize;
}

/* 7. CORRECTION DARK MODE AUTO */
@media (prefers-color-scheme: dark) {
    body:not([data-theme="light"]) {
        background: var(--clr-bg, #111827) !important;
        color: var(--clr-text, #f9fafb) !important;
    }
    
    body:not([data-theme="light"]) .cta-button {
        background: var(--clr-accent, #818cf8) !important;
        color: white !important;
    }
}

/* 8. DESIGN PREMIUM MOBILE - EXPERIENCE SOPHISTIQUÉE */

/* Premium Mobile Typography */
@media (max-width: 768px) {
    body {
        font-size: 16px;
        line-height: 1.7;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
    
    h1, h2, h3 {
        font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
        font-weight: 700;
        letter-spacing: -0.02em;
    }
}

/* Premium Mobile Navigation - Glassmorphism Effect */
.main-header {
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    background: rgba(255, 255, 255, 0.75) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 1px 40px rgba(0, 0, 0, 0.03);
}

.dark-mode .main-header {
    background: rgba(26, 26, 46, 0.75) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Premium Mobile Menu Toggle - Smooth Animation */
.mobile-menu-toggle {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.9) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.mobile-menu-toggle:active {
    transform: scale(0.95);
}

.burger-line {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--primary-color, #6366f1);
    height: 2px;
    border-radius: 2px;
}

.mobile-sidebar.active ~ .mobile-menu-toggle .burger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-sidebar.active ~ .mobile-menu-toggle .burger-line:nth-child(2) {
    opacity: 0;
}

.mobile-sidebar.active ~ .mobile-menu-toggle .burger-line:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Premium Mobile Sidebar - Elevated Design */
.mobile-sidebar {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    box-shadow: 4px 0 30px rgba(0, 0, 0, 0.1);
    /* Transition sur left, pas transform */
    transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.dark-mode .mobile-sidebar {
    background: rgba(26, 26, 46, 0.98);
}

.mobile-nav-link {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    border-radius: 12px;
    margin: 0.25rem 1rem;
}

.mobile-nav-link::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: var(--primary-gradient, linear-gradient(135deg, #667eea 0%, #764ba2 100%));
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.mobile-nav-link:active {
    transform: scale(0.98);
    background: rgba(99, 102, 241, 0.05);
}

.mobile-nav-link.active::before {
    transform: translateX(0);
}

/* Premium Mobile Buttons - Touch Optimized */
@media (max-width: 768px) {
    .btn, .cta-button, button {
        min-height: 48px !important;
        padding: 14px 28px !important;
        font-size: 16px !important;
        font-weight: 600;
        border-radius: 12px !important;
        position: relative;
        overflow: hidden;
        -webkit-tap-highlight-color: transparent;
    }
    
    /* Boutons de notation du test */
    .rating-button {
        min-width: auto !important;
        width: auto !important;
        padding: 12px 20px !important;
        font-size: 0.95rem !important;
        white-space: nowrap !important;
    }
    
    .btn-primary, .cta-button {
        background: var(--primary-gradient, linear-gradient(135deg, #667eea 0%, #764ba2 100%)) !important;
        box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
        color: white !important;
    }
    
    .btn:active, .cta-button:active {
        transform: scale(0.97);
        box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
    }
}

/* Premium Mobile Cards - Soft Shadows */
@media (max-width: 768px) {
    .card, .feature-card, .stat-card {
        background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(167, 139, 250, 0.1) 100%) !important;
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border: 1px solid rgba(139, 92, 246, 0.2) !important;
        border-radius: 16px !important;
        box-shadow: 0 4px 20px rgba(139, 92, 246, 0.1);
        margin-bottom: 1rem;
        padding: 1.5rem !important;
        transition: all 0.3s ease;
    }
    
    .dark-mode .card,
    .dark-mode .feature-card,
    .dark-mode .stat-card {
        background: rgba(26, 26, 46, 0.95) !important;
        border: 1px solid rgba(129, 140, 248, 0.2) !important;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    }
    
    .card:active {
        transform: scale(0.98);
    }
    
    /* Encadrés lavande pour toutes les sections mobile */
    section {
        background: linear-gradient(135deg, rgba(139, 92, 246, 0.08) 0%, rgba(167, 139, 250, 0.08) 100%);
        padding: 1.5rem 1rem !important;
        margin: 1rem 0 !important;
        border-radius: 20px;
        border: 1px solid rgba(139, 92, 246, 0.12);
    }
    
    .dark-mode section {
        background: rgba(16, 16, 35, 0.5);
        border: 1px solid rgba(139, 92, 246, 0.2);
    }
    
    /* Hero section avec fond dégradé */
    .hero-section {
        background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%) !important;
        border-radius: 0 0 30px 30px !important;
        margin-top: 0 !important;
        padding: 2rem 1rem 3rem 1rem !important;
    }
    
    .dark-mode .hero-section {
        background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%) !important;
    }
    
    /* Features avec fond coloré */
    .features-section {
        background: rgba(249, 250, 251, 0.8) !important;
        backdrop-filter: blur(10px);
    }
    
    .dark-mode .features-section {
        background: rgba(26, 26, 46, 0.5) !important;
    }
    
    /* How it works avec fond accent */
    .how-it-works {
        background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%) !important;
        border: 1px solid var(--border-color);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    }
    
    /* Container principal avec marges */
    main {
        padding: 0 0.5rem !important;
        background: var(--bg-secondary);
    }
    
    .dark-mode main {
        background: var(--bg-primary);
    }
    
    /* Amélioration lisibilité du texte */
    p, li {
        line-height: 1.8 !important;
        color: var(--text-secondary);
    }
    
    h1, h2, h3 {
        color: var(--text-primary);
        margin-bottom: 1rem !important;
    }
}

/* Premium Mobile Hero Section */
@media (max-width: 768px) {
    .hero-section {
        padding: 3rem 1rem !important;
        text-align: center;
    }
    
    .hero-section h1 {
        font-size: 2.25rem !important;
        line-height: 1.2;
        margin-bottom: 1rem !important;
        background: var(--primary-gradient, linear-gradient(135deg, #667eea 0%, #764ba2 100%));
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
    }
    
    .hero-section p {
        font-size: 1.125rem !important;
        opacity: 0.85;
        margin-bottom: 2rem !important;
    }
}

/* Premium Mobile Forms - Touch Friendly */
@media (max-width: 768px) {
    input, textarea, select {
        min-height: 48px !important;
        padding: 12px 16px !important;
        font-size: 16px !important;
        border-radius: 12px !important;
        border: 2px solid transparent;
        background: rgba(255, 255, 255, 0.8);
        backdrop-filter: blur(10px);
        transition: all 0.3s ease;
    }
    
    input:focus, textarea:focus, select:focus {
        border-color: var(--primary-color, #6366f1);
        box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
        outline: none;
    }
}

/* Premium Mobile Animations - Smooth Entrance */
@media (max-width: 768px) {
    .fade-in {
        animation: fadeIn 0.6s ease-out;
    }
    
    @keyframes fadeIn {
        from {
            opacity: 0;
            transform: translateY(20px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    main > * {
        animation: fadeIn 0.6s ease-out;
        animation-fill-mode: both;
    }
    
    main > *:nth-child(1) { animation-delay: 0.1s; }
    main > *:nth-child(2) { animation-delay: 0.2s; }
    main > *:nth-child(3) { animation-delay: 0.3s; }
}

/* Premium Mobile Scrollbar */
@media (max-width: 768px) {
    ::-webkit-scrollbar {
        width: 6px;
        height: 6px;
    }
    
    ::-webkit-scrollbar-track {
        background: transparent;
    }
    
    ::-webkit-scrollbar-thumb {
        background: rgba(99, 102, 241, 0.3);
        border-radius: 3px;
    }
}

/* Premium Mobile Safe Areas - iPhone X+ */
@supports (padding: max(0px)) {
    .main-header {
        padding-top: max(1rem, env(safe-area-inset-top));
    }
    
    .mobile-nav {
        padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
    }
    
    .mobile-sidebar {
        padding-top: max(1rem, env(safe-area-inset-top));
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
}

/* Premium Mobile Performance - Hardware Acceleration */
.mobile-menu-toggle,
.btn,
.card {
    will-change: transform;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* Sidebar utilise left, pas transform */
.mobile-sidebar {
    will-change: left;
}

/* Premium Mobile Loading States */
@media (max-width: 768px) {
    .skeleton {
        background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
        background-size: 200% 100%;
        animation: loading 1.5s infinite;
        border-radius: 8px;
    }
    
    @keyframes loading {
        0% { background-position: 200% 0; }
        100% { background-position: -200% 0; }
    }
    
    .dark-mode .skeleton {
        background: linear-gradient(90deg, #2a2a3e 25%, #3a3a4e 50%, #2a2a3e 75%);
        background-size: 200% 100%;
    }
}

/* Premium Mobile Touch Feedback */
@media (max-width: 768px) {
    .touchable {
        -webkit-tap-highlight-color: rgba(99, 102, 241, 0.1);
        touch-action: manipulation;
    }
    
    .touchable:active {
        background-color: rgba(99, 102, 241, 0.05);
    }
}