/*
 Theme Name:   Woodmart Child
 Description:  Woodmart Child Theme
 Author:       XTemos
 Author URI:   http://xtemos.com
 Template:     woodmart
 Version:      1.0.0
 Text Domain:  woodmart
*/




/**
 * STYLE POUR LE MENU MOBILE TRADUIT
 */
add_action('wp_footer', 'translate_mobile_toolbar_css', 998);

function translate_mobile_toolbar_css() {
    ?>
    <style>
        /* Ajustements pour le menu mobile traduit */
        .wd-toolbar .wd-toolbar-item .wd-toolbar-label {
            font-size: 11px !important;
            font-weight: 600 !important;
            text-transform: none !important;
            letter-spacing: 0.3px !important;
        }
        
        .wd-toolbar .wd-toolbar-item {
            min-width: 60px !important;
        }
        
        .wd-toolbar .wd-tools-element .wd-toolbar-label {
            font-size: 10px !important;
            font-weight: 500 !important;
        }
        
        /* Ajustements pour les longs textes en français */
        .wd-toolbar .wd-toolbar-label {
            white-space: nowrap !important;
            overflow: hidden !important;
            text-overflow: ellipsis !important;
            max-width: 70px !important;
        }
        
        @media (max-width: 480px) {
            .wd-toolbar .wd-toolbar-item .wd-toolbar-label {
                font-size: 9px !important;
            }
            .wd-toolbar .wd-toolbar-item {
                min-width: 50px !important;
                padding: 0 4px !important;
            }
            .wd-toolbar .wd-toolbar-label {
                max-width: 55px !important;
            }
        }
        
        @media (max-width: 380px) {
            .wd-toolbar .wd-toolbar-item .wd-toolbar-label {
                font-size: 8px !important;
            }
            .wd-toolbar .wd-toolbar-item {
                min-width: 40px !important;
            }
            .wd-toolbar .wd-toolbar-label {
                max-width: 45px !important;
            }
        }
    </style>
    <?php
}





/* ============================================================
   ALIGNEMENT DES TITRES DE PRODUITS DANS LA GRILLE
   ============================================================ */

/* 1. Conteneur de produit en flex pour aligner les titres */
.product-wrapper,
.product-grid-item,
.product-item,
.products .product {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
}

/* 2. La zone d'information du produit prend tout l'espace */
.product-wrapper .product-info,
.product-grid-item .product-info,
.product-item .product-info,
.products .product .product-info {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 !important;
    height: 100% !important;
}

/* 3. Le titre du produit prend de l'espace et s'aligne */
.product-wrapper .product-info .product-title,
.product-grid-item .product-info .product-title,
.product-item .product-info .product-title,
.products .product .product-info .product-title,
.product-wrapper .product-info .wd-entities-title,
.product-grid-item .product-info .wd-entities-title,
.products .product .product-info .wd-entities-title,
.woocommerce-loop-product__title,
.product-title a,
.wd-entities-title a {
    display: block !important;
    min-height: 40px !important;
    height: auto !important;
    max-height: 60px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    line-height: 1.4 !important;
    margin-bottom: 4px !important;
    flex-shrink: 0 !important;
}

/* 4. Le prix reste en bas */
.product-wrapper .product-info .price,
.product-grid-item .product-info .price,
.product-item .product-info .price,
.products .product .product-info .price {
    margin-top: auto !important;
    padding-top: 6px !important;
}

/* 5. Les boutons et actions restent alignés */
.product-wrapper .product-info .product-actions,
.product-grid-item .product-info .product-actions,
.product-item .product-info .product-actions,
.products .product .product-info .product-actions,
.product-wrapper .product-info .wd-product-actions,
.product-grid-item .product-info .wd-product-actions,
.products .product .product-info .wd-product-actions {
    margin-top: auto !important;
    padding-top: 8px !important;
}

/* 6. Pour les produits variables ou avec variations */
.product-wrapper .product-info .variations,
.product-grid-item .product-info .variations {
    min-height: 30px !important;
}

/* 7. Les notes/avis sont alignés */
.product-wrapper .product-info .star-rating,
.product-grid-item .product-info .star-rating,
.products .product .product-info .star-rating {
    flex-shrink: 0 !important;
    min-height: 20px !important;
}

/* 8. La description courte */
.product-wrapper .product-info .product-short-description,
.product-grid-item .product-info .product-short-description,
.products .product .product-info .product-short-description {
    min-height: 20px !important;
    margin-bottom: 4px !important;
}

/* 9. Pour les produits sur une ligne */
.products-grid .product,
.products-list .product,
.products .product {
    height: 100% !important;
}

/* 10. Correction pour les colonnes */
.products .product .product-wrapper {
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
}

/* 11. Alignement des titres sur 2 lignes maximum */
.woocommerce-loop-product__title,
.woocommerce-loop-category__title,
.product-title {
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    min-height: 40px !important;
    max-height: 44px !important;
    line-height: 1.3 !important;
    margin-bottom: 4px !important;
    padding: 0 !important;
}

/* 12. Ajustement pour les titres sur 1 ligne */
.woocommerce-loop-product__title:only-child,
.product-title:only-child {
    min-height: 30px !important;
    max-height: 30px !important;
}