/* ==========================================================
   src/css/lists.css
   Обране, порівняння та стани кнопок.

   ВАЖЛИВО: цей файл підключений глобально (на всіх сторінках),
   тому картка товару (.product-card) продубльована тут повністю —
   сторінки "Обране" й "Порівняння" це звичайні WP-сторінки з
   шорткодом, а catalog.css там НЕ підключається (він вантажиться
   тільки на catalog.php/single-product.php/тощо за картою в
   functions.php). Без цього дублювання картки на "Обране"
   виглядають зламаними (як на скріншоті — величезне фото без рамок).
   ========================================================== */

/* --- Кнопки обраного/порівняння на сторінці товару --- */
.product-view__tool-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--color-primary);
  transition: color 0.3s ease, transform 0.3s ease;
}

.product-view__tool-btn:hover {
  transform: scale(1.1);
}

.product-view__tool-btn .icon-fav {
  width: 18px;
  height: 18px;
  display: block;
}

.product-view__tool-btn.is-active {
  color: var(--color-secondary-dark);
}

.product-view__tool-btn.is-active .icon-fav__outline {
  opacity: 0;
}

.product-view__tool-btn.is-active .icon-fav__solid {
  opacity: 1;
}

.js-list-toggle[data-busy="1"] {
  opacity: 0.5;
  pointer-events: none;
}

/* --- Кнопка "в кошик" у неактивному стані --- */
.product-view__add-btn:disabled,
.product-view__add-btn.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* --- Обраний розмір у випадаючому списку --- */
.product-view__size-list a.is-selected {
  font-weight: 500;
  text-decoration: underline;
}

/* --- Активний пункт сортування (catalog.php) --- */
.catalog-toolbar__dropdown a.is-current {
  color: var(--color-secondary-dark);
  font-weight: 500;
}

/* ==========================================================
   КАРТКА ТОВАРУ — самостійна копія стилів з catalog.css,
   щоб працювало на будь-якій сторінці без catalog.css
   ========================================================== */

.product-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}

.product-card__global-link {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
}

.product-card__image-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  background-color: #f8f8f8;
  overflow: hidden;
}

.product-card__badge {
  position: absolute;
  top: 15px;
  left: 15px;
  font-size: 10px;
  z-index: 3;
}

.product-card__badge--sale {
  color: #d9534f;
  font-weight: 500;
}

.product-card__favorite {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 3;
  padding: 0;
}

.product-card__favorite svg {
  width: 16px;
  height: 16px;
  display: block;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.product-card .icon-fav__outline {
  transition: opacity 0.3s ease;
  opacity: 1;
}

.product-card .icon-fav__solid {
  transition: opacity 0.3s ease;
  opacity: 0;
  fill: #000;
}

.product-card:hover .product-card__favorite,
.product-card__favorite.is-active {
  opacity: 1;
  transform: translateY(0);
}

.product-card__favorite:hover svg {
  transform: scale(1.15);
}

.product-card__favorite.is-active {
  color: var(--color-secondary-dark);
}

.product-card__favorite.is-active .icon-fav__outline {
  opacity: 0;
}

.product-card__favorite.is-active .icon-fav__solid {
  opacity: 1;
  fill: var(--color-secondary-dark);
}

.product-card__img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.5s ease;
}

.product-card__img--secondary {
  opacity: 0;
}

.product-card:hover .product-card__img--secondary {
  opacity: 1;
}

.product-card__info {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.product-card__details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.product-card__name {
  font-size: 14px;
  color: var(--color-primary);
}

.product-card__price-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.product-card__price-wrapper del,
.product-card__price-wrapper ins,
.product-card__price-wrapper .amount {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  background: transparent;
}

.product-card__price-wrapper .screen-reader-text {
  display: none !important;
}

.product-card__price-wrapper del {
  font-family: "Switzer", sans-serif;
  font-size: 10px;
  color: #8e8e8e;
}

.product-card__price-wrapper del .amount {
  text-decoration: line-through;
}

.product-card__price-wrapper ins,
.product-card__price-wrapper > .amount {
  font-family: "Switzer", sans-serif;
  font-size: 12px;
  color: var(--color-primary);
  font-weight: 500;
}

.product-card__add {
  background: none;
  border: none;
  cursor: pointer;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  position: relative;
  z-index: 3;
  text-decoration: none;
}

.product-card__add-icon {
  position: relative;
  width: 14px;
  height: 14px;
}

.product-card__add-icon::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 0;
  width: 14px;
  height: 1.5px;
  background-color: var(--color-primary);
}

.product-card__add-icon::after {
  content: "";
  position: absolute;
  top: 0;
  left: 6px;
  width: 1.5px;
  height: 14px;
  background-color: var(--color-primary);
}

/* ==========================================================
   СІТКА ДЛЯ "ОБРАНЕ" / "ПОРІВНЯННЯ"
   ========================================================== */

.list-grid {
  max-width: 1440px;
  margin: 60px auto;
  width: 100%;
  padding: 0 40px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 25px 30px;
  margin-bottom: 50px;
}

/* на сторінці обраного сердечко завжди видно, не тільки на ховер */
.list-grid .product-card__favorite {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 992px) {
  .list-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .list-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    padding: 0 15px;
  }
}

@media (max-width: 480px) {
  .list-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Порожній список --- */
.list-empty {
  text-align: center;
  padding: 80px 20px;
}

.list-empty p {
  font-size: 16px;
  color: var(--color-primary);
  margin-bottom: 20px;
}

.list-empty .btn {
  font-family: "Switzer", sans-serif;
  display: inline-block;
  padding: 12px 32px;
  border: 1px solid var(--color-primary);
  color: var(--color-primary);
  font-size: 14px;
  text-decoration: none;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.list-empty .btn:hover {
  background-color: var(--color-primary);
  color: var(--color-white);
}

/* ==========================================================
   ТАБЛИЦЯ ПОРІВНЯННЯ
   ========================================================== */

.compare-table-wrap {
  overflow-x: auto;
  margin-bottom: 60px;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}

.compare-table th,
.compare-table td {
  border: 0.4px solid #818181;
  padding: 14px;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
  color: var(--color-primary);
}

.compare-table tbody th {
  width: 180px;
  font-weight: 500;
  background-color: #f8f8f8;
}

.compare-table thead th {
  position: relative;
  text-align: center;
  width: 220px;
  vertical-align: bottom;
}

.compare-table thead a {
  text-decoration: none;
  color: var(--color-primary);
}

.compare-table thead img {
  width: 100%;
  max-width: 180px;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
  margin: 0 auto 10px;
  background-color: #f8f8f8;
}

.compare-table__name {
  display: block;
  font-size: 14px;
}

.compare-table__remove {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--color-primary);
  padding: 0;
  z-index: 4;
  transition: transform 0.3s ease;
}

.compare-table__remove:hover {
  transform: scale(1.2);
  color: var(--color-secondary-dark);
}