/* ===== NỀN TRANG VÀ TIÊU ĐỀ ===== */
.cart-section {
  background-color: #f5f0eb;
  min-height: 80vh;
  padding: 2rem 1.5rem 4rem;
}

.cart-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: #2c1a0e;
  margin-bottom: 1.5rem;
  text-align: center;
}
/* ====GIỎ HÀNG 2 CỘT TRÁI-PHẢI==== */
.cart-container {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.5fr 1fr; /* cột trái rộng hơn cột phải */
  gap: 2rem;
  align-items: start;
}

/* ===== KHUNG DANH SÁCH SP ===== */
/* Tạo khung trắng bo góc chứa danh sách sản phẩm */
.cart-items {
  background: #fff;
  border-radius: 15px;
  padding: 2rem;
  box-shadow: 0 5px 20px rgba(0,0,0,0.08);
}

/* Giỏ trống */
/* Khi giỏ hàng trống, hiển thị icon mờ + thông báo*/
.cart-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: #888;
}

.cart-empty .empty-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.4;
}

.cart-empty h3 {
  font-size: 1.2rem;
  color: #555;
  margin-bottom: 0.5rem;
}

.cart-empty p {
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}


/* Từng sp */
/* Mỗi sp chia thành 3 cột: ảnh | tên+giá+sl | tổng tiền+nút xóa */
.cart-item {
  display: grid;
  grid-template-columns: 100px 1fr auto;
  gap: 1.5rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid #f0ece8;
  align-items: center;
}

.cart-item:last-child { border-bottom: none; }

.cart-item-image {
  width: 100px;
  height: 100px;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(135deg, #6f4e37, #8B6F47);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
}
/* Ảnh sản phẩm
Nếu không có ảnh thì hiện nền nâu gradient với icon */
.cart-item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-item-details h3 {
  font-size: 1rem;
  font-weight: 700;
  color: #2c1a0e;
  margin-bottom: 4px;
}

.cart-item-options {
  font-size: 0.78rem;
  color: #999;
  margin-bottom: 8px;
}

.cart-item-price {
  font-size: 0.9rem;
  color: #c8956c;
  font-weight: 600;
}

/* Tăng giảm số lượng */
/* Tạo 2 nút − và + hình vuông nhỏ, có hiệu ứng đổi màu khi di chuột vào */
.quantity-control {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.quantity-btn {
  width: 28px;
  height: 28px;
  border: 1.5px solid #ddd;
  background: #fff;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.quantity-btn:hover { background: #f5f0eb; }

.quantity-value {
  font-size: 0.95rem;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
}

.cart-item-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.item-total {
  font-size: 1rem;
  font-weight: 700;
  color: #2c1a0e;
}

/* Nút xóa sp */
.btn-remove {
  background: none;
  border: none;
  color: #ccc;
  font-size: 1.1rem;
  cursor: pointer;
  transition: color 0.2s;
  padding: 4px;
}

.btn-remove:hover { color: #e74c3c; }

/* ===== KHUNG TÓM TẮT ĐƠN HÀNG ===== */
.cart-summary {
  background: #fff;
  border-radius: 15px;
  padding: 2rem;
  box-shadow: 0 5px 20px rgba(0,0,0,0.08);
  position: sticky; /* dính theo khi cuộn trang */
  top: 80px;
}

.cart-summary h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: #2c1a0e;
  margin-bottom: 1.2rem;
}
 /* hiển thị tên bên trái và số tiền bên phải */
.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.92rem;
  color: #555;
  margin-bottom: 0.8rem;
}

.summary-row.total {
  font-size: 1.1rem;
  font-weight: 700;
  color: #2c1a0e;
  margin-top: 0.5rem;
}

.cart-summary hr {
  border: none;
  border-top: 1px solid #f0ece8;
  margin: 1rem 0;
}

.text-success { color: #27ae60; }

/* Mã giảm giá */
.promo-code {
  display: flex;
  gap: 8px;
  margin: 1.2rem 0;
}

.promo-code input {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 0.55rem 0.8rem;
  font-size: 0.88rem;
  outline: none;
}

.promo-code input:focus { border-color: #c8956c; }

.btn-apply {
  padding: 0.55rem 1rem;
  background: #3b2314;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

.btn-apply:hover { background: #c8956c; }

/* Nút thanh toán */
.btn-checkout {
  width: 100%;
  padding: 0.85rem;
  background: #c8956c;
  color: #fff;
  border: none;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  margin-bottom: 0.8rem;
}

.btn-checkout:hover {
  background: #b07d55;
  transform: translateY(-2px);
}

.btn-continue {
  display: block;
  text-align: center;
  font-size: 0.88rem;
  color: #888;
  text-decoration: underline;
}

.btn-continue:hover { color: #3b2314; }

/* ===== MODAL ===== */
.modal {
  display: none;
  position: fixed; /* cố định trên màn hình */
  inset: 0; /* che toàn bộ màn hình */
  background: rgba(0,0,0,0.5);
  z-index: 9999; /* nằm trên tất cả */
  align-items: center;
  justify-content: center;
}

.modal.active { display: flex; }

.modal-content {
  background: #fff;
  border-radius: 16px;
  padding: 2rem;
  width: 90%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

.modal-content h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: #2c1a0e;
  margin-bottom: 1.2rem;
}

.close {
  position: absolute;
  top: 1rem;
  right: 1.2rem;
  font-size: 1.5rem;
  cursor: pointer;
  color: #aaa;
  line-height: 1;
}

.close:hover { color: #333; }

.modal-content .form-group {
  margin-bottom: 1rem;
}

.modal-content .form-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: #2c1a0e;
  margin-bottom: 0.4rem;
}

.modal-content .form-group input,
.modal-content .form-group textarea {
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  resize: vertical;
}

.modal-content .form-group input:focus,
.modal-content .form-group textarea:focus {
  border-color: #c8956c;
}

/* Phương thức thanh toán */
.payment-methods {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.payment-option {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  color: #444;
  cursor: pointer;
  padding: 0.5rem;
  border: 1px solid #eee;
  border-radius: 8px;
  transition: border-color 0.2s;
}

.payment-option:hover { border-color: #c8956c; }

/* Modal thành công */
.success-content {
  text-align: center;
  padding: 3rem 2rem;
}

.success-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
}

.success-content h2 {
  color: #27ae60;
  margin-bottom: 0.5rem;
}

.success-content p {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 0.4rem;
}

/* ===== RESPONSIVE ===== */
/* Tự động chuyển layout từ 2 cột sang 1 cột khi màn hình nhỏ */
@media (max-width: 968px) {
  .cart-container {
    grid-template-columns: 1fr;
  }

  .cart-summary {
    position: static;
  }

  .cart-item {
    grid-template-columns: 100px 1fr;
  }

  .cart-item-actions {
    grid-column: 1 / -1;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

@media (max-width: 576px) {
  .cart-items,
  .cart-summary {
    padding: 1.5rem;
  }

  .cart-item {
    grid-template-columns: 80px 1fr;
    gap: 0.8rem;
    padding: 1rem 0;
  }

  .cart-item-image {
    width: 80px;
    height: 80px;
    font-size: 2rem;
  }
}