/* ============================================
   THAJVI ATTIRE — Cart Styles (cart.css)
   Black & Gold luxury cart system
   ============================================ */

/* ===== NAVBAR CART BUTTON ===== */
.nav-cart-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gold);
  padding: 6px;
  transition: color 0.2s;
}
.nav-cart-btn:hover { color: var(--gold-light); }
.navbar:not(.scrolled) .nav-cart-btn { color: var(--gold-light); }

.nav-cart-btn.bounce {
  animation: cartBounce 0.5s ease;
}
@keyframes cartBounce {
  0%, 100% { transform: scale(1); }
  30% { transform: scale(1.3); }
  60% { transform: scale(0.9); }
}

/* Cart count badge */
.cart-badge {
  position: absolute;
  top: -4px;
  right: -6px;
  background: var(--gold);
  color: #0A0A0A;
  font-size: 0.6rem;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.cart-badge.visible {
  opacity: 1;
  transform: scale(1);
}
.cart-badge.bounce {
  animation: badgePop 0.4s ease;
}
@keyframes badgePop {
  0% { transform: scale(1); }
  50% { transform: scale(1.4); }
  100% { transform: scale(1); }
}

/* ===== CART DRAWER OVERLAY ===== */
.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 1050;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}
.cart-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* ===== CART DRAWER ===== */
.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  height: 100vh;
  background: #0F0F0F;
  border-left: 1px solid rgba(201,168,76,0.15);
  z-index: 1051;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -10px 0 40px rgba(0,0,0,0.5);
}
.cart-drawer.open {
  transform: translateX(0);
}

/* Drawer Header */
.cart-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px;
  border-bottom: 1px solid rgba(201,168,76,0.1);
  flex-shrink: 0;
}
.cart-drawer-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--gold-light);
  margin: 0;
}
.cart-drawer-count {
  font-size: 0.8rem;
  color: var(--muted);
  margin-left: 8px;
}
.cart-drawer-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.6rem;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  border-radius: 6px;
  transition: background 0.2s, color 0.2s, transform 0.3s;
}
.cart-drawer-close:hover {
  background: rgba(201,168,76,0.1);
  color: var(--gold);
  transform: rotate(90deg);
}

/* Drawer Body */
.cart-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
  -webkit-overflow-scrolling: touch;
}

/* Cart Item */
.cart-item {
  display: flex;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid rgba(201,168,76,0.08);
}
.cart-item:last-child { border-bottom: none; }

.cart-item-img {
  width: 70px;
  height: 70px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: #1A1A1A;
}
.cart-item-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cart-item-img-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #1A1A1A, #222);
}

.cart-item-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cart-item-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.cart-item-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gold-light);
  margin: 0;
  line-height: 1.3;
}
.cart-item-remove {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.2s;
  flex-shrink: 0;
}
.cart-item-remove:hover { color: #e74c3c; }

.cart-item-size {
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0;
}

.cart-item-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
}

/* Quantity Control */
.cart-qty-control {
  display: flex;
  align-items: center;
  border: 1px solid rgba(201,168,76,0.2);
  border-radius: 6px;
  overflow: hidden;
}
.cart-qty-btn {
  background: none;
  border: none;
  color: var(--gold);
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.cart-qty-btn:hover { background: rgba(201,168,76,0.1); }
.cart-qty-num {
  width: 30px;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  border-left: 1px solid rgba(201,168,76,0.1);
  border-right: 1px solid rgba(201,168,76,0.1);
  line-height: 30px;
}

.cart-item-price {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gold);
}

/* Empty State */
.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  gap: 12px;
}
.cart-empty-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.3rem;
  color: var(--gold-light);
  margin: 8px 0 0;
}
.cart-empty-sub {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
}
.cart-empty-btn {
  margin-top: 16px;
  padding: 12px 28px;
  background: var(--gold);
  color: #0A0A0A;
  border: none;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}
.cart-empty-btn:hover { background: var(--gold-light); transform: translateY(-1px); }

/* Drawer Footer */
.cart-drawer-footer {
  padding: 20px 24px;
  border-top: 1px solid rgba(201,168,76,0.1);
  flex-shrink: 0;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
}

/* Shipping Progress Bar */
.cart-shipping-progress {
  margin-bottom: 16px;
}
.cart-shipping-bar {
  width: 100%;
  height: 4px;
  background: #222;
  border-radius: 4px;
  overflow: hidden;
}
.cart-shipping-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold));
  border-radius: 4px;
  transition: width 0.4s ease;
}
.cart-shipping-msg {
  font-size: 0.72rem;
  color: var(--muted);
  margin: 6px 0 0;
  text-align: center;
}
.cart-shipping-msg.free { color: #25d366; }

/* Summary Rows */
.cart-summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  color: var(--text);
  padding: 4px 0;
}
.cart-summary-total {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gold-light);
  padding: 8px 0;
}
.cart-summary-divider {
  height: 1px;
  background: rgba(201,168,76,0.15);
  margin: 8px 0;
}

/* Checkout Button */
.cart-checkout-btn {
  display: block;
  width: 100%;
  padding: 14px;
  background: var(--gold);
  color: #0A0A0A;
  text-align: center;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 16px;
  transition: background 0.2s, transform 0.2s;
  text-decoration: none;
}
.cart-checkout-btn:hover { background: var(--gold-light); transform: translateY(-1px); }

.cart-continue-btn {
  display: block;
  width: 100%;
  padding: 12px;
  background: transparent;
  color: var(--gold);
  border: 1px solid rgba(201,168,76,0.3);
  border-radius: 4px;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.5px;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.2s;
}
.cart-continue-btn:hover { background: rgba(201,168,76,0.08); }

/* ===== TOAST NOTIFICATION ===== */
.cart-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1100;
  background: #111111;
  border: 1px solid rgba(201,168,76,0.3);
  border-radius: 10px;
  padding: 14px 18px;
  min-width: 280px;
  max-width: 360px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  opacity: 0;
  transform: translateX(100%);
  transition: opacity 0.3s, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.cart-toast.visible {
  opacity: 1;
  transform: translateX(0);
}
.cart-toast-content {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cart-toast-icon {
  width: 28px;
  height: 28px;
  background: rgba(37,211,102,0.15);
  color: #25d366;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
}
.cart-toast-text { flex: 1; }
.cart-toast-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--gold-light);
  margin: 0;
}
.cart-toast-detail {
  font-size: 0.72rem;
  color: var(--muted);
  margin: 2px 0 0;
}
.cart-toast-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  flex-shrink: 0;
}
.cart-toast-close:hover { color: var(--gold); }

.cart-toast-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.cart-toast-view,
.cart-toast-checkout {
  flex: 1;
  padding: 8px;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
  text-decoration: none;
}
.cart-toast-view {
  background: transparent;
  border: 1px solid rgba(201,168,76,0.3);
  color: var(--gold);
}
.cart-toast-view:hover { background: rgba(201,168,76,0.1); }
.cart-toast-checkout {
  background: var(--gold);
  border: none;
  color: #0A0A0A;
}
.cart-toast-checkout:hover { background: var(--gold-light); }

/* Toast Progress Bar */
.cart-toast-progress {
  height: 2px;
  background: #222;
  border-radius: 2px;
  margin-top: 10px;
  overflow: hidden;
}
.cart-toast-progress-bar {
  height: 100%;
  background: var(--gold);
  border-radius: 2px;
  animation: toastCountdown 3s linear forwards;
}
@keyframes toastCountdown {
  from { width: 100%; }
  to { width: 0%; }
}

/* ===== PRODUCT CARD — ADD TO CART BUTTON ===== */
.card-add-to-cart {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  margin-top: 8px;
  background: var(--gold);
  color: #0A0A0A;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.card-add-to-cart:hover { background: var(--gold-light); transform: translateY(-1px); }
.card-add-to-cart:active { transform: scale(0.98); }
.card-add-to-cart.loading {
  opacity: 0.7;
  cursor: wait;
}
.card-add-to-cart.success {
  background: #25d366;
  color: #fff;
}
.card-add-to-cart.no-size {
  background: #e74c3c;
  color: #fff;
  animation: btnShake 0.5s ease;
}
.card-add-to-cart.atc-primary {
  padding: 14px;
  font-size: 0.9rem;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(201,168,76,0.25);
}

@keyframes btnShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* Size Selector in Card */
.cart-size-selector {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 8px 0;
  align-items: center;
}
.cart-size-selector .size-label {
  font-size: 0.78rem;
  color: var(--muted);
  width: 100%;
  margin-bottom: 2px;
}
.cart-size-btn {
  padding: 6px 14px;
  border: 1.5px solid var(--gold);
  border-radius: 20px;
  background: #1A1A1A;
  color: var(--gold);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}
.cart-size-btn:hover { background: rgba(201,168,76,0.1); }
.cart-size-btn.selected {
  background: var(--gold);
  color: #0A0A0A;
}

.cart-size-selector.shake {
  animation: btnShake 0.5s ease;
}

/* ===== CART PAGE STYLES ===== */
.cart-page { padding: 120px 0 80px; min-height: 100vh; background: #0A0A0A; }
.cart-page-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  color: var(--gold-light);
  margin-bottom: 40px;
}
.cart-page-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 48px;
  align-items: start;
}

/* Cart Table */
.cart-table { width: 100%; border-collapse: collapse; }
.cart-table th {
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--gold);
  padding: 12px 0;
  border-bottom: 1px solid rgba(201,168,76,0.15);
}
.cart-table td {
  padding: 20px 0;
  border-bottom: 1px solid rgba(201,168,76,0.06);
  vertical-align: middle;
}
.cart-table-product {
  display: flex;
  align-items: center;
  gap: 14px;
}
.cart-table-img {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: #1A1A1A;
}
.cart-table-img img { width: 100%; height: 100%; object-fit: cover; }
.cart-table-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--gold-light);
  margin: 0 0 2px;
}
.cart-table-size { font-size: 0.78rem; color: var(--muted); margin: 0; }
.cart-table-price {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}
.cart-table-total {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--gold);
}
.cart-table-remove {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 6px;
  transition: color 0.2s;
}
.cart-table-remove:hover { color: #e74c3c; }

.cart-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 24px;
  color: var(--gold);
  font-size: 0.85rem;
  font-weight: 500;
  transition: color 0.2s;
}
.cart-back-link:hover { color: var(--gold-light); }

/* Order Summary Sidebar */
.cart-order-summary {
  background: #111;
  border: 1px solid rgba(201,168,76,0.12);
  border-radius: 12px;
  padding: 28px;
  position: sticky;
  top: 100px;
}
.cart-order-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--gold-light);
  margin: 0 0 20px;
}

/* Coupon Code */
.cart-coupon {
  display: flex;
  gap: 8px;
  margin: 16px 0;
}
.cart-coupon input {
  flex: 1;
  padding: 10px 14px;
  background: #1A1A1A;
  border: 1px solid rgba(201,168,76,0.2);
  border-radius: 4px;
  color: var(--text);
  font-size: 0.85rem;
  font-family: 'Jost', sans-serif;
}
.cart-coupon input:focus {
  outline: none;
  border-color: var(--gold);
}
.cart-coupon button {
  padding: 10px 16px;
  background: transparent;
  border: 1px solid var(--gold);
  color: var(--gold);
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s;
}
.cart-coupon button:hover { background: rgba(201,168,76,0.1); }

/* Trust Badges on Cart Page */
.cart-trust-row {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.cart-trust-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--muted);
}

/* Inclusive note */
.cart-tax-note {
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
  margin-top: 8px;
}

/* Empty cart page */
.cart-page-empty {
  text-align: center;
  padding: 80px 20px;
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 960px) {
  .cart-page-grid { grid-template-columns: 1fr; gap: 32px; }
  .cart-order-summary { position: static; }
}

@media (max-width: 600px) {
  /* Always show cart icon on mobile */
  .nav-cart-btn { display: flex !important; }

  .cart-drawer {
    width: 100%;
    border-left: none;
  }

  .cart-toast {
    top: auto;
    bottom: 70px;
    right: 12px;
    left: 12px;
    max-width: none;
    min-width: auto;
  }

  .cart-table th:nth-child(3),
  .cart-table td:nth-child(3) { display: none; }

  .cart-table-img { width: 60px; height: 60px; }

  .cart-page { padding: 100px 0 80px; }

  .cart-trust-row { gap: 12px; }

  /* Safe area for iPhone */
  .cart-drawer-footer {
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }
}
