/* Column-sizing tokens — overridable per breakpoint. The product column
   width is computed as (100% - label width) / N so every product column
   is exactly the same regardless of name length, image size or feature
   value content. */
.lm-compare-page {
  --lm-compare-label-width: 200px;
  --lm-compare-cols: 3;
  margin: 1.5rem 0;
}
.lm-compare-page--wide { --lm-compare-label-width: 220px; }

.lm-compare-empty { text-align: center; padding: 3rem 1rem; }
.lm-compare-warning { margin-bottom: 1rem; }

/* Top toolbar — "Zamknij porównanie" close button */
.lm-compare-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1rem;
}
.lm-compare-close {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.lm-compare-close .material-icons {
  font-size: 18px;
  line-height: 1;
}

.lm-compare-table-wrapper {
  overflow-x: auto;
  /* iOS momentum scrolling for older Safari versions */
  -webkit-overflow-scrolling: touch;
}

/* Inherits Bootstrap .table .table-bordered styles from the theme */
.lm-compare-table {
  width: 100%;
  background: #fff;
  margin-bottom: 0;
  /* Fixed layout: column widths come from the first row, not content —
     so a long product name can no longer stretch its own column. */
  table-layout: fixed;
}
/* Keep the table wide enough on small viewports that each product column
   stays readable; the wrapper handles horizontal scroll past that point. */
.lm-compare-table {
  min-width: calc(var(--lm-compare-label-width) + var(--lm-compare-cols) * 220px);
}
.lm-compare-table th,
.lm-compare-table td {
  padding: 0.75rem 1rem;
  vertical-align: top;
  text-align: left;
  /* Long names / unbroken feature values wrap instead of widening the cell. */
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.lm-compare-table__label-col {
  width: var(--lm-compare-label-width);
  background: #f8f9fa;
  position: sticky;
  left: 0;
  z-index: 2;
}
/* Every product column gets exactly the same width: an equal share of
   whatever's left after the (sticky) label column. */
.lm-compare-table__product-col {
  width: calc((100% - var(--lm-compare-label-width)) / var(--lm-compare-cols));
  text-align: center !important;
  vertical-align: top;
  background: #fff;
}

/* Product card in header row */
.lm-compare-card { position: relative; padding: 0.5rem 0; text-align: center; }
.lm-compare-card__remove {
  position: absolute;
  top: 0;
  right: 0;
  background: transparent;
  border: 0;
  cursor: pointer;
  color: #6c757d;
}
.lm-compare-card__remove:hover { color: #dc3545; }
.lm-compare-card__image {
  display: block;
  margin: 0 auto 0.5rem;
  width: 100%;
  max-width: 180px;
}
.lm-compare-card__image img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
}
.lm-compare-card__name {
  display: block;
  font-weight: 600;
  color: #212529;
  text-decoration: none;
  margin-bottom: 0.25rem;
}
.lm-compare-card__name:hover {
  text-decoration: underline;
  color: #1F5FB8;
}
.lm-compare-card__ref {
  font-size: 0.8rem;
  color: #6c757d;
  margin-bottom: 0.4rem;
}
.lm-compare-card__price {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1F5FB8;
  margin-bottom: 0.5rem;
}
.lm-compare-card__price-old {
  display: inline-block;
  text-decoration: line-through;
  color: #adb5bd;
  font-weight: 400;
  font-size: 0.85rem;
  margin-right: 0.35rem;
}

/* Group header row */
.lm-compare-row--group-header th {
  background: #f8f9fa;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: #495057;
}

/* Row state highlighting */
.lm-compare-row--same .lm-compare-row__value { color: #495057; }
.lm-compare-row--diff .lm-compare-row__value {
  background: #fff3cd;
  font-weight: 600;
}
.lm-compare-row--partial .lm-compare-row__value { background: #f8f9fa; }

.lm-compare-row__label {
  font-weight: 600;
  color: #212529;
  background: #f8f9fa;
  position: sticky;
  left: 0;
  z-index: 1;
}
.lm-compare-row__empty { color: #adb5bd; }

.lm-compare-no-features {
  text-align: center;
  padding: 2rem;
  color: #6c757d;
  font-style: italic;
}

/* =============================================================
 * Responsive — mobile / tablet
 * =============================================================
 * Below 768px the sticky label column would eat most of the viewport,
 * leaving very little room for the actual product column. We shrink
 * the label width and the per-product min-width so each product column
 * remains comfortably readable while the user scrolls horizontally.
 */
@media (max-width: 768px) {
  .lm-compare-page { --lm-compare-label-width: 130px; }
  .lm-compare-page--wide { --lm-compare-label-width: 140px; }
  .lm-compare-table {
    min-width: calc(var(--lm-compare-label-width) + var(--lm-compare-cols) * 180px);
  }
  .lm-compare-table th,
  .lm-compare-table td {
    padding: 0.5rem 0.6rem;
    font-size: 0.85rem;
  }
  .lm-compare-card__image { max-width: 140px; }
  .lm-compare-card__price { font-size: 0.95rem; }
  .lm-compare-row__label { font-size: 0.8rem; }
}

@media (max-width: 480px) {
  .lm-compare-page { --lm-compare-label-width: 110px; }
  .lm-compare-page--wide { --lm-compare-label-width: 120px; }
  .lm-compare-table {
    min-width: calc(var(--lm-compare-label-width) + var(--lm-compare-cols) * 160px);
  }
  .lm-compare-table th,
  .lm-compare-table td { padding: 0.45rem 0.5rem; }
  .lm-compare-card__image { max-width: 110px; }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
