/* Floating compare bar + modal */
.compare-float {
  position: fixed;
  left: 16px;
  bottom: 20px;
  z-index: 1040;
}
.compare-float__toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 10px 14px;
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #222;
}
.compare-float__toggle i {
  color: #0a7bf7;
}

.compare-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1050;
  background: #fff;
  border-top: 3px solid #0a7bf7;
  box-shadow: 0 -6px 24px rgba(0,0,0,.15);
  transform: translateY(110%);
  transition: transform .25s ease;
}
.compare-bar.is-open {
  transform: translateY(0);
}
.compare-bar__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #0a7bf7;
  color: #fff;
  padding: 8px 16px;
}
.compare-bar__close {
  border: none;
  background: transparent;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.compare-bar__body {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  max-width: 1200px;
  margin: 0 auto;
}
.compare-bar__slots {
  display: flex;
  gap: 10px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
}
.compare-bar__slot {
  flex: 0 0 150px;
  width: 150px;
  min-height: 150px;
  border: 1px dashed #cfcfcf;
  border-radius: 8px;
  background: #fafafa;
  padding: 8px;
  position: relative;
  text-align: center;
}
.compare-bar__slot.is-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #666;
  cursor: pointer;
  border-style: dashed;
}
.compare-bar__plus {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px dashed #999;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #888;
}
.compare-bar__slot.is-filled {
  border-style: solid;
  background: #fff;
}
.compare-bar__thumb img {
  width: 64px;
  height: 64px;
  object-fit: contain;
}
.compare-bar__name {
  display: block;
  font-size: 12px;
  color: #222;
  margin-top: 6px;
  max-height: 34px;
  overflow: hidden;
  line-height: 1.3;
}
.compare-bar__price {
  color: #ed1b24;
  font-weight: 700;
  font-size: 13px;
  margin-top: 4px;
}
.compare-bar__remove {
  position: absolute;
  top: 2px;
  right: 6px;
  color: #ed1b24;
  font-size: 18px;
  line-height: 1;
}
.compare-bar__actions {
  flex: 0 0 auto;
  text-align: center;
}
.compare-bar__go {
  display: inline-block;
  background: #0a7bf7;
  color: #fff !important;
  padding: 10px 18px;
  border-radius: 4px;
  font-weight: 700;
  text-decoration: none;
}
.compare-bar__clear {
  display: block;
  margin-top: 8px;
  color: #ed1b24;
  font-size: 13px;
}

.compare-modal {
  position: fixed;
  inset: 0;
  z-index: 1060;
  display: none;
}
.compare-modal.is-open {
  display: block;
}
.compare-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
}
.compare-modal__panel {
  position: relative;
  width: min(720px, calc(100vw - 24px));
  max-height: calc(100vh - 80px);
  margin: 60px auto 0;
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.compare-modal__close {
  align-self: flex-end;
  border: none;
  background: transparent;
  color: #333;
  cursor: pointer;
  margin-bottom: 8px;
}
.compare-modal__filters {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}
.compare-modal__filters .search-cate {
  max-width: none;
  width: 100%;
}
.compare-modal__filters .search-cate__btn {
  width: 100%;
  max-width: none;
  border-radius: 6px;
  border: 1px solid #ddd;
  min-height: 38px;
}
.compare-modal__search {
  position: relative;
}
.compare-modal__search i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #888;
}
.compare-modal__search input {
  width: 100%;
  height: 40px;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 0 12px 0 36px;
}
.compare-modal__results {
  overflow-y: auto;
  max-height: min(420px, 55vh);
}
.compare-modal__hint,
.compare-modal__empty {
  text-align: center;
  color: #777;
  padding: 24px 8px;
}
.compare-modal__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid #eee;
}
.compare-modal__item img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  flex: 0 0 56px;
}
.compare-modal__meta {
  flex: 1;
  min-width: 0;
}
.compare-modal__meta .name {
  font-size: 13px;
  color: #222;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.compare-modal__meta .price {
  color: #ed1b24;
  font-weight: 700;
  margin-top: 4px;
}
.compare-modal__add {
  flex: 0 0 auto;
  border: none;
  background: transparent;
  color: #0a7bf7;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.compare-modal__add.is-added {
  color: #888;
  cursor: default;
}

body.compare-bar-open {
  padding-bottom: 190px;
}

.btn-add-compare {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #0a7bf7;
  border-radius: 4px;
  color: #0a7bf7 !important;
  font-weight: 600;
  text-decoration: none !important;
  background: #fff;
}
.btn-add-compare:hover {
  background: #0a7bf7;
  color: #fff !important;
}
.product-card-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.product-compare-link {
  display: inline;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: #222 !important;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none !important;
  white-space: nowrap;
}
.product-compare-link:hover {
  color: #0a7bf7 !important;
  background: none;
}

@media (max-width: 767px) {
  .compare-bar__body {
    flex-direction: column;
    align-items: stretch;
  }
  .compare-bar__slot {
    flex: 0 0 120px;
    width: 120px;
  }
  .compare-float {
    bottom: 90px;
  }
}
