a,
button,
div {
  -webkit-tap-highlight-color: transparent;
}

:root {
  --gold: #f5c542;
  --black: #0b0b0b;
  --dark: #151515;
  --border: #333333;
  --text: #ffffff;
  --muted: #b8b8b8;

  --cart-font: "Chakra Petch", "Poppins", sans-serif;
}

/* Overlay */
.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.68);
  opacity: 0;
  visibility: hidden;
  z-index: 9998;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.cart-sidebar.active + .cart-overlay {
  opacity: 1;
  visibility: visible;
}

body.cart-open {
  overflow: hidden !important;
}

/* Sidebar */
.cart-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 360px;
  max-width: calc(100vw - 16px);
  height: 100vh;
  height: 100dvh;
  background: var(--black);
  color: var(--text);
  padding: 22px;
  border-left: 1px solid rgba(245, 197, 66, 0.25);
  z-index: 10000;
  overflow: hidden;
  box-shadow: -8px 0 22px rgba(0, 0, 0, 0.35);
  transform: translateX(105%);
  transition: transform 0.28s ease;
}

.cart-sidebar.active {
  transform: translateX(0);
}

/* Fixed footer background inside cart */
.cart-sidebar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 220px;
  background: var(--black);
  border-top: 1px solid var(--border);
  z-index: 4;
  pointer-events: none;
}

/* Header */
.cart-header {
  position: relative;
  z-index: 12;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.cart-sidebar h2,
.cart-header h2 {
  margin: 0;
  color: var(--gold);
  font-size: 30px;
  font-weight: 700;
  font-family: var(--cart-font);
  letter-spacing: 0.01em;
  line-height: 1;
}

.close-cart-btn {
  width: 36px;
  height: 36px;
  background: var(--dark);
  border: 1px solid rgba(245, 197, 66, 0.25);
  border-radius: 50%;
  color: var(--gold);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.close-cart-btn:hover {
  background: var(--gold);
  color: #111111;
  transform: scale(1.05);
}

/* Cart scroll area */
.cart-preview {
  margin-top: 18px;
  height: calc(100vh - 100px);
  height: calc(100dvh - 100px);
  padding: 2px 4px 245px 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

/* Hide scrollbar but keep scrolling */
.cart-preview::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

/* Empty cart */
.empty-cart {
  text-align: center;
  padding: 42px 18px;
  color: var(--muted);
  border: 1px dashed rgba(245, 197, 66, 0.3);
  border-radius: 16px;
  background: var(--dark);
}

.empty-cart-img {
  max-width: 110px;
  margin-bottom: 12px;
  opacity: 0.65;
}

/* Cart item */
.cart-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 14px;
}

.cart-with-thumb {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding: 12px;
  background: var(--dark);
  border: 1px solid rgba(245, 197, 66, 0.16);
  border-radius: 14px;
  position: relative;
  transition: transform 0.2s ease, border-color 0.2s ease;
  touch-action: pan-y;
}

.cart-with-thumb:hover {
  transform: translateY(-1px);
  border-color: rgba(245, 197, 66, 0.38);
}

.cart-with-thumb.swipe-left {
  transform: translateX(-100%);
  opacity: 0;
}

.cart-item-thumb img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid rgba(245, 197, 66, 0.25);
  background: #101010;
}

.cart-item-details {
  flex-grow: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 14px;
  color: var(--muted);
}

.cart-item-details strong,
.cart-item-details b,
.cart-item-details span:first-child {
  color: var(--text);
  font-weight: 700;
}

/* Quantity controls */
.quantity-controls {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 6px;
}

.quantity-btn {
  width: 24px;
  height: 24px;
  background: var(--gold);
  border: none;
  border-radius: 50%;
  color: #111111;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.quantity-btn:hover {
  background: #ffd95c;
  transform: scale(1.05);
}

.quantity-btn:active {
  transform: scale(0.94);
}

.quantity-controls span {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

/* Remove button */
.remove-btn {
  width: 36px;
  height: 36px;
  min-width: 36px;
  background: transparent;
  border: 1px solid rgba(245, 197, 66, 0.28);
  border-radius: 10px;
  color: var(--gold);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
  overflow: hidden;
  flex-shrink: 0;
  transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.remove-btn::before {
  content: "×";
  font-size: 24px;
  line-height: 1;
  font-weight: 800;
  color: var(--gold);
}

.remove-btn:hover {
  background: rgba(245, 197, 66, 0.1);
  border-color: rgba(245, 197, 66, 0.5);
  transform: scale(1.06);
}

.remove-btn:active {
  transform: scale(0.94);
}

.trash-icon {
  display: none;
}

/* Footer note */
.cart-footer-note {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 153px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0 12px;
  background: var(--black);
  border-bottom: 1px solid rgba(245, 197, 66, 0.12);
}

.cart-footer-badge {
  font-family: var(--cart-font);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: #111111;
  background: var(--gold);
  padding: 6px 9px;
  border-radius: 6px;
  white-space: nowrap;
  font-weight: 700;
}

.cart-footer-text {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-align: right;
  line-height: 1.4;
}

/* Total area */
.cart-total {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 88px;
  padding: 15px 0 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text);
  background: var(--black);
  z-index: 20;
  font-family: var(--cart-font) !important;
  font-size: 34px !important;
  line-height: 1 !important;
}

/* Total label */
.cart-total span:first-child,
.cart-total strong:first-child,
.cart-total b:first-child {
  color: var(--gold) !important;
  font-family: var(--cart-font) !important;
  font-weight: 700 !important;
  font-size: 28px !important;
  line-height: 1 !important;
  letter-spacing: 0.01em !important;
}

/* Total amount */
.cart-total span:last-child,
.cart-total strong:last-child,
.cart-total b:last-child,
.cart-total .amount,
.cart-total .cart-total-price,
.cart-total .total-price,
.cart-total .price {
  color: var(--text) !important;
  font-family: var(--cart-font) !important;
  font-weight: 700 !important;
  font-size: 34px !important;
  line-height: 1 !important;
  letter-spacing: 0.01em !important;
  font-variant-numeric: tabular-nums !important;
}

/* Checkout button */
.checkout-btn {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 32px;
  width: auto;
  margin-top: 0;
  background: var(--gold);
  color: #111111;
  border: none;
  padding: 14px;
  border-radius: 12px;
  font-family: var(--cart-font) !important;
  font-size: 22px !important;
  font-weight: 700 !important;
  letter-spacing: 0.01em;
  cursor: pointer;
  z-index: 21;
  box-shadow: 0 8px 18px rgba(245, 197, 66, 0.14);
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.checkout-btn:hover {
  background: #ffd95c;
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(245, 197, 66, 0.18);
}

.checkout-btn:active {
  transform: scale(0.98);
}

/* Undo snackbar */
.undo-snackbar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #111111;
  color: var(--text);
  border: 1px solid var(--gold);
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  display: none;
  z-index: 10050;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.undo-snackbar button {
  background: transparent;
  border: none;
  color: var(--gold);
  font-weight: 800;
  cursor: pointer;
  margin-left: 8px;
}

/* Floating cart button hidden on desktop */
.floating-cart {
  display: none;
}

/* Floating cart button only for mobile/tablet */
@media (max-width: 991px) {
  .floating-cart {
    position: fixed;
    right: 16px;
    bottom: 82px;
    width: 50px;
    height: 50px;
    background: #111111;
    border: 1px solid rgba(245, 197, 66, 0.45);
    border-radius: 16px;
    display: grid;
    place-items: center;
    cursor: pointer;
    z-index: 9997;
    box-shadow: 0 7px 18px rgba(0, 0, 0, 0.32);
    transition: transform 0.2s ease, background 0.2s ease;
  }

  .floating-cart:hover {
    background: #181818;
    transform: translateY(-2px);
  }

  .cart-img-mobile {
    width: 21px;
    height: 21px;
  }

  .floating-cart .cart-badge {
    top: -6px;
    right: -6px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    font-size: 10px;
  }
}

.cart-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: var(--gold);
  color: #111111;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 900;
  display: grid;
  place-items: center;
  border: 2px solid #111111;
}

.cart-wrapper {
  position: relative;
}

.cart-wrapper .cart-badge {
  top: -10px;
  right: -10px;
}

/* Mobile */
@media (max-width: 520px) {
  .cart-sidebar {
    width: 100%;
    max-width: 100%;
    padding: 18px;
    transform: translateX(100%);
  }

  .cart-sidebar.active {
    transform: translateX(0);
  }

  .cart-sidebar::after {
    height: 220px;
  }

  .cart-preview {
    height: calc(100vh - 92px);
    height: calc(100dvh - 92px);
    padding-bottom: 245px;
  }

  .cart-footer-note {
    left: 18px;
    right: 18px;
    bottom: 150px;
  }

  .cart-total {
    left: 18px;
    right: 18px;
    bottom: 86px;
    font-size: 34px !important;
  }

  .cart-total span:first-child,
  .cart-total strong:first-child,
  .cart-total b:first-child {
    font-size: 28px !important;
  }

  .cart-total span:last-child,
  .cart-total strong:last-child,
  .cart-total b:last-child,
  .cart-total .amount,
  .cart-total .cart-total-price,
  .cart-total .total-price,
  .cart-total .price {
    font-size: 34px !important;
  }

  .checkout-btn {
    left: 18px;
    right: 18px;
    bottom: 30px;
    font-size: 22px !important;
  }

  .cart-with-thumb {
    padding: 11px;
    gap: 10px;
  }

  .cart-item-thumb img {
    width: 38px;
    height: 38px;
  }

  .remove-btn {
    width: 34px;
    height: 34px;
    min-width: 34px;
  }

  .floating-cart {
    right: 15px;
    bottom: 80px;
    width: 48px;
    height: 48px;
    border-radius: 15px;
  }

  .cart-img-mobile {
    width: 20px;
    height: 20px;
  }

  .floating-cart .cart-badge {
    min-width: 19px;
    height: 19px;
    font-size: 10px;
  }

  .undo-snackbar {
    width: calc(100vw - 32px);
    text-align: center;
  }

  .cart-footer-text {
    font-size: 10px;
  }

  .cart-footer-badge {
    font-size: 11px;
    padding: 6px 8px;
  }
}