/* =====================================================================
   SULO Group – comparison page ([wc_compare_table], plugin sulogroup-blocks shop/compare.php).
   Loaded only on that page (woocommerce/inc/setup.php). Base: woo.css.
   ===================================================================== */

/* ---------- Comparison page: same look as cart and quote list ----------
   Line on top, product columns aligned with the table below (label column + 3 equal columns),
   grey image squares, quiet remove button, table rows with lines, sticky product row below the header. */
.wcpc-compare-page {
  --wcpc-label-w: 220px;
  --wcpc-sticky-offset: 76px; /* header height after scrolling */
  margin-top: 8px;
  padding-bottom: 56px;
  font-size: 15px;
  color: var(--sg-body);
}
.admin-bar .wcpc-compare-page { --wcpc-sticky-offset: 108px; }
.wcpc-cards-row {
  display: grid;
  grid-template-columns: var(--wcpc-label-w) repeat(3, minmax(0, 1fr));
}
.wcpc-cards-row::before { content: ""; } /* empty label column */
.wcpc-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 24px 12px;
  text-align: left;
}
.wcpc-card-remove {
  position: absolute;
  top: 32px;
  right: 20px;
  z-index: 1;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--wp--custom--field-border, #7d8b88);
  border-radius: 50%;
  background: #fff;
  color: var(--sg-ink);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.wcpc-card-remove:hover { background: var(--sg-teal); border-color: var(--sg-teal); color: #fff; }
.wcpc-card-image { margin-bottom: 8px; }
.wcpc-card-title { margin: 4px 0 0; font-size: 16px; font-weight: 700; line-height: 1.35; }
.wcpc-card-title a { color: var(--sg-ink); text-decoration: none; }
.wcpc-card-title a:hover { color: var(--sg-teal); }
.wcpc-card-rating { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--sg-muted); }
.wcpc-card-excerpt { font-size: 14px; color: var(--sg-body); }
.wcpc-card-excerpt > :last-child { margin-bottom: 0; }
.wcpc-card-stock { font-size: 13px; color: var(--sg-muted); }
.wcpc-card-stock.in-stock { color: var(--sg-teal); }
.wcpc-card-price { font-weight: 700; color: var(--sg-ink); }
.wcpc-card-price:empty { display: none; }

/* empty slot: dashed square with "+ Add product", then the two selects */
.wcpc-card-add { justify-content: flex-start; }
.wcpc-add-toggle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 0;
  border: 1px dashed var(--wp--custom--field-border, #7d8b88);
  background: none;
  color: var(--sg-muted);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease;
}
.wcpc-add-toggle:hover, .wcpc-add-toggle[aria-expanded="true"] { border-color: var(--sg-teal); color: var(--sg-teal); }
.wcpc-add-icon {
  display: inline-block;
  width: 28px;
  height: 28px;
  background-color: currentColor;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M11 11V5h2v6h6v2h-6v6h-2v-6H5v-2z'/></svg>") center/contain no-repeat;
}
.wcpc-add-picker { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.wcpc-add-picker[hidden] { display: none; }
.wcpc-add-picker select {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--wp--custom--field-border, #7d8b88);
  border-radius: 0;
  background: #fff;
  color: var(--sg-ink);
  font: inherit;
  font-size: 14px;
}
.wcpc-add-picker select:focus { border-color: var(--sg-teal); outline: none; }
.wcpc-add-picker select:disabled { color: var(--sg-muted); cursor: not-allowed; }

/* details table */
.wcpc-tech-details { margin-top: 32px; }
.wcpc-tech-details h2 { margin: 0 0 12px; font-size: 18px; font-weight: 700; color: var(--sg-ink); }
.wcpc-tech-details table.wcpc-attr-table {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
  table-layout: fixed;
}
.wcpc-attr-table tr:nth-child(odd) { background: none; }
.wcpc-attr-table th, .wcpc-attr-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--sg-line);
  text-align: left;
  vertical-align: top;
}
.wcpc-attr-table tbody th { width: var(--wcpc-label-w); padding-left: 0; color: var(--sg-ink); font-size: 14px; font-weight: 600; }
.wcpc-attr-table thead th.wcpc-sticky-label { width: var(--wcpc-label-w); }
/* sticky row with the products while scrolling the table */
.wcpc-attr-table thead th {
  position: sticky;
  top: var(--wcpc-sticky-offset);
  z-index: 5;
  padding: 10px 12px;
  background: #fff;
  border-bottom: 1px solid var(--sg-line);
}
.wcpc-sticky-product-inner { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 700; color: var(--sg-ink); text-align: left; }
.wcpc-sticky-product-inner img {
  width: 40px;
  height: 40px;
  padding: 3px;
  flex-shrink: 0;
  object-fit: contain;
  background: var(--sg-grey);
  mix-blend-mode: multiply;
}
.wcpc-group-divider :is(th, td), .wcpc-individual-divider :is(th, td) {
  padding: 28px 0 8px;
  border-bottom: 1px solid var(--sg-line);
  background: none;
  color: var(--sg-teal);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.wcpc-individual-divider :is(th, td) { color: var(--sg-muted); }
.wcpc-notice { margin: 12px 0 0; color: var(--sg-muted); }

/* buttons below each product: to the product (outline) + quote (SULO Group Leads) */
.wcpc-cta-row { border-top: 0; margin-top: 8px; }
.wcpc-cta-actions { display: flex; flex-direction: column; gap: 8px; padding: 16px 12px 0; }
.wcpc-cta-row a.button.wcpc-goto-product, .wcpc-cta-row .sg-leads-add {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  margin: 0;
  padding: 0 16px;
  border: 1.5px solid var(--sg-teal);
  border-radius: 0;
  background: #fff;
  color: var(--sg-teal);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .07em;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
  transition: background-color .15s ease, color .15s ease;
}
.wcpc-cta-row .sg-leads-add { background: var(--sg-teal); color: #fff; width: 100%; }
.wcpc-cta-row a.button.wcpc-goto-product:hover { background: var(--sg-teal); color: #fff; }
.wcpc-cta-row .sg-leads-add:hover { background: var(--sg-teal-dark); border-color: var(--sg-teal-dark); }
.wcpc-cta-row .disabled { visibility: hidden; }
.wcpc-compare-page .screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Mobile: label column narrower, the comparison scrolls sideways (columns stay aligned) ---------- */
@media (max-width: 1023px) {
  .wcpc-compare-page { --wcpc-sticky-offset: 66px; }
}
@media (max-width: 768px) {
  .wcpc-compare-page { --wcpc-label-w: 120px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .wcpc-cards-row, .wcpc-tech-details { min-width: 680px; }
  .wcpc-attr-table thead th { position: static; } /* sticky does not work inside a scroll box */
  .wcpc-sticky-product-inner span { display: none; }
  .wcpc-card-excerpt { display: none; }
}
@media (max-width: 600px) {
  .wcpc-compare-toggle { padding: 6px 10px; font-size: .85em; }
  .wcpc-attr-table th, .wcpc-attr-table td { padding: 10px 8px; font-size: 14px; }
}

/* Compare page: equal image boxes for all products */
/* every product image of the comparison in the same square, shown whole */
.wcpc-card-image {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--sg-grey);

  & a {
    display: block;
    width: 100%;
    height: 100%;
    padding: 8%;
  }

  & img {
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: none;
    object-fit: contain;
    mix-blend-mode: multiply;
  }
}

