/**
 * Wishlist & Recently Viewed — Styles
 *
 * Covers:
 *  1. Wishlist filter toggle button (toolbar)
 *  2. Wishlist empty state in the catalog grid
 *  3. Recently-viewed carousel on the catalog page
 *  4. Heart pop animation on toggle
 *  5. Settings page tab (wishlist-rv) — no extra CSS needed (uses WP defaults)
 *
 * All design tokens (colors, spacing, radius, type) come from
 * ljc-design-system.css — no ad-hoc values introduced here.
 *
 * @package LuxuryJewelryCatalog
 * @since   2.0.0
 */

/* =========================================================================
   1. Wishlist Filter Toggle Button
   ========================================================================= */

/**
 * Sits in the catalog toolbar row alongside the search bar and filter button.
 * Uses the same glass-pill visual language as the category nav chips.
 */
.ljc-wishlist-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--ljc-space-2);
  padding: 10px var(--ljc-space-4);
  min-height: 44px;               /* Apple HIG touch target */
  min-width: 44px;
  border-radius: var(--ljc-radius-full);
  border: 1px solid var(--ljc-hairline);
  background: rgba(255, 255, 255, 0.65);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  font-family: var(--ljc-font-body);
  font-size: var(--ljc-type-caption);
  font-weight: var(--ljc-weight-medium);
  color: var(--ljc-text-secondary);
  cursor: pointer;
  transition:
    background var(--ljc-transition-fast),
    border-color var(--ljc-transition-fast),
    color var(--ljc-transition-fast),
    box-shadow var(--ljc-transition-fast);
  white-space: nowrap;
  flex-shrink: 0;
}

.ljc-wishlist-toggle:hover {
  border-color: var(--ljc-accent-primary);
  color: var(--ljc-text-primary);
  box-shadow: 0 2px 12px rgba(58, 50, 44, 0.07);
}

/* Active state: user has toggled "show wishlist only" */
.ljc-wishlist-toggle.is-active {
  background: var(--ljc-accent-primary);
  border-color: var(--ljc-accent-primary);
  color: #fff;
  box-shadow: 0 4px 16px rgba(217, 185, 131, 0.3);
}

.ljc-wishlist-toggle.is-active:hover {
  background: var(--ljc-accent-secondary);
  border-color: var(--ljc-accent-secondary);
}

/* Heart icon inside the toggle */
.ljc-wishlist-toggle svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  transition: transform var(--ljc-transition-fast);
}

.ljc-wishlist-toggle:hover svg {
  transform: scale(1.12);
}

/* Count badge */
.ljc-wishlist-toggle__count {
  font-variant-numeric: tabular-nums;
}

/* =========================================================================
   2. Wishlist Empty State
   ========================================================================= */

/**
 * Shown inside the main catalog grid when the wishlist filter is active
 * but no items are wishlisted.
 */
.ljc-wishlist-empty {
  grid-column: 1 / -1;           /* Span all grid columns */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--ljc-space-10) var(--ljc-space-6);
  gap: var(--ljc-space-3);
}

.ljc-wishlist-empty__icon {
  width: 48px;
  height: 48px;
  color: var(--ljc-hairline);
  margin-bottom: var(--ljc-space-2);
}

.ljc-wishlist-empty__title {
  font-family: var(--ljc-font-display);
  font-size: var(--ljc-type-subheading);
  font-weight: var(--ljc-weight-regular);
  color: var(--ljc-text-primary);
}

.ljc-wishlist-empty__hint {
  font-family: var(--ljc-font-body);
  font-size: var(--ljc-type-body);
  color: var(--ljc-text-secondary);
  max-width: 320px;
}

/* =========================================================================
   3. Recently Viewed Carousel — Catalog Page
   ========================================================================= */

/**
 * Sits above the catalog grid, below the toolbar.
 * Hidden until at least 1 item is present (controlled by JS toggling
 * .ljc-rv-section--visible).
 */
.ljc-rv-section {
  display: none;                  /* JS adds .ljc-rv-section--visible */
  flex-direction: column;
  gap: var(--ljc-space-3);
  padding: var(--ljc-space-5) 0 var(--ljc-space-4);
  border-bottom: 1px solid var(--ljc-hairline);
  margin-bottom: var(--ljc-space-4);
}

.ljc-rv-section--visible {
  display: flex;
}

.ljc-rv-section__header {
  display: flex;
  align-items: center;
  gap: var(--ljc-space-3);
  padding: 0 var(--ljc-space-2);
}

.ljc-rv-section__title {
  font-family: var(--ljc-font-display);
  font-size: var(--ljc-type-subheading);
  font-weight: var(--ljc-weight-regular);
  color: var(--ljc-text-primary);
}

/* The horizontal scroll strip — mirrors .ljc-related__scroll in ljc-modal.css */
.ljc-rv-scroll {
  display: flex;
  gap: var(--ljc-space-3);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  /* Trailing padding so the last card doesn't abut the edge */
  padding: var(--ljc-space-1) var(--ljc-space-2) var(--ljc-space-2);
}

.ljc-rv-scroll::-webkit-scrollbar {
  display: none;
}

/* Cards inside the recently-viewed catalog strip are slightly larger
   than in the modal "You May Also Like" row */
.ljc-rv-scroll .ljc-card {
  flex: 0 0 160px;
  scroll-snap-align: start;
}

.ljc-rv-scroll .ljc-card__name {
  font-size: var(--ljc-type-caption);
  -webkit-line-clamp: 1;
}

/* Same lighter glass border as related cards in the modal */
.ljc-rv-scroll .ljc-card__image-wrap {
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: var(--ljc-radius-sm);
  background: rgba(255, 255, 255, 0.55);
  box-shadow: 0 2px 8px rgba(58, 50, 44, 0.07);
}

/* =========================================================================
   4. Heart Pop Animation on Wishlist Toggle
   ========================================================================= */

@keyframes ljc-heart-pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.35); }
  70%  { transform: scale(0.9); }
  100% { transform: scale(1); }
}

/**
 * Applied by JS for one animation cycle when the state changes.
 * Respects prefers-reduced-motion.
 */
.ljc-wishlist-btn.is-animating svg {
  animation: ljc-heart-pop 0.35s var(--ljc-ease-spring, cubic-bezier(0.34, 1.56, 0.64, 1)) forwards;
}

@media (prefers-reduced-motion: reduce) {
  .ljc-wishlist-btn.is-animating svg {
    animation: none;
  }
  .ljc-wishlist-toggle svg {
    transition: none;
  }
}

/* =========================================================================
   5. Responsive Overrides
   ========================================================================= */

/* On small phones, let the toggle label collapse to icon-only */
@media (max-width: 479px) {
  .ljc-wishlist-toggle__label {
    /* Keep label present for screen-readers but visually hidden at 320px */
    display: none;
  }

  .ljc-wishlist-toggle {
    padding: 10px 12px;
  }
}
