.bsp-sp-compare {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: stretch;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.bsp-sp-compare.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

body.bsp-sp-compare-open {
  overflow: hidden;
}

.bsp-sp-compare__overlay {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.72);
}

.bsp-sp-compare__dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.bsp-sp-compare__container {
  width: 100%;
  max-width: 100%;
  height: 100%;
  height: 100dvh;
  background: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.bsp-sp-compare__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.bsp-sp-compare__title {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: #111827;
}

.bsp-sp-compare__close {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: #f3f4f6;
  color: #111827;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.bsp-sp-compare__close:hover {
  background: #e5e7eb;
}

.bsp-sp-compare__layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  overflow: hidden;
}

.bsp-sp-compare__column {
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 24px;
  overflow: hidden;
}

.bsp-sp-compare__column--current {
  border-right: 1px solid #e5e7eb;
  background: #faf9f7;
}

.bsp-sp-compare__column-title {
  margin: 0 0 18px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6b7280;
}

.bsp-sp-compare__panel-wrap,
.bsp-sp-compare__selected {
  flex-shrink: 0;
}

.bsp-sp-compare__panel-wrap {
  overflow: auto;
  min-height: 0;
}

.bsp-sp-compare__panel {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 20px;
  padding: 20px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
}

.bsp-sp-compare__panel--current {
  border-color: #d1d5db;
}

.bsp-sp-compare__panel-media {
  border-radius: 10px;
  overflow: hidden;
  background: #f9fafb;
}

.bsp-sp-compare__panel-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  aspect-ratio: 1;
}

.bsp-sp-compare__panel-brand {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #9ca3af;
}

.bsp-sp-compare__panel-title {
  margin: 0 0 10px;
  font-size: 22px;
  line-height: 1.3;
  font-weight: 700;
  color: #111827;
}

.bsp-sp-compare__panel-title a {
  color: inherit;
  text-decoration: none;
}

.bsp-sp-compare__panel-title a:hover {
  color: #4b5563;
}

.bsp-sp-compare__panel-rating {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.bsp-sp-compare__panel-reviews {
  font-size: 13px;
  color: #6b7280;
}

.bsp-sp-compare__panel-price {
  margin-bottom: 12px;
  font-size: 24px;
  font-weight: 700;
  color: #111827;
}

.bsp-sp-compare__panel-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 600;
}

.bsp-sp-compare__panel-stock.is-in-stock {
  color: #16a34a;
}

.bsp-sp-compare__panel-stock.is-out-of-stock {
  color: #dc2626;
}

.bsp-sp-compare__panel-sold {
  color: #6b7280;
}

.bsp-sp-compare__panel-description {
  margin: 0 0 16px;
  color: #6b7280;
  font-size: 14px;
  line-height: 1.6;
}

.bsp-sp-compare__panel-attributes {
  margin: 0 0 18px;
  display: grid;
  gap: 10px;
}

.bsp-sp-compare__panel-attribute {
  display: grid;
  grid-template-columns: 50% minmax(0, 1fr);
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f3f4f6;
}

.bsp-sp-compare__panel-attribute:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.bsp-sp-compare__panel-attribute dt {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: #9ca3af;
}

.bsp-sp-compare__panel-attribute dd {
  margin: 0;
  font-size: 14px;
  color: #111827;
}

.bsp-sp-compare__panel-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border: 1.5px solid #111827;
  border-radius: 8px;
  color: #111827;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
}

.bsp-sp-compare__panel-link:hover {
  background: #111827;
  color: #fff;
}

.bsp-sp-compare__search-wrap {
  position: relative;
  margin-bottom: 18px;
  flex-shrink: 0;
}

.bsp-sp-compare__search-field {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 0 16px;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
}

.bsp-sp-compare__search-field:focus-within {
  border-color: #111827;
}

.bsp-sp-compare__search-field i {
  color: #9ca3af;
  font-size: 15px;
}

.bsp-sp-compare__search {
  width: 100%;
  border: 0;
  background: transparent;
  color: #111827;
  font-size: 15px;
  outline: none;
}

.bsp-sp-compare__search::placeholder {
  color: #9ca3af;
}

.bsp-sp-compare__suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 3;
  max-height: 280px;
  overflow: auto;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(17, 24, 39, 0.12);
}

.bsp-sp-compare__suggestions[hidden] {
  display: none !important;
}

.bsp-sp-compare__suggestion,
.bsp-sp-compare__list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid #f3f4f6;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.bsp-sp-compare__list-item {
  text-decoration: none;
  color: inherit;
}

.bsp-sp-compare__suggestion:last-child,
.bsp-sp-compare__list-item:last-child {
  border-bottom: 0;
}

.bsp-sp-compare__suggestion:hover,
.bsp-sp-compare__list-item:hover,
.bsp-sp-compare__list-item.is-active {
  background: #f9fafb;
}

.bsp-sp-compare__item-thumb {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  background: #f3f4f6;
}

.bsp-sp-compare__item-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bsp-sp-compare__item-body {
  min-width: 0;
  flex: 1;
}

.bsp-sp-compare__item-brand {
  display: block;
  margin-bottom: 2px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #9ca3af;
}

.bsp-sp-compare__item-title {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  line-height: 1.35;
}

.bsp-sp-compare__item-price {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #4b5563;
}

.bsp-sp-compare__selected {
  margin-bottom: 18px;
}

.bsp-sp-compare__selected[hidden] {
  display: none !important;
}

.bsp-sp-compare__list-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.bsp-sp-compare__list-title {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 700;
  color: #111827;
}

.bsp-sp-compare__list-status {
  margin-bottom: 10px;
  font-size: 13px;
  color: #6b7280;
}

.bsp-sp-compare__list {
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: auto;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
}

.bsp-sp-compare__empty {
  padding: 18px 16px;
  color: #6b7280;
  font-size: 14px;
}

.bsp-sp-compare__loading {
  padding: 18px 16px;
  color: #6b7280;
  font-size: 14px;
}

/* Tablet landscape / small desktop */
@media (max-width: 1199px) {
  .bsp-sp-compare__header {
    padding: 18px 20px;
  }

  .bsp-sp-compare__title {
    font-size: 22px;
  }

  .bsp-sp-compare__column {
    padding: 20px;
  }

  .bsp-sp-compare__panel {
    grid-template-columns: 140px minmax(0, 1fr);
    gap: 16px;
    padding: 16px;
  }

  .bsp-sp-compare__panel-title {
    font-size: 20px;
  }

  .bsp-sp-compare__panel-price {
    font-size: 22px;
  }
}

/* Tablet portrait */
@media (max-width: 991px) {
  .bsp-sp-compare__layout {
    grid-template-columns: 1fr;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .bsp-sp-compare__column {
    overflow: visible;
    min-height: auto;
    flex-shrink: 0;
  }

  .bsp-sp-compare__column--current {
    border-right: 0;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 18px;
  }

  .bsp-sp-compare__column--picker {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  .bsp-sp-compare__panel-wrap,
  .bsp-sp-compare__selected {
    overflow: visible;
    max-height: none;
  }

  .bsp-sp-compare__panel {
    grid-template-columns: 120px minmax(0, 1fr);
  }

  .bsp-sp-compare__panel-media {
    max-width: none;
  }

  .bsp-sp-compare__list-wrap {
    flex: 1;
    min-height: 280px;
  }

  .bsp-sp-compare__list {
    max-height: none;
  }

  .bsp-sp-compare__suggestions {
    max-height: min(280px, 42vh);
  }
}

/* Mobile */
@media (max-width: 767px) {
  .bsp-sp-compare__header {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 12px 16px;
    padding-top: max(12px, env(safe-area-inset-top, 0px));
    background: #fff;
  }

  .bsp-sp-compare__title {
    font-size: 18px;
    line-height: 1.25;
    padding-right: 8px;
  }

  .bsp-sp-compare__close {
    width: 40px;
    height: 40px;
    font-size: 24px;
    flex-shrink: 0;
  }

  .bsp-sp-compare__column {
    padding: 16px;
  }

  .bsp-sp-compare__column-title {
    margin-bottom: 12px;
    font-size: 12px;
  }

  .bsp-sp-compare__panel {
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 12px;
    padding: 14px;
    border-radius: 10px;
  }

  .bsp-sp-compare__panel-title {
    font-size: 16px;
    margin-bottom: 8px;
  }

  .bsp-sp-compare__panel-price {
    margin-bottom: 8px;
    font-size: 18px;
  }

  .bsp-sp-compare__panel-rating {
    margin-bottom: 8px;
  }

  .bsp-sp-compare__panel-meta {
    gap: 8px 12px;
    margin-bottom: 10px;
    font-size: 12px;
  }

  .bsp-sp-compare__panel-description {
    margin-bottom: 12px;
    font-size: 13px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .bsp-sp-compare__panel-attributes {
    margin-bottom: 14px;
    gap: 8px;
  }

  .bsp-sp-compare__panel-attribute {
    grid-template-columns: 1fr;
    gap: 2px;
    padding-bottom: 8px;
  }

  .bsp-sp-compare__panel-link {
    width: 100%;
    min-height: 44px;
  }

  .bsp-sp-compare__search-wrap {
    margin-bottom: 14px;
  }

  .bsp-sp-compare__search-field {
    min-height: 48px;
    padding: 0 14px;
    gap: 10px;
  }

  .bsp-sp-compare__search {
    font-size: 16px;
  }

  .bsp-sp-compare__suggestions {
    max-height: min(220px, 38vh);
  }

  .bsp-sp-compare__selected {
    margin-bottom: 14px;
  }

  .bsp-sp-compare__list-title {
    font-size: 13px;
    margin-bottom: 10px;
  }

  .bsp-sp-compare__suggestion,
  .bsp-sp-compare__list-item {
    min-height: 64px;
    padding: 10px 12px;
    gap: 10px;
  }

  .bsp-sp-compare__item-thumb {
    width: 48px;
    height: 48px;
  }

  .bsp-sp-compare__item-title {
    font-size: 13px;
  }

  .bsp-sp-compare__item-price {
    font-size: 12px;
  }

  .bsp-sp-compare__list-wrap {
    min-height: 240px;
    padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
  }
}

/* Small phones */
@media (max-width: 479px) {
  .bsp-sp-compare__column--current {
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .bsp-sp-compare__panel {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .bsp-sp-compare__panel-media {
    width: 100%;
    max-width: 160px;
    margin: 0 auto;
  }

  .bsp-sp-compare__panel-body {
    text-align: left;
  }

  .bsp-sp-compare__panel-rating {
    justify-content: flex-start;
  }

  .bsp-sp-compare__panel-attribute {
    text-align: left;
  }
}
