/* ==================== COMPARE PAGE ==================== */
:root {
  --font-ecommerce: "Inter", "SF Pro Display", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-price: "Inter", "SF Pro Display", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --primary: #1358ff;
  --primary-light: #1f67ff;
  --primary-dark: #0f4ee8;
  --primary-bg: #edf3ff;
  --text-dark: #0b1430;
  --text-mid: #263044;
  --text-light: #66758d;
  --text-muted: #96a0b2;
  --border: #e2e8f2;
  --border-strong: #d8e0ec;
  --bg-white: #ffffff;
  --bg-page: #f5f6fa;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
  overflow-x: clip;
}

body {
  font-family: var(--font-ecommerce);
  color: var(--text-dark);
  background: radial-gradient(circle at 18% 0%, rgba(19, 88, 255, 0.045), transparent 28%), linear-gradient(180deg, var(--bg-page, #fbfcff) 0%, var(--premium-bg) 58%, var(--bg-page, #f7f8fb) 100%);
  line-height: 1.5;
  font-weight: 500;
}

.compare-section {
  max-width: 1240px;
  margin: 0 auto;
  padding: 46px 36px 42px;
  font-family: var(--font-ecommerce);
  background: radial-gradient(circle at 18% 0%, rgba(19, 88, 255, 0.045), transparent 28%), linear-gradient(180deg, var(--bg-page, #fbfcff) 0%, var(--premium-bg) 58%, var(--bg-page, #f7f8fb) 100%);
  min-height: 100vh;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  overflow-x: clip;
}

/* Breadcrumb */
.compare-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 8px;
  padding-top: 16px;
}

.compare-breadcrumb a {
  color: var(--text-light);
  text-decoration: none;
}

.compare-breadcrumb a:hover {
  color: var(--primary);
}

.breadcrumb-sep {
  color: var(--text-muted);
}

.compare-breadcrumb .breadcrumb-sep:empty::before {
  content: ">";
  font-size: 11px;
}

.breadcrumb-current {
  color: var(--text-mid);
  font-weight: 600;
}

/* Header */
.compare-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 32px;
  padding: 16px 0;
}

.compare-title {
  font-size: 32px;
  font-weight: 800;
  color: var(--text-dark);
  margin: 0;
  letter-spacing: -0.03em;
}

.compare-subtitle {
  font-size: 15px;
  color: var(--text-light);
  margin: 6px 0 0;
}

.compare-actions {
  display: flex;
  gap: 10px;
  margin-left: auto;
}

.compare-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-white);
  color: var(--text-mid);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.compare-action-btn:hover {
  background: var(--bg-page);
  border-color: var(--border-strong);
}

.compare-action-btn svg {
  width: 16px;
  height: 16px;
}

.compare-action-danger {
  color: var(--danger, #dc2626);
}

.compare-action-danger:hover {
  background: var(--danger-soft, #fef2f2);
  border-color: var(--danger-soft, #fecaca);
}

/* Sidebar - unified card style */
.compare-sidebar {
  width: 300px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Target price card */
.compare-sidebar-top {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.target-price-label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 12px;
}

.target-price-tooltip {
  color: var(--text-muted);
  cursor: help;
  font-size: 12px;
}

.target-price-row {
  display: flex;
  gap: 10px;
}

.target-price-input-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--bg-page);
  transition: all 0.2s ease;
}

.target-price-input-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(19, 88, 255, 0.1);
  background: var(--bg-white);
}

.target-price-currency {
  color: var(--text-light);
  font-weight: 700;
  font-size: 15px;
}

.target-price-input-wrap input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-dark);
  background: transparent;
}

.target-price-apply {
  padding: 10px 24px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.target-price-apply:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(19, 88, 255, 0.3);
}

.target-price-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin: 10px 0 0;
}

/* Products card */
.compare-products-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.compare-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.compare-sidebar-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0;
}

.compare-sidebar-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
}

.compare-sidebar-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 14px;
}

.compare-sidebar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  margin-bottom: 14px;
  background: var(--bg-page);
  transition: all 0.2s ease;
}

.compare-sidebar-search:focus-within {
  border-color: var(--primary);
  background: var(--bg-white);
  box-shadow: 0 0 0 3px rgba(19, 88, 255, 0.1);
}

.compare-sidebar-search svg {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.compare-sidebar-search input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 13px;
  color: var(--text-dark);
  background: transparent;
}

.compare-sidebar-products {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  max-height: 360px;
  overflow-y: auto;
}

.compare-sidebar-product {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 10px;
  background: var(--bg-white);
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.compare-sidebar-product:hover {
  background: var(--bg-page);
  border-color: var(--border);
}

.compare-sidebar-product-img {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--border);
}

.compare-sidebar-product-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.compare-sidebar-product-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--border) 0%, var(--border-strong) 100%);
}

.compare-sidebar-product-info {
  flex: 1;
  min-width: 0;
}

.compare-sidebar-product-name {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.compare-sidebar-product-variant {
  display: block;
  font-size: 11px;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.compare-sidebar-product-condition {
  display: inline-block;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--primary);
  background: var(--primary-bg);
  border: 1px solid rgba(19, 88, 255, 0.2);
  padding: 2px 8px;
  border-radius: 999px;
  margin-top: 3px;
}

.compare-sidebar-product-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.compare-sidebar-product-remove:hover {
  background: var(--danger-soft, #fee2e2);
  color: var(--danger, #dc2626);
}

.compare-add-more-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 12px;
  border: 1.5px dashed var(--primary);
  border-radius: 10px;
  background: transparent;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.compare-add-more-btn:hover {
  background: var(--primary-bg);
  border-style: solid;
  transform: translateY(-1px);
}

.compare-add-more-btn svg {
  width: 14px;
  height: 14px;
}

.compare-autoupdate-all-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 42px;
  padding: 0 18px;
  margin-top: 8px;
  border: 1px solid var(--primary-soft-border, #C8D4FF);
  border-radius: 8px;
  background: var(--bg-white);
  color: var(--primary, #1358ff);
  box-shadow: 0 1px 2px rgba(0, 68, 255, 0.08);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.compare-autoupdate-all-btn:hover {
  background: rgba(19, 88, 255, 0.08);
}

.compare-autoupdate-all-btn:disabled {
  opacity: 0.4;
  cursor: wait;
  pointer-events: none;
}

.compare-autoupdate-all-btn svg {
  width: 16px;
  height: 16px;
}

.compare-autoupdate-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 18px;
  min-height: 36px;
  border: 1px solid var(--primary-soft-border, #C8D4FF);
  border-radius: 8px;
  background: var(--bg-white);
  color: var(--primary, #1358ff);
  box-shadow: 0 1px 2px rgba(0, 68, 255, 0.08);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
  margin-top: 6px;
}

.compare-autoupdate-btn:hover {
  background: rgba(19, 88, 255, 0.08);
}

.compare-autoupdate-btn:disabled {
  opacity: 0.4;
  cursor: wait;
  pointer-events: none;
}

.compare-autoupdate-btn svg {
  width: 16px;
  height: 16px;
}

/* Comparison table */
.compare-body {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.compare-table-wrap {
  flex: 1;
  min-width: 0;
  /* Shorter table: vertical overflow scrolls INSIDE the card so the
     horizontal scrollbar stays reachable without scrolling the page. */
  max-height: 520px;
  overflow: auto;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Sticky column headers while the table scrolls vertically (desktop; the
   mobile breakpoint restores static labels further down). */
@media (min-width: 901px) {
  .compare-table thead th {
    position: sticky;
    top: 0;
    z-index: 4;
  }
  .compare-table thead th.compare-th-label {
    top: 0;
    left: 0;
    z-index: 6;
  }
  .compare-table thead th.compare-th-product {
    z-index: 4;
  }
}

.compare-empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-light);
}

.compare-empty-state svg {
  margin-bottom: 16px;
  color: var(--border-strong);
}

.compare-empty-state h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-mid);
  margin: 0 0 8px;
}

.compare-empty-state p {
  font-size: 14px;
  margin: 0;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--compare-cell-bg, var(--bg-white));
}

.compare-th-label {
  width: 200px;
  padding: 18px 20px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
  background: var(--compare-cell-bg, var(--bg-white));
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  position: sticky;
  left: 0;
  z-index: 1;
}

.compare-th-product {
  min-width: 240px;
  padding: 20px;
  text-align: center;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  border-left: 1px solid var(--border);
  vertical-align: top;
  position: relative;
}

.compare-product-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.compare-product-remove:hover {
  background: var(--danger-soft, #fee2e2);
  color: var(--danger, #dc2626);
}

.compare-product-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.compare-product-thumb {
  width: 80px;
  height: 80px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--border);
  margin-bottom: 4px;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.compare-product-thumb:hover {
  transform: scale(1.05);
}

.compare-product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.compare-product-thumb-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--border) 0%, var(--border-strong) 100%);
}

.compare-product-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.3;
  max-width: 180px;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s ease;
}

.compare-product-name:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.compare-product-condition {
  display: inline-block;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--primary);
  background: var(--primary-bg);
  border: 1px solid rgba(19, 88, 255, 0.2);
  padding: 2px 8px;
  border-radius: 999px;
}

.compare-last-updated {
  font-size: 14px;
  color: var(--text-dark);
  font-weight: 600;
}

.compare-row td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.compare-row:last-child td {
  border-bottom: none;
}

.compare-row td:not(:first-child) {
  border-left: 1px solid var(--border);
}

.compare-label-cell {
  background: var(--compare-cell-bg, var(--bg-white));
}

.compare-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-mid);
  display: flex;
  align-items: center;
  gap: 4px;
}

.compare-tooltip {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 400;
  cursor: help;
  margin-left: 3px;
}

.compare-tooltip-note {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 400;
}

.compare-value-cell {
  text-align: center;
  background: var(--compare-cell-bg, var(--bg-white));
}

.compare-your-price-input {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--bg-page);
  max-width: 200px;
  margin: 0 auto;
  transition: all 0.2s ease;
}

.compare-your-price-input:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(19, 88, 255, 0.1);
  background: var(--bg-white);
}

.compare-currency {
  color: var(--text-light);
  font-weight: 700;
  font-size: 15px;
}

.compare-your-price-input input {
  width: 80px;
  border: none;
  outline: none;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-dark);
  background: transparent;
  text-align: right;
}

.compare-price-bold {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-dark);
}

.compare-price-source {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 3px;
}

.compare-comparison-better {
  color: var(--success, #16a34a);
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--success-bg, #dcfce7);
  border-radius: 8px;
  margin: 0 auto;
}

.compare-comparison-worse {
  color: var(--danger, #dc2626);
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--danger-soft, #fee2e2);
  border-radius: 8px;
  margin: 0 auto;
}

.compare-comparison-arrow {
  font-size: 18px;
  font-weight: 700;
}

.compare-comparison-sub {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-light);
  margin-top: 2px;
  text-align: center;
}

.compare-diff-better {
  color: var(--success, #16a34a);
  font-size: 15px;
  font-weight: 700;
  padding: 6px 12px;
  background: var(--success-bg, #dcfce7);
  border-radius: 8px;
  display: inline-block;
}

.compare-diff-worse {
  color: var(--danger, #dc2626);
  font-size: 15px;
  font-weight: 700;
  padding: 6px 12px;
  background: var(--danger-soft, #fee2e2);
  border-radius: 8px;
  display: inline-block;
}

.compare-diff-pct {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 4px;
}

.compare-na {
  color: var(--border-strong);
  font-size: 18px;
  font-weight: 700;
}

.compare-price-range-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-mid);
  margin-bottom: 10px;
}

.compare-price-range-bar {
  padding: 0 4px;
}

.compare-range-track {
  position: relative;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  margin-bottom: 6px;
}

.compare-range-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--primary);
  border-radius: 3px;
}

.compare-range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Footer */
.compare-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
  padding: 14px 18px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 12px;
  color: var(--text-light);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.compare-footer-note {
  display: flex;
  align-items: center;
  gap: 6px;
}

.compare-footer-note svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.compare-footer-updated {
  display: flex;
  align-items: center;
  gap: 8px;
}

.compare-refresh-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.15s ease;
}

.compare-refresh-btn:hover {
  background: var(--border);
  color: var(--text-mid);
}

.compare-refresh-btn svg {
  width: 14px;
  height: 14px;
}

/* ==================== SHARE POPUP ==================== */
.share-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  font-family: var(--font-ecommerce);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.share-popup {
  background: var(--bg-white);
  border-radius: 20px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  font-family: var(--font-ecommerce);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.share-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}

.share-popup-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0;
}

.share-popup-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.15s ease;
}

.share-popup-close:hover {
  background: var(--bg-page);
  color: var(--text-dark);
}

.share-type-selector {
  display: flex;
  gap: 8px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-page);
}

.share-type-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--bg-white);
  color: var(--text-light);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.share-type-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.share-type-btn.active {
  border-color: var(--primary);
  background: var(--primary-bg);
  color: var(--primary);
}

.share-type-btn svg {
  width: 20px;
  height: 20px;
}

.share-options {
  padding: 20px 24px;
  overflow-y: auto;
}

.share-link-preview {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.share-link-preview input {
  flex: 1;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text-dark);
  background: var(--bg-page);
  outline: none;
}

.share-copy-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 20px;
  border: none;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.share-copy-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(19, 88, 255, 0.3);
}

.share-copy-btn svg {
  width: 18px;
  height: 18px;
}

.share-platforms {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.share-platform-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 12px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--bg-white);
  color: var(--text-mid);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.share-platform-btn:hover {
  border-color: var(--primary);
  background: var(--bg-page);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.share-platform-btn svg {
  width: 24px;
  height: 24px;
}

.share-image-preview {
  margin-bottom: 20px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-page);
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.share-image-preview img {
  width: 100%;
  height: auto;
  display: block;
}

.share-image-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-light);
  font-size: 14px;
}

.share-image-loading svg {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Auto-update buttons */
.compare-autoupdate-all-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 42px;
  padding: 0 18px;
  margin-top: 8px;
  border: 1px solid var(--primary-soft-border, #C8D4FF);
  border-radius: 8px;
  background: var(--bg-white);
  color: var(--primary);
  box-shadow: 0 1px 2px rgba(0, 68, 255, 0.08);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.compare-autoupdate-all-btn:hover {
  background: var(--primary-bg);
}

.compare-autoupdate-all-btn:disabled {
  opacity: 0.4;
  cursor: wait;
  pointer-events: none;
}

.compare-autoupdate-all-btn svg {
  width: 16px;
  height: 16px;
}

.compare-autoupdate-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 18px;
  min-height: 36px;
  border: 1px solid var(--primary-soft-border, #C8D4FF);
  border-radius: 8px;
  background: var(--bg-white);
  color: var(--primary);
  box-shadow: 0 1px 2px rgba(0, 68, 255, 0.08);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
  margin-top: 6px;
}

.compare-autoupdate-btn:hover {
  background: var(--primary-bg);
}

.compare-autoupdate-btn:disabled {
  opacity: 0.4;
  cursor: wait;
  pointer-events: none;
}

.compare-autoupdate-btn svg {
  width: 16px;
  height: 16px;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 900px) {
  .compare-section {
    padding: 24px 16px 36px;
  }

  .compare-body {
    flex-direction: column;
    align-items: stretch;
  }

  .compare-sidebar {
    width: 100%;
    flex-direction: column;
    align-items: center;
  }

  .compare-sidebar-top,
  .compare-products-card {
    flex: none;
    width: 100%;
    max-width: 720px;
    min-width: 0;
  }

  .compare-sidebar-products {
    flex-direction: row;
    flex-wrap: wrap;
    max-height: none;
  }

  .compare-sidebar-product {
    flex: 1;
    min-width: 200px;
  }

  .compare-th-label {
    width: 140px;
    /* On smaller screens the sticky label column must not follow the user
       through the table — it overlays and blocks the product columns. */
    position: static;
  }
}

@media (max-width: 640px) {
  .compare-section {
    padding: 16px 12px;
  }

  .compare-title {
    font-size: 24px;
  }

  .compare-header {
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
  }

  .compare-actions {
    margin-left: 0;
    width: 100%;
  }

  .compare-action-btn {
    flex: 1;
    justify-content: center;
  }

  .compare-sidebar {
    flex-direction: column;
  }

  .compare-sidebar-top,
  .compare-products-card {
    flex: none;
    width: 100%;
    padding: 16px;
  }

  .compare-sidebar-products {
    max-height: 300px;
    overflow-y: auto;
  }

  .compare-sidebar-product {
    flex: none;
    width: 100%;
    min-width: 0;
  }

  .compare-th-label {
    width: 110px;
    padding: 14px 10px;
    font-size: 12px;
  }

  .compare-th-product {
    min-width: 150px;
    padding: 14px 8px;
  }

  .compare-product-remove {
    right: 6px;
    padding: 4px 8px;
  }

  .compare-product-thumb {
    width: 56px;
    height: 56px;
  }

  .compare-product-name {
    font-size: 13px;
    max-width: 110px;
  }

  .compare-row td {
    padding: 12px 10px;
  }

  .compare-price-bold {
    font-size: 15px;
  }

  .compare-your-price-input {
    padding: 8px 10px;
  }

  .compare-footer {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
}

/* ==================== ADD PRODUCTS POPUP ==================== */
.add-products-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  font-family: var(--font-ecommerce);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.add-products-popup {
  background: var(--bg-white);
  border-radius: 16px;
  width: 100%;
  max-width: 680px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.add-products-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}

.add-products-header h3 {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-dark);
  margin: 0;
  letter-spacing: -0.02em;
}

.add-products-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.15s ease;
}

.add-products-close:hover {
  background: var(--bg-page);
  color: var(--text-dark);
}

.add-products-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-page);
}

.add-products-search svg {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.add-products-search input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dark);
  background: transparent;
  font-family: var(--font-ecommerce);
}

.add-products-results {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  align-content: start;
}

.add-products-result-card {
  display: flex;
  flex-direction: column;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  background: var(--bg-white);
  position: relative;
}

.add-products-result-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(19, 88, 255, 0.12);
}

.add-products-result-card.already-added {
  opacity: 0.5;
  pointer-events: none;
  border-color: var(--border);
}

.add-products-result-card.already-added::after {
  content: "Added";
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 10px;
  font-weight: 700;
  color: var(--success, #16a34a);
  background: var(--success-bg, #dcfce7);
  padding: 2px 6px;
  border-radius: 4px;
}

.add-products-result-img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--border);
  margin-bottom: 10px;
}

.add-products-result-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.add-products-result-img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--border) 0%, var(--border-strong) 100%);
  font-size: 24px;
  color: var(--text-muted);
}

.add-products-result-name {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-dark);
  line-height: 1.2;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 6px;
}

.add-products-result-condition {
  display: inline-block;
  width: fit-content;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--primary);
  background: var(--primary-bg);
  border: 1px solid rgba(19, 88, 255, 0.2);
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: 6px;
}

.add-products-result-price {
  font-size: 15px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.03em;
  margin-top: 4px;
}

.add-products-result-add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 10px;
  padding: 8px;
  border: 1.5px solid var(--primary);
  border-radius: 8px;
  background: transparent;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: var(--font-ecommerce);
}

.add-products-result-add-btn:hover {
  background: var(--primary-bg);
}

.add-products-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  color: var(--text-light);
}

.add-products-empty svg {
  margin-bottom: 12px;
  color: var(--border-strong);
}

.add-products-footer {
  padding: 12px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-page);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-light);
  font-family: var(--font-ecommerce);
}



/* ==================== REFRESH ALL CONFIRMATION ==================== */
.confirm-update-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  font-family: var(--font-ecommerce);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.confirm-update-popup {
  background: var(--bg-white);
  border-radius: 16px;
  width: 100%;
  max-width: 420px;
  padding: 24px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
  font-family: var(--font-ecommerce);
}

.confirm-update-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.confirm-update-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0;
}

.confirm-update-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.confirm-update-close:hover {
  background: var(--bg-page);
  color: var(--text-dark);
}

.confirm-update-text {
  margin: 0 0 20px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-mid);
}

.confirm-update-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.confirm-update-btn {
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-white);
  color: var(--text-mid);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}

.confirm-update-btn:hover {
  border-color: var(--border-strong);
  background: var(--bg-page);
}

.confirm-update-btn.confirm-update-confirm {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
}

.confirm-update-btn.confirm-update-confirm:hover {
  background: var(--primary-dark);
}

/* Share button (primary, social-style) */
.compare-action-primary {
    background: var(--primary, #1358ff) !important;
    border-color: var(--primary, #1358ff) !important;
    color: #ffffff !important;
}
.compare-action-primary:hover {
    background: var(--primary-dark, #0b3fcc) !important;
    border-color: var(--primary-dark, #0b3fcc) !important;
    color: #ffffff !important;
}
.compare-action-primary svg {
    color: #ffffff;
}

/* ==================== VIEW SLIDER (PRICE / SPECIFICS) ==================== */
.compare-view-toggle {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  margin: 14px auto 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-white);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
}

.compare-view-slider {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(50% - 4px);
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 2px 8px rgba(19, 88, 255, 0.35);
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.compare-view-toggle[data-mode="specifics"] .compare-view-slider {
  transform: translateX(100%);
}

.compare-view-option {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 132px;
  padding: 8px 18px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-light);
  font-family: var(--font-ecommerce);
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: color 0.18s ease;
}

.compare-view-option.is-active {
  color: #ffffff;
}

.compare-view-option:disabled,
.compare-view-option.is-locked {
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.7;
}

.compare-view-option:disabled .compare-view-lock,
.compare-view-option.is-locked .compare-view-lock {
  opacity: 0.9;
}

.compare-view-hint {
  margin: 8px auto 0;
  max-width: 480px;
  text-align: center;
  color: var(--text-light);
  font-size: 12px;
  line-height: 1.45;
}

@media (max-width: 480px) {
  .compare-view-option {
    min-width: 104px;
    padding: 7px 12px;
    font-size: 13px;
  }
}
/* ==================== SPECIFICS COMPARISON VIEW ==================== */
.compare-specifics-row .compare-label-cell {
  font-weight: 650;
  color: var(--text-mid);
}

.compare-specific-value {
  font-size: 13px;
  color: var(--text-mid);
  text-align: left;
  white-space: normal;
  word-break: break-word;
}

.compare-specific-value.compare-specific-diff {
  background: var(--diff-highlight, rgba(19, 88, 255, 0.06));
  border-radius: 8px;
  color: var(--text-dark);
  font-weight: 650;
  box-shadow: inset 0 0 0 1px var(--diff-highlight-ring, rgba(19, 88, 255, 0.14));
}
.compare-view-option:not(:disabled):not(.is-locked) .compare-view-lock {
  display: none;
}

/* ==================== PER-COLUMN FILTERS (funnel toggle + multi-selects) ==================== */
/* The funnel icon sits next to each product/brand name (the same control as
   the product page's card filters) and toggles a panel with the condition and
   marketplace multi-selects for that column. */
.compare-product-name-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
}
.compare-product-name-row .compare-product-name {
  min-width: 0;
  overflow-wrap: anywhere;
}
.compare-product-name-row .card-filters-toggle {
  width: 28px;
  height: 28px;
  margin-left: 0;
  flex-shrink: 0;
}
.compare-product-filters-panel {
  justify-content: center;
  width: 100%;
  margin: 2px 0 0;
}
.compare-product-marketplace { margin-top: 4px; }

/* Multi-select dropdown — same look as the product page's card filters
   (product.css parity; this page does not load product.css). */
.mp-multiselect-wrap { position: relative; display: inline-block; }
.mp-multiselect-toggle {
  appearance: none; border: 1.5px solid var(--border, #e2e8f2); border-radius: 10px;
  background: var(--bg-white); padding: 7px 12px; font-family: inherit; font-size: 12.5px; font-weight: 700;
  color: var(--text-dark, #0b1430); cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  min-width: 150px; justify-content: space-between; transition: border-color .15s ease;
}
.mp-multiselect-toggle:hover { border-color: var(--primary, #1358ff); }
.mp-multiselect-toggle svg { flex-shrink: 0; color: var(--text-light, #66758d); }
.mp-multiselect-menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 60; background: var(--bg-white);
  border: 1px solid var(--border, #e2e8f2); border-radius: 12px; box-shadow: 0 12px 32px rgba(11,20,48,0.14);
  padding: 6px; min-width: 100%; max-height: 240px; overflow-y: auto;
}
.mp-multiselect-option {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  font-size: 13px; font-weight: 600; color: var(--text-dark, #0b1430); cursor: pointer; user-select: none;
}
.mp-multiselect-option:hover { background: var(--primary-bg, #edf3ff); }
.mp-multiselect-option input[type="checkbox"] { accent-color: var(--primary, #1358ff); width: 15px; height: 15px; cursor: pointer; flex-shrink: 0; }

/* Add-products picker cards: one full-width Add button (the split
   add/caret pair was removed — adding never asks for conditions). */
.add-products-result-actions { display: flex; align-items: stretch; width: 100%; margin-top: 10px; }
.add-products-result-actions .add-products-result-add-btn {
  flex: 1;
  min-width: 0;
  margin-top: 0;
}

/* ==================== MOBILE ORDER: SIDEBAR ABOVE THE VIEW SLIDER ==================== */
/* At <=900px the sidebar stacks above the comparison table, but the
   Prices/Information slider sits outside .compare-body in the DOM, so it
   would normally stay above the sidebar. Promote .compare-section to a
   column flex container, flatten .compare-body with display:contents and
   order the blocks explicitly: breadcrumb -> actions -> sidebar -> slider
   -> hint -> table. Desktop (wide) layout is untouched. */
@media (max-width: 900px) {
  .compare-section { display: flex; flex-direction: column; }
  .compare-body { display: contents; }
  .compare-header { order: 1; }
  .compare-sidebar { order: 2; margin-bottom: 16px; }
  .compare-view-toggle { order: 3; }
  .compare-view-hint { order: 4; }
  .compare-table-wrap { order: 5; }
}

/* Search-term group headers in the Add-products picker. */
.add-products-term-group {
  margin: 12px 0 4px;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted, #66758d);
}
.add-products-term-group:first-child { margin-top: 2px; }
