/* Модальное окно избранного */
.favorites-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.favorites-modal.active {
  opacity: 1;
  visibility: visible;
}

.favorites-modal__overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.favorites-modal__content {
  position: relative;
  background: #fff;
  border-radius: 16px;
  width: 90%;
  max-width: 700px;
  max-height: 80vh;
  padding: 30px;
  overflow-y: auto;
  transform: scale(0.9);
  transition: transform 0.3s ease;
  z-index: 1;
}

.favorites-modal.active .favorites-modal__content {
  transform: scale(1);
}

.favorites-modal__close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border: none;
  background: #f5f5f5;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 2;
}

.favorites-modal__close:hover {
  background-color: #e0e0e0;
  transform: rotate(90deg);
}

.favorites-modal__close .icon {
  width: 20px;
  height: 20px;
  fill: #333;
}

.favorites-modal__title {
  font-size: 24px;
  font-weight: 700;
  color: #333;
  margin-bottom: 24px;
  padding-right: 50px;
}

.favorites-modal__list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Состояние загрузки */
.favorites-modal__loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: #666;
}

.favorites-modal__loading .spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #333;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Пустое состояние */
.favorites-modal__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: #999;
}

.favorites-modal__empty .icon {
  width: 80px;
  height: 80px;
  fill: #ddd;
  margin-bottom: 16px;
}

.favorites-modal__empty p {
  font-size: 16px;
  text-align: center;
}

/* Карточка избранного товара */
.favorite-item {
  display: flex;
  gap: 16px;
  padding: 16px;
  background: #f9f9f9;
  border-radius: 12px;
  transition: all 0.3s ease;
  position: relative;
}

.favorite-item:hover {
  background-color: #f0f0f0;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.favorite-item__link {
  display: flex;
  gap: 16px;
  flex: 1;
  text-decoration: none;
  color: inherit;
}

.favorite-item__image {
  width: 100px;
  height: 100px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background-color: #fff;
}

.favorite-item__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.favorite-item__info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.favorite-item__name {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
  line-height: 1.4;
}

.favorite-item__sku {
  font-size: 13px;
  color: #666;
  margin-bottom: 8px;
}

.favorite-item__price {
  font-size: 18px;
  font-weight: 700;
  color: #e74c3c;
}

.favorite-item__remove {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border: none;
  background: #fff;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.favorite-item__remove:hover {
  background-color: #fee;
  transform: scale(1.1);
}

.favorite-item__remove .icon {
  width: 18px;
  height: 18px;
  fill: #e74c3c;
}

/* Кнопка избранного на карточке товара */
.product-favorite-btn {
  font-size: 24px;
  color: #999;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 0;
  border: none;
  background: transparent;
}

.product-favorite-btn.active {
  color: #e74c3c;
}

.product-item__favorites:hover,
.product-favorite-btn:hover {
  transform: scale(1.1);
}

/* Адаптив */
@media (max-width: 768px) {
  .favorites-modal__content {
    width: 95%;
    max-height: 90vh;
    padding: 20px;
  }

  .favorites-modal__title {
    font-size: 20px;
  }

  .favorite-item {
    flex-direction: column;
  }

  .favorite-item__image {
    width: 100%;
    height: 180px;
  }

  .favorite-item__remove {
    top: 12px;
    right: 12px;
  }
}
