/**
 * ShopNFood Price Manager - Styles B2B
 */

/* === Message connexion requise === */
.shopnfood-price-hidden {
    padding: 15px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    text-align: center;
}

.shopnfood-login-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #fff !important;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 14px;
}

.shopnfood-login-link:hover {
    color: #fff !important;
    text-decoration: underline !important;
}

.shopnfood-login-link .dashicons {
    font-size: 18px;
}

/* === Message compte en attente === */
.shopnfood-price-pending {
    padding: 15px 20px;
    background-color: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    color: #856404;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.shopnfood-price-pending .dashicons {
    font-size: 18px;
}

/* === Prix B2B === */
/* La boîte admin partage le même habillage que la boîte client (B2B),
   mais conserve le prix WooCommerce réel (régulier + promo barrée). */
.shopnfood-b2b-price,
.shopnfood-admin-price {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
}

.shopnfood-price-carton,
.shopnfood-price-half-palette,
.shopnfood-price-palette {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #e9ecef;
}

.shopnfood-price-carton:last-child,
.shopnfood-price-half-palette:last-child,
.shopnfood-price-palette:last-child {
    border-bottom: none;
}

.shopnfood-price-label {
    font-weight: 600;
    color: #495057;
    min-width: 100px;
}

.shopnfood-price-amount {
    font-size: 1.4em;
    font-weight: 700;
    color: #28a745;
}

/* Montant + "HT" sur la même ligne dans le bloc prix principal de la fiche
   produit (.shopnfood-price-current, généré par format_b2b_price_html).
   Le thème (snf-product-page.css, redesign fiche produit) force
   `display:block !important` sur .shopnfood-price-current pour empiler
   montant / prix unitaire ; avec un gros font-size en clamp(), "HT"
   (texte brut, même taille que le montant, voir class-price-manager.php)
   peut alors déborder sur sa propre ligne. On repasse ce bloc précis en
   ligne (inline-flex + baseline) pour garder montant et HT ensemble,
   quelle que soit la taille de police.
   Sélecteur volontairement plus spécifique que celui du thème pour gagner
   sans dépendre de l'ordre de chargement des feuilles de style.
   Scope strict à .shopnfood-price-current : les blocs demi-palette/palette
   et la boucle produits (simple .shopnfood-price-amount, sans cette classe)
   ne sont pas concernés. */
.shopnfood-price-carton .shopnfood-price-current {
    display: inline-flex;
    align-items: baseline;
    flex-wrap: nowrap;
}

body.snf-product-redesign.single-product .shopnfood-b2b-price .shopnfood-price-carton .shopnfood-price-current {
    display: inline-flex !important;
    align-items: baseline;
    flex-wrap: nowrap;
}

.shopnfood-price-unit {
    font-size: 0.85em;
    color: #6c757d;
    width: 100%;
    padding-left: 0;
}

.shopnfood-price-category {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #dee2e6;
    text-align: right;
}

.shopnfood-price-category small {
    font-style: italic;
}

/* === Prix indisponible === */
.shopnfood-price-unavailable {
    color: #dc3545;
    font-style: italic;
}

/* === Admin price indicator === */
/* Montant principal (ou prix promo) : même look que .shopnfood-price-amount. */
.shopnfood-admin-price ins,
.shopnfood-admin-price .shopnfood-price-carton > .woocommerce-Price-amount,
.shopnfood-admin-price ins .woocommerce-Price-amount {
    font-size: 1.4em;
    font-weight: 700;
    color: #28a745;
    text-decoration: none;
    background: none;
}

/* Prix régulier barré (promo) : discret, à côté du prix actif. */
.shopnfood-admin-price del {
    margin-right: 8px;
    font-size: 1em;
    font-weight: 400;
}

/* Format compact admin dans la boucle produits : réutilise .shopnfood-price-amount
   (vert/gras + « HT »), on gère juste le prix barré/actif comme côté fiche. */
.shopnfood-admin-price-loop ins,
.shopnfood-admin-price-loop ins .woocommerce-Price-amount {
    text-decoration: none;
}

.shopnfood-admin-price-loop del {
    margin-right: 5px;
    font-weight: 400;
    font-size: 0.8em;
}

/* === Notice de connexion sur page produit === */
.shopnfood-login-notice {
    background-color: #e9ecef;
    border-radius: 8px;
    padding: 25px;
    text-align: center;
    margin: 20px 0;
}

.shopnfood-login-notice p {
    margin: 0 0 15px;
    color: #495057;
}

.shopnfood-login-notice p:first-child {
    font-size: 1.1em;
    margin-bottom: 10px;
}

.shopnfood-login-notice .button {
    background-color: #667eea;
    color: #fff;
    border: none;
    padding: 12px 30px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.shopnfood-login-notice .button:hover {
    background-color: #5a6fd6;
    color: #fff;
}

body.shopnfood-account-pending-validation form.cart,
body.shopnfood-account-pending-validation .single_add_to_cart_button,
body.shopnfood-account-pending-validation .add_to_cart_button,
body.shopnfood-account-pending-validation .ajax_add_to_cart,
body.shopnfood-account-pending-validation .product_type_simple,
body.shopnfood-account-pending-validation .product_type_variable {
    display: none !important;
}

/* === Informations produit B2B === */
.shopnfood-product-info {
    margin: 20px 0;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.shopnfood-product-info h4 {
    margin: 0 0 15px;
    padding-bottom: 10px;
    color: #343a40;
    font-size: 1em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.shopnfood-info-table {
    width: 100%;
    border-collapse: collapse;
}

.shopnfood-info-table th,
.shopnfood-info-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
    font-size: 0.9em;
}

.shopnfood-info-table th {
    width: 40%;
    font-weight: 500;
}

.shopnfood-info-table td {
    color: #343a40;
}

.shopnfood-info-table tr:last-child th,
.shopnfood-info-table tr:last-child td {
    border-bottom: none;
}

/* === Badges produit (NEW, etc.) === */
.shopnfood-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.7em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.shopnfood-badge-new {
    background-color: #28a745;
    color: #fff;
}

.shopnfood-badge-promo {
    background-color: #dc3545;
    color: #fff;
}

.shopnfood-badge-limited {
    background-color: #ffc107;
    color: #212529;
}

/* === Responsive === */
@media (max-width: 768px) {
    .shopnfood-price-carton,
    .shopnfood-price-half-palette,
    .shopnfood-price-palette {
        flex-direction: column;
        gap: 5px;
    }
    
    .shopnfood-price-unit {
        padding-left: 0;
    }
    
    .shopnfood-info-table th,
    .shopnfood-info-table td {
        display: block;
        width: 100%;
    }
    
    .shopnfood-info-table th {
        border-bottom: none;
        padding-bottom: 2px;
    }
    
    .shopnfood-info-table td {
        padding-top: 2px;
    }
}

/* === Dans la boucle produits (shop) === */
.woocommerce ul.products li.product .shopnfood-price-hidden,
.woocommerce ul.products li.product .shopnfood-price-pending {
    padding: 10px;
    font-size: 0.85em;
}

.woocommerce ul.products li.product .shopnfood-b2b-price {
    padding: 10px;
}

.woocommerce ul.products li.product .shopnfood-price-amount {
    font-size: 1.1em;
}

.woocommerce ul.products li.product .shopnfood-price-unit,
.woocommerce ul.products li.product .shopnfood-price-half-palette,
.woocommerce ul.products li.product .shopnfood-price-palette,
.woocommerce ul.products li.product .shopnfood-price-category {
    display: none;
}

/* Prix + badge empilés : montant au-dessus, badge catégorie en pill dessous. */
.woocommerce ul.products li.product .price {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

/* Badge catégorie (« Prix Détaillant »… généré par sage-tiers) : pill neutre
   discrète, sur sa propre ligne. !important pour surcharger les styles inline
   du badge — uniquement dans la grille catalogue (la fiche produit garde son
   badge coloré via le thème). */
.woocommerce ul.products li.product .price .snf-price-badge {
    margin: 0 !important;
    padding: 3px 10px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
    background: #28A745 !important;
    color: white !important;
    border-radius: 20px !important;
    vertical-align: baseline;
}

/* === Panier === */
.woocommerce-cart-form .shopnfood-price-amount small,
.woocommerce-checkout .shopnfood-price-amount small {
    font-size: 0.8em;
}
