/**
 * LLA Product Cards — Unified Style v2.1
 * One card style for: shop, homepage, artisan, wishlist, search, upsells
 *
 * Palette: LLA gold (#D79942), cream borders (#f0e6d3), warm backgrounds
 *
 * @package LLA_Marketplace_Connector
 * @version 2.1.0
 */

/* ==========================================
   VARIABLES
   ========================================== */
:root {
    --lla-card-bg: #ffffff;
    --lla-card-border: #f0e6d3;
    --lla-card-border-hover: #D79942;
    --lla-card-shadow-hover: 0 4px 16px rgba(215, 153, 66, 0.12);
    --lla-card-radius: 12px;
    --lla-text-primary: #1f2937;        /* contraste 12.6:1 sur blanc — AAA */
    --lla-text-secondary: #4b5563;      /* contraste 7.6:1 — AAA — était #6b7280 limite */
    --lla-text-muted: #6b7280;          /* contraste 4.6:1 — AA — était #9ca3af FAIL */
    --lla-primary: #D79942;             /* gold accent — usage limité car contraste 2.6:1 sur blanc */
    --lla-primary-hover: #C88835;
    --lla-primary-text: #A06D2C;        /* gold foncé pour texte sur fond clair, contraste 4.7:1 — AA */
    --lla-success: #059669;
    --lla-danger: #dc2626;
    --lla-warning: #f59e0b;
}

/* ==========================================
   CARD BASE
   ========================================== */
.lla-product-card {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.lla-card-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--lla-card-bg);
    border: 1.5px solid var(--lla-card-border);
    border-radius: var(--lla-card-radius);
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.lla-card-inner:hover {
    border-color: var(--lla-card-border-hover);
    box-shadow: var(--lla-card-shadow-hover);
    transform: translateY(-2px);
}

/* ==========================================
   IMAGE + OVERLAYS
   ========================================== */
.lla-card-image-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    background: #faf8f5;
    overflow: hidden;
}

.lla-card-image-link {
    display: block;
    width: 100%;
    height: 100%;
}

.lla-card-image-wrapper img,
.lla-card-image-wrapper .lla-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.lla-card-inner:hover .lla-card-image-wrapper img {
    transform: scale(1.05);
}

/* Badges overlay — top-left on image */
.lla-card-badges-overlay {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.lla-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-radius: 4px;
    line-height: 1.3;
}

.lla-badge-sale { background: var(--lla-danger); color: #fff; }
.lla-badge-new { background: var(--lla-success); color: #fff; }
.lla-badge-featured { background: var(--lla-warning); color: #fff; }
.lla-badge-promo { color: #fff; }
.lla-badge-out-of-stock { background: #6b7280; color: #fff; }

/* Wishlist button — top-right on image */
.lla-wishlist-btn {
    position: absolute !important;
    top: 8px !important;
    right: 8px !important;
    z-index: 5 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 34px !important;
    height: 34px !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 50% !important;
    background: #fff !important;
    color: var(--lla-text-muted) !important;
    cursor: pointer !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1) !important;
    transition: transform 0.2s, color 0.2s !important;
}

.lla-wishlist-btn:hover {
    transform: scale(1.1) !important;
    color: var(--lla-danger) !important;
}

.lla-wishlist-btn.is-active,
.lla-wishlist-btn.in-wishlist {
    background: var(--lla-danger) !important;
    color: #fff !important;
}

.lla-wishlist-btn.is-active .lla-heart-icon,
.lla-wishlist-btn.in-wishlist .lla-heart-icon {
    fill: currentColor;
}

.lla-heart-icon {
    width: 16px;
    height: 16px;
    transition: all 0.2s;
}

/* ==========================================
   CONTENT
   ========================================== */
.lla-card-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
    flex: 1;
}

/* Vendor */
.lla-card-vendor {
    font-size: 12px;
}

.lla-vendor-link {
    /* Gris-brun chaud secondaire : ne concurrence pas le titre, harmonise
       avec la palette terre/orange. Contraste 5.4:1 sur blanc — AA. */
    color: #7a6f5d !important;
    text-decoration: none !important;
    font-weight: 600;
    transition: color 0.2s;
}

.lla-vendor-link:hover { color: var(--lla-primary-hover) !important; }

.lla-vendor-name {
    font-weight: 600;
    color: var(--lla-primary-text);  /* gold foncé contraste 4.7:1 AA — était --lla-primary FAIL */
}

/* Remove "Vendu par" label if still present */
.lla-vendor-label { display: none; }

/* Title */
.lla-card-title {
    margin: 0 !important;
    padding: 0 !important;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    /* Brun chaud fonce qui s'harmonise avec la palette orange/gold du brand,
       au lieu d'un slate froid bleute. Contraste 13.5:1 sur blanc — AAA. */
    color: #2d2419;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.lla-card-title a { color: inherit; text-decoration: none; }
.lla-card-title a:hover { color: var(--lla-primary); }

/* Rating */
.lla-card-rating {
    display: flex;
    align-items: center;
    gap: 4px;
}

.lla-stars {
    display: flex;
    align-items: center;
    color: var(--lla-warning);
}

.lla-star { font-size: 13px; line-height: 1; }
.lla-star-empty { color: #e0d5c8; }
.lla-star-half { position: relative; color: #e0d5c8; }
.lla-star-half::before {
    content: '\2605';
    position: absolute; left: 0;
    color: var(--lla-warning);
    width: 50%; overflow: hidden;
}

.lla-rating-count { color: var(--lla-text-muted); font-size: 11px; }

/* Tags (Fait main, Made in France) */
.lla-card-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.lla-card-tag {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    background: #faf8f5;
    color: #7A6F5D;
    border: 1px solid #f0e6d3;
    font-weight: 500;
}

/* Price */
.lla-card-price {
    font-size: 16px;
    font-weight: 700;
    /* Prix en gold fonce — accent visuel sur l'element clef de conversion. */
    color: var(--lla-primary-text);
    margin-top: auto;
    padding-top: 4px;
}

.lla-card-price del {
    font-size: 12px;
    font-weight: 400;
    color: var(--lla-text-muted);
}

.lla-card-price ins {
    text-decoration: none;
    color: var(--lla-danger);
}

/* ==========================================
   ACTIONS
   ========================================== */
.lla-card-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

/* Add to cart */
.lla-add-to-cart-btn,
a.lla-add-to-cart-btn,
.lla-card-actions .lla-add-to-cart-btn {
    flex: 1;
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 14px !important;
    background: var(--lla-primary) !important;
    color: #fff !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    border: none !important;
    border-radius: 8px !important;
    cursor: pointer;
    transition: background 0.2s;
}

.lla-add-to-cart-btn:hover,
a.lla-add-to-cart-btn:hover {
    background: var(--lla-primary-hover) !important;
    color: #fff !important;
}

.lla-add-to-cart-btn.loading::after {
    content: '';
    width: 14px; height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: lla-spin 0.6s linear infinite;
}

.lla-add-to-cart-btn.added { background: var(--lla-success) !important; }

.lla-cart-icon { width: 14px; height: 14px; stroke: #fff !important; }

.lla-add-to-cart-btn span,
a.lla-add-to-cart-btn span {
    color: #fff !important;
}

/* Choisir une variante (produit variable) — STYLE COHÉRENT avec "Ajouter".
 * On garde le fond plein gold + texte blanc pour que les 2 boutons d'action
 * aient le même poids visuel sur la grille. Le texte est différent ("Choisir
 * et voir" vs "Ajouter") pour signaler qu'il y a un choix à faire avant achat.
 *
 * Avant : outline gold sur fond transparent → contraste texte/fond 2.6:1 (FAIL WCAG)
 *         + visuellement déséquilibré vs "Ajouter" plein.
 */
.lla-view-product,
a.lla-view-product,
.lla-add-to-cart-btn.lla-view-product,
a.lla-add-to-cart-btn.lla-view-product {
    background: var(--lla-primary) !important;
    border: 1.5px solid var(--lla-primary) !important;
    color: #fff !important;
}

.lla-view-product:hover,
a.lla-view-product:hover {
    background: var(--lla-primary-hover) !important;
    border-color: var(--lla-primary-hover) !important;
    color: #fff !important;
}

.lla-view-product span,
a.lla-view-product span,
.lla-add-to-cart-btn.lla-view-product span {
    color: #fff !important;
}

.lla-view-product .lla-cart-icon,
a.lla-view-product .lla-cart-icon {
    stroke: #fff !important;
}

/* Petit chevron à droite pour indiquer "ouvre la fiche pour choisir" */
.lla-view-product::after,
a.lla-view-product::after {
    content: '›';
    margin-left: 4px;
    font-size: 14px;
    line-height: 1;
    transition: transform 0.2s;
}

.lla-view-product:hover::after,
a.lla-view-product:hover::after {
    transform: translateX(2px);
}

/* Out of stock */
.lla-out-of-stock {
    flex: 1;
    text-align: center;
    padding: 9px;
    font-size: 12px;
    font-weight: 500;
    color: var(--lla-text-muted);
    background: #faf8f5;
    border-radius: 8px;
    border: 1px solid var(--lla-card-border);
}

/* ==========================================
   ANIMATIONS
   ========================================== */
@keyframes lla-spin { to { transform: rotate(360deg); } }
@keyframes lla-heart-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}
.lla-wishlist-btn.just-added .lla-heart-icon { animation: lla-heart-pop 0.3s ease; }

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 768px) {
    .lla-card-content { padding: 10px; gap: 3px; }
    .lla-card-title { font-size: 13px; }
    .lla-card-vendor { font-size: 11px; }
    .lla-card-price { font-size: 14px; }
    .lla-card-tags { display: none; }
    .lla-add-to-cart-btn,
    a.lla-add-to-cart-btn { padding: 7px 10px !important; font-size: 12px !important; }
    .lla-add-to-cart-btn span { display: none; }
    .lla-add-to-cart-btn .lla-cart-icon { display: block !important; }
    .lla-wishlist-btn { width: 30px !important; height: 30px !important; }
    .lla-heart-icon { width: 14px; height: 14px; }
    .lla-badge { font-size: 9px; padding: 2px 6px; }
}

/* ==========================================
   WC GRID RESET
   ========================================== */
.woocommerce ul.products li.product.lla-product-card,
ul.products li.product.lla-product-card {
    padding: 0 !important;
    width: 100% !important;
}

/* Hide default WC elements we replace */
.lla-product-card .woocommerce-loop-product__title,
.lla-product-card .price,
.lla-product-card .star-rating,
.lla-product-card .button.add_to_cart_button,
.lla-product-card .onsale {
    display: none !important;
}

/* Old badge container (in content, not overlay) — hide if both exist */
.lla-card-badges { display: none; }
