/* ═══════════════════════════════════════════════════════════════
   Compare Page — MC Виан B2B Portal
   ═══════════════════════════════════════════════════════════════ */

/* ── Header ──────────────────────────────────────────────── */
.compare-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}
.compare-header__title {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0;
}
.compare-header__count {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-left: var(--space-sm);
}
.compare-header__info {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
}
.compare-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

/* ── Toggle switch ───────────────────────────────────────── */
.compare-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  font-size: 0.875rem;
  user-select: none;
}
.compare-toggle input { display: none; }
.compare-toggle__slider {
  width: 40px;
  height: 22px;
  border-radius: 11px;
  background: var(--color-border);
  position: relative;
  transition: var(--transition);
  flex-shrink: 0;
}
.compare-toggle__slider::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  top: 3px;
  left: 3px;
  transition: var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.compare-toggle input:checked + .compare-toggle__slider {
  background: var(--color-primary);
}
.compare-toggle input:checked + .compare-toggle__slider::after {
  transform: translateX(18px);
}
.compare-toggle__text {
  color: var(--color-text-secondary);
  font-weight: 500;
}

/* ── Compare Table ───────────────────────────────────────── */
.compare-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  background: var(--color-surface);
  box-shadow: var(--shadow-md);
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

/* ── Label column (sticky) ───────────────────────────────── */
.compare-table__label-col {
  position: sticky;
  left: 0;
  background: var(--color-bg);
  z-index: 2;
  min-width: 200px;
  max-width: 240px;
  font-weight: 500;
  font-size: 0.8125rem;
  padding: 12px var(--space-lg);
  border-bottom: 1px solid var(--color-border-light);
  color: var(--color-text-secondary);
}

/* ── Product columns ─────────────────────────────────────── */
.compare-table__product-col {
  min-width: 200px;
  max-width: 260px;
  padding: var(--space-lg);
  border-bottom: 1px solid var(--color-border);
  border-left: 1px solid var(--color-border-light);
  vertical-align: top;
  background: var(--color-surface);
}

/* ── Group header row ────────────────────────────────────── */
.compare-table__group-header {
  background: var(--color-bg);
  font-weight: 700;
  font-size: 0.75rem;
  padding: 10px var(--space-lg);
  color: var(--color-text);
  border-bottom: 2px solid var(--color-primary);
  border-top: 1px solid var(--color-border-light);
  cursor: pointer;
  user-select: none;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.compare-table__group-toggle {
  font-size: 1rem;
  transition: transform 0.2s ease;
  color: var(--color-primary);
  margin-right: var(--space-xs);
  display: inline-block;
}
.compare-table__group-row.is-collapsed .compare-table__group-toggle {
  transform: rotate(-90deg);
}

/* ── Value cells ─────────────────────────────────────────── */
.compare-table__value {
  padding: 12px var(--space-lg);
  border-bottom: 1px solid var(--color-border-light);
  border-left: 1px solid var(--color-border-light);
  font-size: 0.875rem;
  min-width: 200px;
  transition: background-color 0.2s ease;
  color: var(--color-text);
}

.compare-table__empty {
  color: var(--color-text-muted);
  font-style: italic;
}

.compare-table tbody tr.compare-table__attr-row:hover .compare-table__value,
.compare-table tbody tr.compare-table__attr-row:hover .compare-table__label-col {
  background: var(--color-primary-light);
}

/* ── Highlight Differences ───────────────────────────────── */
.compare-same {
  /* no highlight for same values */
}
.compare-diff {
  background: #FFF4E5;
  font-weight: 600;
  color: var(--color-text);
  position: relative;
}
.compare-diff::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--color-warning);
}

/* ── Product Card in Header ──────────────────────────────── */
.compare-product-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  text-align: center;
  padding: var(--space-xs);
}

.compare-product-card__img-wrap {
  width: 120px;
  height: 120px;
  border-radius: var(--radius-lg);
  border: 2px solid var(--color-border-light);
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-sm);
  transition: var(--transition);
  margin-bottom: var(--space-xs);
}
.compare-product-card__img-wrap:hover {
  border-color: var(--color-primary);
  box-shadow: 0 4px 16px rgba(0,126,255,0.12);
}

.compare-product-card__img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.compare-product-card__name {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--color-text);
  text-decoration: none;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.compare-product-card__name:hover { color: var(--color-primary); }

.compare-product-card__article {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.compare-product-card__price {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-primary);
}
.compare-product-card__price--retail {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--color-text-muted);
  margin-right: 4px;
}
.compare-product-card__discount {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-success);
  margin-left: 4px;
}

.compare-product-card__actions {
  margin-top: var(--space-xs);
}

.compare-remove {
  font-size: 0.8125rem;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.compare-remove:hover {
  border-color: var(--color-danger);
  color: var(--color-danger);
  background: var(--color-danger-light);
}

/* ── Empty State ─────────────────────────────────────────── */
.compare-empty {
  text-align: center;
  padding: var(--space-3xl) var(--space-xl);
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  border: 2px dashed var(--color-border);
}

.compare-empty__icon {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--color-primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: var(--color-primary);
  margin: 0 auto var(--space-xl);
}

.compare-empty h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.compare-empty p {
  color: var(--color-text-secondary);
  font-size: 1rem;
  margin-bottom: var(--space-xl);
}

/* ── Hidden rows for diff filter ─────────────────────────── */
.compare-table tr.is-hidden { display: none; }

/* ── Column remove animation ─────────────────────────────── */
.compare-table th.is-removing,
.compare-table td.is-removing {
  animation: fadeOut 0.3s ease forwards;
}
@keyframes fadeOut {
  to { opacity: 0; transform: scale(0.95); }
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 767px) {
  .compare-header { flex-direction: column; align-items: flex-start; }
  .compare-table__label-col { min-width: 140px; font-size: 0.75rem; padding: 10px 12px; }
  .compare-table__value { min-width: 160px; padding: 10px 12px; font-size: 0.8125rem; }
  .compare-product-card__img-wrap { width: 80px; height: 80px; }
  .compare-product-card__name { font-size: 0.8125rem; }
  .compare-product-card__price { font-size: 1rem; }
}
@media (max-width: 767px) {
  .compare-product-card__img { width: 80px; height: 80px; }
  .compare-table__product-col { min-width: 160px; }
  .compare-table__label-col { min-width: 120px; font-size: 0.8125rem; }
  .page-header--with-action { flex-direction: column; gap: var(--space-md); align-items: flex-start; }
}
