/* =========================================================
   CMAmarc B2B Engine — Public CSS
   ========================================================= */

/* ======================================================
   Panachage — Tableau Croisé Dynamique
   ====================================================== */
.cmab2b-panachage {
    margin: 30px 0;
}

.cmab2b-panachage-title {
    font-size: 1.2em;
    margin-bottom: 14px;
    font-weight: 700;
}

.cmab2b-no-variations {
    background: #fff8e1;
    border-left: 4px solid #ffc107;
    padding: 10px 14px;
    color: #555;
}

/* ---- Wrapper scrollable ---- */
.cmab2b-panachage-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ---- Tableau croisé ---- */
.cmab2b-panachage-matrix {
    border-collapse: collapse;
    font-size: .92em;
    min-width: 400px;
}

.cmab2b-panachage-matrix th,
.cmab2b-panachage-matrix td {
    border: 1px solid #ddd;
    padding: 6px 10px;
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
}

/* En-têtes colonnes (tailles) */
.cmab2b-matrix-col-header {
    background: #2271b1;
    color: #fff;
    font-weight: 700;
    min-width: 70px;
}

/* En-têtes des colonnes de labels de lignes */
.cmab2b-matrix-row-header {
    background: #f0f0f0;
    font-weight: 700;
    text-align: left;
    min-width: 90px;
}

/* Cellules de label de ligne (couleur, coupe...) */
.cmab2b-matrix-row-label {
    background: #fafafa;
    font-weight: 600;
    text-align: left;
    padding-left: 12px;
}

/* Ligne au survol */
.cmab2b-matrix-row:hover .cmab2b-matrix-row-label {
    background: #f0f6fc;
}

.cmab2b-matrix-row:hover .cmab2b-matrix-cell {
    background: #f5faff;
}

/* Cellule de saisie */
.cmab2b-matrix-cell {
    position: relative;
    min-width: 70px;
    background: #fff;
}

.cmab2b-matrix-cell.cmab2b-cell-na {
    background: #f9f9f9;
    color: #ccc;
}

.cmab2b-matrix-cell.cmab2b-cell-outofstock {
    background: #fef2f2;
}

/* Input quantité */
.cmab2b-qty-input {
    width: 52px;
    text-align: center;
    padding: 4px 4px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: .9em;
    -moz-appearance: textfield;
}
.cmab2b-qty-input::-webkit-outer-spin-button,
.cmab2b-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; }

.cmab2b-qty-input:focus {
    border-color: #2271b1;
    outline: none;
    box-shadow: 0 0 0 2px rgba(34,113,177,.18);
}

/* Cellule active (qty > 0) */
.cmab2b-matrix-cell.cmab2b-cell-active {
    background: #e8f4fd;
}

/* Badge stock faible */
.cmab2b-stock-badge {
    display: block;
    font-size: .7em;
    color: #e17000;
    margin-top: 2px;
}

/* Rupture */
.cmab2b-rupture {
    color: #ccc;
    font-size: 1.1em;
}

/* Colonne total ligne */
.cmab2b-matrix-row-total-header,
.cmab2b-matrix-row-total {
    background: #f5f5f5;
    font-weight: 700;
    min-width: 65px;
    border-left: 2px solid #ddd;
}

.cmab2b-row-total-qty {
    color: #2271b1;
}

/* Ligne totaux colonnes */
.cmab2b-matrix-totals-row td {
    background: #f0f6fc;
    font-size: .88em;
    border-top: 2px solid #2271b1;
}

.cmab2b-matrix-grand-total {
    background: #2271b1 !important;
    color: #fff;
}

.cmab2b-matrix-grand-total span {
    color: #fff;
}

.cmab2b-col-total-qty {
    color: #1a5a8f;
    font-weight: 700;
}

.cmab2b-matrix-totals-label {
    text-align: right;
    color: #444;
}

/* ---- Barre de résumé ---- */
.cmab2b-panachage-summary {
    margin-top: 12px;
    font-size: .95em;
    color: #444;
    padding: 10px 14px;
    background: #f9f9f9;
    border-radius: 4px;
    border: 1px solid #e5e5e5;
    display: flex;
    align-items: flex-start;
    gap: 24px;
    flex-wrap: wrap;
}

.cmab2b-summary-qty {
    font-size: 1em;
    white-space: nowrap;
}

.cmab2b-summary-qty strong {
    color: #2271b1;
    font-size: 1.1em;
}

.cmab2b-summary-prices {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cmab2b-summary-price-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.cmab2b-price-label {
    color: #666;
    font-size: .9em;
    min-width: 72px;
}

.cmab2b-price-ttc {
    font-weight: 600;
}

.cmab2b-discount-badge {
    display: inline-block;
    background: #e53935;
    color: #fff;
    font-size: .75em;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    vertical-align: middle;
}

.cmab2b-discounted-price-excl,
.cmab2b-discounted-price-incl {
    color: #2e7d32;
    font-weight: 700;
}

.cmab2b-panachage-summary.has-discount .cmab2b-total-price-excl,
.cmab2b-panachage-summary.has-discount .cmab2b-total-price-incl {
    text-decoration: line-through;
    color: #999;
}

/* Incitation palier suivant */
.cmab2b-next-tier-incentive {
    margin-top: 8px;
    padding: 8px 12px;
    background: #fff8e1;
    border-left: 3px solid #f9a825;
    border-radius: 0 4px 4px 0;
    font-size: .9em;
    color: #5d4037;
}

.cmab2b-next-tier-incentive strong {
    color: #e65100;
}

/* ---- Actions ---- */
.cmab2b-panachage-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.cmab2b-btn-add-panachage:disabled {
    opacity: .45;
    cursor: not-allowed;
}

/* ---- Prix dégressifs ---- */
.cmab2b-degressive-pricing {
    margin: 20px 0;
}

.cmab2b-pricing-frontend-table {
    border-collapse: collapse;
    font-size: .9em;
}

.cmab2b-pricing-frontend-table th,
.cmab2b-pricing-frontend-table td {
    padding: 6px 14px;
    border: 1px solid #e0e0e0;
}

.cmab2b-pricing-frontend-table thead th {
    background: #f5f5f5;
}

/* ---- Liste employés frontend ---- */
.cmab2b-employee-list-section {
    margin: 30px 0;
    padding: 20px;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
}

.cmab2b-employee-frontend-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9em;
    margin-top: 12px;
}

.cmab2b-employee-frontend-table th,
.cmab2b-employee-frontend-table td {
    padding: 7px 10px;
    border: 1px solid #e0e0e0;
}

.cmab2b-employee-frontend-table thead th {
    background: #eee;
}

/* ---- Modals (devis marquage, changement technique) ---- */
.cmab2b-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
}

.cmab2b-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.55);
}

.cmab2b-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 8px;
    padding: 30px;
    width: min(520px, 95vw);
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,.18);
}

.cmab2b-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.4em;
    cursor: pointer;
    color: #888;
    line-height: 1;
}

.cmab2b-modal-content label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
}

.cmab2b-modal-content input,
.cmab2b-modal-content select,
.cmab2b-modal-content textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin-bottom: 14px;
    box-sizing: border-box;
}

/* Boutons B2B */
.cmab2b-btn-marking-quote,
.cmab2b-btn-technique {
    margin-top: 8px;
}

/* ---- Cagnotte checkout ---- */
.cmab2b-cagnotte-checkout-block {
    background: #f0f8ff;
    border: 1px solid #c0dcf0;
    border-radius: 6px;
    padding: 16px 20px;
    margin-bottom: 24px;
}

.cmab2b-cagnotte-use-form {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
}

/* ---- PDF technique ---- */
.cmab2b-tech-pdf {
    margin: 12px 0;
}

/* ---- Dashboard client ---- */
.cmab2b-dashboard {
    margin: 20px 0;
}

.cmab2b-dashboard-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #2271b1;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.cmab2b-tab-btn {
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-bottom: none;
    padding: 10px 20px;
    cursor: pointer;
    font-size: .95em;
    transition: background .15s;
    border-radius: 4px 4px 0 0;
    margin-right: 4px;
}

.cmab2b-tab-btn:hover,
.cmab2b-tab-btn.active {
    background: #2271b1;
    color: #fff;
    border-color: #2271b1;
}

.cmab2b-tab-content {
    display: none;
}

.cmab2b-tab-content.active {
    display: block;
}

/* Parc grid */
.cmab2b-parc-grid,
.cmab2b-boutique-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 16px;
}

.cmab2b-parc-item,
.cmab2b-boutique-item {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 14px;
    text-align: center;
    background: #fff;
}

.cmab2b-parc-img img,
.cmab2b-boutique-img img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin-bottom: 10px;
}

/* Stats */
.cmab2b-stat-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.cmab2b-stat-box {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 18px 24px;
    text-align: center;
    min-width: 150px;
}

.cmab2b-stat-value {
    display: block;
    font-size: 1.6em;
    font-weight: 700;
    color: #2271b1;
}

.cmab2b-stat-label {
    font-size: .8em;
    color: #666;
}

/* Simulateur */
.cmab2b-simulator-wrap {
    margin-top: 20px;
    padding: 16px;
    background: #f9f9f9;
    border-radius: 6px;
    border: 1px solid #e5e5e5;
}

.cmab2b-simulator-tip {
    color: #c0392b;
    font-weight: 600;
}

.cmab2b-simulator-chart-wrap {
    max-width: 500px;
    margin-top: 14px;
}

/* Cagnotte counters */
.cmab2b-cagnotte-counters {
    display: flex;
    gap: 20px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.cmab2b-cagnotte-box {
    flex: 1;
    min-width: 140px;
    padding: 18px;
    border-radius: 8px;
    text-align: center;
}

.cmab2b-credit-available {
    background: #e8f5e9;
    border: 1px solid #a5d6a7;
}

.cmab2b-credit-inprogress {
    background: #fff8e1;
    border: 1px solid #ffe082;
}

.cmab2b-cagnotte-box .cmab2b-cagnotte-value {
    display: block;
    font-size: 1.5em;
    font-weight: 700;
}

.cmab2b-cagnotte-box .cmab2b-cagnotte-label {
    display: block;
    font-size: .85em;
    margin-top: 4px;
}

/* Historique cagnotte */
.cmab2b-cagnotte-history th,
.cmab2b-cagnotte-history td {
    padding: 8px 12px;
}

.cmab2b-badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: .8em;
    font-weight: 700;
}

.cmab2b-badge-gain {
    background: #e8f5e9;
    color: #2e7d32;
}

.cmab2b-badge-debit {
    background: #fde8e8;
    color: #c62828;
}

/* Commercial card */
.cmab2b-commercial-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 20px;
    max-width: 340px;
}

.cmab2b-commercial-name {
    font-size: 1.1em;
    margin-bottom: 10px;
}

/* Feedback */
.cmab2b-feedback {
    margin-top: 10px;
    padding: 8px 14px;
    border-radius: 4px;
}

/* Responsive */
@media (max-width: 600px) {
    .cmab2b-panachage-table th:not(:first-child):not(:last-child),
    .cmab2b-panachage-table td:not(:first-child):not(:last-child) {
        display: none;
    }
}

/* ---- Puces de couleur attributs ---- */
.cmab2b-color-swatch {
    display: inline-block;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,.18);
    vertical-align: middle;
    box-shadow: 0 1px 3px rgba(0,0,0,.15);
    flex-shrink: 0;
}

.cmab2b-matrix-col-header .cmab2b-color-swatch {
    width: 26px;
    height: 26px;
}

.cmab2b-matrix-row-label .cmab2b-color-swatch {
    width: 20px;
    height: 20px;
    margin-right: 6px;
}

.cmab2b-swatch-label {
    vertical-align: middle;
}

/* ---- Images de termes ---- */
.cmab2b-term-image {
    width: 28px;
    height: 28px;
    object-fit: cover;
    vertical-align: middle;
}

.cmab2b-matrix-row-label .cmab2b-term-image {
    width: 24px;
    height: 24px;
}

/* ---- Toggle liste employés ---- */
.cmab2b-employee-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 14px;
    background: #f0f6fc;
    border: 1px solid #c8d9ec;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    color: #1d2327;
    text-align: left;
    margin-bottom: 0;
}

.cmab2b-employee-toggle:hover {
    background: #e4f0fb;
    border-color: #2271b1;
}

.cmab2b-toggle-icon {
    font-size: .75em;
    color: #2271b1;
    transition: transform .15s;
}

.cmab2b-employee-content {
    margin-top: 12px;
}
