/**
 * Sumaar wishlist.
 *
 * Only what Elementor's style controls cannot express: the filled/empty heart
 * state, and the heart WooCommerce's own archive template needs. Page layout and
 * brand styling stay in Elementor.
 */

:root {
  --sumaar-plum: #6b1550;
  --sumaar-plum-dark: #521040;
}

/* ---------------------------------------------------------------- */
/* Shared heart glyph                                                */
/* ---------------------------------------------------------------- */

.sumaar-wish {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #e0d3db;
  background: #fff;
  color: var(--sumaar-plum);
  cursor: pointer;
  font: inherit;
  line-height: 1;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease;
}

.sumaar-wish__icon {
  width: 1em;
  height: 1em;
  flex: none;
  background-color: currentColor;
  -webkit-mask: var(--sumaar-heart-outline) center / contain no-repeat;
  mask: var(--sumaar-heart-outline) center / contain no-repeat;
}

:root {
  --sumaar-heart-outline: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.8 4.6a5.5 5.5 0 0 0-7.8 0L12 5.7l-1-1.1a5.5 5.5 0 0 0-7.8 7.8l1.1 1L12 21l7.7-7.7 1.1-1a5.5 5.5 0 0 0 0-7.7z'/%3E%3C/svg%3E");
  --sumaar-heart-solid: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M20.8 4.6a5.5 5.5 0 0 0-7.8 0L12 5.7l-1-1.1a5.5 5.5 0 0 0-7.8 7.8l1.1 1L12 21l7.7-7.7 1.1-1a5.5 5.5 0 0 0 0-7.7z'/%3E%3C/svg%3E");
}

.sumaar-wish.is-active .sumaar-wish__icon {
  -webkit-mask-image: var(--sumaar-heart-solid);
  mask-image: var(--sumaar-heart-solid);
}

/* Floating heart on WooCommerce archive cards ---------------------- */

/* Top-left: WooCommerce puts its "Sale!" badge in the top-right corner. */
.sumaar-wish-wrap {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
}

.sumaar-wish--icon {
  width: 32px;
  height: 32px;
  padding: 0;
  justify-content: center;
  border-radius: 8px;
  font-size: 15px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}

.sumaar-wish--icon.is-active {
  background: var(--sumaar-plum);
  border-color: var(--sumaar-plum);
  color: #fff;
}

/* WooCommerce archive items need a positioning context for the heart. */
.woocommerce ul.products li.product {
  position: relative;
}

/* Labelled control on the single product page ---------------------- */

.sumaar-wish--button {
  margin: 14px 0 0;
  padding: 11px 20px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
}

.sumaar-wish--button:hover {
  border-color: var(--sumaar-plum);
  background: #faf5f8;
}

.sumaar-wish--button.is-active {
  background: var(--sumaar-plum);
  border-color: var(--sumaar-plum);
  color: #fff;
}

/* ---------------------------------------------------------------- */
/* Heart inside the Elementor product card                           */
/* ---------------------------------------------------------------- */

.elementor-widget-icon.sumaar-wish-icon {
  cursor: pointer;
}

.elementor-widget-icon.sumaar-wish-icon .elementor-icon {
  transition: transform .15s ease;
}

.elementor-widget-icon.sumaar-wish-icon:hover .elementor-icon {
  transform: scale(1.12);
}

/**
 * Saved state.
 *
 * Elementor renders Font Awesome as inline SVG, so the outline glyph cannot be
 * swapped for the solid one in CSS. Invert the chip instead: plum tile, white
 * heart. !important is needed because Elementor writes the widget's background
 * as an id-scoped rule of equal specificity that loads after this file.
 */
.elementor-widget-icon.sumaar-wish-icon.is-active {
  background-color: var(--sumaar-plum) !important;
}

.elementor-widget-icon.sumaar-wish-icon.is-active .elementor-icon svg {
  fill: #fff !important;
}

.elementor-widget-icon.sumaar-wish-icon.is-busy,
.sumaar-wish.is-busy {
  opacity: .55;
  pointer-events: none;
}

.elementor-widget-icon.sumaar-wish-icon.has-error .elementor-icon,
.sumaar-wish.has-error {
  animation: sumaar-shake .3s ease;
}

@keyframes sumaar-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

.elementor-widget-icon.sumaar-wish-icon:focus-visible,
.sumaar-wish:focus-visible {
  outline: 2px solid var(--sumaar-plum);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- */
/* Header counter badge                                              */
/* ---------------------------------------------------------------- */

.sumaar-wish-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--sumaar-plum);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
}

.sumaar-wish-count.is-empty {
  display: none;
}
