﻿/* ===================================================== */
/* CART.CSS                                              */
/* Giao dien gio hang dang drawer truot tu ben phai.     */
/* Khi body co class .cart-open, overlay va drawer mo ra.*/
/* ===================================================== */

/* Lop nen mo phu toan man hinh khi gio hang dang mo. */
.cart-fly-item {
  position: fixed;
  z-index: 120;
  overflow: hidden;
  border: 2px solid rgba(255, 250, 242, 0.92);
  border-radius: 20px;
  background-color: var(--color-cream);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  box-shadow:
    0 18px 38px rgba(54, 31, 19, 0.26),
    0 0 0 6px rgba(170, 63, 34, 0.08);
  pointer-events: none;
  will-change: transform, opacity;
}

.cart-button.is-cart-receiving {
  animation: cart-receive-bounce 580ms cubic-bezier(0.2, 0.85, 0.28, 1);
}

.cart-button.is-cart-receiving .cart-count {
  animation: cart-count-pop 580ms cubic-bezier(0.2, 0.85, 0.28, 1);
}

@keyframes cart-receive-bounce {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }

  38% {
    transform: translateY(-5px) scale(1.16) rotate(-7deg);
  }

  68% {
    transform: translateY(1px) scale(0.96) rotate(3deg);
  }
}

@keyframes cart-count-pop {
  0%,
  100% {
    transform: scale(1);
  }

  42% {
    transform: scale(1.42);
  }
}

@media (prefers-reduced-motion: reduce) {
  .cart-fly-item {
    display: none;
  }

  .cart-button.is-cart-receiving,
  .cart-button.is-cart-receiving .cart-count {
    animation: none;
  }
}

.cart-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(33, 17, 7, 0.38);
  opacity: 0;
  pointer-events: none;
  transition: opacity 260ms ease;
}

/* Panel gio hang chinh, truot vao tu ben phai. */
.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 75;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(430px, 100%);
  height: min(100vh, 100dvh);
  overflow: hidden;
  border-left: 1px solid rgba(91, 61, 44, 0.12);
  background: rgba(255, 250, 242, 0.96);
  box-shadow: -24px 0 70px rgba(33, 17, 7, 0.16);
  transform: translateX(102%);
  transition: transform 320ms ease;
}

/* Trang thai mo gio hang do cart.js them vao body. */
.cart-open .cart-overlay {
  opacity: 1;
  pointer-events: auto;
}

.cart-open .cart-drawer {
  transform: translateX(0);
}

/* Header chua tieu de va nut dong, footer chua tong tien va checkout. */
.cart-drawer__header,
.cart-drawer__footer {
  padding: 22px 28px;
}

.cart-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(91, 61, 44, 0.1);
}

.cart-drawer__header h2 {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 500;
}

.cart-drawer__header .icon-btn {
  width: 44px;
  height: 44px;
}

.cart-drawer__footer {
  max-height: 44dvh;
  overflow: auto;
  border-top: 1px solid rgba(91, 61, 44, 0.1);
  background: rgba(255, 250, 242, 0.98);
  box-shadow: 0 -16px 34px rgba(54, 31, 19, 0.07);
  scrollbar-width: thin;
}

/* Danh sach mon trong gio hang, co scroll khi nhieu mon. */
.cart-items {
  display: grid;
  gap: 0;
  align-content: start;
  padding: 12px 28px 16px;
  overflow: auto;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

/* Mot dong san pham trong gio hang. */
.cart-item {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr) 28px;
  gap: 12px;
  align-items: center;
  min-height: 78px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(91, 61, 44, 0.08);
}

.cart-item:last-child {
  border-bottom: 0;
}

.cart-item.is-invalid {
  margin: 4px -8px;
  padding: 10px 8px;
  border: 1px solid rgba(170, 63, 34, 0.28);
  border-radius: 10px;
  background: rgba(255, 241, 234, 0.7);
}

.cart-item__image {
  width: 66px;
  height: 66px;
  border-radius: 8px;
}

.cart-item > div:not(.cart-item__image) {
  min-width: 0;
}

.cart-item h3 {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.cart-item p {
  margin: 4px 0 0;
  color: var(--color-ink);
  font-size: 12px;
  font-weight: 800;
}

.cart-item .cart-item__warning {
  color: #a43e2d;
  font-size: 11px;
  line-height: 1.35;
}

.cart-item__reconfigure {
  margin-top: 7px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid currentColor;
  color: var(--color-clay);
  background: transparent;
  font-size: 11px;
  font-weight: 850;
}

/* Cum tang/giam so luong tung mon. */
.cart-qty {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 6px;
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 800;
}

.cart-qty .qty-btn {
  width: 26px;
  height: 26px;
  font-size: 14px;
}

.remove-btn {
  align-self: start;
  justify-self: end;
  width: 28px;
  height: 28px;
  color: var(--color-muted);
  background: transparent;
  font-size: 18px;
}

/* Cac dong tong tien, phi va VAT trong footer gio hang. */
.cart-total-line {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: var(--color-muted);
  font-size: 13px;
  padding: 5px 0;
}

/* VAT/MwSt chi la thong tin tach thue trong gia gross. */
.cart-total-line--tax {
  color: var(--color-muted-light);
  font-size: 11px;
  padding: 2px 0;
}

.cart-total-line strong {
  color: var(--color-ink);
  font-size: 21px;
}

.checkout-line-warning {
  display: block;
  margin-top: 3px;
  color: #a43e2d;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.35;
}

.cart-order-status {
  display: grid;
  gap: 4px;
  margin: 10px 0 12px;
  padding: 11px 14px;
  border: 1px solid rgba(91, 61, 44, 0.12);
  border-radius: 12px;
  background: rgba(246, 239, 229, 0.72);
  color: var(--color-muted);
  font-size: 11px;
  line-height: 1.45;
}

.cart-order-status strong {
  color: var(--color-ink);
  font-size: 12px;
}

.cart-order-status span {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.cart-order-status.is-open {
  border-color: rgba(24, 138, 79, 0.28);
  background: rgba(231, 246, 236, 0.78);
}

.cart-order-status.is-open strong {
  color: #087a3a;
}

.cart-order-status.is-closed {
  border-color: rgba(170, 63, 34, 0.24);
  background: rgba(255, 241, 234, 0.82);
}

.cart-order-status.is-closed strong {
  color: var(--color-clay);
}

.cart-drawer .btn.is-disabled {
  cursor: not-allowed;
  opacity: 0.48;
  pointer-events: auto;
}

.cart-drawer .btn {
  width: 100%;
  min-height: 44px;
  padding: 0 24px;
  justify-content: center;
}

.cart-empty {
  padding: 36px 0;
  color: var(--color-muted);
  text-align: center;
}

/* Mobile: drawer chiem tron chieu ngang, padding gon hon. */
@media (max-width: 520px) {
  .cart-drawer {
    width: 100%;
    box-shadow: 0 -16px 36px rgba(33, 17, 7, 0.16);
  }

  .cart-drawer__header,
  .cart-drawer__footer,
  .cart-items {
    padding-left: 16px;
    padding-right: 16px;
  }

  .cart-drawer__header,
  .cart-drawer__footer {
    padding-top: 16px;
    padding-bottom: 16px;
  }

  .cart-drawer__header h2 {
    font-size: 27px;
  }

  .cart-drawer__header .icon-btn {
    width: 40px;
    height: 40px;
  }

  .cart-drawer__footer {
    max-height: 40dvh;
  }

  .cart-items {
    padding-top: 8px;
    padding-bottom: 10px;
  }

  .cart-item {
    grid-template-columns: 58px minmax(0, 1fr) 26px;
    gap: 10px;
    min-height: 68px;
    padding: 6px 0;
  }

  .cart-item__image {
    width: 58px;
    height: 58px;
  }

  .cart-item h3 {
    font-size: 12px;
  }

  .cart-item p {
    margin-top: 3px;
    font-size: 11px;
  }

  .cart-qty {
    gap: 6px;
    margin-top: 4px;
  }

  .cart-qty .qty-btn {
    width: 24px;
    height: 24px;
  }

  .cart-total-line {
    font-size: 12px;
    padding: 4px 0;
  }

  .cart-total-line strong {
    font-size: 19px;
  }

  .cart-order-status {
    margin: 8px 0 10px;
    padding: 10px 12px;
  }

  .cart-drawer .btn {
    width: 100%;
    min-height: 42px;
  }

}
/* Item configurator: mobile-first variant and extras picker. */
body.item-config-open { overflow: hidden; }

.item-config-dialog {
  width: min(620px, calc(100vw - 32px));
  max-width: none;
  max-height: min(820px, calc(100dvh - 32px));
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 26px;
  color: var(--color-ink, #25170f);
  background: #fffdf9;
  box-shadow: 0 30px 90px rgba(35, 18, 9, 0.28);
}

.item-config-dialog::backdrop {
  background: rgba(35, 18, 9, 0.54);
  backdrop-filter: blur(5px);
}

.item-config-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-height: min(820px, calc(100dvh - 32px));
}

.item-config-header,
.item-config-footer {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 22px;
  background: rgba(255, 253, 249, 0.96);
  backdrop-filter: blur(14px);
}
.item-config-header { border-bottom: 1px solid rgba(78, 52, 35, 0.1); }
.item-config-footer { border-top: 1px solid rgba(78, 52, 35, 0.1); }
.item-config-header h2 { margin: 2px 0 0; font-size: clamp(22px, 4vw, 30px); line-height: 1.08; }
.item-config-kicker {
  color: var(--color-accent, #ad3f24);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.item-config-header .icon-btn {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 15px;
  font-size: 26px;
}

.item-config-content {
  padding: 18px 22px 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.item-config-description { margin: 0 0 18px; color: #725f51; line-height: 1.55; }
.item-config-group {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 17px;
  border: 1px solid rgba(78, 52, 35, 0.12);
  border-radius: 18px;
  background: #fffaf3;
}
.item-config-group + .item-config-group { margin-top: 13px; }
.item-config-group.is-incomplete { border-color: rgba(181, 72, 44, 0.36); }
.item-config-group legend {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 0 2px 7px;
}
.item-config-group legend span { font-size: 16px; font-weight: 850; }
.item-config-group legend small { color: #826d5e; font-size: 11px; font-weight: 750; }
.item-config-options { display: grid; gap: 8px; }
.item-config-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 58px;
  padding: 10px 13px;
  border: 1px solid rgba(78, 52, 35, 0.12);
  border-radius: 14px;
  color: inherit;
  background: #ffffff;
  text-align: left;
  cursor: pointer;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease, background 150ms ease;
}
.item-config-option:hover { transform: translateY(-1px); border-color: rgba(173, 63, 36, 0.36); }
.item-config-option.is-selected {
  border-color: var(--color-accent, #ad3f24);
  background: rgba(173, 63, 36, 0.055);
  box-shadow: 0 0 0 2px rgba(173, 63, 36, 0.11);
}
.item-config-option span { display: grid; gap: 3px; min-width: 0; }
.item-config-option strong { font-size: 14px; }
.item-config-option small { overflow: hidden; color: #8a7566; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.item-config-option b { flex: 0 0 auto; color: #3f2a1c; font-size: 13px; }
.item-config-hint { margin: 0; color: #a43e2d; font-size: 11px; font-weight: 750; }

.item-config-footer > div { display: grid; gap: 2px; }
.item-config-footer > div span { color: #826d5e; font-size: 11px; }
.item-config-footer > div strong { font-size: 20px; }
.item-config-footer .btn { min-width: 210px; min-height: 52px; }
.item-config-footer .btn:disabled { opacity: 0.45; cursor: not-allowed; }

.cart-item__choices {
  margin: 2px 0 5px !important;
  color: #826d5e !important;
  font-size: 11px !important;
  line-height: 1.4 !important;
}

@media (max-width: 620px) {
  .item-config-dialog {
    width: 100%;
    max-height: calc(100dvh - 10px);
    margin: auto 0 0;
    border-radius: 24px 24px 0 0;
  }
  .item-config-shell { max-height: calc(100dvh - 10px); }
  .item-config-header { padding: 17px 18px; }
  .item-config-content { padding: 15px 16px 22px; }
  .item-config-group { padding: 14px; }
  .item-config-footer {
    align-items: stretch;
    padding: 13px 16px calc(13px + env(safe-area-inset-bottom));
  }
  .item-config-footer .btn { flex: 1; min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .item-config-option { transition: none; }
}
