/* Algérie Parfums — cartes produit des grilles. Chargé par includes/product-display.php */

/* ---------- Grille ---------- */
/* Le clearfix ul.products::before/::after de Storefront devient sinon
   un item de grille et occupe la première cellule. */
.woocommerce ul.products::before,
.woocommerce ul.products::after,
ul.products::before,
ul.products::after {
    content: none !important;
    display: none !important;
}

.woocommerce ul.products,
ul.products.ap-products {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    grid-auto-flow: row !important;
    width: auto !important;
    gap: 26px 20px;
    margin: 0 0 40px !important;
    padding: 0 !important;
    clear: none !important;
}
/* Le nombre de colonnes est piloté par le body class (voir shop-page.css). */
body.ap-shop-cols-4 ul.products { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
body.ap-shop-cols-3 ul.products { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
body.ap-shop-cols-2 ul.products { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }

@media (max-width: 1100px) { body.ap-shop-cols-4 ul.products { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; } }
@media (max-width: 780px)  { body.ap-shop-cols-4 ul.products, body.ap-shop-cols-3 ul.products { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; } }
@media (max-width: 420px)  { ul.products { grid-template-columns: repeat(1, minmax(0, 1fr)) !important; } }

/* ---------- Carte ---------- */
ul.products li.product {
    width: auto !important;
    float: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    overflow: visible;
}

.ap-card {
    position: relative;
    background: #fff;
    border: 1px solid hsl(30 20% 90%);
    border-radius: 2px;
    overflow: hidden;
    transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
    display: flex;
    flex-direction: column;
}
.ap-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .10);
    border-color: hsl(38 60% 70%);
}

/* ---------- Image ---------- */
.ap-card-media {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #fafafa;
}
.ap-card-media-link {
    display: block;
    width: 100%;
    height: 100%;
}
.ap-card-img-front,
.ap-card-img-back {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity .35s ease, transform .45s ease;
}
.ap-card-img-back { opacity: 0; }
.ap-card:hover .ap-card-img-front { opacity: 0; transform: scale(1.05); }
.ap-card:hover .ap-card-img-back { opacity: 1; transform: scale(1.05); }

/* Pas de 2e photo : on garde l'image visible et on zoome seulement. */
.ap-card:hover .ap-card-media.ap-single .ap-card-img-front {
    opacity: 1;
    transform: scale(1.09);
}

/* ---------- Overlay panier / wishlist ---------- */
.ap-card-overlay {
    position: absolute;
    right: 12px;
    bottom: 12px;
    display: flex;
    gap: 8px;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .25s ease, transform .25s ease;
    z-index: 3;
}
.ap-card:hover .ap-card-overlay { opacity: 1; transform: translateY(0); }

.ap-ov-btn {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .16);
    color: #333;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}
.ap-ov-cart:hover { background: hsl(38 70% 52%); color: #fff; transform: scale(1.08); }
.ap-ov-heart:hover { background: hsl(350 70% 55%); color: #fff; transform: scale(1.08); }
.ap-ov-btn svg { width: 18px; height: 18px; }

/* ---------- Badges ---------- */
.ap-ribbon {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 4;
    padding: 4px 12px;
    border-radius: 0;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .03em;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
    pointer-events: none;
}
.ap-ribbon-out {
    background: #6b6b6b;
    color: #fff;
}
.ap-ribbon-promo {
    background: hsl(0 72% 52%);
    color: #fff;
}
.ap-ribbon-new {
    background: hsl(150 55% 36%);
    color: #fff;
}

/* ---------- Contenu ---------- */
.ap-card > .woocommerce-loop-product__title {
    display: none !important;
}

.ap-card-rating {
    display: flex;
    gap: 2px;
    padding: 14px 16px 6px;
    color: hsl(38 80% 50%);
}
.ap-star-off { color: hsl(30 15% 82%); }

.ap-card-title {
    margin: 0 !important;
    padding: 0 16px;
    font-family: var(--font-display, 'Cormorant Garamond', Georgia, serif);
    font-size: 15.5px !important;
    font-weight: 600 !important;
    line-height: 1.35;
    color: var(--color-text, #2d2d2d) !important;
}
.ap-card-title a {
    color: inherit;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.7em;
}
.ap-card-title a:hover { color: hsl(38 70% 42%) !important; }

.ap-card-brand {
    display: inline-block;
    margin: 7px 16px 0;
    padding: 2px 9px;
    background: hsl(38 60% 52% / .14);
    color: hsl(38 70% 38%);
    border-radius: 0;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.ap-card-excerpt {
    margin: 9px 16px 0;
    font-size: 12.5px;
    line-height: 1.5;
    color: hsl(0 0% 42%);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.9em;
}

.ap-card-price {
    margin: auto 16px 0;
    padding: 12px 0 15px;
    display: flex;
    align-items: baseline;
    gap: 9px;
    flex-wrap: wrap;
}
.ap-now {
    font-family: var(--font-display, 'Cormorant Garamond', Georgia, serif);
    font-size: 19px;
    font-weight: 700;
    color: hsl(30 8% 9%);
}
.ap-now .woocommerce-Price-amount { color: inherit !important; }
.ap-old {
    font-size: 13px;
    color: hsl(0 0% 58%);
    opacity: .8;
}
.ap-old .woocommerce-Price-amount { color: inherit !important; }

/* ---------- Rupture ---------- */
.ap-card.ap-out { opacity: .62; }
.ap-card.ap-out .ap-card-img-front { filter: grayscale(.65); }

/* ---------- Bouton WC caché dans les grilles ---------- */
ul.products li.product .button,
ul.products li.product .added_to_cart,
ul.products li.product .product_type_simple,
ul.products li.product .add_to_cart_button {
    display: none !important;
}

/* ---------- Wrapper WC aligné sur la carte ---------- */
ul.products li.product {
    display: block !important;
}
/* Nom arabe sous le titre (cartes et fiche) */
.ap-card-name-ar { display: block; margin: -2px 0 4px; font-size: 13px; color: #6d6d6d; text-align: center; }
.ap-product-name-ar { margin: -6px 0 10px; font-size: 18px; color: #6d6d6d; text-align: left; }
.ap-tarifs-livraison td:last-child { white-space: nowrap; font-weight: 600; }
