/* Корзина (Figma 1:6056 desktop, 1:6310 / 1:6556 mobile) → WP: woocommerce/cart/cart.php */

.cart {
  /* Локальные токены страницы (цвета макета, отсутствующие в UI kit) */
  --cart-green: #1e7e1e;
  --cart-green-bg: #ebf9eb;
  --cart-summary-bg: #f8f9fa;
  --cart-btn-yellow: #ffd600;

  padding-bottom: 96px;
}

/* display у блоков не должен перебивать атрибут hidden */
.cart [hidden] {
  display: none !important;
}

/* --- Заголовок --- */
.cart__head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-top: 24px;
}

.cart__title {
  font-weight: var(--fw-bold);
  font-size: 35px;
  line-height: 1;
  letter-spacing: var(--ls-base);
  color: var(--text-brown-dark);
}

.cart__count {
  font-weight: var(--fw-regular);
  font-size: 18px;
  color: var(--text-gray-blue);
}

.cart__count--mobile,
.cart__title-bar {
  display: none;
}

/* --- Сетка: список + сумма --- */
.cart__layout {
  display: flex;
  align-items: flex-start;
  gap: 32px;
  margin-top: 24px;
}

.cart__list {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* --- Карточка товара (1:6217) --- */
.cart-item {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) auto;
  grid-template-areas:
    'image body  prices'
    'image controls prices';
  align-items: center;
  column-gap: 24px;
  padding: 24px;
  border: 1px solid var(--border-light);
  border-radius: 16px;
  background: var(--bg-white);
}

.cart-item::before {
  /* Разделитель для мобильной раскладки */
  content: '';
  display: none;
  grid-area: line;
  border-top: 1px solid var(--border-light);
}

.cart-item__image {
  grid-area: image;
  display: block;
  width: 110px;
  height: 110px;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  overflow: hidden;
}

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

.cart-item__body {
  grid-area: body;
  align-self: end;
  min-width: 0;
}

.cart-item__name {
  font-weight: var(--fw-bold);
  font-size: 16px;
  line-height: 1.4;
  color: var(--text-dark-800);
}

.cart-item__sku {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-gray-blue);
}

/* Количество + удалить */
.cart-item__controls {
  grid-area: controls;
  align-self: start;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
}

.cart-item__qty {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cart-item__qty-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 16px;
  font-weight: var(--fw-bold);
  font-size: 16px;
  line-height: 1;
  color: var(--text-dark-800);
}

.cart-item__qty-btn--minus {
  border: 1px solid var(--border-light);
  background: var(--bg-white);
}

.cart-item__qty-btn--plus {
  background: var(--yellow-500);
}

.cart-item__qty-btn:hover {
  filter: brightness(0.96);
}

.cart-item__qty-value {
  min-width: 12px;
  text-align: center;
  font-weight: var(--fw-bold);
  font-size: 14px;
  color: var(--text-dark-800);
}

.cart-item__controls-divider {
  width: 1px;
  height: 20px;
  background: var(--border-light);
}

.cart-item__remove {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-gray-blue);
}

.cart-item__remove:hover {
  color: var(--error);
  border-color: var(--error);
}

/* Цены справа */
.cart-item__prices {
  grid-area: prices;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  width: 180px;
}

.cart-item__old-price {
  font-size: 13px;
  color: var(--text-gray-blue);
  text-decoration: line-through;
}

.cart-item__price {
  font-weight: var(--fw-black);
  font-size: 22px;
  color: var(--text-dark-800);
}

.cart-item__savings {
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--cart-green-bg);
  font-weight: var(--fw-bold);
  font-size: 12px;
  color: var(--cart-green);
}

/* --- Сумма корзины (1:6283) --- */
.cart-summary {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 420px;
  padding: 32px;
  border: 1px solid var(--border-light);
  border-radius: 16px;
  background: var(--cart-summary-bg);
  position: sticky;
  top: 24px;
}

.cart-summary__title {
  font-weight: var(--fw-black);
  font-size: 20px;
  color: var(--text-dark-800);
}

.cart-summary__rows {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cart-summary__row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.cart-summary__label {
  font-size: 14px;
  color: var(--text-gray-blue);
}

.cart-summary__value {
  font-weight: var(--fw-bold);
  font-size: 14px;
  color: var(--text-dark-800);
}

.cart-summary__value--green {
  color: var(--cart-green);
}

.cart-summary__line {
  margin: 0;
  border: none;
  border-top: 1px solid var(--border-light);
}

/* Купон */
.cart-summary__promo {
  display: flex;
  gap: 8px;
  height: 44px;
}

.cart-summary__promo-input {
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
  padding: 0 0 0 16px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--bg-white);
  font-size: 14px;
  outline: none;
}

.cart-summary__promo-input::placeholder {
  color: var(--text-gray-blue);
}

.cart-summary__promo-input:focus {
  border-color: var(--yellow-500);
}

.cart-summary__promo-btn {
  flex-shrink: 0;
  height: 100%;
  padding: 0 16px;
  border-radius: 8px;
  background: var(--text-dark-800);
  font-weight: var(--fw-bold);
  font-size: 14px;
  color: var(--bg-white);
}

/* Итог */
.cart-summary__total-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.cart-summary__total-label {
  font-size: 15px;
  color: var(--text-dark-800);
}

.cart-summary__total {
  font-weight: var(--fw-black);
  font-size: 24px;
  color: var(--text-dark-800);
  white-space: nowrap;
}

.cart-summary__checkout {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 8px 20px;
  border-radius: 8px;
  background: var(--cart-btn-yellow);
  font-weight: var(--fw-medium);
  font-size: 13px;
  color: var(--text-dark-900);
  text-align: center;
}

.cart-summary__checkout:hover {
  background: var(--yellow-500);
}

/* --- Пустое состояние (в макете отсутствует) --- */
.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 80px 16px;
  text-align: center;
}

.cart-empty__title {
  font-weight: var(--fw-bold);
  font-size: 24px;
  color: var(--text-dark-800);
}

.cart-empty__text {
  font-size: 14px;
  color: var(--text-gray-blue);
}

.cart-empty__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 12px;
  height: 46px;
  padding: 10px 25px;
  border-radius: 90px;
  background: var(--yellow-500);
  font-weight: var(--fw-bold);
  font-size: 14px;
  color: var(--text-brown-dark);
}

.cart-empty__btn:hover {
  background: var(--yellow-450);
}

/* ================= Адаптив ================= */

/* 1024 и ниже: сумма под списком */
@media (max-width: 1023px) {
  .cart__layout {
    flex-direction: column;
  }

  .cart-summary {
    width: 100%;
    position: static;
  }
}

/* 768 и ниже: мобильные карточки (1:6360) */
@media (max-width: 767px) {
  .cart {
    padding-bottom: 48px;
  }

  .cart__head {
    display: block;
    margin-top: 8px;
    padding-bottom: 8px;
  }

  .cart__title {
    display: inline;
    font-weight: var(--fw-black);
    font-size: 24px;
    line-height: normal;
    color: var(--text-dark-800);
  }

  .cart__count--desktop {
    display: none;
  }

  .cart__count--mobile {
    display: inline;
    font-weight: var(--fw-black);
    font-size: 24px;
    color: var(--text-dark-800);
  }

  .cart__title-bar {
    display: block;
    width: 50px;
    height: 2px;
    margin-top: 8px;
    background: var(--yellow-500);
  }

  .cart__layout {
    margin-top: 16px;
    gap: 24px;
  }

  /* Карточка: фото + описание / линия / количество + цена */
  .cart-item {
    grid-template-columns: 72px minmax(0, 1fr);
    grid-template-areas:
      'image body'
      'line line'
      'controls prices';
    align-items: start;
    column-gap: 12px;
    row-gap: 16px;
    padding: 16px;
    border-radius: 12px;
  }

  .cart-item::before {
    display: block;
  }

  .cart-item__image {
    width: 72px;
    height: 72px;
    border-radius: 8px;
  }

  .cart-item__body {
    align-self: start;
  }

  .cart-item__name {
    font-size: 13px;
    line-height: 1.3;
  }

  .cart-item__sku {
    margin-top: 4px;
    font-size: 11px;
  }

  .cart-item__controls {
    align-self: center;
    margin-top: 0;
  }

  /* На мобильной карточке нет кнопки «Удалить» (минус при 1 шт. удаляет товар) */
  .cart-item__controls-divider,
  .cart-item__remove {
    display: none;
  }

  .cart-item__qty-btn {
    width: 28px;
    height: 28px;
    border-radius: 14px;
    font-size: 14px;
  }

  .cart-item__qty-value {
    font-size: 13px;
  }

  .cart-item__prices {
    align-self: center;
    gap: 2px;
    width: auto;
  }

  .cart-item__old-price {
    font-size: 11px;
  }

  .cart-item__price {
    font-size: 16px;
  }

  .cart-item__savings {
    display: none;
  }
}

/* 320: уменьшенные отступы суммы */
@media (max-width: 389px) {
  .cart-summary {
    padding: 24px 20px;
  }

  .cart-summary__total-label {
    font-size: 14px;
  }

  .cart-summary__total {
    font-size: 20px;
  }
}
