/* =========================================================================
   ShopNFood — Refonte fiche produit (UI uniquement)
   Scopé sous body.snf-product-redesign.single-product
   Chargé APRÈS crazyfood-style.css (dépendance) => override propre.
   Aucune règle globale agressive : tout est préfixé/scopé.
   ========================================================================= */

:root {
    --snf-pp-bg:        #f7fbfd;
    --snf-pp-card:      #ffffff;
    --snf-pp-border:    #e8f1f6;
    --snf-pp-radius:    22px;
    --snf-pp-shadow:    0 10px 30px rgba(20, 80, 120, 0.07);
    --snf-pp-blue:      #2c9fd4;
    --snf-pp-teal:      #2aa3d6;
    --snf-pp-teal-2:    #1f8fc0;
    --snf-pp-green:     #1aa260;
    --snf-pp-ink:       #1f2d3d;
    --snf-pp-muted:     #6b7c8c;
}

/* ---- Fond général de la page produit ---- */
body.snf-product-redesign.single-product {
    background: var(--snf-pp-bg);
}

/* =========================================================
   1. LAYOUT PRINCIPAL — 2 colonnes (galerie / résumé)
   ========================================================= */
body.snf-product-redesign.single-product .woocommerce {
    max-width: 1320px !important;
    margin: 0 auto !important;
    padding: 30px 20px !important;
}

body.snf-product-redesign.single-product div.product {
    display: grid !important;
    grid-template-columns: 1fr 1.2fr !important;
    gap: 28px !important;
    align-items: start !important;
}

/* Carte galerie (gauche) */
body.snf-product-redesign.single-product .woocommerce-product-gallery {
    flex: none !important;
    max-width: 100% !important;
    margin: 0 !important;
    background: var(--snf-pp-card) !important;
    border: 1px solid var(--snf-pp-border) !important;
    border-radius: var(--snf-pp-radius) !important;
    box-shadow: var(--snf-pp-shadow) !important;
    padding: 32px !important;
    position: relative !important;
}

/* Carte résumé (droite) */
body.snf-product-redesign.single-product .summary {
    flex: none !important;
    max-width: 100% !important;
    margin: 0 !important;
    background: var(--snf-pp-card) !important;
    border: 1px solid var(--snf-pp-border) !important;
    border-radius: var(--snf-pp-radius) !important;
    box-shadow: var(--snf-pp-shadow) !important;
    padding: 34px 36px !important;
}

/* Tabs + carte infos + similaires : pleine largeur sous les 2 colonnes */
body.snf-product-redesign.single-product .woocommerce-tabs,
body.snf-product-redesign.single-product .snf-product-info-card,
body.snf-product-redesign.single-product .related.products,
body.snf-product-redesign.single-product .up-sells {
    grid-column: 1 / -1 !important;
}

/* =========================================================
   2. GALERIE
   ========================================================= */
body.snf-product-redesign.single-product .woocommerce-product-gallery__image img {
    border-radius: 14px;
}

/* Miniatures horizontales sous l'image */
body.snf-product-redesign.single-product .flex-control-thumbs {
    display: flex !important;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 22px !important;
    padding: 0;
    justify-content: center;
}
body.snf-product-redesign.single-product .flex-control-thumbs li {
    width: 64px !important;
    margin: 0 !important;
    float: none !important;
}
body.snf-product-redesign.single-product .flex-control-thumbs img {
    border: 2px solid var(--snf-pp-border);
    border-radius: 12px;
    padding: 4px;
    opacity: 1;
    transition: border-color .2s ease, transform .2s ease;
}
body.snf-product-redesign.single-product .flex-control-thumbs img:hover,
body.snf-product-redesign.single-product .flex-control-thumbs img.flex-active {
    border-color: var(--snf-pp-teal);
    transform: translateY(-2px);
}

/* Cœur favori repositionné en haut à droite de l'image (déplacé par JS).
   Sur la fiche produit on veut un cœur rond (pas le pill « texte au survol »
   de la liste favoris) : on force le cercle et on masque le libellé. */
body.snf-product-redesign.single-product .woocommerce-product-gallery .snf-fav-btn--single {
    position: absolute;
    top: 22px;
    right: 22px;
    z-index: 5;
    width: 44px !important;
    height: 44px !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 50% !important;
    background: #fff !important;
    border: 1px solid var(--snf-pp-border) !important;
    box-shadow: 0 2px 10px rgba(20, 80, 120, 0.12) !important;
    overflow: visible !important;
}
body.snf-product-redesign.single-product .woocommerce-product-gallery .snf-fav-btn--single span {
    display: none !important;
}
/* Le bouton « zoom » natif de WooCommerce (loupe) est aussi en haut-droite et
   chevauchait le cœur favori : on le descend en bas-droite de la galerie. */
body.snf-product-redesign.single-product .woocommerce-product-gallery__trigger {
    top: auto !important;
    bottom: 18px !important;
    right: 18px !important;
    left: auto !important;
    z-index: 4 !important;
}
body.snf-product-redesign.single-product .woocommerce-product-gallery .snf-fav-btn--single.active {
    background: #fff5fa !important;
    border-color: rgba(255, 79, 160, .3) !important;
}

/* Badge promo « -40% » : le .onsale est un frère de la galerie dans
   div.product. Sans parent positionné il partait au mauvais endroit (donc
   invisible). On positionne div.product en relative et le badge en haut-gauche
   de la galerie. Le style visuel (dégradé rose) vient de crazyfood-style.css. */
body.snf-product-redesign.single-product div.product {
    position: relative !important;
}
body.snf-product-redesign.single-product .onsale {
    position: absolute !important;
    top: 22px !important;
    left: 22px !important;
    right: auto !important;
    z-index: 6 !important;
    margin: 0 !important;
}

/* =========================================================
   3. RÉSUMÉ — fil d'ariane, catégorie, titre
   ========================================================= */
body.snf-product-redesign.single-product .summary .woocommerce-breadcrumb,
body.snf-product-redesign.single-product .woocommerce-breadcrumb {
    font-size: .8rem;
    color: var(--snf-pp-muted);
    margin: 0 0 16px;
    padding: 0 4px;
}

body.snf-product-redesign.single-product .product_title {
    font-size: 1.7rem !important;
    line-height: 1.2 !important;
    font-weight: 800 !important;
    color: var(--snf-pp-ink) !important;
    margin: 4px 0 18px !important;
    text-transform: uppercase;
}

/* =========================================================
   4. ZONE PRIX — centrée (montant, badge, "soit X/unité")
      Le badge .snf-price-badge est déplacé par JS entre le
      montant et la ligne unité.
   ========================================================= */
body.snf-product-redesign.single-product .summary .price {
    display: block !important;
    text-align: center !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    padding: 0 !important;
    margin: 0 0 18px !important;
}

body.snf-product-redesign.single-product .shopnfood-b2b-price {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
body.snf-product-redesign.single-product .shopnfood-price-carton {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    border: 0 !important;
    padding: 0 !important;
}
body.snf-product-redesign.single-product .shopnfood-price-amount {
    font-size: 2.3rem !important;
    font-weight: 800 !important;
    color: var(--snf-pp-green) !important;
    line-height: 1 !important;
}
body.snf-product-redesign.single-product .shopnfood-price-amount small {
    font-size: .9rem !important;
    color: var(--snf-pp-muted) !important;
}

/* Badge catégorie ("Prix Détaillant") : centré sous le montant */
body.snf-product-redesign.single-product .summary .snf-price-badge {
    display: inline-block !important;
    margin: 4px auto 2px !important;
    padding: 5px 14px !important;
    font-size: .8rem !important;
    font-weight: 600 !important;
    border-radius: 20px !important;
    vertical-align: middle;
}

/* Ligne "soit 3,15 € HT / unité (18 unités/carton)" */
body.snf-product-redesign.single-product .shopnfood-price-unit {
    display: block !important;
    width: auto !important;
    padding-left: 0 !important;
    font-size: .9rem !important;
    color: var(--snf-pp-muted) !important;
}

/* Paliers demi-palette / palette : centrés également */
body.snf-product-redesign.single-product .shopnfood-price-half-palette,
body.snf-product-redesign.single-product .shopnfood-price-palette {
    justify-content: center;
    gap: 8px;
    border: 0 !important;
}

/* =========================================================
   5. SÉPARATEUR + LIGNE ACHAT (quantité + ajouter au panier)
   ========================================================= */
body.snf-product-redesign.single-product form.cart {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 14px !important;
    width: 100% !important;
    margin: 18px 0 8px !important;
    padding-top: 0 !important;
    border-top: 0 !important;
}

body.snf-product-redesign.single-product form.cart .snf-qty-block {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 6px !important;
    width: 100% !important;
}

body.snf-product-redesign.single-product form.cart .snf-qty-label {
    display: block !important;
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    color: #1f2a44;
    line-height: 1.2;
    text-align: center;
}

/* Sélecteur quantité moderne avec boutons -/+ (ajoutés par JS) */
body.snf-product-redesign.single-product .snf-qty-wrap {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: auto !important;
    height: 48px !important;
    border: 1px solid #e4edf3 !important;
    border-radius: 16px !important;
    overflow: hidden !important;
    background: #fff !important;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04) !important;
}
body.snf-product-redesign.single-product .snf-qty-btn {
    width: 48px !important;
    height: 48px !important;
    border: 0 !important;
    background: #f8fbfd !important;
    color: #08aeca !important;
    font-size: 18px !important;
    font-weight: 800 !important;
    cursor: pointer !important;
    line-height: 1;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background .15s ease;
}
body.snf-product-redesign.single-product .snf-qty-btn:hover {
    background: #e3f3fb;
}
body.snf-product-redesign.single-product form.cart .quantity {
    flex: 0 0 64px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 64px !important;
    height: 48px !important;
    margin: 0 !important;
    padding: 0 !important;
}
body.snf-product-redesign.single-product .snf-qty-wrap .qty,
body.snf-product-redesign.single-product form.cart .quantity .qty {
    width: 64px !important;
    height: 48px !important;
    min-height: 48px !important;
    border: 0 !important;
    border-left: 1px solid #e4edf3 !important;
    border-right: 1px solid #e4edf3 !important;
    border-radius: 0 !important;
    background: #fff !important;
    text-align: center !important;
    font-weight: 800 !important;
    font-size: 15px !important;
    color: #1f2a44 !important;
    padding: 0 !important;
    box-shadow: none !important;
    -moz-appearance: textfield;
}
body.snf-product-redesign.single-product .snf-qty-wrap .qty::-webkit-outer-spin-button,
body.snf-product-redesign.single-product .snf-qty-wrap .qty::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

body.snf-product-redesign.single-product .single_add_to_cart_button {
    width: 100% !important;
    height: 50px !important;
    min-height: 50px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    background: #08aeca !important;
    color: #fff !important;
    border: 0 !important;
    border-radius: 16px !important;
    padding: 0 28px !important;
    margin: 0 !important;
    font-size: 15px !important;
    font-weight: 800 !important;
    box-shadow: 0 12px 24px rgba(8, 174, 202, 0.25) !important;
}
body.snf-product-redesign.single-product .single_add_to_cart_button:hover {
    background: var(--snf-pp-teal-2) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 12px 26px rgba(42, 163, 214, 0.4) !important;
}
body.snf-product-redesign.single-product .single_add_to_cart_button::before {
    /* Icône panier en SVG inline (aucune dépendance FontAwesome/lucide) */
    content: "";
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    background: no-repeat center / contain
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='21' r='1'/%3E%3Ccircle cx='20' cy='21' r='1'/%3E%3Cpath d='M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6'/%3E%3C/svg%3E");
}

/* =========================================================
   6. BLOC PAIEMENT SÉCURISÉ
   ========================================================= */
body.snf-product-redesign.single-product .snf-product-payment {
    margin: 18px 0 0 !important;
    padding: 16px 18px;
    border: 1px solid var(--snf-pp-border);
    border-radius: 16px;
    background: #fbfdff;
    text-align: center;
}
body.snf-product-redesign.single-product .snf-product-payment__title {
    display: block;
    font-size: .82rem;
    font-weight: 700;
    color: var(--snf-pp-ink);
    margin-bottom: 12px;
}
body.snf-product-redesign.single-product .snf-product-payment__cards {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}
body.snf-product-redesign.single-product .snf-card-chip {
    padding: 7px 12px;
    border: 1px solid var(--snf-pp-border);
    border-radius: 10px;
    background: #fff;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .3px;
    color: #34495e;
    box-shadow: 0 2px 6px rgba(20, 80, 120, 0.05);
}

/* =========================================================
   7. BLOC RÉASSURANCE 3 COLONNES
   ========================================================= */
body.snf-product-redesign.single-product .snf-product-reassurance {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin: 18px 0 0 !important;
    padding: 18px;
    border: 1px solid var(--snf-pp-border);
    border-radius: 16px;
    background: #fbfdff;
}
body.snf-product-redesign.single-product .snf-reassurance-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
body.snf-product-redesign.single-product .snf-reassurance-item__icon {
    flex: 0 0 auto;
    color: var(--snf-pp-teal);
    display: inline-flex;
}
body.snf-product-redesign.single-product .snf-reassurance-item__icon i,
body.snf-product-redesign.single-product .snf-reassurance-item__icon svg {
    width: 22px;
    height: 22px;
}
body.snf-product-redesign.single-product .snf-reassurance-item__text {
    display: flex;
    flex-direction: column;
    font-size: .76rem;
    line-height: 1.35;
    color: var(--snf-pp-muted);
}
body.snf-product-redesign.single-product .snf-reassurance-item__text strong {
    color: var(--snf-pp-ink);
    font-size: .8rem;
}

/* =========================================================
   8. MÉTA (UGS / catégorie)
   ========================================================= */
body.snf-product-redesign.single-product .product_meta {
    margin-top: 20px !important;
    padding-top: 16px !important;
    border-top: 1px solid var(--snf-pp-border) !important;
    font-size: .85rem !important;
}

/* =========================================================
   9. CARTE INFOS PRODUIT + INGRÉDIENTS (pleine largeur, 2 col)
   ========================================================= */
body.snf-product-redesign.single-product .snf-product-info-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 28px;
    padding: 32px 36px;
    background: var(--snf-pp-card);
    border: 1px solid var(--snf-pp-border);
    border-radius: var(--snf-pp-radius);
    box-shadow: var(--snf-pp-shadow);
}
body.snf-product-redesign.single-product .snf-product-info-card:empty {
    display: none;
}
body.snf-product-redesign.single-product .snf-product-info-card h4 {
    position: relative;
    font-size: 1rem !important;
    font-weight: 800 !important;
    text-transform: uppercase;
    color: var(--snf-pp-ink) !important;
    margin: 0 0 20px !important;
    padding-bottom: 12px;
    display: inline-block;
}
/* Soulignement bleu court sous le titre (façon maquette) */
body.snf-product-redesign.single-product .snf-product-info-card h4::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 46px;
    height: 3px;
    border-radius: 2px;
    background: var(--snf-pp-teal);
}
body.snf-product-redesign.single-product .shopnfood-product-info,
body.snf-product-redesign.single-product .shopnfood-glossaire {
    margin: 0 !important;
}
/* Tableau bordé en grille, coins arrondis, lignes séparées */
body.snf-product-redesign.single-product .shopnfood-info-table {
    width: 100%;
    margin-top: 4px;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--snf-pp-border);
    border-radius: 12px;
    overflow: hidden;
}
body.snf-product-redesign.single-product .shopnfood-info-table th,
body.snf-product-redesign.single-product .shopnfood-info-table td {
    text-align: left;
    padding: 14px 18px;
    font-size: .9rem;
    vertical-align: middle;
}
/* Séparateur horizontal entre les lignes (sauf la dernière) */
body.snf-product-redesign.single-product .shopnfood-info-table tr:not(:last-child) > th,
body.snf-product-redesign.single-product .shopnfood-info-table tr:not(:last-child) > td {
    border-bottom: 1px solid var(--snf-pp-border);
}
/* Colonne libellés (gauche) — léger fond + séparateur vertical */
body.snf-product-redesign.single-product .shopnfood-info-table th {
    font-weight: 500;
    color: var(--snf-pp-muted);
    width: 42%;
    background: #fbfdfe;
    border-right: 1px solid var(--snf-pp-border);
}
/* Colonne valeurs (droite) — poids normal (façon maquette, pas gras) */
body.snf-product-redesign.single-product .shopnfood-info-table td {
    font-weight: 500;
    color: var(--snf-pp-ink);
}
/* DDM — alerte couleur dans « Informations produit ».
   Colore l'intitulé (th) ET la date (td) :
     - orange quand la DDM est dans la période Last Chance,
     - rouge quand la DDM est dépassée.
   Sélecteur plus spécifique que les règles th/td ci-dessus pour écraser leur couleur. */
body.snf-product-redesign.single-product .shopnfood-info-table tr.snf-ddm--soon > th,
body.snf-product-redesign.single-product .shopnfood-info-table tr.snf-ddm--soon > td {
    color: #ea7a00;
    font-weight: 600;
}
body.snf-product-redesign.single-product .shopnfood-info-table tr.snf-ddm--expired > th,
body.snf-product-redesign.single-product .shopnfood-info-table tr.snf-ddm--expired > td {
    color: #dc2626;
    font-weight: 600;
}
body.snf-product-redesign.single-product .shopnfood-glossaire-content {
    margin-top: 14px;
    font-size: .85rem;
    line-height: 1.6;
    color: #3a4a59;
}

/* =========================================================
   10. PRODUITS SIMILAIRES
   ========================================================= */
body.snf-product-redesign.single-product .related.products > h2,
body.snf-product-redesign.single-product .up-sells > h2 {
    text-align: center !important;
    text-transform: uppercase !important;
    font-size: 1.5rem !important;
    font-weight: 800 !important;
    color: var(--snf-pp-ink) !important;
    margin-bottom: 6px !important;
}
body.snf-product-redesign.single-product .related.products > h2::after,
body.snf-product-redesign.single-product .up-sells > h2::after {
    content: "";
    display: block;
    width: 60px;
    height: 3px;
    background: var(--snf-pp-teal);
    border-radius: 2px;
    margin: 10px auto 26px;
}

body.snf-product-redesign.single-product .related.products ul.products,
body.snf-product-redesign.single-product .up-sells ul.products {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 22px !important;
    margin: 0 !important;
}
body.snf-product-redesign.single-product ul.products li.product {
    width: auto !important;
    margin: 0 !important;
    background: var(--snf-pp-card);
    border: 1px solid var(--snf-pp-border);
    border-radius: 18px;
    box-shadow: var(--snf-pp-shadow);
    padding: 18px;
    text-align: left;
    transition: transform .2s ease, box-shadow .2s ease;
}
body.snf-product-redesign.single-product ul.products li.product:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 34px rgba(20, 80, 120, 0.12);
}
body.snf-product-redesign.single-product ul.products li.product img {
    border-radius: 12px;
    margin: 0 auto 12px !important;
}
body.snf-product-redesign.single-product .snf-loop-cat {
    display: block;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .5px;
    color: var(--snf-pp-blue);
    margin-bottom: 4px;
}
body.snf-product-redesign.single-product ul.products li.product .woocommerce-loop-product__title {
    font-size: .9rem !important;
    font-weight: 700 !important;
    color: var(--snf-pp-ink) !important;
    min-height: 2.4em;
}
body.snf-product-redesign.single-product .snf-stock-badge {
    display: inline-block;
    margin: 4px 0;
    padding: 3px 10px;
    font-size: .68rem;
    font-weight: 700;
    border-radius: 20px;
}
body.snf-product-redesign.single-product .snf-stock-badge--in {
    background: #e6f7ef;
    color: var(--snf-pp-green);
}
body.snf-product-redesign.single-product .snf-stock-badge--out {
    background: #fdeaea;
    color: #d33;
}
body.snf-product-redesign.single-product ul.products li.product .price {
    color: var(--snf-pp-teal-2) !important;
    font-weight: 800 !important;
    margin: 4px 0 12px !important;
}
body.snf-product-redesign.single-product ul.products li.product .add_to_cart_button,
body.snf-product-redesign.single-product ul.products li.product .button {
    display: block !important;
    width: 100% !important;
    text-align: center !important;
    background: var(--snf-pp-teal) !important;
    color: #fff !important;
    border-radius: 12px !important;
    padding: 11px 14px !important;
    font-weight: 700 !important;
}
body.snf-product-redesign.single-product ul.products li.product .ast-on-card-button {
    display: none !important;
}
body.snf-product-redesign.single-product ul.products li.product .add_to_cart_button:hover,
body.snf-product-redesign.single-product ul.products li.product .button:hover {
    background: var(--snf-pp-teal-2) !important;
}

/* =========================================================
   11. RESPONSIVE
   ========================================================= */
@media (max-width: 1024px) {
    body.snf-product-redesign.single-product div.product {
        grid-template-columns: 1fr !important;
    }
    body.snf-product-redesign.single-product .related.products ul.products,
    body.snf-product-redesign.single-product .up-sells ul.products {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media (max-width: 782px) {
    body.snf-product-redesign.single-product .summary {
        padding: 26px 22px !important;
    }
    body.snf-product-redesign.single-product .snf-product-info-card {
        grid-template-columns: 1fr;
        padding: 26px 22px;
    }
    body.snf-product-redesign.single-product .snf-product-reassurance {
        grid-template-columns: 1fr;
    }
    body.snf-product-redesign.single-product .related.products ul.products,
    body.snf-product-redesign.single-product .up-sells ul.products {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    body.snf-product-redesign.single-product form.cart {
        flex-direction: column !important;
    }
    body.snf-product-redesign.single-product .single_add_to_cart_button {
        width: 100% !important;
        flex: 1 0 100% !important;
    }
}

@media (max-width: 480px) {
    body.snf-product-redesign.single-product .related.products ul.products,
    body.snf-product-redesign.single-product .up-sells ul.products {
        grid-template-columns: 1fr !important;
    }
    body.snf-product-redesign.single-product .product_title {
        font-size: 1.4rem !important;
    }
    body.snf-product-redesign.single-product .shopnfood-price-amount {
        font-size: 2rem !important;
    }
}
