/* ======================================================
   STM Compare (Global)
   File: inc/features/compare/assets/compare.css
====================================================== */

/* Hide old compare button if it exists in actions row (product-loop hardcoded) */
.stm-pl__row--actions .stm-pl__compare{
  display:none !important;
}

/* ======================================================
   OVERLAY BUTTON (inside .stm-pl__media)
   - black button, white icon
   - FIX: quick view ke sath touch/overlap na ho
====================================================== */

.stm-pl__media{ position: relative; }

/* Ensure Quick View always above compare (no touch conflict) */
.stm-qv-btn{ z-index: 8; }

/* Base */
.stm-compare-btn--overlay{
  position:absolute;
  left:50%;
  top:calc(50% + 56px);
  transform:translate(-50%, -50%) scale(.98);
  z-index: 7;

  width:42px;
  height:42px;
  border-radius:999px;
  border:0 !important;

  background:#000;
  color:#fff;

  display:inline-flex;
  align-items:center;
  justify-content:center;

  opacity:0;
  pointer-events:none;
  transition:opacity .14s ease, transform .14s ease;

  cursor:pointer;
  -webkit-tap-highlight-color: transparent;
}

/* Icon uses assets/svg/compare.svg via CSS mask */
.stm-compare-btn--overlay .stm-compare-btn__ico{
  width:18px;
  height:18px;
  display:block;

  background:#fff;

  -webkit-mask-image: url("../../../../assets/svg/compare.svg");
  mask-image: url("../../../../assets/svg/compare.svg");
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

/* Hover show only on desktop */
@media (hover:hover) and (pointer:fine){
  .stm-pl:hover .stm-pl__media .stm-compare-btn--overlay,
  .stm-pl__media:hover .stm-compare-btn--overlay{
    opacity:1;
    pointer-events:auto;
    transform:translate(-50%, -50%) scale(1);
  }
  .stm-compare-btn--overlay:hover{ filter: brightness(.92); }
}

/* Touch devices: hide (same UX as quick view) */
@media (hover:none){
  .stm-pl__media .stm-compare-btn--overlay{ display:none !important; }
}

/* Loading state */
.stm-compare-btn--overlay.is-loading{
  pointer-events:none;
  opacity:.7;
}

/* ======================================================
   CENTER POPUP (Toast)
====================================================== */

.stm-compare-toast{
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(.98);
  z-index: 999999;

  min-width: 240px;
  max-width: min(520px, 92vw);

  padding: 12px 16px;
  border-radius: 12px;

  font-size: 14px;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;

  box-shadow: 0 18px 55px rgba(0,0,0,.18);

  opacity: 0;
  pointer-events: none;
  transition: opacity .14s ease, transform .14s ease;

  background: #111827;
  color: #fff;
}

/* Visible */
.stm-compare-toast.is-visible{
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* Types */
.stm-compare-toast[data-type="success"],
.stm-compare-toast[data-type="info"]{
  background: #111827;
  color:#fff;
}
.stm-compare-toast[data-type="danger"],
.stm-compare-toast[data-type="error"]{
  background: #b91c1c;
  color:#fff;
}

/* ======================================================
   HEADER NOTIFICATION BADGE (BLACK -> GREEN)
   - Zero items: black badge
   - Has items: green badge + white text
====================================================== */

.stm-compare__count,
[data-stm-compare-count]{
  display: inline-flex;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #111;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.stm-compare.is-active .stm-compare__count,
.stm-compare.is-active [data-stm-compare-count]{
  background: #19a33a;
  color: #fff;
}

/* ======================================================
   HEADER DROPDOWN (Premium like Wishlist)
   Works with template: template-parts/header/compare.php
====================================================== */

.stm-compare{ position: relative; }

/* Dropdown shell (NO blur/shade like wishlist) */
.stm-compare__dd{
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: 380px;
  max-width: min(380px, 92vw);

  background: #fff;
  border: 1px solid rgba(0,0,0,.10);
  border-radius: 16px;

  /* ✅ hard-kill blur/shadow to match wishlist */
  box-shadow: none !important;
  filter: none !important;
  backdrop-filter: none !important;

  overflow: hidden;
  z-index: 99999;

  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity .12s ease, transform .12s ease;
}

/* Open state */
.stm-compare.is-open .stm-compare__dd{
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Head */
.stm-compare__hd{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;

  padding: 14px 16px;
  border-bottom: 1px solid rgba(0,0,0,.06);
}
.stm-compare__title{
  font-size: 15px;
  font-weight: 900;
  color: #111827;
}
.stm-compare__close{
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,.08);
  background: #fff;
  color: #111827;

  display:inline-flex;
  align-items:center;
  justify-content:center;

  cursor:pointer;
  transition: border-color .18s ease, transform .18s ease, background .18s ease;
}
.stm-compare__close:hover{ border-color: rgba(0,0,0,.16); background: rgba(0,0,0,.03); }
.stm-compare__close:active{ transform: translateY(1px); }

/* Body */
.stm-compare__body{
  padding: 10px 12px;
  max-height: 360px;
  overflow-y: auto;
  overflow-x: hidden;
}
.stm-compare__empty{
  margin: 0;
  padding: 12px 6px;
  font-size: 13px;
  font-weight: 700;
  opacity: .75;
}

/* List becomes grid + gap (wishlist style) */
.stm-compare__list{
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;

  max-height: 360px;
  overflow: auto;
}

/* Row (card style like wishlist) */
.stm-compare-dd__row{
  display:grid;
  grid-template-columns: 56px 1fr 32px;
  gap: 10px;
  align-items:center;

  padding: 10px;
  border-radius: 12px;
  background: rgba(0,0,0,.02);

  border: 0; /* remove old separators */
}
.stm-compare-dd__row:hover{ background: rgba(0,0,0,.04); }

/* Thumb */
.stm-compare-dd__thumb{
  width:56px;
  height:56px;
  border-radius:10px;
  overflow:hidden;

  display:flex;
  align-items:center;
  justify-content:center;

  background:#fff;
  border:1px solid rgba(0,0,0,.06);
}
.stm-compare-dd__thumb img{
  width:100% !important;
  height:100% !important;
  object-fit: cover !important;
  display:block;
}

/* Title — ✅ clamp 3 lines (consistent) */
.stm-compare-dd__title{
  min-width: 0;
  font-size: 13px;
  font-weight: 800;
  color: #111827;
  text-decoration: none;

  display: -webkit-box !important;
  -webkit-box-orient: vertical !important;
  -webkit-line-clamp: 3 !important;

  overflow: hidden !important;
  white-space: normal !important;
  text-overflow: ellipsis !important;

  line-height: 1.25;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.stm-compare-dd__title:hover{ text-decoration: underline; }

/* Remove button */
.stm-compare-dd__remove{
  width: 32px;
  height: 32px;
  border-radius: 10px;

  border: 1px solid rgba(0,0,0,.08);
  background: #fff;
  color: #111827;

  display:inline-flex;
  align-items:center;
  justify-content:center;

  cursor:pointer;
  font-size: 18px;
  line-height: 1;

  transition: border-color .18s ease, transform .18s ease, background .18s ease, color .18s ease;
}
.stm-compare-dd__remove:hover{
  background: rgba(185,28,28,.08);
  border-color: rgba(185,28,28,.25);
  color: #b91c1c;
}
.stm-compare-dd__remove:active{ transform: translateY(1px); }

/* Footer */
.stm-compare__ft{
  padding: 12px 12px 14px;
  border-top: 1px solid rgba(0,0,0,.06);
}
.stm-compare__btn{
  display:block;
  width:100%;
  text-align:center;

  padding: 12px 14px;
  border-radius: 12px;

  background:#111827;
  color:#fff;

  font-weight: 900;
  font-size: 13px;
  text-decoration: none;
}
.stm-compare__btn:hover{ opacity: .92; }

/* Scrollbar (subtle) */
.stm-compare__list::-webkit-scrollbar{ width: 10px; }
.stm-compare__list::-webkit-scrollbar-thumb{
  background: rgba(0,0,0,.12);
  border-radius: 999px;
  border: 3px solid #fff;
}

@media (max-width: 420px){
  .stm-compare__dd{ width: 330px; }
}
