/* ======================================================
   File Location: assets/css/header-compare.css
   File Purpose: Header compare icon button, dropdown panel, product rows, scroll area, and footer action buttons.
====================================================== */

.stm-compare{
  position: relative;
  display: inline-flex;
  align-items: center;
}

/* =========================
   TOGGLE BUTTON (FIXED MATCH WISHLIST)
========================= */

.stm-compare__toggle{
  position: relative;

  appearance: none;
  -webkit-appearance: none;

  min-width: 50px;
  width: 50px;
  height: 46px;
  min-height: 46px;
  padding: 0 14px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  box-sizing: border-box;
  line-height: 1;

  background: #fff !important;
  border: 1px solid #d9dee8;
  border-radius: 10px !important;

  cursor: pointer;
  transition: border-color .15s ease, transform .15s ease, background .15s ease, box-shadow .15s ease;
}

/* Header global .stm-mb-action rules have higher specificity.
   This selector locks compare toggle to the same 50x46 visual size as wishlist. */
.stm-header .stm-compare .stm-compare__toggle.stm-mb-action{
  width: 50px !important;
  min-width: 50px !important;
  max-width: 50px !important;
  height: 46px !important;
  min-height: 46px !important;
  padding: 0 14px !important;
  gap: 0 !important;

  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;

  flex: 0 0 50px;
  box-sizing: border-box !important;
  line-height: 1 !important;
}

.stm-compare__toggle:hover,
.stm-compare.is-open .stm-compare__toggle{
  border-color: #cfd7e6;
  background: #fff !important;
  box-shadow: 0 8px 18px rgba(15,23,42,.08);
}

.stm-compare__toggle:focus-visible{
  border-color: #f97316;
  box-shadow: 0 0 0 3px rgba(249,115,22,.16);
  outline: none;
}

.stm-compare__toggle:active{
  transform: translateY(1px);
}

/* =========================
   ICON FIX (VERY IMPORTANT)
========================= */

.stm-mb-action__icon{
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.stm-header .stm-compare .stm-compare__toggle.stm-mb-action .stm-mb-action__icon{
  width: 20px !important;
  min-width: 20px !important;
  height: 20px !important;
  min-height: 20px !important;
  flex: 0 0 20px;
  display: block !important;
  background: var(--stm-mb-ico) center / 20px 20px no-repeat;
}

/* =========================
   BADGE
========================= */

.stm-compare__badge{
  position: absolute;
  top: -6px;
  right: -6px;

  min-width: 18px;
  height: 18px;

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 11px;
  font-weight: 800;

  border-radius: 999px;
  background: #111;
  color: #fff;
}

/* =========================
   DROPDOWN CORE
========================= */

.stm-compare__dd{
  position: absolute;
  top: calc(100% + 10px);
  right: 0;

  width: 360px;
  max-width: 92vw;

  background: #fff;

  border: 1px solid #d7dbe2;
  border-radius: 14px;

  box-shadow: none !important;
  filter: none !important;
  backdrop-filter: none !important;

  z-index: 9999;

  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  pointer-events: none;

  transition: .18s ease;
}

.stm-compare.is-open .stm-compare__dd,
.stm-compare:hover .stm-compare__dd,
.stm-compare.is-hover .stm-compare__dd{
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

/* =========================
   HEADER
========================= */

.stm-compare__hd{
  display: flex;
  justify-content: space-between;
  align-items: center;

  padding: 14px 14px 10px;
  border-bottom: 1px solid #eef0f4;
}

/* =========================
   BODY (STRICT 3 ITEMS)
========================= */

.stm-compare__body{
  padding: 10px 12px;
  max-height: 252px;
  overflow-y: auto;
  overflow-x: hidden;
}

/* scrollbar */
.stm-compare__body::-webkit-scrollbar{
  width: 6px;
}

.stm-compare__body::-webkit-scrollbar-thumb{
  background: #d1d5db;
  border-radius: 10px;
}

/* =========================
   PRODUCT CARD
========================= */

.stm-compare__list{
  list-style: none;
  margin: 0;
  padding: 0;

  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stm-compare__item{
  display: grid;
  grid-template-columns: 62px minmax(0,1fr) 30px;
  gap: 12px;

  align-items: center;

  padding: 12px;

  border: 1px solid #d9dde5;
  border-radius: 14px;

  background: #fff;
}

/* image */
.stm-compare__thumb{
  width: 62px;
  height: 62px;

  border-radius: 10px;
  overflow: hidden;

  border: 1px solid #e6e9ef;
  background: #fff;
}

.stm-compare__thumb img{
  width: 62px !important;
  height: 62px !important;
  object-fit: contain !important;
}

/* title */
.stm-compare__name a{
  font-size: 13px;
  font-weight: 800;
  color: #0f172a;

  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;

  overflow: hidden;
  text-decoration: none;
}

.stm-compare__name a:hover{
  text-decoration: underline;
  color: #000;
}

/* remove */
.stm-compare__remove{
  width: 28px;
  height: 28px;

  border-radius: 999px;

  border: 1px solid #f3b6b6;
  background: #fff5f5;
  color: #ef4444;

  display: flex;
  align-items: center;
  justify-content: center;
}

/* =========================
   FOOTER
========================= */

.stm-compare__ft{
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;

  padding: 12px 12px 14px;
  border-top: 1px solid #eef0f4;
}

/* Match wishlist widget footer buttons exactly */
.stm-compare .stm-compare__dd .stm-compare__btn{
  width: 100%;
  min-width: 0;
  height: auto !important;
  min-height: 42px;
  box-sizing: border-box;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 11px 14px;
  border-radius: 999px;

  font-size: 13px;
  font-weight: 900;
  line-height: 1.15;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;

  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;

  transition:
    background-color .18s ease,
    border-color .18s ease,
    color .18s ease,
    transform .18s ease,
    opacity .18s ease;
}

.stm-compare .stm-compare__dd .stm-compare__btn:active{
  transform: translateY(1px);
}

.stm-compare .stm-compare__dd .stm-compare__btn:disabled,
.stm-compare .stm-compare__dd .stm-compare__btn[disabled]{
  cursor: not-allowed;
  opacity: .55;
}

.stm-compare .stm-compare__dd .stm-compare__btn--view{
  background: #f97316;
  border: 1px solid #f97316;
  color: #fff !important;
}

.stm-compare .stm-compare__dd .stm-compare__btn--view:hover,
.stm-compare .stm-compare__dd .stm-compare__btn--view:focus-visible{
  background: #c2410c;
  border-color: #c2410c;
  color: #fff !important;
  outline: none;
  text-decoration: none;
}

.stm-compare .stm-compare__dd .stm-compare__btn--clear{
  background: #fff;
  border: 1px solid #111827;
  color: #111827;
}

.stm-compare .stm-compare__dd .stm-compare__btn--clear:hover:not(:disabled),
.stm-compare .stm-compare__dd .stm-compare__btn--clear:focus-visible:not(:disabled),
.stm-compare .stm-compare__dd .stm-compare__btn--clear.is-loading{
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
  outline: none;
}

.stm-compare .stm-compare__dd .stm-compare__btn--clear:disabled:hover,
.stm-compare .stm-compare__dd .stm-compare__btn--clear[disabled]:hover{
  background: #fff;
  border-color: #111827;
  color: #111827;
}

/* safety */
.stm-compare__dd,
.stm-compare__dd *{
  backdrop-filter: none !important;
  filter: none !important;
}
/* ======================================================
   Tablet/mobile action-size sync
   - Compare button follows the same size as the mobile location action button.
   - Desktop 50x46 size remains unchanged.
====================================================== */
@media (max-width: 1023px){
  .stm-header .stm-compare,
  .stm-compare{
    flex: 0 0 var(--stm-header-action-size-responsive, 38px) !important;
  }

  .stm-header .stm-compare .stm-compare__toggle,
  .stm-header .stm-compare .stm-compare__toggle.stm-mb-action,
  .stm-compare__toggle{
    width: var(--stm-header-action-size-responsive, 38px) !important;
    min-width: var(--stm-header-action-size-responsive, 38px) !important;
    max-width: var(--stm-header-action-size-responsive, 38px) !important;
    height: var(--stm-header-action-size-responsive, 38px) !important;
    min-height: var(--stm-header-action-size-responsive, 38px) !important;
    padding: 0 !important;
    gap: 0 !important;
    border-radius: 10px !important;
    flex: 0 0 var(--stm-header-action-size-responsive, 38px) !important;
  }

  .stm-header .stm-compare__toggle .stm-mb-action__icon,
  .stm-compare__icon,
  .stm-compare__toggle .stm-mb-action__icon{
    width: var(--stm-header-action-icon-responsive, 18px) !important;
    height: var(--stm-header-action-icon-responsive, 18px) !important;
    flex: 0 0 var(--stm-header-action-icon-responsive, 18px) !important;
    background-size: var(--stm-header-action-icon-responsive, 18px) var(--stm-header-action-icon-responsive, 18px) !important;
  }
}


/* Plugin-owned global compare styles. */
/* ======================================================
   File: inc/features/compare/assets/compare.css
   Purpose: Global compare styles for product-card image-hover overlay button, header compare dropdown, dropdown actions, and compare feedback UI.
====================================================== */

/* 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)
   - Theme orange button, white icon
   - Shows ONLY when user hovers the product feature image area
   - FIX: quick view ke sath touch/overlap na ho
====================================================== */

.stm-pl__media{ position: relative; }

/* Ensure Quick View always above compare (no touch conflict) */
.stm-pl__media .stm-qv-btn,
.stm-pl__media .stm-qv-trigger{ z-index: 8; }

/* Base */
.stm-compare-btn--overlay{
  position:absolute;
  left:50%;
  top:calc(50% + 24px);
  transform:translate(-50%, -50%) scale(.98);
  z-index: 7;

  width:36px;
  height:36px;
  border-radius:999px;
  border:0 !important;

  background:#ff7a00;
  color:#fff;

  display:inline-flex;
  align-items:center;
  justify-content:center;

  opacity:0;
  pointer-events:none;
  transition:opacity .14s ease, transform .14s ease, background-color .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:17px;
  height:17px;
  display:block;

  background:#fff;

  -webkit-mask-image: url("icons/compare.svg");
  mask-image: url("icons/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 when the actual feature image/media area is hovered */
@media (hover:hover) and (pointer:fine){
  .stm-pl__media:hover .stm-compare-btn--overlay{
    opacity:1;
    pointer-events:auto;
    transform:translate(-50%, -50%) scale(1);
  }

  .stm-compare-btn--overlay:hover,
  .stm-compare-btn--overlay:focus-visible{
    background:#e65f00;
    color:#fff;
  }
}

/* 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,
.stm-compare:hover .stm-compare__dd,
.stm-compare.is-hover .stm-compare__dd{
  opacity: 1;
  visibility: visible;
  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;
  overflow: 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{
  --stm-compare-visible-items-height: 254px; /* 3 rows + 2 gaps */
  --stm-compare-row-gap: 10px;

  list-style: none;
  margin: 0;
  padding: 0 2px 0 0;
  display: grid;
  gap: var(--stm-compare-row-gap);

  max-height: var(--stm-compare-visible-items-height);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}

/* 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{
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;

  padding: 12px 12px 14px;
  border-top: 1px solid rgba(0,0,0,.06);
}
.stm-compare__btn{
  min-height: 42px;
  width: 100%;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 11px 14px;
  border-radius: 999px;

  font-weight: 900;
  font-size: 13px;
  line-height: 1.15;
  text-align: center;
  text-decoration: none;

  cursor: pointer;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease, transform .18s ease, opacity .18s ease;
}
.stm-compare__btn:active{ transform: translateY(1px); }
.stm-compare__btn:disabled{
  cursor: not-allowed;
  opacity: .55;
}
.stm-compare__btn--view{
  background: #f97316;
  border: 1px solid #f97316;
  color: #fff;
}
.stm-compare__btn--view:hover{
  background: #c2410c;
  border-color: #c2410c;
  color: #fff;
}
.stm-compare__btn--clear{
  background: #fff;
  border: 1px solid #111827;
  color: #111827;
}
.stm-compare__btn--clear:hover:not(:disabled),
.stm-compare__btn--clear.is-loading{
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
}
.stm-compare__btn--clear:disabled:hover{
  background: #fff;
  border-color: #111827;
  color: #111827;
}

/* 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; }
}
