/* ── Wishlist button ───────────────────────────────────────────────────── */

.wl-btn {
  position: absolute;
  top:    var(--wl-btn-top,    10px);
  bottom: var(--wl-btn-bottom, auto);
  left:   var(--wl-btn-left,   auto);
  right:  var(--wl-btn-right,  10px);
  z-index: 10;

  display: flex;
  align-items: center;
  justify-content: center;

  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(0, 0, 0, 0.15);
  background: var(--wl-product-card-button-color);
  backdrop-filter: blur(4px);
  cursor: pointer;

  color: var(--wl-product-card-button-text-color);
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}

/* Filled button style */
.wl-btn--filled {
  background: var(--wl-product-card-button-text-color);
  color: var(--wl-product-card-button-color);
}

.wl-btn--filled:hover {
  background: var(--wl-button-hover-color);
  color: var(--wl-button-text-color);
}

.wl-btn--filled.wl-btn--active {
  background: var(--wl-product-card-button-active-text-color);
  color: var(--wl-product-card-button-active-color);
  border-color: var(--wl-product-card-button-active-text-color);
}

.wl-btn svg {
  width: 18px;
  height: 18px;
  pointer-events: none;
  display: block;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Hover */
.wl-btn:hover {
  transform: scale(1.1);
  background: #fff;
}

/* Active / in wishlist */
.wl-btn--active {
  color: var(--wl-product-card-button-active-text-color);
  border-color: var(--wl-product-card-button-active-text-color);
  background: var(--wl-product-card-button-active-color);
}

/* Loading state */
.wl-btn--loading {
  opacity: 0.5;
  pointer-events: none;
}

/* Focus ring for keyboard users */
.wl-btn:focus-visible {
  outline: 2px solid #4a90e2;
  outline-offset: 2px;
}

/* ── Nav trigger button ────────────────────────────────────────────────── */

.wl-trigger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9998;

  display: flex;
  align-items: center;
  justify-content: center;

  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: var(--wl-floating-button-color);
  color: var(--wl-floating-button-text-color);
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  transition: transform 0.15s ease, background 0.15s ease;
}

.wl-trigger:hover { transform: scale(1.08); background: var(--wl-floating-button-hover-color); }
.wl-trigger:focus-visible { outline: 2px solid #4a90e2; outline-offset: 2px; }

.wl-trigger svg {
  width: 22px;
  height: 22px;
  pointer-events: none;
}

/* ── Root CSS variables ────────────────────────────────────────────────────── */

:root {
  --wl-button-color: #111;
  --wl-button-hover-color: #333;
  --wl-button-text-color: #fff;
  --wl-drawer-button-color: #111;
  --wl-drawer-button-text-color: #fff;
  --wl-drawer-toolbar-color: #f9fafb;
  --wl-drawer-toolbar-text-color: #111;
  --wl-floating-button-color: #111;
  --wl-floating-button-text-color: #fff;
  --wl-floating-button-hover-color: #222;
  --wl-product-card-button-color: rgba(255, 255, 255, 0.92);
  --wl-product-card-button-text-color: #111;
  --wl-product-card-button-active-color: #fff0f0;
  --wl-product-card-button-active-text-color: #e53e3e;
  --wl-accent-color: #e53e3e;
    /* Button position defaults (top-right, 10px) */
  --wl-btn-top:    10px;
  --wl-btn-bottom: auto;
  --wl-btn-left:   auto;
  --wl-btn-right:  10px;
}

/* ── Count badge ───────────────────────────────────────────────────────── */

.wl-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: #e53e3e;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
  display: none;
  pointer-events: none;
}

.wl-count--visible { display: block; }

/* ── Scroll lock ───────────────────────────────────────────────────────── */

.wl-scroll-lock { overflow: hidden; }

/* ── Overlay ───────────────────────────────────────────────────────────── */

#wl-popup { display: contents; }

.wl-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(0,0,0,0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.wl-popup--open .wl-overlay {
  opacity: 1;
  pointer-events: all;
}

/* ── Drawer ────────────────────────────────────────────────────────────── */

.wl-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  width: min(420px, 100vw);
  background: #fff;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -4px 0 24px rgba(0,0,0,0.12);
}

.wl-popup--open .wl-drawer { transform: translateX(0); }

/* ── Drawer header ─────────────────────────────────────────────────────── */

.wl-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.wl-drawer-title {
  font-size: 16px;
  font-weight: 600;
  color: #111;
  margin: 0;
}

.wl-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #6b7280;
  padding: 4px;
  border-radius: 4px;
  line-height: 1;
}

.wl-close:hover { color: #111; }

/* ── Drawer body ───────────────────────────────────────────────────────── */

.wl-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

/* ── Item cards ────────────────────────────────────────────────────────── */

.wl-grid { display: flex; flex-direction: column; gap: 12px; }

.wl-card {
  display: flex;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #fff;
}

.wl-card-img {
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  border-radius: 6px;
  overflow: hidden;
  background: #f3f4f6;
  display: block;
}

.wl-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.wl-img-placeholder { width: 100%; height: 100%; background: #e5e7eb; }

.wl-card-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.wl-card-title {
  font-size: 13px;
  font-weight: 500;
  color: #111;
  text-decoration: none;
  line-height: 1.4;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.wl-card-title:hover { text-decoration: underline; }

.wl-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.wl-stock {
  font-size: 10px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 4px;
}

.wl-stock--in  { background: #dcfce7; color: #166534; }
.wl-stock--out { background: #fee2e2; color: #991b1b; }

.wl-card-price { display: flex; align-items: center; gap: 6px; }
.wl-price      { font-size: 13px; font-weight: 600; color: #111; }
.wl-compare    { font-size: 12px; color: #9ca3af; }

/* ── Card actions ──────────────────────────────────────────────────────── */

.wl-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 6px;
}

.wl-action-atc {
  flex: 1;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
  border: none;
  background: var(--wl-drawer-button-color);
  color: var(--wl-drawer-button-text-color);
  cursor: pointer;
  transition: background 0.15s;
}

.wl-action-atc:hover    { background: var(--wl-button-hover-color); }
.wl-action-atc:disabled { opacity: 0.6; cursor: not-allowed; }

.wl-action-remove {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  background: none;
  color: #9ca3af;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s;
}

.wl-action-remove:hover { color: #e53e3e; border-color: #e53e3e; }

/* ── Empty state ───────────────────────────────────────────────────────── */

.wl-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 20px;
  color: #9ca3af;
  text-align: center;
}

.wl-empty p  { font-size: 14px; }

.wl-empty-cta {
  display: inline-block;
  padding: 8px 20px;
  border-radius: 8px;
  background: var(--wl-button-color);
  color: var(--wl-button-text-color);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s;
}

.wl-empty-cta:hover { background: var(--wl-button-hover-color); }

/* ── Toolbar ───────────────────────────────────────────────────────────── */

.wl-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.wl-select {
  flex: 1;
  min-width: 0;
  padding: 5px 8px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  background: var(--wl-drawer-toolbar-color);
  color: var(--wl-drawer-toolbar-text-color);
  cursor: pointer;
  outline: none;
}

.wl-select:focus { border-color: #111; }

/* ── Layout toggle buttons ─────────────────────────────────────────────── */

.wl-layout-btns {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.wl-layout-btn {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  background: var(--wl-drawer-toolbar-color);
  color: #6b7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.wl-layout-btn:hover { background: #f3f4f6; color: #111; }

.wl-layout-btn--active {
  background: var(--wl-drawer-button-color);
  color: var(--wl-drawer-button-text-color);
  border-color: var(--wl-drawer-button-color);
}

/* ── Grid layout (default) ─────────────────────────────────────────────── */

.wl-grid--grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.wl-grid--grid .wl-card {
  flex-direction: column;
  padding: 10px;
}

.wl-grid--grid .wl-card-img {
  width: 100%;
  height: 140px;
  margin-bottom: 8px;
}

/* ── List layout ───────────────────────────────────────────────────────── */

.wl-grid--list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wl-grid--list .wl-card {
  flex-direction: row;
}

.wl-grid--list .wl-card-img {
  width: 80px;
  height: 80px;
  flex-shrink: 0;
}

/* ── Toast Notifications ─────────────────────────────────────────────────── */

.wl-toast-container {
  position: fixed;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
  max-width: 400px;
}

/* Position variants */
.wl-toast-container--top-right {
  top: 20px;
  right: 20px;
  align-items: flex-end;
}

.wl-toast-container--top-left {
  top: 20px;
  left: 20px;
  align-items: flex-start;
}

.wl-toast-container--top-center {
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  align-items: center;
}

.wl-toast-container--bottom-right {
  bottom: 80px;
  right: 20px;
  align-items: flex-end;
}

.wl-toast-container--bottom-left {
  bottom: 80px;
  left: 20px;
  align-items: flex-start;
}

.wl-toast-container--bottom-center {
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  align-items: center;
}

.wl-toast {
  pointer-events: all;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1);
  min-width: 280px;
  max-width: 400px;
  animation: wl-toast-slide-in 0.3s ease-out;
  border-left: 4px solid;
  will-change: transform, opacity;
}

.wl-toast--success {
  border-left-color: #10b981;
}

.wl-toast--info {
  border-left-color: #3b82f6;
}

.wl-toast--error {
  border-left-color: #ef4444;
}

.wl-toast--warning {
  border-left-color: #f59e0b;
}

.wl-toast-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wl-toast-icon svg {
  width: 20px;
  height: 20px;
}

.wl-toast--success .wl-toast-icon {
  color: #10b981;
}

.wl-toast--info .wl-toast-icon {
  color: #3b82f6;
}

.wl-toast--error .wl-toast-icon {
  color: #ef4444;
}

.wl-toast--warning .wl-toast-icon {
  color: #f59e0b;
}

.wl-toast-message {
  flex: 1;
  font-size: 14px;
  line-height: 1.5;
  color: #111827;
  font-weight: 500;
}

.wl-toast-close {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: #6b7280;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.15s ease, color 0.15s ease;
  font-size: 16px;
  padding: 0;
}

.wl-toast-close:hover {
  background: #f3f4f6;
  color: #111827;
}

.wl-toast-close:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Exit animation */
.wl-toast--hiding {
  animation: wl-toast-slide-out 0.3s ease-in forwards;
  pointer-events: none;
}

/* Collapsing state - smoothly reduce space */
.wl-toast--collapsing {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin-top: 0;
  margin-bottom: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease, margin 0.3s ease;
  pointer-events: none;
}

/* Animations */
@keyframes wl-toast-slide-in {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes wl-toast-slide-out {
  from {
    opacity: 1;
    transform: translateY(0);
    max-height: 200px;
  }
  to {
    opacity: 0;
    transform: translateY(-20px);
    max-height: 0;
  }
}

/* Mobile responsive */
@media (max-width: 640px) {
  .wl-toast-container {
    left: 16px !important;
    right: 16px !important;
    max-width: none;
    transform: none !important;
  }

  .wl-toast-container--top-right,
  .wl-toast-container--top-left,
  .wl-toast-container--bottom-right,
  .wl-toast-container--bottom-left {
    align-items: stretch;
  }

  .wl-toast {
    min-width: auto;
    max-width: none;
  }
}