@layer page {
/* Favorites / login dialogs — not needed until the user opens them. */

.favorites-modal {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: calc(var(--header-offset, 4rem) + 0.75rem) 1rem 1rem;
}

.favorites-modal[hidden] {
  display: none !important;
}

.favorites-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.favorites-modal__dialog {
  position: relative;
  width: min(100%, 28rem);
  max-height: min(80vh, 32rem);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 1rem 1.25rem 1.25rem;
  border-radius: 1rem;
  background: #fff;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
}

.favorites-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.favorites-modal__close {
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.06);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.favorites-modal__list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
}

.favorites-modal__item {
  display: grid;
  grid-template-columns: 4rem 1fr auto;
  gap: 0.75rem;
  align-items: start;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.favorites-modal__thumb-link {
  display: block;
  border-radius: 6px;
  overflow: hidden;
}

.favorites-modal__thumb {
  width: 4rem;
  height: 4rem;
  object-fit: cover;
  border-radius: 6px;
  background: var(--color-surface, #f3f4f6);
  display: block;
}

.favorites-modal__thumb--empty {
  display: block;
}

.favorites-modal__title {
  font-weight: 600;
  color: inherit;
  text-decoration: none;
}

.favorites-modal__title:hover {
  text-decoration: underline;
}

.favorites-modal__price {
  margin: 0.15rem 0 0.5rem;
  font-size: 0.9375rem;
  color: var(--color-text, #1d1d1f);
}

.favorites-modal__cart-btn {
  width: 100%;
  max-width: 9rem;
  min-height: 2.25rem;
  margin-top: 0.35rem;
}

.favorites-modal__remove {
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--color-text-muted, #6b7280);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.favorites-modal__remove:hover,
.favorites-modal__remove:focus-visible {
  color: #e11d48;
  background: rgba(225, 29, 72, 0.08);
}

.favorites-modal__empty {
  margin: 0.5rem 0 1rem;
  color: #6b7280;
}

.favorites-modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.favorites-login-dialog {
  border: none;
  border-radius: 1rem;
  padding: 1.25rem;
  max-width: 22rem;
}

.favorites-login-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.catalog-product__action.is-active .catalog-product__heart,
.catalog-card__fav.is-active,
[data-product-favorite].is-active {
  color: #e11d48;
}

@media (max-width: 768px) {
  .favorites-modal {
    padding-top: calc(var(--header-offset, 3.5rem) + 0.5rem);
    align-items: stretch;
  }

  .favorites-modal__dialog {
    max-height: none;
    height: auto;
    flex: 1;
  }
}
}
