@import url('https://fonts.googleapis.com/css2?family=Ubuntu:wght@300;400;500;700&display=swap');

.favorite-page {
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
  font-family: 'Ubuntu', Arial, sans-serif;
}

.favorite-title {
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 20px;
  color: #4F6BB0;
  padding-bottom: 40px;
  border-bottom: 2px solid #7594E1;
  font-family: 'Ubuntu', Arial, sans-serif;
}

.favorite-products {
  display: flex;
  flex-direction: column;
}

.favorite-product-item {
  display: flex;
  justify-content: space-between;
  padding: 15px;
  background: #fff;
  position: relative;
  border-bottom: 2px solid #7594E1;
  font-family: 'Ubuntu', Arial, sans-serif;
  animation: fadeIn 0.3s ease;
}

.product-main {
  display: flex;
  gap: 15px;
  flex: 1;
}

.product-image {
  width: 80px;
  height: 80px;
  flex-shrink: 0;
  border-radius: 4px;
  overflow: hidden;
}

.product-image__img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f5;
  color: #999;
  font-size: 10px;
  font-family: 'Ubuntu', Arial, sans-serif;
}

.product-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: center;
}

.product-name {
  margin: 0;
  font-size: 16px;
  font-weight: bold;
  color: #4F6BB0;
  font-family: 'Ubuntu', Arial, sans-serif;
}

.product-name a {
  color: #7594E1;
  text-decoration: none;
  font-family: 'Ubuntu', Arial, sans-serif;
}

.product-name a:hover {
  color: #1e88e5;
  text-decoration: underline;
}

.product-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.product-detail-item {
  display: flex;
  gap: 5px;
  font-size: 13px;
  color: #7594E1;
  font-family: 'Ubuntu', Arial, sans-serif;
}

.detail-label {
  font-weight: 500;
  color: #4F6BB0;
}

.detail-value {
  color: #666;
}

.product-side {
  display: flex;
  align-items: center;
  gap: 20px;
}

/* Стили для строки цена-количество-сумма */
.price-quantity-row {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 10px;
  justify-content: flex-end;
}

.price-quantity-row .price-value {
  font-size: 15px;
  font-weight: bold;
  color: #7594E1;
  min-width: 120px;
  text-align: right;
}

.price-quantity-row .quantity-controls {
  display: flex;
  align-items: center;
  gap: 5px;
}

.price-quantity-row .price-total {
  font-size: 15px;
  font-weight: bold;
  color: #7594E1;
  min-width: 120px;
  text-align: left;
}

.quantity-btn {
  width: 28px;
  height: 28px;
  border: 1px solid #4470C6;
  background: #4470C6;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  font-family: 'Ubuntu', Arial, sans-serif;
}

.quantity-btn:hover {
  background: #3a5da8;
  border-color: #3a5da8;
}

.quantity-input {
  width: 40px;
  height: 28px;
  text-align: center;
  border: 1px solid #ddd;
  border-radius: 3px;
  font-size: 13px;
  font-family: 'Ubuntu', Arial, sans-serif;
}

.product-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

/* Стили для строки сравнения, корзины и удаления */
.compare-cart-row {
  display: flex;
  align-items: center;
  gap: 15px;
  justify-content: space-between;
  width: 100%;
}

.compare-cart-row .add-to-compare-btn {
  order: 1;
}

.compare-cart-row .add-to-cart-btn {
  order: 2;
  margin: 0;
  flex: 1;
  max-width: 140px;
}

.compare-cart-row .remove-from-fav {
  order: 3;
  margin: 0;
  width: 30px;
  height: 30px;
  background: #4F6BB0;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
  font-family: 'Ubuntu', Arial, sans-serif;
}

.compare-cart-row .remove-from-fav:hover {
  background: #3a5da8;
}

/* Стили для кнопки сравнения */
.add-to-compare-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  border-radius: 4px;
}

.add-to-compare-btn:hover {
  background: rgba(0, 0, 238, 0.1);
}

.add-to-compare-btn.compare-active {
  color: #0000EE !important;
}

.add-to-compare-btn.compare-active svg {
  filter: brightness(0) saturate(100%) invert(25%) sepia(100%) saturate(2000%) hue-rotate(220deg) brightness(90%) contrast(90%) !important;
}

/* Ховер эффект для сравнения */
.add-to-compare-btn:hover svg {
  filter: brightness(0) saturate(100%) invert(25%) sepia(100%) saturate(2000%) hue-rotate(220deg) brightness(90%) contrast(90%) !important;
}

.add-to-compare-btn:hover {
  color: #0000EE !important;
}

/* Плавные переходы для SVG */
.add-to-compare-btn svg {
  transition: filter 0.2s ease;
}

.compare_product {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.compare_product__img {
  width: 20px;
  height: 20px;
}

.add-to-cart-btn {
  background: #4470C6;
  border: none;
  padding: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  border-radius: 4px;
  position: relative;
  min-width: 120px;
  height: 44px;
  gap: 8px;
}

.add-to-cart-btn:hover {
  background: #3a5da8;
  transform: translateY(-2px);
}

.add-to-cart-btn.in-cart {
  background: #4CAF50;
}

.add-to-cart-btn.in-cart:hover {
  background: #43A047;
}

.add-to-cart-btn .btn-text {
  color: white;
  font-weight: 500;
  font-size: 14px;
}

.add-to-cart-btn .btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.add-to-cart-btn img {
  filter: brightness(0) invert(1);
  height: 20px;
  width: auto;
}

.add-to-cart-btn.in-cart .btn-text {
  display: none;
}

.add-to-cart-btn.in-cart .btn-icon img {
  display: none;
}

.add-to-cart-btn .btn-icon::before {
  content: '';
  display: none;
  width: 20px;
  height: 20px;
  background: url('/include/img/1_h.png') center/contain no-repeat;
  filter: brightness(0) invert(1);
}

.add-to-cart-btn.in-cart .btn-icon::before {
  display: block;
  animation: checkmark 0.3s ease;
}

.product-status {
  display: none;
  font-size: 12px;
  color: #4CAF50;
  font-weight: 500;
  margin-top: 5px;
  font-family: 'Ubuntu', Arial, sans-serif;
}

.remove-from-fav {
  background: #4F6BB0;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: #FFFFFF;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
  font-family: 'Ubuntu', Arial, sans-serif;
}

.remove-from-fav:hover {
  background: #3a5da8;
}

.favorite-empty {
  text-align: center;
  padding: 50px 20px;
  background: #fff;
  border-radius: 4px;
  border: 1px solid #e0e0e0;
  margin: 20px 0;
  font-family: 'Ubuntu', Arial, sans-serif;
}

.empty-icon {
  font-size: 60px;
  color: #e0e0e0;
  margin-bottom: 15px;
}

.favorite-empty h2 {
  margin: 0 0 10px;
  color: #333;
  font-size: 20px;
  font-family: 'Ubuntu', Arial, sans-serif;
}

.favorite-empty p {
  margin: 0 0 20px;
  color: #666;
  font-size: 15px;
  font-family: 'Ubuntu', Arial, sans-serif;
}

.btn-primary {
  display: inline-block;
  padding: 10px 20px;
  background: #2196F3;
  color: white;
  text-decoration: none;
  border-radius: 4px;
  font-weight: 500;
  font-family: 'Ubuntu', Arial, sans-serif;
}

.btn-primary:hover {
  background: #1E88E5;
}

.overall-total-price {
  font-size: 18px;
  font-weight: bold;
  color: #4F6BB0;
  margin-top: 20px;
  text-align: right;
  padding: 10px;
  background: #f8f9fa;
  border-radius: 4px;
}

/* Стили для индикаторов загрузки */
.compare-loading, .cart-loading, .remove-loading {
  width: 20px;
  height: 20px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

/* Стили для активного состояния корзины */
.add-to-cart-btn.in-cart {
  background-color: #4CAF50 !important;
  border-color: #4CAF50 !important;
}

.add-to-cart-btn.in-cart .btn-text::before {
  content: "✓ ";
}

/* Анимации */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes checkmark {
  0% { transform: scale(0); opacity: 0; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* Стили для сравнения в избранном */
.favorite-page .add-to-compare-btn.compare-active svg.compare_product__img,
.favorite-page .add-to-compare-btn:hover svg.compare_product__img {
  filter: brightness(0) saturate(100%) invert(25%) sepia(100%) saturate(2000%) hue-rotate(220deg) brightness(90%) contrast(90%) !important;
  stroke: #0000EE !important;
}

.favorite-page .compare_product__img {
  width: 20px !important;
  height: 20px !important;
  stroke: #719CFF;
  transition: stroke 0.2s ease, filter 0.2s ease;
}

/* Активное состояние с повышенной специфичностью */
.favorite-page .favorite-product-item .add-to-compare-btn.compare-active .compare_product__img {
  stroke: #0000EE !important;
  filter: brightness(0) saturate(100%) invert(25%) sepia(100%) saturate(2000%) hue-rotate(220deg) brightness(90%) contrast(90%) !important;
}

/* Ховер состояние с повышенной специфичностью */
.favorite-page .favorite-product-item .add-to-compare-btn:hover .compare_product__img {
  stroke: #0000EE !important;
  filter: brightness(0) saturate(100%) invert(25%) sepia(100%) saturate(2000%) hue-rotate(220deg) brightness(90%) contrast(90%) !important;
}

@media (max-width: 768px) {
  .favorite-title {
    padding-bottom: 20px;
    text-align: center;
  }

  .favorite-product-item {
    flex-direction: column;
    gap: 15px;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 15px;
    border-bottom: none;
  }

  .product-main {
    flex-direction: row;
    align-items: center;
    width: 100%;
    gap: 12px;
  }

  .product-image {
    width: 70px;
    height: 70px;
    border-radius: 6px;
  }

  .product-info {
    flex: 1;
  }

  .product-name {
    font-size: 15px;
    line-height: 1.3;
    margin-bottom: 4px;
  }

  .product-details {
    display: block;
  }

  .product-detail-item {
    font-size: 12px;
    color: #666;
    margin-bottom: 2px;
  }

  .product-side {
    flex-direction: column;
    width: 100%;
    gap: 12px;
    border-top: 1px dashed #e0e0e0;
    padding-top: 12px;
  }

  /* Адаптивность для строки цена-количество-сумма */
  .price-quantity-row {
    flex-direction: column;
    gap: 10px;
    width: 100%;
    margin-bottom: 15px;
  }
  
  .price-quantity-row .price-value,
  .price-quantity-row .price-total {
    min-width: unset;
    text-align: center;
    width: 100%;
  }
  
  .price-quantity-row .quantity-controls {
    justify-content: center;
  }

  .quantity-controls {
    width: 100%;
    justify-content: center;
    gap: 10px;
  }

  .quantity-btn {
    width: 35px;
    height: 35px;
    border-radius: 6px;
    font-size: 18px;
  }

  .quantity-input {
    width: 50px;
    height: 35px;
    font-size: 14px;
    font-weight: bold;
  }

  /* Адаптивность для строки сравнения, корзины и удаления */
  .compare-cart-row {
    flex-direction: row;
    justify-content: space-between;
    gap: 10px;
  }

  .compare-cart-row .add-to-compare-btn {
    order: 1;
    padding: 8px;
  }

  .compare-cart-row .add-to-cart-btn {
    order: 2;
    background: #4470C6 !important;
    border: none !important;
    padding: 12px 20px !important;
    border-radius: 8px !important;
    min-width: 120px !important;
    height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    margin: 0 !important;
    flex: 1;
    max-width: none;
  }

  .compare-cart-row .add-to-cart-btn.in-cart {
    background: #4CAF50 !important;
    min-width: 44px !important;
    height: 44px !important;
    padding: 0 !important;
  }

  .compare-cart-row .add-to-cart-btn .btn-text {
    display: none !important;
  }
  
  .compare-cart-row .add-to-cart-btn .btn-icon img {
    display: block !important;
    height: 20px !important;
    width: auto !important;
    filter: brightness(0) invert(1) !important;
  }

  .compare-cart-row .add-to-cart-btn.in-cart .btn-icon img {
    display: none !important;
  }

  .compare-cart-row .add-to-cart-btn.in-cart .btn-icon::before {
    display: block !important;
  }

  .compare-cart-row .remove-from-fav {
    order: 3;
    width: 44px !important;
    height: 44px !important;
    border-radius: 8px !important;
    font-size: 18px !important;
    background: #6c757d !important;
  }

  .compare-cart-row .remove-from-fav:hover {
    background: #5a6268 !important;
  }

  .product-status {
    display: none !important;
  }
}

@media (max-width: 480px) {
  .favorite-product-item {
    padding: 12px;
    gap: 12px;
  }

  .product-image {
    width: 60px;
    height: 60px;
  }

  .product-name {
    font-size: 14px;
  }

  .product-detail-item {
    font-size: 11px;
  }

  .quantity-btn {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }

  .quantity-input {
    width: 45px;
    height: 32px;
    font-size: 13px;
  }

  .compare-cart-row .add-to-cart-btn {
    min-width: 100px !important;
    height: 40px !important;
    padding: 10px 15px !important;
  }

  .compare-cart-row .add-to-cart-btn img {
    height: 18px !important;
  }

  .compare-cart-row .remove-from-fav {
    width: 40px !important;
    height: 40px !important;
    font-size: 16px !important;
  }
}