/* ===== Основные переменные ===== */
:root {
  --color-text: #333;
  --color-text-muted: #6c757d;
  --color-text-soft: #555;
  --color-bg: #fff;
  --color-bg-alt: #f5f5f5;
  --color-border: #ddd;
  --color-primary: #0071e3;
  --color-primary-hover: #005bb5;
  --color-danger: #e74c3c;
  --color-shadow: rgba(0, 0, 0, 0.1);
}

/* ===== Баннер корзины ===== */
.cart-banner {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    height: 80px;
    padding: 0 20px;
    box-sizing: border-box;
}

.cart-banner__icon-section {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
    border-radius: 12px;
    color: white;
    box-shadow: 0 4px 15px rgba(0, 113, 227, 0.3);
}

.cart-banner__icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-banner__icon svg {
    width: 40px;
    height: 40px;
}

.cart-banner__info-section {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 25px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
    border-radius: 12px;
    color: white;
    box-shadow: 0 4px 15px rgba(0, 113, 227, 0.3);
    text-align: center;
}

.cart-banner__slogan {
    margin: 0;
    font-size: 1.3rem;
    opacity: 0.95;
    font-weight: 500;
    line-height: 1.4;
}

/* Адаптивность для баннера */
@media (max-width: 768px) {
    .cart-banner {
        height: 70px;
        gap: 15px;
        padding: 0 15px;
    }
    
    .cart-banner__icon-section {
        width: 70px;
        height: 70px;
    }
    
    .cart-banner__icon svg {
        width: 36px;
        height: 36px;
    }
    
    .cart-banner__info-section {
        padding: 0 20px;
    }
    
    .cart-banner__slogan {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .cart-banner {
        height: 60px;
        gap: 12px;
        padding: 0 10px;
    }
    
    .cart-banner__icon-section {
        width: 60px;
        height: 60px;
        border-radius: 10px;
    }
    
    .cart-banner__icon svg {
        width: 32px;
        height: 32px;
    }
    
    .cart-banner__info-section {
        padding: 0 15px;
        border-radius: 10px;
    }
    
    .cart-banner__slogan {
        font-size: 1rem;
    }
}

/* ===== Ссылки ===== */
.product-link {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

.product-link:hover {
  color: var(--color-primary);
}

/* ===== Основная структура корзины ===== */
.cart-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
  box-sizing: border-box;
  width: 100%; /* Фиксируем ширину контейнера */
  min-width: 1200px; /* Минимальная ширина чтобы не сужался */
}

.cart-content-wrapper {
  display: flex;
  gap: 40px;
  margin-top: 20px;
}

/* ===== Шапка списка товаров ===== */
.cart-product-list-header {
  margin-bottom: 20px;
  width: 100%;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 30px;
}

.cart-product-list-header h2 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--color-text-soft);
}

.select-all-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.select-all-container label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  user-select: none;
  color: var(--color-text-soft);
}

#select-all-products {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--color-primary);
}

/* ===== Список товаров ===== */
.cart-product-list {
  flex: 3;
  display: flex;
  flex-direction: column;
  gap: 25px;
  min-width: 0; /* Важно для ограничения ширины в flex-контейнере */
}

.cart-product {
  position: relative;
  display: grid;
  grid-template-columns: auto 100px minmax(200px, 1fr) 200px; /* Фиксируем третью колонку */
  gap: 15px;
  padding: 15px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background-color: var(--color-bg);
  box-shadow: 0 2px 12px var(--color-shadow);
  align-items: start;
}

/* ===== Левая колонка: чекбокс, избранное и удаление ===== */
.cart-product__select {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    justify-content: flex-start;
}

/* Стандартный чекбокс */
.cart-product__select input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--color-primary);
}

/* Общие стили для кнопок */

/* ===== Стили для избранного в корзине ===== */
.cart-product .favorite-heart-btn svg {
    width: 22px;
    height: 22px;
    stroke: #666;
    stroke-width: 1;
    fill: transparent;
    transition: all 0.2s ease;
}

.cart-product .favorite-heart-btn.active svg {
    fill: #e74c3c !important;
    stroke: #e74c3c !important;
}

.cart-product .favorite-heart-btn:hover svg {
    stroke: #e74c3c;
}



.favorite-heart-btn,
.remove-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
    color: #666;
    width: 32px;
    height: 32px;
    box-sizing: border-box;
}

.favorite-heart-btn:hover,
.remove-btn:hover {
    background: rgba(0, 113, 227, 0.1);
    color: var(--color-primary);
}

.favorite-heart-btn.active {
    color: #e74c3c;
}

/* Общие стили для SVG иконок */
.favorite-heart-btn svg,
.remove-btn svg {
    width: 22px;
    height: 22px;
}

/* ===== ПРЯМОУГОЛЬНЫЕ КОНТЕЙНЕРЫ ДЛЯ ФОТОГРАФИЙ С УВЕЛИЧЕНИЕМ ПРИ НАВЕДЕНИИ ===== */
.cart-product__image {
  width: 75px;
  height: 95px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 6px;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
  cursor: pointer;
  background-color: var(--color-bg); /* Только белый фон */
}

.cart-product__image:hover {
  z-index: 100;
  transform: scale(1.8);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
  border-radius: 8px;
}

.cart-product__image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  transition: transform 0.3s ease;
}

.cart-product__image:hover img {
  transform: scale(1.1);
}

.cart-product__info {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0; /* Критически важно для ограничения ширины */
  flex: 1;
}

.cart-product__name {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-soft);
  line-height: 1.4;
}

.cart-product__price {
  font-size: 1rem;
  font-weight: bold;
  color: var(--color-text-soft);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.price-current {
  color: var(--color-text-soft);
  font-size: 1rem;
}

.price-original {
  text-decoration: line-through;
  color: var(--color-text-muted);
  font-weight: normal;
  font-size: 0.95rem;
}

.discount-percent {
  color: var(--color-danger);
  font-weight: bold;
  font-size: 0.9rem;
}

.cart-product__delivery {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  display: flex;
  gap: 4px;
  align-items: center;
}

/* ===== Правая колонка: управление количеством и цена ===== */
.cart-product__right-column {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 15px;
  min-width: 140px;
  flex-shrink: 0;
}

/* ===== Вариант 4 - Тултип при наведении ===== */
.cart-product__controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.quantity-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

.quantity-controls:hover::after {
  content: "Доступно: " attr(data-stock) " шт.";
  position: absolute;
  top: -35px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: white;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 11px;
  white-space: nowrap;
  z-index: 10;
}

.quantity-controls:hover::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #333;
  z-index: 11;
}

.stock-info {
  display: none;
}

.quantity-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0;
  transition: all 0.2s ease;
}

.quantity-btn:hover {
  background: var(--color-bg-alt);
}

.quantity-display {
  min-width: 30px;
  text-align: center;
  font-weight: bold;
  font-size: 1rem;
}

.cart-product__total {
  font-size: 1.1rem;
  font-weight: bold;
  text-align: right;
  color: var(--color-text-soft);
  line-height: 1.3;
  white-space: normal;
}

.delivery-line {
  margin-top: 2px;
  line-height: 1.2;
}

.delivery-line small {
  font-size: 0.7rem;
  font-weight: normal;
  color: var(--color-text-muted);
}

.delivery-line {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--color-text-soft);
}

/* ===== Предупреждение для товаров с удалённого склада ===== */
.cart-product__warning {
  grid-column: 1 / -1;
  background-color: #fff3cd;
  color: #856404;
  border: 1px solid #ffeeba;
  border-radius: 6px;
  padding: 8px 8px;
  font-size: 0.8rem;
  text-align: center;
  cursor: help;
  position: relative;
  z-index: 1;
}

.cart-product__warning:hover::after {
  content: "Запрашиваемого количества товара нет на ближайшем складе. Дополнительные экземпляры товара будут доставляться с удалённого склада и придут отдельной партией, как отдельная позиция в заказе. Вы сможете получать их отдельно по мере поступления в пункт выдачи. Стоимость и сроки доставки с разных складов могут отличаться. Просим это учитывать при оформлении заказа.";
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: white;
  padding: 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  width: 320px;
  text-align: left;
  line-height: 1.4;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  white-space: normal;
}

.cart-product__warning:hover::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #333;
  z-index: 1001;
}

/* ===== Панель итогов ===== */
.cart-summary-panel {
  flex: 1;
  padding: 25px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background-color: var(--color-bg);
  box-shadow: 0 2px 8px var(--color-shadow);
  height: fit-content;
  position: sticky;
  top: 20px;
}

.cart-summary-panel h2 {
  margin: 0 0 20px 0;
  font-size: 1.25rem;
  color: var(--color-text-soft);
}

.summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 15px;
  font-size: 0.9375rem;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-bg-alt);
  color: var(--color-text-soft);
}

.summary-row:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.summary-row strong {
  font-weight: 600;
  color: var(--color-text);
}

.summary-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 25px;
}

.btn-clear {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  padding: 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9375rem;
  transition: background 0.2s;
  color: var(--color-text-soft);
}

.btn-clear:hover {
  background: #e0e0e0;
}

.btn-checkout {
  background: var(--color-primary);
  color: white;
  padding: 14px;
  text-align: center;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 500;
  transition: background 0.2s;
}

.btn-checkout:hover {
  background: var(--color-primary-hover);
}

/* ===== Состояние пустой корзины ===== */
.empty-cart {
  color: var(--color-text-muted);
  text-align: center;
  padding: 40px 20px;
  font-style: italic;
    font-size: 01.5rem;
  grid-column: 1 / -1;
}

/* ===== Адаптивность ===== */
@media (max-width: 1200px) {
  .cart-container {
    min-width: unset; /* Снимаем фиксированную ширину на маленьких экранах */
  }
}

@media (max-width: 992px) {
  .cart-content-wrapper {
    flex-direction: column;
  }

  .cart-summary-panel {
    position: static;
  }
}

@media (max-width: 768px) {
  .cart-container {
    padding: 15px;
  }
  
  .cart-product-list-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  
  .cart-product {
    grid-template-columns: auto 60px minmax(150px, 1fr); /* Сохраняем для мобильных */
    gap: 15px;
    padding: 15px;
  }

  .cart-product__image {
    width: 80px;
    height: 112px;
  }

  .cart-product__name {
    font-size: 0.95rem;
  }

  .cart-product__price {
    font-size: 0.95rem;
  }

  .cart-product__right-column {
    grid-column: 3;
    grid-row: 1;
    align-items: flex-end;
  }

  .cart-product__warning {
    font-size: 0.7rem;
    padding: 5px 8px;
  }
}

@media (max-width: 480px) {
  .cart-container {
    padding: 10px;
  }
  
  .cart-product {
    grid-template-columns: auto 50px minmax(120px, 1fr); /* Сохраняем для маленьких экранов */
    grid-template-rows: auto auto;
    gap: 12px;
    padding: 12px;
  }

  .cart-product__image {
    width: 70px;
    height: 98px;
  }

  .cart-product__name {
    font-size: 0.9rem;
  }

  .cart-product__price {
    font-size: 0.9rem;
  }

  .cart-product__right-column {
    grid-column: 2 / span 2;
    grid-row: 2;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-top: 10px;
  }

  .cart-product__controls {
    align-items: flex-start;
  }

  .cart-product__total {
    text-align: right;
  }
  
  .cart-product__select {
    flex-direction: row;
    gap: 15px;
  }
}

/* Отключаем увеличение на мобильных устройствах */
@media (max-width: 768px) {
  .cart-product__image:hover {
    transform: none;
    box-shadow: none;
    z-index: auto;
  }
  
  .cart-product__image:hover img {
    transform: none;
  }
  
  .cart-product__image {
    cursor: default;
  }
}