/* dottcarlovalli-b2b — assets/b2b-components.css — 2026-02-21
   Componenti riutilizzabili B2B: panel, table, buttons, qty, thumb, modal immagini
*/

.dcv-b2b .panel {
  background: rgba(255,255,255,.85);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  overflow: hidden;
}

.dcv-b2b .table-wrap { overflow: auto; }

.dcv-b2b table.b2b-table,
.dcv-b2b table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
  border: var(--border);
  border-radius: 14px;
  overflow: hidden;
}

.dcv-b2b table.b2b-table thead th,
.dcv-b2b table thead th {
  text-align: left;
  font-size: .95rem;
  color: var(--muted);
  background: rgba(207,233,249,.65);
  padding: 12px 12px;
  border-bottom: 1px solid rgba(0,0,0,.06);
  position: sticky;
  top: 0;
  z-index: 1;
}

.dcv-b2b table.b2b-table tbody td,
.dcv-b2b table tbody td {
  padding: 12px 12px;
  border-bottom: 1px solid rgba(0,0,0,.06);
  vertical-align: middle;
}

.dcv-b2b table.b2b-table tbody tr:hover td,
.dcv-b2b table tbody tr:hover td {
  background: rgba(56,189,248,.06);
}

.dcv-b2b table.b2b-table tbody tr:last-child td,
.dcv-b2b table tbody tr:last-child td {
  border-bottom: 0;
}

.dcv-b2b .btn,
.dcv-b2b button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: .65rem 1rem;
  border-radius: 999px;
  border: 0;
  cursor: pointer;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 8px 30px rgba(14,165,233,.25);
  white-space: nowrap;
}

.dcv-b2b .btn.secondary {
  background: #fff;
  color: var(--text);
  border: var(--border);
  box-shadow: none;
}

.dcv-b2b .btn:disabled {
  opacity: .6;
  cursor: not-allowed;
}

.dcv-b2b .b2b-thumb {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,.08);
  object-fit: contain;
  background: #fff;
}

.dcv-b2b .is-clickable {
  cursor: zoom-in;
}

.dcv-b2b .b2b-qty {
  width: 86px;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,.14);
  font: inherit;
  outline: none;
}

.dcv-b2b .b2b-qty:focus {
  border-color: rgba(14,165,233,.55);
  box-shadow: 0 0 0 4px rgba(56,189,248,.18);
}

.dcv-b2b .b2b-price-cell {
  white-space: nowrap;
  font-weight: 700;
  text-align: right;
}

/* ===== MODAL IMMAGINI (usato da b2b-catalog.js: #imgModal, #modalImg, .modal-close) ===== */
#imgModal {
  position: fixed;
  inset: 0;
  display: none; /* JS toggle */
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(11,16,32,.65);
  z-index: 9999;
}

#imgModal[aria-hidden="false"] {
  display: flex;
}

#imgModal .modal-card {
  position: relative;
  width: min(920px, 96vw);
  max-height: 92vh;
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  overflow: hidden;
}

#imgModal .modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(207,233,249,.65);
  border-bottom: 1px solid rgba(0,0,0,.06);
}

#imgModal .modal-title {
  margin: 0;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

#imgModal .modal-close {
  border: 1px solid rgba(0,0,0,.12);
  background: #fff;
  border-radius: 999px;
  padding: 8px 10px;
  cursor: pointer;
  font-weight: 800;
  color: var(--text);
}

#imgModal .modal-body {
  padding: 14px;
  background: #fff;
}

#imgModal .modal-body img {
  width: 100%;
  height: auto;
  max-height: 78vh;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

/* Error text */
.dcv-b2b .b2b-error{ color:#b00020; font-weight:600; }

/* Qty small (70px) */
.dcv-b2b .b2b-qty.b2b-qty-sm{ width:70px; padding:6px; border-radius:12px; }

/* Products table thumb sizing (compat per page-b2b-prodotti.php) */
.dcv-b2b .products-table td:first-child{ width:80px; }
.dcv-b2b .products-table td img.b2b-thumb{
  width:60px; height:60px;
  max-width:60px; max-height:60px;
}

/* ===== MODAL IMMAGINI (compat: page-b2b-prodotti.php) ===== */
.b2b-img-modal[hidden]{ display:none; }
.b2b-img-modal{ position:fixed; inset:0; z-index:9999; }
.b2b-img-modal__overlay{ position:absolute; inset:0; background:rgba(0,0,0,.55); }
.b2b-img-modal__dialog{
  position:relative;
  width:min(980px, 96vw);
  height:min(740px, 90vh);
  margin:0 auto;
  background:rgba(255,255,255,.92);
  border:1px solid rgba(255,255,255,.35);
  border-radius:18px;
  box-shadow:0 20px 60px rgba(0,0,0,.35);
  overflow:hidden;
  display:flex;
  flex-direction:column;
}
.b2b-img-modal__close{
  position:absolute;
  top:10px; right:14px;
  border:0;
  background:#fff;
  border-radius:999px;
  padding:8px 10px;
  cursor:pointer;
  font-weight:900;
  border:1px solid rgba(0,0,0,.12);
}
.b2b-img-modal__head{
  padding:14px 52px 12px 16px;
  border-bottom:1px solid rgba(0,0,0,.08);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  background: rgba(207,233,249,.65);
}
.b2b-img-modal__title{ font-weight:700; margin:0; }
.b2b-img-modal__body{
  flex:1;
  padding:14px;
  background:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
}
.b2b-img-modal__img{
  width:100%;
  height:auto;
  max-height:78vh;
  object-fit:contain;
  display:block;
}
body.dcv-b2b .products-table{
  background:#edf6fb !important;
}

body.dcv-b2b .products-table thead th{
  background:#d9edf9 !important;
}

body.dcv-b2b .products-table tbody tr,
body.dcv-b2b .products-table tbody td{
  background:#edf6fb !important;
}

.dcv-mylist-table .b2b-qty,
.dcv-mylist-table .dcv-mylist-qty{
  width: 70px;
  min-width: 70px;
  max-width: 70px;
  height: 40px;
  padding: 6px 8px;
  text-align: center;
}


/* =========================
   PROMO B2B
========================= */

.b2b-price-wrap{
  display:flex;
  flex-direction:column;
  gap:3px;
}

.b2b-promo-badge{
  display:inline-block;
  background:#d63638;
  color:#fff;
  font-size:11px;
  font-weight:600;
  padding:2px 6px;
  border-radius:4px;
  width:max-content;
}

.b2b-price-old{
  font-size:13px;
  color:#777;
  text-decoration:line-through;
}

.b2b-price-new{
  font-size:16px;
  font-weight:700;
  color:#d63638;
}

.woocommerce-cart .b2b-price-wrap{
  align-items:flex-start;
}

.woocommerce-cart .b2b-price-old,
.woocommerce-cart .b2b-price-new{
  line-height:1.15;
}