/* Global BestBuds — Cart + Drawer Styles (nav layout in nav.css) */
.cart-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border, rgba(15, 23, 42, .10));
  border-radius: 12px;
  background: rgba(255,255,255,.65);
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(2, 8, 23, .10);
  transition: transform .12s ease, background .18s ease, box-shadow .18s ease;
  color: var(--text, #0b1220);
}
.cart-btn:hover {
  background: rgba(255,255,255,.85);
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(2, 8, 23, .14);
}

.cart-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cart-icon svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
}

.cart-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  background: var(--accent, #22c55e);
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(34,197,94,.4);
}
.cart-badge[hidden] {
  display: none !important;
}

@keyframes badgeBump {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.25); }
  60%  { transform: scale(0.95); }
  100% { transform: scale(1); }
}

.cart-badge.bump {
  animation: badgeBump 320ms ease;
}

/* Overlay */
.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 8, 23, .45);
  z-index: 9998;
  opacity: 0;
  transition: opacity .25s ease;
  pointer-events: none;
}
.cart-overlay:not([hidden]) {
  opacity: 1;
  pointer-events: auto;
}

/* Drawer */
.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, 92vw);
  max-width: 100%;
  height: 100vh;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-left: 1px solid var(--border, rgba(15, 23, 42, .10));
  box-shadow: -18px 0 48px rgba(2, 8, 23, .18);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(0.4, 0, 0.2, 1);
}
.cart-drawer.open {
  transform: translateX(0);
}

.cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border, rgba(15, 23, 42, .10));
  flex-shrink: 0;
}
.cart-header strong {
  font-size: 18px;
  font-weight: 900;
}

.cart-close {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255,255,255,.7);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  color: var(--text);
  transition: background .2s;
}
.cart-close:hover {
  background: rgba(255,255,255,1);
}

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  min-height: 120px;
}

.cart-empty-msg {
  padding: 24px;
  text-align: center;
  color: var(--muted-text, #5b6474);
  font-weight: 600;
}

.cart-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.6);
  margin-bottom: 10px;
}
.cart-item:last-child {
  margin-bottom: 0;
}

.cart-item-img-wrap {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(15, 23, 42, .06);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.cart-item-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cart-item-no-img {
  font-size: 24px;
  color: var(--muted-text);
}

.cart-item-details {
  flex: 1;
  min-width: 0;
}
.cart-item-name {
  display: block;
  font-weight: 800;
  font-size: 14px;
  color: var(--text);
  text-decoration: none;
  margin-bottom: 4px;
  line-height: 1.3;
}
.cart-item-name:hover {
  color: var(--accent-dark, #15803d);
}
.cart-item-subline {
  font-size: 12px;
  color: var(--muted-text, #5b6474);
  margin-bottom: 6px;
  line-height: 1.35;
}
.cart-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.cart-item-price {
  font-weight: 700;
  color: var(--accent);
}
.cart-qty-stepper {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.cart-qty-stepper button {
  width: 28px;
  height: 26px;
  padding: 0;
  border: none;
  background: rgba(255,255,255,.8);
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  transition: background .15s;
}
.cart-qty-stepper button:hover {
  background: rgba(34,197,94,.15);
}
.cart-qty-val {
  min-width: 24px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}
.cart-item-remove {
  background: none;
  border: none;
  padding: 2px 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted-text);
  cursor: pointer;
  text-decoration: underline;
}
.cart-item-remove:hover {
  color: #dc2626;
}

.quick-set {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.quick-set button {
  padding: 8px 10px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 12px;
  color: #111;
  background: rgba(255,255,255,.85);
  border: 1px solid rgba(255,255,255,.16);
  box-shadow: 0 14px 30px rgba(0,0,0,.25);
}
.quick-set button:hover {
  color: #111;
  box-shadow: 0 18px 40px rgba(0,0,0,.32), 0 0 0 4px rgba(34,197,94,.18);
}
.quick-set button.active {
  box-shadow: 0 18px 44px rgba(0,0,0,.36), 0 0 0 4px rgba(34,197,94,.28);
  border-color: rgba(34,197,94,.35);
}

.cart-savings-toast {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 16px 40px rgba(0,0,0,.30), 0 0 0 3px rgba(34,197,94,.18);
  backdrop-filter: blur(10px);
  font-weight: 800;
  font-size: 13px;
  line-height: 1.2;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .18s ease, transform .18s ease;
}
.cart-savings-toast.show {
  opacity: 1;
  transform: translateY(0);
}
.cart-savings-toast small {
  display: block;
  font-weight: 600;
  opacity: .85;
  margin-top: 4px;
}
#checkout-cart-summary .cart-savings-toast {
  background: rgba(255,255,255,.45);
}

.cart-footer {
  flex-shrink: 0;
  padding: 16px 26px 24px 26px; /* extra padding for pill/glow breathing room */
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,.5);
  overflow: visible;
}

.cart-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 14px;
}
.cart-row.total {
  margin-top: 10px;
  margin-bottom: 0;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 18px;
  font-weight: 900;
}

.cart-checkout-btn {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-top: 14px;
  padding: 14px 18px;
  font-size: 16px;
  font-weight: 900;
  text-align: center;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(90deg, rgba(34,197,94,1), rgba(14,165,233,1));
  border: none;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(0,0,0,.2);
  transition: transform .14s ease, filter .18s ease;
}
.cart-checkout-btn:hover:not(.disabled) {
  transform: translateY(-2px);
  filter: brightness(1.04);
}
.cart-checkout-btn.disabled {
  background: rgba(15, 23, 42, .25);
  cursor: not-allowed;
  pointer-events: none;
}

.cart-mini-note {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted-text);
  text-align: center;
}

/* Checkout page form layout */
#checkout-form .form-row,
#checkout-form .form-row * {
  box-sizing: border-box;
}
#checkout-form .form-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  min-width: 0;
}
#checkout-form .form-row label {
  font-weight: 800;
  text-align: left;
}
#checkout-form .form-row input,
#checkout-form .form-row textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
#checkout-form .form-row.checkbox-row {
  align-items: center;
}
#checkout-form .form-row.checkbox-row .checkbox-wrap {
  display: flex;
  justify-content: flex-start;
  align-items: center;
}
#checkout-form .form-row.checkbox-row input[type="checkbox"] {
  width: auto;
  margin: 0;
  transform: translateY(1px);
}
#checkout-form .form-row input:focus,
#checkout-form .form-row textarea:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(34,197,94,.22), 0 0 0 1px rgba(255,255,255,.16);
}
#checkout-form .field-helper {
  margin: -10px 0 14px 0;
  font-size: 13px;
  opacity: .85;
}
#checkout-form .form-required-note {
  margin: 0 0 14px 0;
  font-weight: 800;
  opacity: .9;
}
@media (max-width: 720px) {
  #checkout-form .form-row {
    grid-template-columns: 1fr;
  }
  #checkout-form .form-row label {
    margin-bottom: 6px;
  }
}

/* Checkout page summary */
.checkout-summary-items {
  max-height: 280px;
  overflow-y: auto;
}
.checkout-summary-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.checkout-summary-item:last-child {
  border-bottom: none;
}
.checkout-item-name {
  font-weight: 800;
  font-size: 14px;
}
.checkout-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 13px;
}
.checkout-summary-totals {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.checkout-negotiable-note {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted-text, #5b6474);
  font-weight: 600;
}

/* Add to Cart button on product cards */
.add-to-cart-btn {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(90deg, rgba(34,197,94,.95), rgba(14,165,233,.9));
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: transform .14s ease, filter .18s ease;
  box-shadow: 0 6px 18px rgba(0,0,0,.15);
}
.add-to-cart-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}
.add-to-cart-btn:active {
  transform: translateY(0);
}

/* ——— Tier selector modal (glass/glow aesthetic) ——— */
.tier-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 8, 23, .55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10001;
  opacity: 0;
  transition: opacity .25s ease;
  pointer-events: none;
}
.tier-modal-overlay:not([hidden]) {
  opacity: 1;
  pointer-events: auto;
}

.tier-modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(420px, 92vw);
  max-height: 90vh;
  overflow-y: auto;
  background: rgba(255, 255, 255, .95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border, rgba(15, 23, 42, .12));
  border-radius: 20px;
  box-shadow: 0 24px 56px rgba(2, 8, 23, .2), 0 0 0 1px rgba(255, 255, 255, .5) inset;
  z-index: 10002;
  transition: opacity .2s ease, transform .2s ease;
}
.tier-modal:not([hidden]) {
  display: block;
}

.tier-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border, rgba(15, 23, 42, .10));
}

.tier-modal-title {
  font-size: 17px;
  font-weight: 900;
  color: var(--text, #0b1220);
  line-height: 1.35;
  flex: 1;
  min-width: 0;
}

.tier-modal-close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, .8);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  color: var(--text);
  transition: background .2s, transform .14s;
}
.tier-modal-close:hover {
  background: rgba(255, 255, 255, 1);
  transform: scale(1.05);
}

.tier-modal-body {
  padding: 18px 20px 22px;
}

.tier-modal-sub {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted-text, #5b6474);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 12px;
}

.tier-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 18px;
}

.tier-option {
  display: block;
  width: 100%;
  padding: 14px 16px;
  text-align: left;
  font-size: 14px;
  font-weight: 700;
  color: var(--text, #0b1220);
  background: rgba(255, 255, 255, .7);
  border: 2px solid var(--border, rgba(15, 23, 42, .12));
  border-radius: 14px;
  cursor: pointer;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.tier-option:hover {
  background: rgba(255, 255, 255, .95);
  border-color: rgba(34, 197, 94, .35);
  box-shadow: 0 4px 16px rgba(34, 197, 94, .12);
}
.tier-option.selected {
  border-color: var(--accent, #22c55e);
  background: rgba(34, 197, 94, .08);
  box-shadow: 0 0 0 4px rgba(34, 197, 94, .2);
}

.tier-modal-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
}
.tier-cancel,
.tier-confirm {
  flex: 1;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 800;
  border-radius: 12px;
  cursor: pointer;
  transition: transform .14s, filter .18s;
}
.tier-cancel {
  background: rgba(255, 255, 255, .8);
  border: 1px solid var(--border);
  color: var(--text);
}
.tier-cancel:hover {
  background: rgba(255, 255, 255, 1);
  transform: translateY(-1px);
}
.tier-confirm {
  background: linear-gradient(90deg, rgba(34, 197, 94, .95), rgba(14, 165, 233, .9));
  border: none;
  color: #fff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .15);
}
.tier-confirm:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.05);
}
.tier-confirm:disabled {
  opacity: .6;
  cursor: not-allowed;
}

.tier-modal-note {
  font-size: 12px;
  color: var(--muted-text, #5b6474);
  line-height: 1.45;
}

@media (min-width: 480px) {
  .tier-options {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile: sticky checkout in footer */
@media (max-width: 768px) {
  .cart-drawer {
    width: min(420px, 92vw);
  }
  .cart-footer {
    position: sticky;
    bottom: 0;
    box-shadow: 0 -4px 20px rgba(2, 8, 23, .08);
  }
}
