/* ==========================================================================
   TCB Wishlist – Frontend Styles
   ========================================================================== */

/* ---- Heart button (product page + shop loop) ---- */
.tcb-wishlist-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.875rem;
  border: 1px solid #d1d5db;
  border-radius: 0.625rem;
  background: #fff;
  color: #6b7280;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  position: relative;
}
.tcb-wishlist-btn:hover {
  border-color: #ec4899;
  color: #ec4899;
  background: #fdf2f8;
}
.tcb-wishlist-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.25);
}

/* Icons */
.tcb-wishlist-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  transition: transform 0.25s ease;
}
.tcb-wishlist-btn:hover .tcb-wishlist-icon { transform: scale(1.15); }
.tcb-wishlist-icon--solid   { display: none; }
.tcb-wishlist-icon--outline { display: block; }

/* Labels */
.tcb-wishlist-label--saved { display: none; }
.tcb-wishlist-label--save  { display: inline; }

/* ---- Active (saved) state ---- */
.tcb-wishlist-btn--active {
  border-color: #ec4899;
  color: #ec4899;
  background: #fdf2f8;
}
.tcb-wishlist-btn--active .tcb-wishlist-icon--outline { display: none; }
.tcb-wishlist-btn--active .tcb-wishlist-icon--solid   { display: block; }
.tcb-wishlist-btn--active .tcb-wishlist-label--save   { display: none; }
.tcb-wishlist-btn--active .tcb-wishlist-label--saved  { display: inline; }

/* Pop animation */
@keyframes tcb-heart-pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.35); }
  100% { transform: scale(1); }
}
.tcb-wishlist-btn--active .tcb-wishlist-icon--solid {
  animation: tcb-heart-pop 0.35s ease;
}

/* Loading spinner */
.tcb-wishlist-btn--loading {
  pointer-events: none;
  opacity: 0.6;
}

/* ---- Shop loop overlay variant ---- */
.tcb-wishlist-btn--loop {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 5;
  padding: 0.375rem;
  border-radius: 9999px;
  border: none;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(4px);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.tcb-wishlist-btn--loop .tcb-wishlist-label--save,
.tcb-wishlist-btn--loop .tcb-wishlist-label--saved {
  display: none !important; /* Icon-only on cards */
}
.tcb-wishlist-btn--loop .tcb-wishlist-icon {
  width: 20px;
  height: 20px;
}
.tcb-wishlist-btn--loop:hover {
  background: #fff;
}

/* ---- Single product variant ---- */
.tcb-wishlist-btn--single {
  margin-top: 0.5rem;
}

/* ---- Dark mode ---- */
.dark .tcb-wishlist-btn {
  background: #1f2937;
  border-color: #374151;
  color: #9ca3af;
}
.dark .tcb-wishlist-btn:hover {
  border-color: #f472b6;
  color: #f472b6;
  background: rgba(236,72,153,0.1);
}
.dark .tcb-wishlist-btn--active {
  border-color: #f472b6;
  color: #f472b6;
  background: rgba(236,72,153,0.1);
}
.dark .tcb-wishlist-btn--loop {
  background: rgba(17,24,39,0.85);
}
.dark .tcb-wishlist-btn--loop:hover {
  background: #1f2937;
}

/* ---- Cart "Save for Later" active state ---- */
.tcb-cart-action--save.tcb-wishlist-btn--active {
  color: #ec4899 !important;
}
.dark .tcb-cart-action--save.tcb-wishlist-btn--active {
  color: #f472b6 !important;
}

/* ---- Toast notification ---- */
.tcb-wishlist-toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(1rem);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: 0.75rem;
  background: #111827;
  color: #f9fafb;
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  z-index: 99999;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  max-width: calc(100vw - 2rem);
}
.tcb-wishlist-toast svg {
  flex: 0 0 auto;
  color: #ec4899;
}
.tcb-wishlist-toast--error svg {
  color: #f87171;
}
.tcb-wishlist-toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.dark .tcb-wishlist-toast {
  background: #f9fafb;
  color: #111827;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

/* ---- My Account: Saved Products grid ---- */
.tcb-saved-products-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 1.25rem;
}
@media (min-width: 640px) {
  .tcb-saved-products-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .tcb-saved-products-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.tcb-saved-card {
  display: flex;
  flex-direction: column;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  overflow: hidden;
  background: #fff;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.tcb-saved-card:hover {
  border-color: #d1d5db;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}
.dark .tcb-saved-card {
  background: #111827;
  border-color: #1f2937;
}
.dark .tcb-saved-card:hover {
  border-color: #374151;
  box-shadow: 0 4px 12px rgba(0,0,0,0.35);
}

.tcb-saved-card__img {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #f3f4f6;
}
.dark .tcb-saved-card__img {
  background: #0b1220;
}
.tcb-saved-card__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tcb-saved-card__body {
  padding: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.tcb-saved-card__title {
  font-size: 1rem;
  font-weight: 700;
  color: #111827;
  line-height: 1.3;
}
.tcb-saved-card__title a {
  color: inherit;
  text-decoration: none;
}
.tcb-saved-card__title a:hover {
  color: #8D5BC1;
}
.dark .tcb-saved-card__title { color: #f9fafb; }
.dark .tcb-saved-card__title a:hover { color: #a78bfa; }

.tcb-saved-card__price {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #374151;
}
.dark .tcb-saved-card__price { color: #d1d5db; }

.tcb-saved-card__sale-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  background: #fef2f2;
  color: #dc2626;
  font-size: 0.75rem;
  font-weight: 700;
}
.dark .tcb-saved-card__sale-badge {
  background: rgba(239,68,68,0.15);
  color: #f87171;
}

.tcb-saved-card__meta {
  font-size: 0.8125rem;
  color: #9ca3af;
}

.tcb-saved-card__actions {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.5rem;
}
.tcb-saved-card__actions .button,
.tcb-saved-card__actions a {
  font-size: 0.8125rem;
}

/* Product card secondary action (Remove from Cart/Remove) */
.tcb-saved-card__actions .tcb-btn--secondary {
  border-color: #8D5BC1 !important;
  color: #8D5BC1 !important;
  background: transparent !important;
}
.tcb-saved-card__actions .tcb-btn--secondary:hover,
.tcb-saved-card__actions .tcb-btn--secondary:focus {
  border-color: var(--tcb-brand) !important;
  color: var(--tcb-brand) !important;
  background: transparent !important;
}
.tcb-saved-card__actions .tcb-btn--secondary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(141, 91, 193, 0.22);
}
.dark .tcb-saved-card__actions .tcb-btn--secondary {
  border-color: #a78bfa !important;
  color: #c4b5fd !important;
  background: transparent !important;
}
.dark .tcb-saved-card__actions .tcb-btn--secondary:hover,
.dark .tcb-saved-card__actions .tcb-btn--secondary:focus {
  border-color: #c4b5fd !important;
  color: #ddd6fe !important;
  background: transparent !important;
}

/* Shop/product-card remove-from-cart state should use secondary styling */
a.button.add_to_cart_button.added,
a.button.added_to_cart,
a.button.tcb-btn--remove-from-cart,
button.tcb-btn--remove-from-cart,
a.button[aria-label*="remove from cart" i],
a.button[title*="remove from cart" i],
button[aria-label*="remove from cart" i],
button[title*="remove from cart" i] {
  border: 1px solid #8D5BC1 !important;
  color: #8D5BC1 !important;
  background: transparent !important;
}

a.button.add_to_cart_button.added:hover,
a.button.added_to_cart:hover,
a.button.tcb-btn--remove-from-cart:hover,
button.tcb-btn--remove-from-cart:hover,
a.button[aria-label*="remove from cart" i]:hover,
a.button[title*="remove from cart" i]:hover,
button[aria-label*="remove from cart" i]:hover,
button[title*="remove from cart" i]:hover,
a.button.add_to_cart_button.added:focus,
a.button.added_to_cart:focus,
a.button.tcb-btn--remove-from-cart:focus,
button.tcb-btn--remove-from-cart:focus,
a.button[aria-label*="remove from cart" i]:focus,
a.button[title*="remove from cart" i]:focus,
button[aria-label*="remove from cart" i]:focus,
button[title*="remove from cart" i]:focus {
  border-color: var(--tcb-brand) !important;
  color: var(--tcb-brand) !important;
  background: transparent !important;
}

/* Loop card CTA states injected by wishlist frontend filter */
.woocommerce ul.products li.product a.button.tcb-loop-card-cta--secondary,
.woocommerce-page ul.products li.product a.button.tcb-loop-card-cta--secondary {
  background: transparent !important;
  border: 1px solid #8D5BC1 !important;
  color: #8D5BC1 !important;
}
.woocommerce ul.products li.product a.button.tcb-loop-card-cta--secondary:hover,
.woocommerce-page ul.products li.product a.button.tcb-loop-card-cta--secondary:hover,
.woocommerce ul.products li.product a.button.tcb-loop-card-cta--secondary:focus,
.woocommerce-page ul.products li.product a.button.tcb-loop-card-cta--secondary:focus {
  background: transparent !important;
  border-color: var(--tcb-brand) !important;
  color: var(--tcb-brand) !important;
}
.woocommerce ul.products li.product a.button.tcb-loop-card-cta--secondary:focus-visible,
.woocommerce-page ul.products li.product a.button.tcb-loop-card-cta--secondary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(141, 91, 193, 0.22) !important;
}

/* Loop card Add-to-Cart variant (brand yellow) */
.woocommerce ul.products li.product a.button.tcb-loop-card-cta--add,
.woocommerce ul.products li.product button.button.tcb-loop-card-cta--add,
.woocommerce-page ul.products li.product a.button.tcb-loop-card-cta--add,
.woocommerce-page ul.products li.product button.button.tcb-loop-card-cta--add {
  background: #facc15 !important;
  border: 1px solid #facc15 !important;
  color: #1f2937 !important;
}
.woocommerce ul.products li.product a.button.tcb-loop-card-cta--add:hover,
.woocommerce ul.products li.product button.button.tcb-loop-card-cta--add:hover,
.woocommerce-page ul.products li.product a.button.tcb-loop-card-cta--add:hover,
.woocommerce-page ul.products li.product button.button.tcb-loop-card-cta--add:hover,
.woocommerce ul.products li.product a.button.tcb-loop-card-cta--add:focus,
.woocommerce ul.products li.product button.button.tcb-loop-card-cta--add:focus,
.woocommerce-page ul.products li.product a.button.tcb-loop-card-cta--add:focus,
.woocommerce-page ul.products li.product button.button.tcb-loop-card-cta--add:focus {
  background: #eab308 !important;
  border-color: #eab308 !important;
  color: #111827 !important;
}
.woocommerce ul.products li.product a.button.tcb-loop-card-cta--add:focus-visible,
.woocommerce ul.products li.product button.button.tcb-loop-card-cta--add:focus-visible,
.woocommerce-page ul.products li.product a.button.tcb-loop-card-cta--add:focus-visible,
.woocommerce-page ul.products li.product button.button.tcb-loop-card-cta--add:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.32) !important;
}
