/* ==========================================
   КОРЗИНА — СТИЛИ
   ========================================== */

/* Шаги оформления */
.checkout-steps {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border-light);
  padding: 16px 0;
}

.steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  max-width: 600px;
  margin: 0 auto;
}

.step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  transition: var(--transition);
}

.step.active {
  background: var(--primary-light);
}

.step.completed {
  cursor: pointer;
}

.step__number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.step.active .step__number {
  background: var(--primary);
  color: #fff;
}

.step.completed .step__number {
  background: var(--success);
  color: #fff;
}

.step__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.step.active .step__label {
  color: var(--primary);
}

.step.completed .step__label {
  color: var(--success);
}

.step__line {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin: 0 8px;
  min-width: 30px;
}

/* ==========================================
   ЗАГОЛОВОК
   ========================================== */
.cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.cart-header__left {
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.cart-header__title {
  font-size: 30px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 12px;
}

.cart-header__title i {
  color: var(--primary);
  font-size: 26px;
}

.cart-header__count {
  font-size: 14px;
  color: var(--text-muted);
  background: var(--bg-gray);
  padding: 4px 14px;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.cart-header__clear {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-white);
}

.cart-header__clear:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

/* ==========================================
   LAYOUT
   ========================================== */
.cart-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.cart-items-section {
  flex: 1;
  min-width: 0;
}

/* ==========================================
   ВЫБРАТЬ ВСЕ
   ========================================== */
.cart-select-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  background: var(--bg-white);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}

.cart-select-all {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}

.cart-select-all input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.cart-remove-selected {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
}

.cart-remove-selected:hover {
  color: var(--primary);
  background: var(--primary-light);
}

/* ==========================================
   ГРУППА МАГАЗИНА
   ========================================== */
.cart-shop-group {
  background: var(--bg-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  overflow: hidden;
}

.cart-shop-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-gray);
}

.cart-shop-header i {
  color: var(--success);
  font-size: 12px;
}

.cart-shop-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.cart-shop-delivery {
  margin-left: auto;
  font-size: 12px;
  color: var(--success);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ==========================================
   КАРТОЧКА ТОВАРА В КОРЗИНЕ
   ========================================== */
.cart-item {
  display: flex;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--border-light);
  transition: var(--transition);
  position: relative;
}

.cart-item:last-child {
  border-bottom: none;
}

.cart-item:hover {
  background: var(--bg-gray);
}

.cart-item.selected {
  background: var(--primary-light);
}

.cart-item.removing {
  animation: removeItem 0.4s ease forwards;
}

@keyframes removeItem {
  to {
    opacity: 0;
    transform: translateX(-30px);
    max-height: 0;
    padding: 0 18px;
    margin: 0;
    overflow: hidden;
  }
}

/* Чекбокс */
.cart-item__select {
  display: flex;
  align-items: flex-start;
  padding-top: 20px;
}

.cart-item__select input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Изображение */
.cart-item__image {
  width: 120px;
  height: 120px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
}

.cart-item__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.cart-item:hover .cart-item__image img {
  transform: scale(1.05);
}

.cart-item__badge {
  position: absolute;
  top: 6px;
  left: 6px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  background: var(--primary);
  color: #fff;
}

/* Информация */
.cart-item__info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cart-item__shop {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.cart-item__shop i {
  color: var(--success);
  font-size: 10px;
}

.cart-item__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  cursor: pointer;
}

.cart-item__title:hover {
  color: var(--primary);
}

.cart-item__variant {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.cart-item__variant-color {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border);
}

.cart-item__rating {
  font-size: 12px;
  color: var(--warning);
  display: flex;
  align-items: center;
  gap: 4px;
}

.cart-item__rating span {
  color: var(--text-light);
}

.cart-item__delivery-info {
  font-size: 11px;
  color: var(--success);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}

.cart-item__delivery-info i {
  font-size: 11px;
}

/* Действия с товаром */
.cart-item__actions-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  min-width: 180px;
}

/* Цена */
.cart-item__price-block {
  text-align: right;
}

.cart-item__price {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.cart-item__old-price {
  font-size: 13px;
  color: var(--text-light);
  text-decoration: line-through;
  margin-left: 6px;
}

.cart-item__discount-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  margin-top: 2px;
}

.cart-item__per-item {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 2px;
}

/* Количество */
.cart-item__qty {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.qty-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text-secondary);
  background: var(--bg-gray);
  transition: var(--transition-fast);
}

.qty-btn:hover {
  background: var(--primary);
  color: #fff;
}

.qty-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.qty-btn:disabled:hover {
  background: var(--bg-gray);
  color: var(--text-secondary);
}

.qty-value {
  width: 44px;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  border: none;
  background: transparent;
  color: var(--text-primary);
}

/* Кнопки действий */
.cart-item__btns {
  display: flex;
  gap: 6px;
}

.cart-item__action {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-muted);
  border: 1px solid transparent;
  transition: var(--transition-fast);
}

.cart-item__action:hover {
  border-color: var(--border);
  background: var(--bg-gray);
}

.cart-item__action.fav:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-light);
}

.cart-item__action.del:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-light);
}

/* ==========================================
   ИТОГО (SUMMARY)
   ========================================== */
.cart-summary {
  width: 380px;
  min-width: 380px;
  position: sticky;
  top: calc(var(--header-height) + 12px);
}

.cart-summary__card {
  background: var(--bg-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 16px;
}

.cart-summary__title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
}

.cart-summary__rows {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cart-summary__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: var(--text-secondary);
}

.cart-summary__discount {
  color: var(--primary);
  font-weight: 600;
}

.cart-summary__divider {
  height: 1px;
  background: var(--border-light);
  margin: 16px 0;
}

.cart-summary__total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 16px;
  font-weight: 700;
}

.cart-summary__total {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
}

.cart-summary__savings {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #e8f5e9;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: #2e7d32;
  margin-top: 12px;
}

.cart-summary__savings i {
  font-size: 16px;
}

.cart-summary__checkout-btn {
  width: 100%;
  padding: 16px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 700;
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.cart-summary__checkout-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(231,76,60,0.3);
}

.cart-summary__secure {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-light);
}

.cart-summary__secure i {
  color: var(--success);
}

/* Промокод */
.cart-promo {
  margin-top: 20px;
  border-top: 1px solid var(--border-light);
  padding-top: 16px;
}

.cart-promo__header {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 4px 0;
}

.cart-promo__header i:first-child {
  color: var(--primary);
}

.cart-promo__arrow {
  margin-left: auto;
  font-size: 11px;
  transition: var(--transition);
}

.cart-promo__header.open .cart-promo__arrow {
  transform: rotate(180deg);
}

.cart-promo__body {
  margin-top: 12px;
}

.cart-promo__input-group {
  display: flex;
  gap: 8px;
}

.cart-promo__input-group input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

.cart-promo__input-group input:focus {
  border-color: var(--primary);
}

.cart-promo__input-group button {
  padding: 10px 18px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.cart-promo__input-group button:hover {
  background: var(--primary-dark);
}

.cart-promo__message {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 600;
}

.cart-promo__message.success {
  color: var(--success);
}

.cart-promo__message.error {
  color: var(--primary);
}

/* Оплата */
.cart-summary__payments {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
  font-size: 12px;
  color: var(--text-light);
}

.payment-icons-small {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.payment-icons-small i {
  font-size: 24px;
  color: var(--text-light);
}

/* Гарантии */
.cart-guarantees {
  background: var(--bg-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.guarantee-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.guarantee-item i {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius-sm);
  font-size: 15px;
  flex-shrink: 0;
}

.guarantee-item strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
}

.guarantee-item span {
  font-size: 11px;
  color: var(--text-muted);
}

/* ==========================================
   ПУСТАЯ КОРЗИНА
   ========================================== */
.cart-empty {
  text-align: center;
  padding: 80px 20px;
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.cart-empty__icon {
  width: 100px;
  height: 100px;
  background: var(--bg-gray);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  font-size: 40px;
  color: var(--text-light);
}

.cart-empty h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 10px;
}

.cart-empty p {
  color: var(--text-muted);
  margin-bottom: 24px;
}

.cart-empty__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-full);
  font-size: 15px;
  font-weight: 700;
}

.cart-empty__btn:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(231,76,60,0.3);
  color: #fff;
}

/* ==========================================
   РЕКОМЕНДАЦИИ
   ========================================== */
.cart-recommendations {
  margin-top: 50px;
  margin-bottom: 40px;
}

.cart-recommendations h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.cart-recommendations h2 i {
  color: var(--warning);
}

.cart-rec-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}

.cart-rec-card {
  background: var(--bg-white);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.cart-rec-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.cart-rec-card__image {
  aspect-ratio: 1/1;
  overflow: hidden;
}

.cart-rec-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s;
}

.cart-rec-card:hover .cart-rec-card__image img {
  transform: scale(1.06);
}

.cart-rec-card__body {
  padding: 12px;
}

.cart-rec-card__title {
  font-size: 12px;
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 32px;
  margin-bottom: 6px;
}

.cart-rec-card__price {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
}

.cart-rec-card__add {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--primary);
  color: var(--primary);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.cart-rec-card__add:hover {
  background: var(--primary);
  color: #fff;
}

/* ==========================================
   МОДАЛКА (если нет из style.css)
   ========================================== */
.modal {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
}
.modal.active { display: flex; }
.modal__content {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 36px;
  max-width: 420px;
  width: 90%;
  text-align: center;
  animation: modalIn 0.3s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal__icon {
  width: 64px; height: 64px;
  background: #fff3e0;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  font-size: 28px;
  color: var(--warning);
}
.modal__title { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.modal__text { font-size: 14px; color: var(--text-muted); margin-bottom: 24px; }
.modal__actions { display: flex; gap: 10px; justify-content: center; }
.modal__btn { padding: 12px 28px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; }
.modal__btn--cancel { background: var(--bg-gray); color: var(--text-secondary); }
.modal__btn--cancel:hover { background: #e0e0e0; }
.modal__btn--confirm { background: var(--primary); color: #fff; }
.modal__btn--confirm:hover { background: var(--primary-dark); }

/* ==========================================
   АДАПТИВ
   ========================================== */
@media (max-width: 1100px) {
  .cart-summary { width: 320px; min-width: 320px; }
  .cart-rec-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 900px) {
  .cart-layout { flex-direction: column; }
  .cart-summary { width: 100%; min-width: 0; position: static; }
  .cart-rec-grid { grid-template-columns: repeat(3, 1fr); }
  .steps { flex-wrap: wrap; gap: 4px; }
  .step__line { display: none; }
}

@media (max-width: 640px) {
  .cart-item { flex-wrap: wrap; }
  .cart-item__image { width: 90px; height: 90px; }
  .cart-item__actions-col { width: 100%; flex-direction: row; justify-content: space-between; align-items: center; min-width: 0; }
  .cart-item__price-block { text-align: left; }
  .cart-item__price { font-size: 17px; }
  .cart-header__title { font-size: 24px; }
  .cart-summary__total { font-size: 24px; }
  .cart-rec-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 400px) {
  .cart-rec-grid { grid-template-columns: 1fr; }
}

/* ==========================================
   ОФОРМЛЕНИЕ ТОВАРОВ НЕ В НАЛИЧИИ (КОРЗИНА)
   ========================================== */
.cart-item.unavailable {
  opacity: 0.65;
  background: #fafafa;
}

.cart-item.unavailable .cart-item__title {
  color: var(--text-muted);
}

.cart-item__out-of-stock-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fee2e2;
  color: #dc2626;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  margin-top: 4px;
}