/**
 * Lin Teas - Mobile MyAccount Styles
 * Styles CSS unifiés pour la navigation mobile des pages Mon Compte
 * 
 * @version 1.0.0
 * @date 2026-01-09
 */

/* ==========================================================================
   BASE MOBILE STYLES (Mobile-First Approach)
   ========================================================================== */

/* Par défaut, masquer la sidebar WooCommerce sur mobile */
@media (max-width: 768px) {
    /* --------------------------------------------------------------------------
       LAYOUT PRINCIPAL
       -------------------------------------------------------------------------- */
    
    body.woocommerce-account .woocommerce {
        display: flex !important;
        flex-direction: column !important;
        grid-template-columns: none !important;
        padding: 0 !important;
        max-width: 100% !important;
    }
    
    /* Le contenu principal prend toute la largeur */
    body.woocommerce-account .woocommerce > .woocommerce-MyAccount-content {
        order: 1;
        flex: 1;
        width: 100%;
        padding: 20px 15px;
        box-sizing: border-box;
    }
    
    /* Masquer la sidebar de navigation */
    body.woocommerce-account .woocommerce-MyAccount-navigation {
        display: none !important;
    }
    
    /* --------------------------------------------------------------------------
       NAVIGATION PAR ONGLETS MOBILE (FIXED BOTTOM)
       -------------------------------------------------------------------------- */
    
    .mobile-tabs-nav {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        z-index: 9999 !important;
        background: #ffffff !important;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1) !important;
        padding: 0 !important;
        margin: 0 !important;
        max-width: 100vw !important;
        overflow: visible !important;
    }
    
    .mobile-tabs-nav .tabs-list {
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-around !important;
        align-items: center !important;
        list-style: none !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        scroll-behavior: smooth !important;
    }
    
    /* Indicateurs de scroll horizontal */
    .mobile-tabs-nav.has-overflow::before,
    .mobile-tabs-nav.has-overflow::after {
        content: '';
        position: absolute;
        top: 0;
        bottom: 0;
        width: 30px;
        z-index: 1;
        pointer-events: none;
    }
    
    .mobile-tabs-nav.has-overflow::before {
        left: 0;
        background: linear-gradient(to right, rgba(255,255,255,0.9), transparent);
    }
    
    .mobile-tabs-nav.has-overflow::after {
        right: 0;
        background: linear-gradient(to left, rgba(255,255,255,0.9), transparent);
    }
    
    .mobile-tabs-nav .tab-item {
        flex: 0 0 auto !important;
        min-width: 70px !important;
        max-width: 100px !important;
        text-align: center !important;
    }
    
    .mobile-tabs-nav .tab-link {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 10px 8px !important;
        text-decoration: none !important;
        color: #666666 !important;
        transition: all 0.2s ease !important;
        border-radius: 0 !important;
        background: transparent !important;
        border: none !important;
        height: auto !important;
        font-size: 11px !important;
        line-height: 1.3 !important;
    }
    
    /* Indicateur visuel du tap (feedback tactile) */
    .mobile-tabs-nav .tab-link:active {
        background: #f5f5f5 !important;
    }
    
    /* Icône SVG */
    .mobile-tabs-nav .tab-icon {
        width: 24px !important;
        height: 24px !important;
        fill: #666666 !important;
        margin-bottom: 4px !important;
        transition: fill 0.2s ease !important;
    }
    
    /* Label texte */
    .mobile-tabs-nav .tab-label {
        display: block !important;
        font-size: 11px !important;
        font-weight: 500 !important;
        color: #666666 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: 100% !important;
    }
    
    /* --------------------------------------------------------------------------
       ÉTAT ACTIF
       -------------------------------------------------------------------------- */
    
    .mobile-tabs-nav .tab-item.active .tab-link {
        color: #C27B5C !important;
        background: rgba(194, 123, 92, 0.08) !important;
    }
    
    .mobile-tabs-nav .tab-item.active .tab-icon {
        fill: #C27B5C !important;
    }
    
    .mobile-tabs-nav .tab-item.active .tab-label {
        color: #C27B5C !important;
    }
    
    /* Indicator de page active (ligne en haut) */
    .mobile-tabs-nav .tab-item.active .tab-link::before {
        content: '';
        position: absolute;
        top: 0;
        left: 10%;
        right: 10%;
        height: 3px;
        background: #C27B5C;
        border-radius: 0 0 3px 3px;
    }
    
    /* --------------------------------------------------------------------------
       CONTENU PRINCIPAL
       -------------------------------------------------------------------------- */
    
    /* Ajouter padding au contenu pour éviter qu'il ne soit caché sous les tabs */
    .site-content.has-mobile-tabs {
        padding-bottom: 70px !important;
    }
    
    body.woocommerce-account .woocommerce-MyAccount-content {
        padding-bottom: 80px !important;
    }
    
    /* Ajustements du contenu */
    .woocommerce-MyAccount-content h2,
    .woocommerce-MyAccount-content h3 {
        font-size: 20px !important;
        margin-bottom: 15px !important;
        color: #333333 !important;
    }
    
    .woocommerce-MyAccount-content p {
        font-size: 14px !important;
        line-height: 1.6 !important;
        color: #555555 !important;
    }
    
    /* --------------------------------------------------------------------------
       TABLEAUX (Commandes, Téléchargements)
       -------------------------------------------------------------------------- */
    
    .woocommerce-MyAccount-content table {
        width: 100% !important;
        font-size: 13px !important;
        border-collapse: collapse !important;
    }
    
    .woocommerce-MyAccount-content table th,
    .woocommerce-MyAccount-content table td {
        padding: 10px 8px !important;
        text-align: left !important;
        border-bottom: 1px solid #eeeeee !important;
    }
    
    .woocommerce-MyAccount-content table th {
        font-weight: 600 !important;
        color: #333333 !important;
        background: #f9f9f9 !important;
    }
    
    /* Faire défiler les tableaux larges horizontalement */
    .woocommerce-MyAccount-content table.woocommerce-orders-table {
        display: block !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    /* --------------------------------------------------------------------------
       BOUTONS
       -------------------------------------------------------------------------- */
    
    .woocommerce-MyAccount-content .button {
        display: inline-block !important;
        padding: 10px 16px !important;
        font-size: 13px !important;
        font-weight: 500 !important;
        text-decoration: none !important;
        border-radius: 4px !important;
        border: none !important;
        cursor: pointer !important;
        transition: all 0.2s ease !important;
        margin: 5px 0 !important;
    }
    
    /* Bouton primaire */
    .woocommerce-MyAccount-content .button:not(.alt):not(.secondary) {
        background: #C27B5C !important;
        color: #ffffff !important;
    }
    
    .woocommerce-MyAccount-content .button:not(.alt):not(.secondary):hover {
        background: #A86548 !important;
    }
    
    /* Bouton secondaire */
    .woocommerce-MyAccount-content .button.secondary {
        background: #f5f5f5 !important;
        color: #666666 !important;
        border: 1px solid #dddddd !important;
    }
    
    .woocommerce-MyAccount-content .button.secondary:hover {
        background: #eeeeee !important;
    }
    
    /* --------------------------------------------------------------------------
       FORMULAIRES
       -------------------------------------------------------------------------- */
    
    .woocommerce-MyAccount-content form {
        max-width: 100% !important;
    }
    
    .woocommerce-MyAccount-content .form-row {
        margin-bottom: 15px !important;
    }
    
    .woocommerce-MyAccount-content label {
        display: block !important;
        font-size: 13px !important;
        font-weight: 500 !important;
        color: #333333 !important;
        margin-bottom: 6px !important;
    }
    
    .woocommerce-MyAccount-content input[type="text"],
    .woocommerce-MyAccount-content input[type="email"],
    .woocommerce-MyAccount-content input[type="password"],
    .woocommerce-MyAccount-content input[type="tel"],
    .woocommerce-MyAccount-content input[type="url"],
    .woocommerce-MyAccount-content textarea,
    .woocommerce-MyAccount-content select {
        width: 100% !important;
        padding: 12px 10px !important;
        font-size: 14px !important;
        border: 1px solid #dddddd !important;
        border-radius: 4px !important;
        background: #ffffff !important;
        box-sizing: border-box !important;
        transition: border-color 0.2s ease !important;
    }
    
    .woocommerce-MyAccount-content input:focus,
    .woocommerce-MyAccount-content textarea:focus,
    .woocommerce-MyAccount-content select:focus {
        outline: none !important;
        border-color: #C27B5C !important;
    }
    
    /* --------------------------------------------------------------------------
       ADRESSES
       -------------------------------------------------------------------------- */
    
    .woocommerce-MyAccount-content address {
        font-style: normal !important;
        font-size: 14px !important;
        line-height: 1.6 !important;
        padding: 15px !important;
        background: #f9f9f9 !important;
        border-radius: 4px !important;
        border: 1px solid #eeeeee !important;
    }
    
    /* --------------------------------------------------------------------------
       NOTIFICATIONS & MESSAGES
       -------------------------------------------------------------------------- */
    
    .woocommerce-MyAccount-content .woocommerce-message,
    .woocommerce-MyAccount-content .woocommerce-info,
    .woocommerce-MyAccount-content .woocommerce-error {
        padding: 12px 15px !important;
        margin-bottom: 15px !important;
        border-radius: 4px !important;
        font-size: 14px !important;
    }
    
    .woocommerce-MyAccount-content .woocommerce-message {
        background: #d4edda !important;
        color: #155724 !important;
        border: 1px solid #c3e6cb !important;
    }
    
    .woocommerce-MyAccount-content .woocommerce-info {
        background: #d1ecf1 !important;
        color: #0c5460 !important;
        border: 1px solid #bee5eb !important;
    }
    
    .woocommerce-MyAccount-content .woocommerce-error {
        background: #f8d7da !important;
        color: #721c24 !important;
        border: 1px solid #f5c6cb !important;
    }
}

/* ==========================================================================
   TABLET ADJUSTMENTS (769px - 1024px)
   ========================================================================== */

/* ==========================================================================
   TABLET & DESKTOP - Désactiver les styles mobile
   ========================================================================== */

@media (min-width: 769px) {
    /* Masquer la navigation mobile sur tablette et desktop */
    .mobile-tabs-nav {
        display: none !important;
    }
    
    /* Restaurer le padding du contenu principal */
    .site-content.has-mobile-tabs {
        padding-bottom: 0 !important;
    }
    
    body.woocommerce-account .woocommerce-MyAccount-content {
        padding-bottom: 0 !important;
    }
}

/* ==========================================================================
   PETITS ÉCRANS (< 375px) - iPhone SE, petits Android
   ========================================================================== */

@media (max-width: 374px) {
    .mobile-tabs-nav .tab-link {
        padding: 8px 4px !important;
    }
    
    .mobile-tabs-nav .tab-icon {
        width: 20px !important;
        height: 20px !important;
    }
    
    .mobile-tabs-nav .tab-label {
        font-size: 10px !important;
    }
    
    .mobile-tabs-nav .tab-item {
        min-width: 60px !important;
        max-width: 80px !important;
    }
}

/* ==========================================================================
   GRANDS ÉCRANS (> 430px) - iPhone Plus, grands Android
   ========================================================================== */

@media (min-width: 430px) and (max-width: 768px) {
    .mobile-tabs-nav .tab-item {
        min-width: 80px !important;
        max-width: 110px !important;
    }
    
    .mobile-tabs-nav .tab-link {
        padding: 12px 10px !important;
    }
    
    .mobile-tabs-nav .tab-icon {
        width: 26px !important;
        height: 26px !important;
    }
}

/* ==========================================================================
   ANIMATIONS ET TRANSITIONS
   ========================================================================== */

@media (max-width: 768px) {
    /* Animation de aparición suave */
    @keyframes slideUpFade {
        from {
            opacity: 0;
            transform: translateY(20px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    .mobile-tabs-nav {
        animation: slideUpFade 0.3s ease-out !important;
    }
    
    /* Animation pour le changement d'onglet actif */
    .mobile-tabs-nav .tab-item {
        transition: all 0.2s ease !important;
    }
    
    .mobile-tabs-nav .tab-item:active {
        transform: scale(0.95) !important;
    }
}

/* ==========================================================================
   ACCESSIBILITÉ
   ========================================================================== */

@media (max-width: 768px) {
    /* Focus visible pour la navigation au clavier */
    .mobile-tabs-nav .tab-link:focus {
        outline: 2px solid #C27B5C !important;
        outline-offset: -2px !important;
    }
    
    /* Mode prefers-reduced-motion */
    @media (prefers-reduced-motion: reduce) {
        .mobile-tabs-nav,
        .mobile-tabs-nav .tab-item,
        .mobile-tabs-nav .tab-link {
            animation: none !important;
            transition: none !important;
        }
    }
    
    /* High contrast mode support */
    @media (prefers-contrast: high) {
        .mobile-tabs-nav {
            border-top: 2px solid #000000 !important;
        }
        
        .mobile-tabs-nav .tab-link {
            border: 1px solid #000000 !important;
        }
        
        .mobile-tabs-nav .tab-item.active .tab-link {
            background: #000000 !important;
            color: #ffffff !important;
        }
        
        .mobile-tabs-nav .tab-item.active .tab-icon {
            fill: #ffffff !important;
        }
    }
}

/* ==========================================================================
   PRINT STYLES (masquer la navigation mobile à l'impression)
   ========================================================================== */

@media print {
    .mobile-tabs-nav {
        display: none !important;
    }
    
    body.woocommerce-account .woocommerce-MyAccount-navigation {
        display: block !important;
    }
}
