:root {
  --gold: #d4af37;
  --emerald: #004d40;
  --cream: #fffdf5;
  --shadow-soft: 0 4px 12px rgba(0,0,0,0.08);
  --transition-fast: 0.3s ease;
}

/* ----------------- Page layout wrapper for desktop aside ----------------- */
.cart-page-grid {
  display: block; /* mobile default */
  max-width: 950px;
  margin: 40px auto;
  padding: 0 15px;
}

@media (min-width: 769px) {
  .cart-page-grid {
    display: grid;
    grid-template-columns: 1fr 360px; /* main content + right aside */
    gap: 24px;
    align-items: start;
    max-width: 1100px;
  }
}

/* ----------------- Cart Container (main) ----------------- */
.cart-container {
  background: var(--cream);
  padding: 30px;
  border-radius: 15px;
  box-shadow: var(--shadow-soft);
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from {opacity:0; transform: translateY(20px);}
  to {opacity:1; transform: translateY(0);}
}

/* ----------------- Title ----------------- */
.cart-title {
  text-align: center;
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--gold), #ffeb3b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 18px;
}

/* ----------------- Cart Table ----------------- */
.cart-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
  margin-bottom: 12px;
}

.cart-table th,
.cart-table td {
  padding: 12px 10px;
  text-align: center;
  border-bottom: 1px solid #eee;
}

.cart-table th {
  background: var(--emerald);
  color: #fff;
  font-weight: 600;
  text-transform: uppercase;
}

/* Center the header word "Product" */
.cart-table th.product-head {
  text-align: center;
}

/* Fallback rule for any plain <img> in table cells */
.cart-table img {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: 10px;
  border: 2px solid var(--gold);
  display: block;
}

/* ----- Product column layout: image left, text vertically centered ----- */
.cart-table td.product-cell {
  display: flex;
  align-items: center;        /* vertical center relative to image */
  justify-content: flex-start;/* image sits at the left of the cell */
  gap: 14px;
  padding-left: 12px;         /* small left padding so image isn't flush to the border */
  text-align: left;           /* keep inner content left-aligned */
}

/* Image sizing and appearance (product cell) */
.cart-table td.product-cell .product-img img {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: 10px;
  border: 2px solid var(--gold);
  display: block;
  flex-shrink: 0;
}

/* Product name sits centered vertically and can wrap if needed */
.cart-table td.product-cell .product-name {
  display: flex;
  align-items: center;   /* vertical centering for the name */
  font-weight: 700;
  color: var(--emerald);
  line-height: 1.2;
  white-space: normal;
  word-break: break-word;
}

/* Quantity Input */
.qty-input {
  width: 60px;
  padding: 6px;
  border: 1px solid #ccc;
  border-radius: 8px;
  text-align: center;
  transition: border var(--transition-fast), box-shadow var(--transition-fast);
}

.qty-input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 5px rgba(212,175,55,0.4);
}

/* ----------------- Shipping ----------------- */
.shipping-postal {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 20px 0;
  flex-wrap: wrap;
}
.shipping-postal label {
  display: inline-flex;
  align-items: center;
  font-weight: 600;
  color: #333;
  margin-right: 6px;
}

.shipping-postal input {
  padding: 8px 12px;          /* balanced vertical + horizontal padding */
  width: 110px;               /* keeps the compact appearance */
  min-width: 90px;
  border: 1px solid #ccc;
  border-radius: 8px;
  text-align: center;         /* horizontal centering */
  line-height: 1.2;           /* vertical centering for the text */
  font-size: 15px;
  transition: border var(--transition-fast), box-shadow var(--transition-fast);
  background: #fff;
}

.shipping-postal input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 5px rgba(212,175,55,0.4);
}

/* ----------------- Free shipping note (pill is used visually) ----------------- */
.free-shipping-note {
  font-size: 0.95rem;
  display: inline-block;
  font-weight: 700;
  transition: color 0.25s ease, background 0.25s ease, transform 0.25s ease;
  padding: 6px 10px;
  border-radius: 999px;
  margin-left: 10px;
  vertical-align: middle;
  display: none;
}
.free-shipping-note.visible { display: inline-block; }

/* color states */
.free-shipping-note.not-qualified {
  color: crimson;
  background: #fff0f0;
  border: 1px solid rgba(200,0,0,0.12);
}
.free-shipping-note.qualified {
  color: #176033;
  background: #eafaf0;
  border: 1px solid rgba(47,122,62,0.08);
}

/* small flip animation */
.free-shipping-note.flip {
  transform: rotateX(360deg);
}

/* ----------------- Cart Summary ----------------- */
.cart-summary {
  text-align: left;
  margin-top: 12px;
  font-size: 16px;
}

.cart-summary p {
  margin: 6px 0;
}

.cart-summary span {
  font-weight: 700;
  color: var(--gold);
}

/* ----------------- Empty Cart ----------------- */
.empty-cart {
  text-align: center;
  padding: 50px 20px;
  font-size: 18px;
  color: #555;
}

/* ----------------- Checkout Form ----------------- */
.cart-aside {
  margin-top: 0;
}

.cart-actions {
  margin-top: 0px;
  background: #fff;
  padding: 22px;
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
  border: 1px solid #f0efe8;
}

.cart-actions h2 {
  text-align: left;
  font-weight: 800;
  margin-bottom: 12px;
  color: var(--emerald);
  font-size: 1.1rem;
}

.cart-actions form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-start;
}

.cart-actions input {
  padding: 10px;
  width: 100%;
  border: 1px solid #eee;
  border-radius: 8px;
  font-size: 14px;
  transition: border var(--transition-fast), box-shadow var(--transition-fast);
}

.cart-actions input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 5px rgba(212,175,55,0.4);
}

/* ------------------------------------------------------------------
   Unified KamalaTreats button system (derived from .card .btn)
   ------------------------------------------------------------------ */

/* Base CTA (large) — mirrors .card .btn luxury style */
.kt-btn {
  display: inline-block;
  background: linear-gradient(90deg, #d4af37 0%, #ffea70 50%, #d4af37 100%);
  color: var(--emerald);
  padding: 14px 28px;
  border-radius: 25px;
  text-decoration: none;
  transition: all 0.4s ease;
  font-weight: 800;
  border: 2px solid transparent;
  cursor: pointer;
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: relative;
  overflow: hidden;
  background-size: 200% auto;
  box-shadow: 0 4px 15px rgba(212,175,55,0.28);
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
}

/* highlight sweep */
.kt-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
  transition: left 0.5s ease;
  pointer-events: none;
}

/* hover state — invert to emerald */
.kt-btn:hover,
.kt-btn:focus {
  background: var(--emerald);
  color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(212,175,55,0.45);
  text-decoration: none;
}
.kt-btn:hover::before { left: 100%; }

.kt-btn:active { transform: translateY(-1px) scale(.995); }

/* Focus visible ring for keyboard users */
.kt-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 6px rgba(212,175,55,0.10), 0 10px 30px rgba(0,0,0,0.10);
  border-color: rgba(212,175,55,0.28);
}

/* Enhanced Delete Button for Cart */
.cart-card-actions .delete-item {
  all: unset; /* reset default button styles */
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;           /* compact circular size */
  height: 40px;
  padding: 0;
  border-radius: 50%;    /* circular shape */
  background: rgba(255, 255, 255, 0.95); /* light background */
  color: crimson;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  font-size: 18px;       /* trash icon size */
  transition: transform 0.25s ease, box-shadow 0.25s ease, color 0.2s ease, background 0.2s ease;
}

/* Hover effect */
.cart-card-actions .delete-item:hover {
  transform: scale(1.1);
  color: #b00020;
  background: rgba(255, 240, 240, 0.95);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

/* Active / pressed state */
.cart-card-actions .delete-item:active {
  transform: scale(0.95);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

/* Optional focus for accessibility */
.cart-card-actions .delete-item:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.1), 0 4px 12px rgba(0,0,0,0.08);
}

/* subtle infinite pulse used for primary CTA context (optional) */
@keyframes luxuryPulse {
  0% { box-shadow: 0 4px 15px rgba(212,175,55,0.28); transform: translateY(0); }
  50% { box-shadow: 0 10px 30px rgba(212,175,55,0.36); transform: translateY(-2px); }
  100% { box-shadow: 0 4px 15px rgba(212,175,55,0.28); transform: translateY(0); }
}

/* ---------- Apply the unified classes to existing cart selectors ---------- */
/* Checkout submit button styled like empty-cart button */
.btn-primary {
  all: unset;
  box-sizing: border-box;
  cursor: pointer;
  display: inline-block;
  text-align: center;
  width: 100%;
  vertical-align: middle;
  background: linear-gradient(90deg, #d4af37 0%, #ffea70 50%, #d4af37 100%);
  color: var(--emerald);
  padding: 12px 25px;        /* match empty-cart button size */
  border-radius: 12px;       /* match empty-cart button */
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  position: relative;
  overflow: hidden;
  border: 2px solid transparent;
  box-shadow: 0 6px 12px rgba(212,175,55,0.3);
  transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease, color 0.3s ease;
}

/* Hover sheen effect */
.btn-primary::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.32), transparent);
  transition: left 0.45s ease;
}

/* Hover / focus styles */
.btn-primary:hover,
.btn-primary:focus {
  background: var(--emerald);
  color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(212,175,55,0.3);
}

.btn-primary:hover::before {
  left: 100%;
}

/* Active / pressed state */
.btn-primary:active {
  transform: translateY(-1px) scale(0.995);
}

/* Focus-visible for accessibility */
.btn-primary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(212,175,55,0.10), 0 10px 20px rgba(0,0,0,0.08);
}

/* Shipping postal calculate button (was .shipping-postal button) */
.shipping-postal button {
  all: unset;
  box-sizing: border-box;
  display: inline-block;
  cursor:pointer;
  text-align:center;
  vertical-align:middle;
  border-radius:12px;
  padding:10px 18px;
  font-weight:700;
  font-size:1rem;
  position:relative;
  overflow:hidden;
  background: linear-gradient(90deg, #d4af37 0%, #ffea70 50%, #d4af37 100%);
  color: var(--emerald);
  border: 2px solid transparent;
  box-shadow: 0 4px 12px rgba(212,175,55,0.25);
  text-decoration: none;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.shipping-postal button::before { content:""; position:absolute; top:0; left:-100%; width:100%; height:100%; background:linear-gradient(90deg, transparent, rgba(255,255,255,0.32), transparent); transition:left .45s ease; }
.shipping-postal button:hover,
.shipping-postal button:focus { background: var(--emerald); color: var(--gold); transform: translateY(-2px); box-shadow: 0 8px 20px rgba(212,175,55,0.3); }
.shipping-postal button:hover::before { left:100%; }

/* Empty cart message layout */
.empty-cart {
  text-align: center;
  padding: 60px 20px;
  color: #444;
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* Shop Now button with gradient hover (like shipping button) */
.empty-cart .btn-shop {
  all: unset;
  box-sizing: border-box;
  display: inline-block;
  cursor: pointer;
  text-align: center;
  vertical-align: middle;
  border-radius: 12px;
  padding: 12px 25px;        /* size same as Proceed to Checkout */
  font-weight: 700;
  font-size: 1rem;
  position: relative;
  overflow: hidden;
  background: linear-gradient(90deg, #d4af37 0%, #ffea70 50%, #d4af37 100%);
  color: var(--emerald);
  border: 2px solid transparent;
  box-shadow: 0 6px 12px rgba(212,175,55,0.3);
  text-decoration: none;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Hover effect with gradient sheen */
.empty-cart .btn-shop::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.32), transparent);
  transition: left 0.45s ease;
}

.empty-cart .btn-shop:hover,
.empty-cart .btn-shop:focus {
  background: var(--emerald);
  color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(212,175,55,0.3);
}

.empty-cart .btn-shop:hover::before {
  left: 100%;
}


/* Address Suggest Buttons - Styled like Empty Cart / Checkout Button */
#address-suggest-reject,
#address-suggest-accept {
  all: unset;
  box-sizing: border-box;
  display: inline-block;
  text-align: center;
  vertical-align: middle;
  cursor: pointer;
  width: auto; /* keep original width based on text */
  padding: 14px 28px;
  font-weight: 800;
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: 25px;
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;
  background: linear-gradient(90deg, #d4af37 0%, #ffea70 50%, #d4af37 100%);
  color: var(--emerald);
  box-shadow: 0 4px 15px rgba(212,175,55,0.28);
  transition: all 0.4s ease;
  background-size: 200% auto;
}

/* shine overlay */
#address-suggest-reject::before,
#address-suggest-accept::before {
  content: "";
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
  transition: left 0.5s ease;
}

/* hover/focus */
#address-suggest-reject:hover,
#address-suggest-reject:focus,
#address-suggest-accept:hover,
#address-suggest-accept:focus {
  background: var(--emerald);
  color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(212,175,55,0.45);
}

#address-suggest-reject:hover::before,
#address-suggest-reject:focus::before,
#address-suggest-accept:hover::before,
#address-suggest-accept:focus::before {
  left: 100%;
}

/* active/pressed state */
#address-suggest-reject:active,
#address-suggest-accept:active {
  transform: translateY(-1px) scale(0.995);
}

/* focus-visible accessibility */
#address-suggest-reject:focus-visible,
#address-suggest-accept:focus-visible {
  outline: none;
  box-shadow: 0 0 0 6px rgba(212,175,55,0.10), 0 10px 30px rgba(0,0,0,0.10);
}




/* Mobile adjustments: keep stacked full-width CTAs where we want */
@media (max-width: 768px) {
  .btn-primary { width: 80%; display:block; margin: 8px auto 0; }
  .shipping-postal button { width: 86%; display:block; margin-left:auto; margin-right:auto; }
  .btn-shop.alt1 { width:86%; justify-content:center; }
}

/* Ensure quantity inputs and other form inputs keep focus look consistent with new CTAs */
.qty-input:focus, .cart-actions input:focus, .shipping-postal input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 6px rgba(212,175,55,0.18);
}

/* ----------------- Desktop: make aside sticky so checkout stays visible ----------------- */
@media (min-width: 769px) {
  .cart-aside { position: sticky; top: 24px; }
  .cart-actions { padding: 24px; }
  .cart-actions input { width: 100%; }
}

/* hide mobile card list on desktop; show only inside the mobile media query */
.mobile-cart {
  display: none;
}

/* ----------------- Responsive + Mobile Cart Cards ----------------- */
@media (max-width: 768px) {

  /* Hide table on small screens (existing behavior) */
  .cart-table { display: none; }

  .shipping-postal { gap: 10px; }
  
  
  .cart-actions { padding: 24px; margin-top: 5px; }
  .cart-actions form { flex-direction: column; align-items: center; }

  .cart-actions input { width: 80%; }

  .btn-primary { width: 80%; }

  /* Mobile Cart Cards */
  .mobile-cart {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 20px;
  }

  .cart-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 15px;
    box-shadow: var(--shadow-soft);
    transition: transform var(--transition-fast);
  }

  .cart-card:hover {
    transform: translateY(-3px);
  }

  .cart-card-img img {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: 10px;
    border: 2px solid var(--gold);
  }

  .cart-card-info {
    flex: 1;
    margin-left: 15px;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .cart-card-name {
    font-weight: 700;
    color: var(--emerald);
    font-size: 1.1em;
  }

  .cart-card-price,
  .cart-card-subtotal {
    color: #444;
    font-size: 0.95em;
  }

  .cart-card-subtotal span {
    font-weight: 600;
    color: var(--gold);
  }

  .cart-card-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
  }

  .cart-card .qty-input {
    width: 60px;
  }

  .cart-card .delete-item {
    font-size: 20px;
    color: crimson;
  }

  /* Slightly smaller product images for smaller widths */
  .cart-table td.product-cell .product-img img {
    width: 60px;
    height: 60px;
  }

  .cart-table th.product-head { text-align: center; }
}

/* ----------------- Loading overlay & spinner ----------------- */
#loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 99999;
}

.loading-spinner {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 6px solid var(--emerald);
  border-top-color: var(--emerald);
  animation: spin 0.9s linear infinite;
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* small message below spinner */
#loading-overlay .loading-text {
  margin-top: 12px;
  font-weight: 700;
  color: #333;
  text-align: center;
}

/* Utility: add pulse helper class you can toggle with JS */
.kt-btn--pulse { animation: luxuryPulse 3.2s ease-in-out infinite; }
/* ===== Mobile: improved cart-card layout (prevents qty sticking out) ===== */
@media (max-width: 480px) {
  /* stack card content vertically so actions sit inside the card */
  .cart-card {
    flex-direction: column;
    align-items: flex-start;     /* left align content */
    gap: 12px;
    padding: 14px;
    box-shadow: var(--shadow-soft);
    border-radius: 12px;
    background: #fff;
    overflow: hidden;            /* ensure children don't overflow the rounded corners */
  }

  /* slightly bigger product image but keep it contained */
  .cart-card-img img {
    width: 100%;
    height: auto;
    max-height: 100px;
    object-fit: cover;
    border-radius: 10px;
    border: 2px solid var(--gold);
  }

  /* keep product info full width and remove left margin */
  .cart-card-info {
    margin-left: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  /* place qty + delete in a single horizontal row that fits inside the card */
  .cart-card-actions {
    width: 100%;
    display: flex;
    flex-direction: row;        /* horizontal layout */
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 6px;
  }

  /* qty input: larger, boxed, and never overflow */
  .cart-card .qty-input,
  .cart-card-actions .qty-input {
    width: 72px;               /* roomy but not huge */
    max-width: 30%;
    padding: 8px;
    border-radius: 10px;
    box-shadow: none;
    border: 1px solid #e6e6e6;
    background: #fff;
    text-align: center;
    -webkit-appearance: none;
    -moz-appearance: textfield;
  }

  /* delete button: circular but smaller on mobile */
  .cart-card .delete-item,
  .cart-card-actions .delete-item {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 18px;
    flex: 0 0 44px;           /* prevent shrinking/growing */
  }

  /* ensure price/subtotal line wraps nicely inside info */
  .cart-card-price,
  .cart-card-subtotal,
  .cart-card-name {
    white-space: normal;
  }

  /* make subtotal badge stand out but not overflow */
  .cart-card-subtotal span {
    display:inline-block;
    word-break: normal;
  }
}

