/* ===== КОРЗИНА ===== */
.cart-container {
  max-width: 1100px;
  margin: 2rem auto;
  background: #fff;
  padding: 1rem;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.cart-container .title {
  text-align: center;
  font-size: 1.8rem;
  color: #2c1b0c;
  letter-spacing: 0.5px;
  font-weight: bold;
  text-decoration: none;
}

/* Таблица */
.cart-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #e0d8c8;
  border-radius: 8px;
  overflow: hidden;
}
.cart-table th,
.cart-table td {
  padding: 0.8rem;
  border-bottom: 1px solid #e5ded0;
  text-align: center;
  vertical-align: middle;
  font-size: 1rem;
  color: #3b2a14;
}
.cart-table th {
  background: #f6f3ee;
  font-weight: 600;
  color: #4a3b24;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Изображения */
.cart-table img {
  width: 100px;
  height: 130px;
  object-fit: cover;
  object-position: center;
  border-radius: 8px;
  display: inline-block;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* Количество */
.cart-table input.qty-input {
  width: 60px;
  text-align: center;
  border: 1px solid #d2aa67;
  border-radius: 6px;
  padding: 4px;
  font-size: 1rem;
  color: #3b2a14;
  background: #fff8f0;
}

/* Кнопка удаления */
.remove-btn {
  background: transparent;
  border: none;
  color: #a00;
  font-size: 22px;
  cursor: pointer;
  transition: color 0.2s;
}
.remove-btn:hover {
  color: #d33;
}

/* Подвал корзины */
.cart-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.cart-footer h3 {
  margin: 0;
  font-size: 1.3rem;
  color: #2c1b0c;
}

#checkout-btn {
  background: linear-gradient(90deg, #b6894b, #d2aa67);
  color: white;
  border: none;
  padding: 0.9rem 1.6rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s, transform 0.15s;
}
#checkout-btn:hover {
  background: linear-gradient(90deg, #d2aa67, #b6894b);
  transform: translateY(-2px);
}

#checkout-btn:disabled {
  background: #8c7a50;
  color: #f2e6cc;
  cursor: not-allowed;
  opacity: 0.6;
  box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.2);
}

/* ===== МОБИЛЬНАЯ АДАПТАЦИЯ КОРЗИНЫ ===== */
@media (max-width: 950px) {
  .cart-container {
    padding: 1rem;
    margin: 4rem auto;
    border-radius: 10px;
  }

  .cart-table {
    display: block;
    border: none;
  }

  .cart-table thead {
    display: none;
  }

  /* — карточки теперь в виде сетки — */
  .cart-table tbody {
    display: grid;
    padding: 6px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
  }

  .cart-table tr {
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* выравнивание по верхнему краю */
    /* justify-content: space-between; */

    background: #fffaf3;
    border-radius: 10px;
    padding: 1rem;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.2);
    height: 450px;

    justify-content: center; /* выравнивает по вертикали */
    align-items: center; /* выравнивает по горизонтали */
    text-align: center; /* текст и элементы по центру */
  }

  .cart-table td {
    border: none;
    text-align: left;
    padding: 0.4rem 0;
    font-size: 0.95rem;
  }

  .cart-table td.cart-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
  }

  .cart-table img {
    width: 160px;
    height: 210px;
    border-radius: 8px;
    object-fit: cover; /* масштабирует изображение, сохраняя пропорции */
  }

  /* .qty-control {
    margin-top: 0.3rem;
  } */

  .cart-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 0.8rem;
    margin-top: 2rem;
  }

  .cart-footer h3 {
    text-align: center;
  }

  #checkout-btn {
    width: 100%;
    font-size: 1rem;
  }
}

/* ===== МОДАЛЬНОЕ ОКНО ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.3s ease;
}

.modal {
  background: #fff;
  border-radius: 12px;
  padding: 2rem 2.5rem;
  max-width: 420px;
  text-align: center;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.25);
  animation: scaleIn 0.25s ease;
}

.modal h2 {
  margin-top: 0;
  font-size: 1.4rem;
  margin-bottom: 1rem;
}

.modal p {
  color: #4a3b24;
  margin-bottom: 1.5rem;
}

.modal.success h2 {
  color: #3b7b3b;
}

.modal.error h2 {
  color: #b33;
}

.modal button {
  background: linear-gradient(90deg, #b6894b, #d2aa67);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1.4rem;
  cursor: pointer;
  font-weight: 600;
  transition: 0.2s;
}

.modal button:hover {
  background: linear-gradient(90deg, #d2aa67, #b6894b);
  transform: translateY(-2px);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes scaleIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.remove-btn.loading {
  pointer-events: none;
  opacity: 0.5;
  animation: spin 0.9s linear infinite;
}
