/* ========================================
   CART — Корзина
   ======================================== */

/* --- Layout --- */
.cart-items-panel {
  flex: 1;
  min-width: 0;
  border-radius: 32px;
}

.cart-summary {
  width: 420px;
  flex-shrink: 0;
  border-radius: 32px;
  position: sticky;
  top: 0;
  margin-top: 0;
  align-self: flex-start;
}

/* --- Счётчик в заголовке --- */
.cart-count {
  font-weight: 400;
  font-size: 16px;
  color: var(--gray-text);
  margin-left: 8px;
}

.cart-main {
  align-items: flex-start !important;
}

.cart-empty {display: flex; flex-direction: column; gap: 12px;}

.cart-extras-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.cart-extra-cats-row {
  margin-bottom: 4px;
}

.cart-extra-cats {
  padding: 2px 0;
  gap: 6px;
}

.cart-extra-cat-chip {
  height: 40px;
  padding: 0 14px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
}

.cart-extra-cat-chip.active {
  background: var(--red-btn);
  color: #fff;
}

.cart-extra-category.is-hidden {
  display: none;
}

.cart-extras-track {
  gap: 8px;
  padding: 4px 0;
}

.cart-extra-card {
  border-radius: 20px;
  background: #f7f7f7;
  border: 1px solid #ececec;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 190px;
  flex: 0 0 auto;
}

.cart-extra-card__image {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 14px;
  background: #fff;
}

.cart-extra-card__info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cart-extra-card__title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--black);
}

.cart-extra-edit-btn {
  min-width: 180px;
}

.cart-extra-empty {
  margin-top: 8px;
  color: var(--gray-text);
  font-size: 14px;
}

/* --- Товар в корзине --- */
.cart-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 24px;
}

/* Блок 1: фото + текст */
.cart-item__info-block {
  flex: 1;
  display: flex;
  gap: 16px;
  min-width: 0;
}

.cart-item__image {
  width: 88px;
  height: 88px;
  border-radius: 16px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--gray-light);
}

.cart-item__info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}

.cart-item__title {
  font-family: 'Google Sans', 'Onest', sans-serif;
  font-weight: 600;
  font-size: 16px;
  line-height: 1.3;
  color: var(--black);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cart-item__subtitle {
  font-family: 'Google Sans', 'Onest', sans-serif;
  font-weight: 400;
  font-size: 14px;
  color: var(--gray-sub);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Блок 2: счётчик + цена */
.cart-item__actions-block {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 20px;
}

.cart-item__counter {
  flex-shrink: 0;
}

/* --- Цены --- */
.cart-item__prices {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
  min-width: 90px;
}

.cart-item__price {
  font-family: 'Google Sans', 'Onest', sans-serif;
  font-weight: 700;
  font-size: 18px;
  color: var(--black);
  white-space: nowrap;
}

.cart-item__old-price {
  font-family: 'Google Sans', 'Onest', sans-serif;
  font-weight: 400;
  font-size: 14px;
  color: var(--gray-text);
  text-decoration: line-through;
  white-space: nowrap;
}

/* --- Удалить --- */
.cart-item__remove {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--gray-text);
  transition: background 0.15s, color 0.15s;
}



/* --- Итого (как на checkout) --- */
.cart-summary-totals {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.summary-row__label {
  font-family: 'Google Sans', 'Onest', sans-serif;
  font-weight: 400;
  font-size: 15px;
  color: var(--gray-text);
}

.summary-row__value {
  font-family: 'Google Sans', 'Onest', sans-serif;
  font-weight: 600;
  font-size: 15px;
  color: var(--black);
}

.summary-row__value--discount {
  color: var(--red-btn);
}

.summary-row--total .summary-row__label {
  font-weight: 700;
  font-size: 18px;
  color: var(--black);
}

.summary-row--total .summary-row__value {
  font-weight: 800;
  font-size: 22px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .cart-main {
    flex-direction: column;
  }

  .cart-items-panel {
    width: 100%;
    border-radius: 32px;
  }

  .cart-summary {
    width: 100%;
    border-radius: 32px;
    position: static;
  }
}

@media (max-width: 768px) {
  /* Карточка товара — колонка */
  .cart-item {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  /* Фото + текст — строка */
  .cart-item__info-block {
    gap: 12px;
  }

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

  .cart-item__info {
    padding-right: 36px; /* место под кнопку удаления */
  }

  .cart-item__title {
    font-size: 15px;
  }

  .cart-item__subtitle {
    font-size: 13px;
  }

  /* Счётчик + цена — строка, space-between */
  .cart-item__actions-block {
    justify-content: space-between;
    gap: 16px;
  }

  .cart-item__prices {
    align-items: flex-end;
    min-width: auto;
  }

  /* Удалить — абсолютно в правом верхнем углу */
  .cart-item__remove {
    position: absolute;
    top: 0;
    right: 0;
    width: 32px;
    height: 32px;
  }

  /* Заголовок корзины */
  .cart-items-panel .panel__title {
    font-size: 20px;
  }

  /* ===== МОБИЛЬНАЯ КОРЗИНА: summary зафиксирован внизу ===== */

  /* Summary — прибит к нижнему краю экрана */
  .cart-summary {
    position: fixed !important;
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 100;
    border-radius: 24px 24px 0 0 !important;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.10);
    padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0)) 16px;
    background: var(--white);
    width: 100% !important;
    box-sizing: border-box;
  }

  /* Список товаров: отступ снизу = высота summary (~200px) */
  .cart-items-panel {
    padding-bottom: 220px !important;
  }

  /* Пустая корзина */
  .cart-empty {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  .cart-extras-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cart-extra-card {
    width: 160px;
    padding: 8px;
  }

  .cart-extra-cat-chip {
    height: 36px;
    padding: 0 12px;
    border-radius: 12px;
    font-size: 13px;
  }

  .cart-extra-edit-btn {
    min-width: 0;
    width: 100%;
  }
}

 
 
@media (hover: hover) {
  .cart-item__remove:hover { background: #e0e0e0; }
}
