/* =========================================================
   motiv/wishlist
   ========================================================= */

.motiv-wishlist {
  --wl-accent: #d7ff3f;
  --wl-gap: 1.25rem;
  --wl-row-gap: 2.5rem;
  --wl-ink: #151515;
  --wl-paper: #f6f5f0;
  --wl-border: rgba(0, 0, 0, .1);
}

/* ============ ICON BUTTON ============ */
.motiv-wishlist--icon .wishlist-icon-button,
.wishlist-icon-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: background .2s;
}
.wishlist-icon-button:hover { background: rgba(0, 0, 0, .06); }
.wishlist-icon-heart {
  font-size: 22px;
  line-height: 1;
  color: inherit;
}
.wishlist-icon-button.is-active .wishlist-icon-heart { color: #e0344c; }
.wishlist-icon-count {
  position: absolute;
  top: -.1rem;
  inset-inline-end: -.1rem;
  min-width: 16px;
  height: 16px;
  padding: 0 .35rem;
  border-radius: 999px;
  background: var(--wl-accent);
  color: var(--wl-ink);
  font-size: 9px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform .3s;
}
.wishlist-icon-count.is-empty { display: none; }

/* ============ PAGE HEAD ============ */
.motiv-wishlist--page .wishlist-head {
  margin-bottom: 2.5rem;
}
.motiv-wishlist .wishlist-title {
  display: inline-flex;
  align-items: baseline;
  gap: .75rem;
  margin: 0;
}
.motiv-wishlist .wishlist-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 .5rem;
  border-radius: 999px;
  background: var(--wl-ink);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  font-family: "DM Sans", sans-serif;
  letter-spacing: 0;
}
.motiv-wishlist .wishlist-count.is-empty { background: rgba(0, 0, 0, .2); }

/* ============ PANEL (drawer + page) ============ */
.motiv-wishlist--page .wishlist-panel { width: 100%; }

/* ============ DRAWER ============ */
.motiv-wishlist--drawer .wishlist-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .35s, visibility .35s;
  pointer-events: none;
}
.motiv-wishlist--drawer.is-open .wishlist-overlay {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.motiv-wishlist--drawer .wishlist-panel {
  position: fixed;
  top: 0;
  bottom: 0;
  inset-inline-end: 0;
  z-index: 70;
  width: min(440px, 100vw);
  max-width: 100vw;
  display: flex;
  flex-direction: column;
  background: var(--wl-paper);
  box-shadow: -20px 0 60px rgba(0, 0, 0, .18);
  transform: translateX(102%);
  transition: transform .5s cubic-bezier(.16, 1, .3, 1);
}
.motiv-wishlist--drawer[data-drawer-pos="left"] .wishlist-panel {
  inset-inline-end: auto;
  inset-inline-start: 0;
  box-shadow: 20px 0 60px rgba(0, 0, 0, .18);
  transform: translateX(-102%);
}
.motiv-wishlist--drawer.is-open .wishlist-panel {
  transform: translateX(0);
}
body.motiv-wishlist-open { overflow: hidden; }

.wishlist-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--wl-border);
}
.wishlist-drawer-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: .6rem;
}
.wishlist-close {
  width: 40px; height: 40px;
  border: 0; background: transparent;
  font-size: 1.5rem;
  cursor: pointer;
  border-radius: 50%;
  transition: background .2s;
}
.wishlist-close:hover { background: rgba(0, 0, 0, .06); }

/* ============ BODY ============ */
.motiv-wishlist--drawer .wishlist-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
  scrollbar-width: thin;
}
.motiv-wishlist--drawer .wishlist-body::-webkit-scrollbar { width: 4px; }
.motiv-wishlist--drawer .wishlist-body::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, .15);
  border-radius: 2px;
}

/* ============ GRID ============ */
.wishlist-grid {
  display: grid;
  grid-template-columns: repeat(var(--wl-cols, 4), minmax(0, 1fr));
  column-gap: var(--wl-gap);
  row-gap: var(--wl-row-gap);
}
.motiv-wishlist--page .wishlist-grid { --wl-cols: 4; }
.motiv-wishlist--drawer .wishlist-grid { --wl-cols: 1; row-gap: 1.25rem; }

@media (max-width: 1023px) {
  .motiv-wishlist--page .wishlist-grid { --wl-cols: 2; }
}
@media (max-width: 639px) {
  .motiv-wishlist--page .wishlist-grid { --wl-cols: 2; }
}

/* ============ CARD ============ */
.wishlist-card {
  display: flex;
  flex-direction: column;
  position: relative;
}
.wishlist-card-image {
  position: relative;
  aspect-ratio: 4/5;
  overflow: hidden;
  background: #e4e3dc;
  transition: transform .35s, box-shadow .35s;
}
.wishlist-card:hover .wishlist-card-image {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, .1);
}
.wishlist-card-image > a {
  display: block;
  width: 100%;
  height: 100%;
}
.wishlist-card-image .product-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity .6s, transform .8s;
}
.wishlist-card-image .product-image.secondary { opacity: 0; }
.wishlist-card:hover .product-image.primary { opacity: 0; }
.wishlist-card:hover .product-image.secondary { opacity: 1; }
.wishlist-card-placeholder {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, #e4e3dc, #d0cec5);
}

/* Remove button */
.wishlist-remove {
  position: absolute;
  top: .5rem;
  inset-inline-end: .5rem;
  z-index: 3;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .95);
  border: 0;
  color: #e0344c;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .12);
  transition: background .2s, transform .2s;
}
.wishlist-remove:hover {
  background: #fff;
  transform: scale(1.1);
}

/* Meta */
.wishlist-card-meta {
  padding-top: .9rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.wishlist-card-name {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -.02em;
}
.wishlist-card-name a {
  color: inherit;
  text-decoration: none;
}
.wishlist-card-name a:hover { text-decoration: underline; }
.wishlist-card-price {
  margin: 0;
  font-size: 12px;
}
.wishlist-card-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  margin-top: .5rem;
  padding: .55rem 1rem;
  background: transparent;
  border: 1px solid var(--wl-ink);
  color: var(--wl-ink);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  text-decoration: none;
  cursor: pointer;
  transition: background .25s, color .25s, transform .25s;
}
.wishlist-card-add:hover {
  background: var(--wl-ink);
  color: #fff;
  transform: translateY(-2px);
}
.wishlist-card-out {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: .5rem;
  padding: .55rem 1rem;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: rgba(0, 0, 0, .4);
  border: 1px solid rgba(0, 0, 0, .1);
}

/* ============ EMPTY ============ */
.wishlist-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 4rem 1rem;
  text-align: center;
  background: #efeee8;
  border: 1px dashed var(--wl-border);
}
.wishlist-empty-icon {
  font-size: 2.5rem;
  opacity: .25;
}
.wishlist-empty-text {
  margin: 0;
  font-size: 14px;
  color: rgba(0, 0, 0, .55);
}
.wishlist-empty-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: .7rem 1.3rem;
  background: var(--wl-ink);
  color: #fff;
  border: 1px solid var(--wl-ink);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  text-decoration: none;
  transition: background .25s, color .25s;
}
.wishlist-empty-cta:hover {
  background: var(--wl-accent);
  color: var(--wl-ink);
  border-color: var(--wl-accent);
}

/* ============ FOOTER (drawer) ============ */
.wishlist-foot {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  padding: 1rem 1.5rem 1.5rem;
  border-top: 1px solid var(--wl-border);
  background: var(--wl-paper);
}
.wishlist-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: .75rem 1rem;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  cursor: pointer;
  text-decoration: none;
  transition: background .25s, color .25s, border-color .25s, transform .25s;
}
.wishlist-btn--primary {
  background: var(--wl-ink);
  color: #fff;
  border: 1px solid var(--wl-ink);
}
.wishlist-btn--primary:hover {
  background: var(--wl-accent);
  color: var(--wl-ink);
  border-color: var(--wl-accent);
  transform: translateY(-2px);
}
.wishlist-btn--ghost {
  background: transparent;
  border: 1px solid rgba(0, 0, 0, .25);
  color: var(--wl-ink);
}
.wishlist-btn--ghost:hover {
  background: var(--wl-ink);
  color: #fff;
  border-color: var(--wl-ink);
}

/* ============ TOAST ============ */
.motiv-wishlist-toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translate(-50%, 1.5rem);
  z-index: 300;
  padding: .85rem 1.25rem;
  background: #151515;
  color: #fff;
  font-size: 13px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .25);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s, transform .3s;
}
.motiv-wishlist-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ============ HEART BUTTON (dùng trong product-card) ============ */
.wishlist-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  border: 0;
  cursor: pointer;
  transition: background .2s, transform .2s;
}
.wishlist-toggle:hover {
  background: var(--wl-accent, #d7ff3f);
  transform: scale(1.05);
}
.wishlist-toggle.is-active { background: var(--wl-accent, #d7ff3f); }

/* ============ Reduced motion ============ */
@media (prefers-reduced-motion: reduce) {
  .motiv-wishlist--drawer .wishlist-panel,
  .motiv-wishlist--drawer .wishlist-overlay,
  .wishlist-card-image,
  .wishlist-card-image .product-image,
  .motiv-wishlist-toast {
    transition: none !important;
  }
}
/* Compact saved-product drawer, using the same paper and ink as the store. */
.header-actions .wishlist-icon-button { color: var(--wp--preset--color--ink, #151515); width: 44px; height: 44px; padding: 0; }
.header-actions .wishlist-icon-count {
  box-sizing: border-box; top: -2px; inset-inline-end: -4px;
  min-width: 20px; height: 20px; padding: 0 5px;
  background: var(--wp--preset--color--ink, #151515); color: #fff;
  border: 2px solid var(--wp--preset--color--paper, #f6f5f0);
  font: 600 10px/1 var(--wp--preset--font-family--body, sans-serif);
}
.motiv-wishlist--drawer { --wl-paper: var(--wp--preset--color--paper, #f6f5f0); --wl-ink: var(--wp--preset--color--ink, #151515); }
.motiv-wishlist--drawer .wishlist-overlay { z-index: 1000; background: rgba(21,21,21,.35); backdrop-filter: blur(3px); }
.motiv-wishlist--drawer .wishlist-panel { z-index: 1001; box-sizing: border-box; width: min(480px, 100vw); }
.motiv-wishlist--drawer .wishlist-drawer-head { flex-shrink: 0; min-height: 88px; box-sizing: border-box; padding: 1.25rem 1.75rem; }
.motiv-wishlist--drawer .wishlist-drawer-title { font-family: var(--wp--preset--font-family--display, inherit); font-size: 28px; font-weight: 500; letter-spacing: -.045em; gap: .75rem; }
.motiv-wishlist--drawer .wishlist-count { box-sizing: border-box; min-width: 26px; height: 26px; font-size: 11px; padding: 0 7px; }
.motiv-wishlist--drawer .wishlist-close { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--wl-ink); border: 1px solid var(--wl-border); border-radius: 50%; font-weight: 400; line-height: 1; }
.motiv-wishlist--drawer .wishlist-body { min-height: 0; padding: 0 1.75rem; overscroll-behavior: contain; }
.motiv-wishlist--drawer .wishlist-grid { display: block; }
.motiv-wishlist--drawer .wishlist-card { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 1.25rem; padding: 1.5rem 0; border-bottom: 1px solid var(--wl-border); }
.motiv-wishlist--drawer .wishlist-card:last-child { border-bottom: 0; }
.motiv-wishlist--drawer .wishlist-card-image { width: 104px; min-height: 0; aspect-ratio: 4/5; align-self: start; transform: none; box-shadow: none; }
.motiv-wishlist--drawer .wishlist-card-image .product-image.primary { opacity: 1; }
.motiv-wishlist--drawer .wishlist-card-image .product-image.secondary { display: none; }
.motiv-wishlist--drawer .wishlist-card-meta { padding: 0; gap: .5rem; justify-content: center; min-width: 0; }
.motiv-wishlist--drawer .wishlist-card-name { padding-inline-end: 1.5rem; font-size: 16px; font-weight: 500; line-height: 1.4; letter-spacing: -.025em; }
.motiv-wishlist--drawer .wishlist-card-price { font-size: 14px; line-height: 1.5; }
.motiv-wishlist--drawer .wishlist-remove { position: absolute; top: .25rem; inset-inline-end: .25rem; width: 28px; height: 28px; color: var(--wl-ink); background: var(--wl-paper); box-shadow: none; }
.motiv-wishlist--drawer .wishlist-remove .motiv-heart-icon { width: 16px; height: 16px; }
.motiv-wishlist--drawer .wishlist-card-add { align-self: flex-start; margin-top: .25rem; min-height: 38px; padding: .5rem .875rem; box-sizing: border-box; font-size: 10px; font-weight: 600; letter-spacing: .1em; transform: none; }
.motiv-wishlist--drawer .wishlist-foot { flex-shrink: 0; padding: 1.25rem 1.75rem; }
.motiv-wishlist--drawer .wishlist-empty { min-height: 320px; padding: 3rem 1rem; background: transparent; border: 0; }
.motiv-wishlist--drawer .wishlist-empty-icon { opacity: .65; }
.motiv-wishlist--drawer .wishlist-empty-text { font-size: 16px; line-height: 1.6; }
.wishlist-icon-button:focus-visible,
.motiv-wishlist--drawer a:focus-visible,
.motiv-wishlist--drawer button:focus-visible { outline: 2px solid var(--wp--preset--color--ink, #151515); outline-offset: 3px; }
@media (max-width: 480px) {
  .motiv-wishlist--drawer .wishlist-drawer-head { padding: 1rem 1.25rem; min-height: 76px; }
  .motiv-wishlist--drawer .wishlist-body { padding-inline: 1.25rem; }
  .motiv-wishlist--drawer .wishlist-foot { padding: 1rem 1.25rem; }
  .motiv-wishlist--drawer .wishlist-card { grid-template-columns: 88px minmax(0, 1fr); gap: 1rem; }
  .motiv-wishlist--drawer .wishlist-card-image { width: 88px; }
}

/* Keep the primary thumbnail visible while the pointer is over a drawer row. */
.motiv-wishlist--drawer .wishlist-card:hover .wishlist-card-image .product-image.primary { opacity: 1; }
.motiv-wishlist .wishlist-card .wishlist-remove {
  position: static; order: 3; align-self: flex-start;
  width: auto; height: auto; min-height: 32px; padding: .25rem 0;
  border: 0; border-radius: 0; background: transparent; box-shadow: none;
  color: var(--wl-ink); font: inherit; font-size: 12px; line-height: 1.5;
  text-decoration: underline; text-underline-offset: 3px; transform: none;
}
.motiv-wishlist .wishlist-card .wishlist-remove:hover { color: #686860; background: transparent; transform: none; }
.motiv-wishlist--drawer .wishlist-card-name { padding-inline-end: 0; }
/* Page cards only swap images when a secondary image actually exists. */
.motiv-wishlist--page .wishlist-card:not(:has(.product-image.secondary)):hover .product-image.primary { opacity: 1; }

/* Full wishlist page: quiet product grid, clear saved-item actions. */
.motiv-wishlist-page .motiv-wishlist--page .wishlist-head { margin: 0 0 28px; }
.motiv-wishlist-page .wishlist-title { font-size: 28px; font-weight: 400; letter-spacing: -.04em; }
.motiv-wishlist-page .wishlist-title .wishlist-count { align-self: center; min-width: 28px; height: 28px; padding: 0 8px; box-sizing: border-box; font-size: 11px; }
.motiv-wishlist-page .wishlist-card-image { transform: none; box-shadow: none; }
.motiv-wishlist-page .wishlist-card-meta { gap: 8px; padding-top: 18px; }
.motiv-wishlist-page .wishlist-card-name { font-size: 20px; font-weight: 400; line-height: 1.4; }
.motiv-wishlist-page .wishlist-card-price { font-size: 16px; line-height: 1.6; }
.motiv-wishlist-page .wishlist-card-add,.motiv-wishlist-page .wishlist-empty-cta { box-sizing: border-box; min-height: 48px; padding: 14px 20px; background: #151515; border: 1px solid #151515; color: #f6f5f0; font-size: 11px; line-height: 1.5; font-weight: 500; letter-spacing: .1em; text-decoration: none; transform: none; }
.motiv-wishlist-page .wishlist-card-add:hover,.motiv-wishlist-page .wishlist-empty-cta:hover { background: #d7ff3f; color: #151515; border-color: #d7ff3f; transform: none; }
.motiv-wishlist-page .wishlist-card .wishlist-remove { min-height: 40px; font-size: 14px; }
.motiv-wishlist-page .wishlist-foot { margin-top: 40px; padding: 24px 0 0; border-top: 1px solid var(--wl-border); justify-content: flex-end; }
.motiv-wishlist .wishlist-foot[hidden] { display: none; }
.motiv-wishlist-page .wishlist-empty { min-height: 320px; padding: 40px 24px; background: rgba(255,255,255,.3); border: 1px solid var(--wl-border); box-sizing: border-box; }
.motiv-wishlist-page .wishlist-empty-icon { opacity: .65; }
.motiv-wishlist-page .wishlist-empty-text { font-size: 20px; color: #151515; line-height: 1.5; }
.motiv-wishlist-page :is(a,button):focus-visible { outline: 2px solid #151515; outline-offset: 4px; }
@media(max-width:639px) {
  .motiv-wishlist-page .wishlist-grid { --wl-cols: 1; }
  .motiv-wishlist-page .wishlist-card-name { font-size: 22px; }
  .motiv-wishlist-page .wishlist-foot { flex-direction: column; }
  .motiv-wishlist-page .wishlist-foot .wishlist-btn { width: 100%; }
}

[dir="rtl"] .motiv-wishlist--drawer .wishlist-panel { transform: translateX(-102%); }
[dir="rtl"] .motiv-wishlist--drawer[data-drawer-pos="left"] .wishlist-panel { transform: translateX(102%); }
[dir="rtl"] .motiv-wishlist--drawer.is-open .wishlist-panel { transform: translateX(0); }
