/* ─────────────────────────────────────────────────────────────────────────
   Giỏ hàng: nút+badge, toast, ngăn kéo. Dùng token toàn cục (App.css) để đồng
   bộ light/dark với cả editor lẫn storefront.
   ───────────────────────────────────────────────────────────────────────── */

/* ── Nút giỏ ── */
.cart-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 9px;
  border: 1px solid var(--border, rgba(0, 0, 0, 0.1));
  background: var(--bg-card, #fff);
  color: var(--text-primary, #1d1d1f);
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.cart-btn:hover { border-color: var(--border-strong, rgba(0, 0, 0, 0.2)); }
.cart-btn svg { width: 19px; height: 19px; }

.cart-btn__badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #e11d48;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--bg-header, #fff);
}

/* ── Toast ── */
.cart-toast {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  z-index: 300;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border: none;
  border-radius: 999px;
  background: #131316;
  color: #f4f4f5;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  animation: cartToastIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes cartToastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
.cart-toast svg { width: 17px; height: 17px; color: #FFD100; flex-shrink: 0; }
.cart-toast__view { color: #FFD100; text-decoration: underline; }

/* ── Overlay + ngăn kéo ── */
.cart-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.42);
  animation: cartFade 0.18s ease both;
}
@keyframes cartFade { from { opacity: 0; } to { opacity: 1; } }

.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 210;
  width: min(420px, 92vw);
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg-app, #f7f6f3);
  border-left: 1px solid var(--border, rgba(0, 0, 0, 0.1));
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.16);
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  visibility: hidden;
}
.cart-drawer.is-open { transform: translateX(0); visibility: visible; }

.cart-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border, rgba(0, 0, 0, 0.08));
  background: var(--bg-header, #fff);
}
.cart-drawer__title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 17px;
  font-weight: 800;
  color: var(--text-primary, #1d1d1f);
}
.cart-drawer__count {
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: #131316;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
}
[data-theme='dark'] .cart-drawer__count { background: #FFD100; color: #131313; }
.cart-drawer__close {
  display: inline-flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary, #636366);
  cursor: pointer;
}
.cart-drawer__close:hover { background: var(--btn-ghost-hover, rgba(0, 0, 0, 0.05)); }
.cart-drawer__close svg { width: 20px; height: 20px; }

/* ── Trống ── */
.cart-empty {
  flex: 1 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 40px;
  text-align: center;
  color: var(--text-tertiary, #8e8e93);
}
.cart-empty svg { width: 54px; height: 54px; opacity: 0.5; }
.cart-empty p { margin: 0; font-size: 15px; font-weight: 600; }
.cart-empty__cta {
  padding: 10px 20px;
  border-radius: 10px;
  background: #131316;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
}
[data-theme='dark'] .cart-empty__cta { background: #FFD100; color: #131313; }

/* ── Danh sách ── */
.cart-drawer__body {
  flex: 1 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cart-line {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border, rgba(0, 0, 0, 0.08));
  border-radius: 12px;
}
.cart-line__thumb {
  flex-shrink: 0;
  width: 62px;
  height: 62px;
  border-radius: 9px;
  overflow: hidden;
  border: 1px solid var(--border, rgba(0, 0, 0, 0.08));
  background: var(--bg-input, #f5f5f7);
}
.cart-line__thumb img { width: 100%; height: 100%; object-fit: cover; }

.cart-line__main { flex: 1 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.cart-line__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.cart-line__name {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-primary, #1d1d1f);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cart-line__remove {
  flex-shrink: 0;
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-tertiary, #8e8e93);
  cursor: pointer;
}
.cart-line__remove:hover { background: #fdeaea; color: #d33; }
.cart-line__remove svg { width: 16px; height: 16px; }

.cart-line__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-secondary, #636366);
}
.cart-line__swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}
.cart-line__sizes { font-size: 12.5px; color: var(--text-tertiary, #8e8e93); }

.cart-edit {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-gap: 6px;
  gap: 6px;
  margin: 6px 0 2px;
}
.cart-edit--single { grid-template-columns: 1fr; }
.cart-edit__cell { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.cart-edit__cell > span { font-size: 11px; font-weight: 700; color: var(--text-secondary, #636366); }

.cart-line__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}
.cart-line__edit {
  border: none;
  background: transparent;
  padding: 0;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary, #131316);
  cursor: pointer;
  text-decoration: underline;
}
.cart-line__total {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--text-primary, #1d1d1f);
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}

/* ── Chân giỏ ── */
.cart-drawer__foot {
  border-top: 1px solid var(--border, rgba(0, 0, 0, 0.08));
  background: var(--bg-header, #fff);
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0));
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.cart-sum {
  display: flex;
  justify-content: space-between;
  font-size: 13.5px;
  color: var(--text-secondary, #636366);
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}
.cart-sum--grand {
  padding-top: 8px;
  margin-top: 2px;
  border-top: 1px dashed var(--border-strong, rgba(0, 0, 0, 0.14));
  font-size: 16px;
  color: var(--text-primary, #1d1d1f);
}
.cart-sum--grand strong { font-weight: 800; }
.cart-note {
  font-size: 11.5px;
  color: #55555c;
  background: #f4f4f5;
  border: 1px solid #e4e4e7;
  border-radius: 9px;
  padding: 7px 10px;
  line-height: 1.45;
}
.cart-checkout { width: 100%; margin-top: 4px; justify-content: center; }
.cart-continue {
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary, #131316);
  text-decoration: none;
  padding: 4px;
}
.cart-continue:hover { text-decoration: underline; }
.cart-fineprint { margin: 0; font-size: 11px; color: var(--text-tertiary, #8e8e93); text-align: center; line-height: 1.4; }

.cart-note--vip {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #131316;
  background: #f4f4f5;
  border-color: #e4e4e7;
}
.cart-note--vip svg { width: 16px; height: 16px; flex-shrink: 0; color: #c9a200; }

[data-theme='dark'] .cart-note { color: #a6a6af; background: #242429; border-color: #3b3b42; }
[data-theme='dark'] .cart-note--vip { color: #ededee; background: #242429; border-color: #3b3b42; }
[data-theme='dark'] .cart-note--vip svg { color: #f2c94c; }
[data-theme='dark'] .cart-line__remove:hover { background: #3a1a1a; color: #f0796a; }

@media (max-width: 768px) {
  .cart-drawer { width: 100vw; }
  .cart-toast { bottom: 92px; }
}

/* Badge "pop" khi số lượng đổi (span remount qua key={count}) */
.cart-btn__badge { animation: cartBadgePop 0.34s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes cartBadgePop {
  0%   { transform: scale(0.4); }
  55%  { transform: scale(1.28); }
  100% { transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) { .cart-btn__badge { animation: none; } }

/* Hàng nút sửa trong dòng giỏ (Sửa thiết kế · Sửa số lượng) */
.cart-line__edits { display: flex; gap: 12px; align-items: center; }
.cart-line__edit--muted { color: var(--text-tertiary, #8e8e93); }

/* Color picker trong "Đặt nhanh" catalog (AddToCartDialog) */
.atc-colorgroups { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.atc-colorgroup__swatches { display: flex; flex-wrap: wrap; gap: 7px; }
.atc-swatch {
  width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.14);
  cursor: pointer; padding: 0;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.atc-swatch:hover { transform: scale(1.1); }
.atc-swatch--on { box-shadow: 0 0 0 2px var(--bg-card, #fff), 0 0 0 4px var(--accent, #131316); }

/* ══════════════════════════════════════════════
   Thư viện ảnh sản phẩm thật (proof) — section đáy trang + lightbox
   Dùng theme token của app (--bg-*, --text-*, --border-*, --accent).
   ══════════════════════════════════════════════ */

/* ─── Section "Sản phẩm thật" ở đáy trang chính ─── */
.proof-section {
  flex: 0 0 auto;
  border-top: 1px solid var(--border-input, #e5e5ea);
  background: var(--bg-sidebar, #f5f5f7);
  padding: 44px 20px 64px;
}
.proof-section__inner { max-width: 1120px; margin: 0 auto; }

.proof-section__head { text-align: center; margin: 0 auto 22px; max-width: 640px; }
.proof-section__eyebrow {
  display: inline-block; margin-bottom: 8px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent, #131316);
}
.proof-section__title { font-size: 26px; font-weight: 800; color: var(--text-primary); margin: 0 0 8px; line-height: 1.2; }
.proof-section__sub { font-size: 14px; color: var(--text-secondary); margin: 0; line-height: 1.6; }
.proof-section__trust {
  justify-content: center; margin-top: 14px;
}
.proof-section__cats { justify-content: center; margin: 0 0 20px; }

.proof-section__grid { }

/* ─── Thanh uy tín (dùng chung) ─── */
.proof__trust {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  font-size: 13px; color: var(--text-secondary);
}
.proof__trust b { color: var(--text-primary); font-weight: 700; }
.proof__dot { color: var(--text-tertiary); }

/* ─── Chip lọc (dùng chung) ─── */
.proof__cats { display: flex; gap: 8px; flex-wrap: wrap; }
.proof__chip {
  padding: 7px 15px; border-radius: 999px;
  border: 1px solid var(--border-input, #e5e5ea);
  background: var(--bg-card, #fff); cursor: pointer;
  font-family: inherit; font-size: 12.5px; font-weight: 600;
  color: var(--text-secondary); transition: all 0.15s;
}
.proof__chip:hover { border-color: var(--accent, #1d1d1f); color: var(--text-primary); }
.proof__chip--active {
  background: var(--accent, #1d1d1f); color: #fff;
  border-color: var(--accent, #1d1d1f);
}

/* ─── Lưới ảnh vuông (dùng chung) ─── */
.proof__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  grid-gap: 14px;
  gap: 14px;
}
.proof__cell {
  position: relative;
  aspect-ratio: 1; width: 100%;
  border-radius: 14px; overflow: hidden;
  border: 1px solid var(--border-input, #e5e5ea);
  /* Skeleton shimmer nền — hiện sau ảnh cho tới khi ảnh Cloudinary tải xong */
  background: var(--bg-input, #eeedf0)
    linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.55) 45%, transparent 70%)
    0 0 / 220% 100% no-repeat;
  animation: proofShimmer 1.35s ease-in-out infinite;
  padding: 0; cursor: pointer; font-family: inherit;
  transition: transform 0.14s, border-color 0.15s, box-shadow 0.15s;
}
[data-theme="dark"] .proof__cell {
  background: var(--bg-input, #1e1e1e)
    linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.08) 45%, transparent 70%)
    0 0 / 220% 100% no-repeat;
}
/* Ảnh đã tải → tắt shimmer nền (khỏi loang qua ảnh có alpha) */
.proof__cell:has(.proof__img.is-loaded) { animation: none; background-image: none; }
@keyframes proofShimmer {
  0% { background-position: 140% 0; }
  100% { background-position: -40% 0; }
}
.proof__cell:hover {
  transform: translateY(-3px);
  border-color: var(--accent, #1d1d1f);
  box-shadow: var(--shadow-md, 0 4px 24px rgba(0,0,0,0.1));
}
.proof__img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  opacity: 0;
  transition: opacity 0.45s ease;
}
.proof__img.is-loaded { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .proof__cell { animation: none; }
  .proof__img { transition: none; opacity: 1; }
}
.proof__cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column; gap: 1px;
  padding: 22px 12px 10px; text-align: left;
  background: linear-gradient(to top, rgba(0,0,0,0.74), rgba(0,0,0,0));
  transform: translateY(100%); transition: transform 0.18s ease;
}
.proof__cell:hover .proof__cap { transform: translateY(0); }
.proof__cap-org { font-size: 13px; font-weight: 700; color: #fff; }
.proof__cap-desc { font-size: 11.5px; color: rgba(255,255,255,0.85); }

.proof__empty { padding: 48px 0; text-align: center; color: var(--text-tertiary); font-size: 13.5px; }

/* ─── Lightbox (xem ảnh lớn) — nền tối cả 2 theme ─── */
.lb {
  position: fixed; inset: 0; z-index: 3800;
  background: rgba(0,0,0,0.92);
  display: flex; align-items: center; justify-content: center;
  animation: lb-in 0.15s ease;
}
@keyframes lb-in { from { opacity: 0; } to { opacity: 1; } }
.lb__figure { margin: 0; max-width: 92vw; max-height: 92vh; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.lb__img { max-width: 92vw; max-height: 82vh; object-fit: contain; border-radius: 10px; background: #111; }
.lb__cap { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: center; color: #fff; font-size: 13px; }
.lb__cap-text { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; justify-content: center; }
.lb__org { font-weight: 700; }
.lb__desc { color: rgba(255,255,255,0.78); }
.lb__count { color: rgba(255,255,255,0.6); font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; }
.lb__close {
  position: absolute; top: 16px; right: 18px;
  width: 40px; height: 40px; border-radius: 50%;
  border: none; background: rgba(255,255,255,0.14); color: #fff;
  cursor: pointer; font-size: 17px; line-height: 1;
}
.lb__close:hover { background: rgba(255,255,255,0.26); }
.lb__nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 46px; height: 46px; border-radius: 50%;
  border: none; background: rgba(255,255,255,0.14); color: #fff;
  cursor: pointer; font-size: 26px; line-height: 1; padding-bottom: 3px;
}
.lb__nav:hover { background: rgba(255,255,255,0.26); }
.lb__nav--prev { left: 14px; }
.lb__nav--next { right: 14px; }

/* ─── Nút mở thư viện ở header ─── */
.btn--proof svg { width: 15px; height: 15px; }

/* ─── Dark mode: chữ tối trên nền accent vàng ─── */
[data-theme="dark"] .proof__chip--active { color: #0d0d0d; }

@media (max-width: 768px) {
  .proof-section { padding: 32px 15px 48px; }
  .proof-section__title { font-size: 21px; }
  .proof__grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
  /* Mobile không có hover → hiện nhẹ tên khách để vẫn có ngữ cảnh */
  .proof__cap { transform: translateY(0); padding: 16px 9px 7px; }
  .proof__cap-desc { display: none; }
}

