/* /CSS/favorites.css
 * Stage 3 — heart-icon button on product cards.
 * Positioned top-right of the product image (top-left holds .product-badge).
 */

.product-img-wrap {
  position: relative;
}

.fav-heart {
  /* Position: top-right corner of the image, mirror of .product-badge */
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;

  /* Circular pill, white background, soft shadow */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  cursor: pointer;

  /* Outline-heart color (default, not yet favorited) */
  color: #2D6A27;

  /* Smooth state transitions */
  transition: transform 0.15s ease, background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.fav-heart:hover {
  transform: scale(1.06);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
}

.fav-heart:active {
  transform: scale(0.96);
}

.fav-heart:focus-visible {
  outline: 2px solid #5DB852;
  outline-offset: 2px;
}

/* Favorited state: filled red heart on white pill. Red is the conventional,
   universally-understood "this is saved/loved" cue. */
.fav-heart.is-fav {
  color: #E33B3B;
}
.fav-heart.is-fav svg path {
  fill: currentColor;
  stroke: currentColor;
}

/* Busy state during an in-flight POST/DELETE. Subtly dim to signal "wait",
   but keep the optimistic color so the user perceives the action as immediate. */
.fav-heart.is-busy {
  pointer-events: none;
  opacity: 0.7;
}

/* SVG stroke uses currentColor so color: changes drive both outline and fill. */
.fav-heart svg {
  display: block;
}

/* ====================================================================
 * Favorites filter button (homepage .cat-filters row)
 * ==================================================================== */

/* When the "❤️ Mis Favoritos" button is active, give it a distinctly different
   visual treatment than the default category buttons — red-tinted border + bg
   so users instantly see "I'm filtering by favorites" vs. "I'm in Toys". */
.cat-btn.fav-filter-btn.active {
  background: #E33B3B;
  border-color: #E33B3B;
  color: #fff;
}

.cat-btn.fav-filter-btn:hover:not(.active) {
  border-color: #E33B3B;
  color: #E33B3B;
}

/* ====================================================================
 * Session B — My Favorites page
 * ==================================================================== */

/* View switching: when body.view-favorites is set, hide every section in the
   main content area EXCEPT #favoritesView. This keeps a single index.html. */
body.view-favorites #mainContent > section:not(#favoritesView),
body.view-favorites #productCount,
body.view-favorites #pagination,
body.view-favorites #filterBar {
  display: none !important;
}
body.view-favorites #favoritesView {
  display: block;
}

#favoritesView {
  padding: 60px 24px 80px;
  min-height: 50vh;
}

.fav-page-inner {
  max-width: 1180px;
  margin: 0 auto;
}

.fav-page-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 2.75rem);
  color: #1A4418;
  margin: 0 0 32px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* Empty + signed-out states share the same visual treatment. */
.fav-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 80px 24px;
  background: #F7FAF6;
  border-radius: 24px;
  border: 1px solid #E2EDDF;
}

.fav-state-icon {
  color: #5DB852;
  margin-bottom: 20px;
  opacity: 0.7;
}

.fav-state-text {
  font-size: 1.05rem;
  color: #3A4A38;
  max-width: 440px;
  line-height: 1.5;
  margin: 0 0 24px;
}

/* The grid reuses .products-grid from main.css so cards look identical to the
   homepage; only the favorites-page-specific wrapper styles live here. */
#favoritesGrid {
  /* Inherits .products-grid layout. Just ensure it's spaced from the title. */
  margin-top: 8px;
}

/* Smooth removal animation when a heart is un-clicked on the favorites page.
   .removing is set by favorites.js while the DELETE is in flight + briefly
   after, then the card is removed from the DOM. */
.product-card.removing {
  transition: opacity 0.22s ease, transform 0.22s ease;
  opacity: 0;
  transform: scale(0.94);
  pointer-events: none;
}

/* Smaller viewport polish. */
@media (max-width: 640px) {
  #favoritesView {
    padding: 32px 16px 60px;
  }
  .fav-state {
    padding: 56px 20px;
    border-radius: 18px;
  }
}
