/* Container principal - Plus large car sous l'image */
.b2b-matrix-container {
    margin: 30px 0;
    padding: 25px;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    clear: both; /* S'assure de prendre toute la largeur sous le bloc image/titre */
}

/* Grille de commande */
.b2b-order-grid {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 25px;
    display: table; /* Retour à table pour une meilleure gestion des largeurs sur desktop */
}

@media screen and (max-width: 768px) {
    .b2b-order-grid {
        display: block;
        overflow-x: auto;
    }
}

.b2b-order-grid th {
    background: #f8f9fa;
    padding: 15px 10px;
    border: 1px solid #eee;
    text-align: center;
    font-size: 0.85em;
    font-weight: 700;
    color: #444;
}

.b2b-order-grid td {
    border: 1px solid #eee;
    padding: 12px 8px;
    text-align: center;
    vertical-align: middle;
    background: #fff;
}

.b2b-order-grid .color-name {
    text-align: left;
    background: #fdfdfd;
    font-weight: 600;
    min-width: 140px;
    position: sticky;
    left: 0;
    z-index: 5;
    border-right: 2px solid #eee;
}

/* Inputs de quantité - Design épuré */
.qty-input-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.unit-price {
    font-size: 0.8em;
    font-weight: 600;
    color: #777;
}

.b2b-qty-input {
    width: 60px !important;
    height: 35px !important;
    padding: 0 !important;
    border-radius: 6px !important;
    border: 1px solid #ddd !important;
    text-align: center;
    font-size: 14px !important;
    transition: all 0.2s ease;
}

.b2b-qty-input:focus {
    border-color: #d4a017 !important;
    background: #fffdeb !important;
    outline: none;
    box-shadow: 0 0 5px rgba(212, 160, 23, 0.2);
}

/* Options d'impression */
.b2b-printing-section {
    background: #fcfcfc;
    padding: 20px;
    border: 1px solid #f0f0f0;
    border-radius: 10px;
    margin-bottom: 30px;
}

.b2b-printing-section h4 {
    margin-top: 0;
    font-size: 1.1em;
    color: #235787;
}

/* Sticky Summary Bar - Ton design favori */
.b2b-summary-sticky {
    position: -webkit-sticky;
    position: sticky;
    bottom: 20px;
    background: #fffaeb; /* Ta couleur fétiche */
    border: 2px solid #ffe58f;
    padding: 20px 30px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    z-index: 999; /* Très haut pour passer au dessus de tout */
    margin-top: 20px;
}

.total-row {
    font-size: 1.1em;
    font-weight: 600;
    color: #444;
}

#b2b-final-total {
    font-size: 1.6em;
    font-weight: 800;
    color: #c3512f; /* Ta couleur de bouton */
}

.old-price {
    text-decoration: line-through;
    color: #a0a0a0;
    font-size: 0.7em;
    margin-right: 8px;
    font-weight: 400;
}

/* Badges de fidélité dans les onglets */
.loyalty-badge {
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #eee;
    margin: 10px 0;
}
.loyalty-badge.blue { border-left: 5px solid #235787; background: #f0f7ff; }
.loyalty-badge.silver { border-left: 5px solid #a0a0a0; background: #f8f8f8; }
.loyalty-badge.gold { border-left: 5px solid #ffd700; background: #fffdf0; }
.loyalty-badge.platinum { border-left: 5px solid #555; background: #f2f2f2; }

/* Amélioration de la section marquage */
.print-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 15px;
}

.print-item {
    background: #fff;
    border: 1px solid #e0e0e0;
    padding: 10px 15px;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.print-item:hover {
    border-color: #235787;
    background: #f0f7ff;
}

.print-item input[type="checkbox"] {
    margin-right: 12px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.print-label-text {
    flex-grow: 1;
    font-weight: 500;
    color: #444;
}

/* Le Badge de prix */
.print-price-tag {
    background: #e8f0f7;
    color: #235787;
    font-size: 0.85em;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    white-space: nowrap;
}

.print-item input:checked + .print-label-text {
    color: #235787;
    font-weight: 700;
}

.print-item input:checked ~ .print-price-tag {
    background: #235787;
    color: #fff;
}

/* Cache le menu déroulant au survol et au clic */
.site-header .item--wc_cart .cart-dropdown-box,
.site-header .builder-header-wc_cart-item .cart-dropdown-box {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    pointer-events: none !important;
}

/* Désactive l'animation de translation du thème */
.item--wc_cart:hover .cart-dropdown-box {
    transform: none !important;
    display: none !important;
}


.woocommerce-cart-form__contents {
    border: 1px solid #eaecee;
    border-radius: 8px;
    overflow: hidden;
}

.shop_table.cart td {
    padding: 15px 12px !important;
}

.color-circle {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid #ddd;
    margin-right: 10px;
    cursor: pointer;
    display: inline-block;
}
.color-name { cursor: pointer; }

.b2b-color-cell { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 5px; border-radius: 4px; transition: background 0.2s; }
.b2b-color-circle { width: 22px; height: 22px; border-radius: 50%; border: 1px solid #ccc; display: inline-block; flex-shrink: 0; box-shadow: inset 0 0 2px rgba(0,0,0,0.1); }
.b2b-color-name { font-weight: bold; color: #333 !important; } /* Forcer la couleur sombre */
.b2b-color-cell:hover { background: rgba(0,0,0,0.05); }
.b2b-color-cell:hover .b2b-color-name { color: #235787 !important; text-decoration: underline; } /* Bleu au lieu de blanc cassé */

.color-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-block;
    border: 1px solid rgba(0,0,0,0.1); /* Bordure subtile pour les couleurs claires */
    box-shadow: inset 0 0 2px rgba(0,0,0,0.05);
}

.woocommerce-Tabs-panel--certifications p {
    margin-bottom: 1em;
    display: block;
}







/* --- AJUSTEMENTS ET RESPONSIVE --- */

/* Wrapper pour le scroll horizontal (à ajouter autour de la table dans le PHP) */
.b2b-matrix-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* Scroll fluide sur iOS */
    margin-bottom: 25px;
    border: 1px solid #eee;
    border-radius: 12px;
    position: relative;
}

/* On modifie la règle existante @media 768px */
@media screen and (max-width: 768px) {
    .b2b-matrix-container {
        padding: 15px; /* On réduit le padding interne sur mobile */
    }

    .b2b-order-grid {
        display: table; /* On force le mode table même sur mobile pour garder l'alignement */
        min-width: 700px; /* Force le scroll horizontal si l'écran est petit */
    }

    /* Indicateur visuel de scroll */
    .b2b-matrix-wrapper::after {
        content: "↔ Défilez horizontalement pour voir toutes les tailles";
        display: block;
        text-align: center;
        font-size: 11px;
        color: #999;
        padding: 8px;
        background: #fdfdfd;
        border-top: 1px solid #eee;
    }

    /* On fixe la barre de total différemment sur mobile pour qu'elle prenne moins de place */
    .b2b-summary-sticky {
        padding: 15px;
        bottom: 10px;
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}

/* Fix pour la colonne de couleur collante (Sticky) */
.b2b-order-grid .color-name {
    position: -webkit-sticky;
    position: sticky;
    left: 0;
    z-index: 10;
    background: #fdfdfd;
    box-shadow: 2px 0 5px rgba(0,0,0,0.05); /* Petite ombre pour séparer du scroll */
}

/* Optimisation des cellules de saisie */
.b2b-order-grid td {
    min-width: 70px; /* Évite que les colonnes de tailles ne soient trop serrées */
}

.stock-status {
    font-size: 10px;
    padding: 2px 4px;
    border-radius: 3px;
    margin-top: 3px;
    display: block;
    white-space: nowrap;
}

.stock-status.in-stock {
    background: #e6ffed;
    color: #22863a;
    border: 1px solid #cef3d6;
}

.stock-status.out-of-stock {
    background: #fff8e6;
    color: #b08800;
    border: 1px solid #ffe58f;
    font-style: italic;
}

