/*
Theme Name: Template Clic&COM
Template: yootheme
Author: Gillian Le Brun - CNC
Description: Template Clic&COM
Version: 1.0.0
Text Domain: yootheme-clicetcom
*/

/**
 * ===================================================================
 * BADGE "NOUVEAUTÉ" SUR LES IMAGES PRODUITS
 * ===================================================================
 * Compatible avec YOOtheme Pro Builder via shortcodes
 */

/* ===== CARTE PRODUIT COMPLÈTE ===== */
.lcda-product-card {
    display: block;
    text-decoration: none;
}

.lcda-product-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.lcda-product-link:hover {
    text-decoration: none;
}

.lcda-product-title {
    margin-top: 15px;
    text-align: center;
}

/* Image produit : toujours dans un cadre de ratio fixe */
.lcda-product-image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center;
}

/* Responsive : adapter l'image sur petits écrans (fix iOS Safari) */
@media (max-width: 768px) {
    .lcda-product-image {
        width: 100% !important;
        height: 100% !important;
    }
}

/* ===== WRAPPER IMAGE AVEC BADGE ===== */
.lcda-product-image-wrapper {
    position: relative !important;
    display: block;
    overflow: hidden;
    width: 100%;
    aspect-ratio: 450 / 670;
}

.lcda-product-image-link {
    display: block;
    position: relative;
}

/* Container de l'image produit avec position relative */
.woocommerce ul.products li.product .woocommerce-loop-product__link,
.woocommerce ul.products li.product .woocommerce-LoopProduct-link,
.woocommerce ul.products li.product a[href*="product"],
.tm-grid-item .uk-card,
.uk-grid .uk-card {
    position: relative !important;
}

/* ===== BADGE "NOUVEAUTÉ" ===== */
.lcda-badge-nouveaute {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: #e74c3c; /* Rouge vif */
    color: #ffffff;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 3px;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    line-height: 1;
    display: inline-block;
}

/* ===== BADGE "PROMOTION" ===== */
.lcda-badge-promotion {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: #1f8b4c; /* Vert promo */
    color: #ffffff;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 3px;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    line-height: 1;
    display: inline-block;
}

/* YOOtheme spécifique : ciblage des éléments produits */
.tm-grid-item .product.tag-nouveaute > a,
.uk-grid .product.tag-nouveaute > a,
article.product.tag-nouveaute > a,
.el-item {
    position: relative !important;
}

/* Animation subtile au survol du produit */
.woocommerce ul.products li.product:hover .lcda-badge-nouveaute,
.product:hover .lcda-badge-nouveaute,
.lcda-product-image-wrapper:hover .lcda-badge-nouveaute,
.lcda-product-card:hover .lcda-badge-nouveaute,
.woocommerce ul.products li.product:hover .lcda-badge-promotion,
.product:hover .lcda-badge-promotion,
.lcda-product-image-wrapper:hover .lcda-badge-promotion,
.lcda-product-card:hover .lcda-badge-promotion {
    transform: scale(1.05);
    transition: transform 0.2s ease;
}

/* S'assurer que l'image ne dépasse pas */
.lcda-product-image-wrapper img,
.lcda-product-image-wrapper .lcda-product-image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center;
}

/* Responsive : adapter sur petits écrans (fix iOS Safari) */
@media (max-width: 768px) {
    .lcda-product-image-wrapper {
        width: 100%;
        aspect-ratio: 450 / 670;
    }

    .lcda-product-image-wrapper img,
    .lcda-product-image-wrapper .lcda-product-image {
        width: 100% !important;
        height: 100% !important;
    }
}

/* Responsive : taille réduite sur mobile */
@media (max-width: 640px) {
    .lcda-badge-nouveaute {
        font-size: 10px;
        padding: 5px 10px;
        top: 8px;
        left: 8px;
    }

    .lcda-badge-promotion {
        font-size: 10px;
        padding: 5px 10px;
        top: 8px;
        left: 8px;
    }
}

/* ===== ALIGNEMENT MOBILE DES GRIDS PRODUIT =====
   Hauteurs fixes pour aligner titre / prix / tailles en grille 2 colonnes. */
@media (max-width: 768px) {

    /* Les cellules de grille s'étirent à la même hauteur */
    .uk-grid > *,
    .tm-grid > *,
    .woocommerce ul.products li.product {
        align-self: stretch;
        display: flex;
        flex-direction: column;
    }

    /* el-item YOOtheme : idem */
    .el-item {
        display: flex;
        flex-direction: column;
        height: 100%;
    }

    .lcda-product-card {
        display: flex;
        flex-direction: column;
        width: 100%;
        height: 100%;
    }

    .lcda-product-link {
        display: flex;
        flex-direction: column;
        flex: 1;
        height: 100%;
    }

    /* Titre : hauteur fixe stricte — PAS de display:-webkit-box qui écrase height */
    .lcda-product-title,
    .woocommerce ul.products li.product .woocommerce-loop-product__title,
    .woocommerce ul.products li.product h2,
    .woocommerce ul.products li.product h3 {
        display: block !important; /* annule tout display flex/box hérité */
        line-height: 1.3;
        height: 2.6em;            /* = exactement 2 lignes */
        overflow: hidden;
        margin-top: 10px;
        margin-bottom: 0;
        text-align: center;
    }

    /* Tailles : hauteur fixe, 1 ligne de badges */
    .lcda-tailles {
        height: 36px;
        overflow: hidden;
        display: flex !important;
        flex-wrap: nowrap;
        gap: 4px;
        align-items: center;
        justify-content: center;
        margin-top: 8px;
    }
}



