/* Giỏ hàng công khai (cart-website01) — modal chọn sản phẩm + giá, gọi cart-manager
   qua proxy /api/cart-website01/. Namespace riêng "cwcart-*", không đụng tới hệ CMS. */

.cwcart-overlay {
  display: none; position: fixed; inset: 0; z-index: 500;
  background: rgba(15, 23, 42, .55); backdrop-filter: blur(6px);
  align-items: center; justify-content: center; padding: 20px;
}
.cwcart-overlay.open { display: flex; }

.cwcart-modal {
  width: 100%; max-width: 1220px; max-height: 88vh; display: flex; flex-direction: column;
  background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow-xl);
  overflow: hidden;
}

.cwcart-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px; border-bottom: 1px solid var(--gray-light); flex-shrink: 0;
}
.cwcart-head h3 { font-size: 1.15rem; font-weight: 800; color: var(--navy); }
.cwcart-close { font-size: 1.3rem; color: var(--gray); line-height: 1; padding: 4px 8px; }
.cwcart-close:hover { color: var(--navy); }

.cwcart-body { flex: 1; overflow: hidden; display: flex; min-height: 0; }

.cwcart-cats {
  width: 200px; flex-shrink: 0; border-right: 1px solid var(--gray-light);
  overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 4px;
}
.cwcart-cat-btn {
  text-align: left; padding: 10px 12px; border-radius: var(--radius-sm);
  font-size: .87rem; font-weight: 600; color: var(--gray);
}
.cwcart-cat-btn:hover { background: var(--gray-pale); color: var(--navy); }
.cwcart-cat-btn.active { background: var(--gold); color: var(--white); }

.cwcart-products { flex: 1; overflow-y: auto; padding: 16px 20px; background: var(--gray-pale); }
.cwcart-loading, .cwcart-empty { text-align: center; color: var(--gray); padding: 40px 0; font-size: .9rem; }

.cwcart-cat-group { margin-bottom: 26px; }
.cwcart-cat-title { font-size: .82rem; font-weight: 800; color: var(--gold-dark); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 12px; }

/* ---- luoi the san pham ---- */
.cwcart-card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px;
}
.cwcart-card {
  display: flex; flex-direction: column; background: var(--white); border: 1px solid var(--gray-light);
  border-radius: var(--radius-sm); overflow: hidden; transition: .15s ease;
}
.cwcart-card:hover { border-color: var(--gold); box-shadow: var(--shadow); }
.cwcart-card-img { width: 100%; height: 130px; background: var(--white); flex-shrink: 0; }
.cwcart-card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cwcart-card-body { padding: 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.cwcart-card-name {
  font-size: .88rem; font-weight: 700; color: var(--navy); line-height: 1.35; min-height: 2.4em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.cwcart-card-desc {
  font-size: .76rem; color: var(--gray); line-height: 1.45; margin-top: -4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.cwcart-variant-select {
  width: 100%; padding: 8px 10px; border: 1px solid var(--gray-light);
  border-radius: var(--radius-sm); font-size: .78rem; font-weight: 600; color: var(--navy); background: var(--gray-pale);
}
.cwcart-variant-select:focus { outline: none; border-color: var(--gold); }
.cwcart-card-price { font-size: 1rem; font-weight: 800; color: var(--gold-dark); }
.cwcart-card-qty { margin-top: auto; padding-top: 4px; justify-content: center; }

/* ---- cot ben phai: san pham da chon ---- */
.cwcart-selected {
  width: 270px; flex-shrink: 0; border-left: 1px solid var(--gray-light);
  overflow-y: auto; padding: 16px; background: var(--gray-pale);
}
.cwcart-selected-title { font-size: .82rem; font-weight: 800; color: var(--navy); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 12px; }
.cwcart-selected-empty { font-size: .82rem; color: var(--gray); text-align: center; padding: 30px 0; }
.cwcart-selected-item {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 0;
  border-bottom: 1px solid var(--gray-light);
}
.cwcart-selected-item:last-child { border-bottom: none; }
.cwcart-selected-thumb {
  width: 44px; height: 44px; border-radius: var(--radius-sm); object-fit: cover;
  background: var(--white); flex-shrink: 0; border: 1px solid var(--gray-light);
}
.cwcart-selected-info { flex: 1; min-width: 0; }
.cwcart-selected-name { font-size: .8rem; font-weight: 600; color: var(--navy); line-height: 1.3; }
.cwcart-selected-meta { font-size: .76rem; color: var(--gray); margin-top: 3px; display: flex; justify-content: space-between; gap: 6px; }
.cwcart-selected-meta strong { color: var(--gold-dark); }
.cwcart-selected-remove { font-size: .95rem; color: var(--gray); flex-shrink: 0; padding: 2px 4px; }
.cwcart-selected-remove:hover { color: var(--danger); }

.cwcart-qty { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.cwcart-qty-btn {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--gray-light);
  display: flex; align-items: center; justify-content: center; font-size: 1.05rem; font-weight: 700; color: var(--navy);
}
.cwcart-qty-btn:hover { background: var(--gray-pale); }
.cwcart-qty-val { width: 28px; text-align: center; font-size: .95rem; font-weight: 700; }

.cwcart-foot {
  flex-shrink: 0; border-top: 1px solid var(--gray-light); padding: 16px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; background: var(--gray-pale);
}
.cwcart-summary { font-size: .87rem; color: var(--navy); }
.cwcart-summary strong { color: var(--gold-dark); font-size: 1rem; }
.cwcart-foot .btn:disabled { opacity: .5; cursor: not-allowed; }

/* nut phu tren nen sang (footer/form cua modal) - .btn-ghost cua site von danh
   cho nen toi (chu trang), dat len day se bi mo, nen dung class rieng nay. */
.cwcart-btn-secondary { background: var(--white); color: var(--navy); border: 1.5px solid var(--gray-light); }
.cwcart-btn-secondary:hover { background: var(--gray-pale); border-color: var(--gray); }

.cwcart-form { padding: 20px 24px; overflow-y: auto; }
.cwcart-field { margin-bottom: 14px; }
.cwcart-field label { display: block; font-size: .82rem; font-weight: 700; margin-bottom: 6px; color: var(--navy); }
.cwcart-field input, .cwcart-field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--gray-light); border-radius: var(--radius-sm); font-size: .9rem;
}
.cwcart-field input:focus, .cwcart-field textarea:focus { outline: none; border-color: var(--gold); }
.cwcart-field textarea { resize: vertical; min-height: 60px; }
.cwcart-order-summary { background: var(--gray-pale); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 16px; font-size: .85rem; color: var(--navy); }
.cwcart-order-summary div { display: flex; justify-content: space-between; padding: 3px 0; }

/* ---- the "Tom Tat Don Hang" o buoc checkout ---- */
.cwcart-summary-card {
  border: 1px solid var(--gray-light); border-radius: var(--radius); padding: 18px 20px;
  margin-bottom: 18px; background: var(--white);
}
.cwcart-summary-card h4 { font-size: 1rem; font-weight: 800; color: var(--navy); margin-bottom: 4px; }
.cwcart-summary-line {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 0; border-bottom: 1px solid var(--gray-light); font-size: .88rem; color: var(--navy);
}
.cwcart-summary-line:last-of-type { border-bottom: none; }
.cwcart-ship-free {
  font-size: .74rem; font-weight: 700; color: var(--accent-2);
  background: #ecfdf5; border-radius: 999px; padding: 3px 10px;
}
.cwcart-summary-total {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 12px; margin-top: 4px; border-top: 1px solid var(--gray-light);
}
.cwcart-summary-total span:first-child { font-size: .95rem; font-weight: 800; color: var(--navy); }
.cwcart-summary-total span:last-child { font-size: 1.2rem; font-weight: 800; color: var(--gold-dark); }

.cwcart-msg { font-size: .85rem; margin-top: 4px; display: none; }
.cwcart-msg.show { display: block; }
.cwcart-msg.error { color: var(--danger); }
.cwcart-msg.success { text-align: center; padding: 30px 10px; }
.cwcart-msg.success strong { display: block; font-size: 1.1rem; color: var(--gold-dark); margin-bottom: 6px; }

.cwcart-badge {
  position: absolute; top: -4px; right: -4px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px; background: var(--gold); color: var(--white); font-size: .65rem; font-weight: 800;
  display: none; align-items: center; justify-content: center; line-height: 1;
}
.cwcart-badge.show { display: flex; }

@media (max-width: 900px) {
  .cwcart-selected { display: none; }
}

@media (max-width: 640px) {
  .cwcart-body { flex-direction: column; }
  .cwcart-cats { width: 100%; flex-direction: row; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--gray-light); }
  .cwcart-cat-btn { flex-shrink: 0; white-space: nowrap; }
  .cwcart-card-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .cwcart-card-img { height: 100px; }
  .cwcart-card-name { font-size: .8rem; }
  .cwcart-foot { flex-direction: column; align-items: stretch; }
}
