/* assets/css/sidecart.css
   Modern sidecart / selection drawer for Membership Box
   Replacable file - updated so items scroll and footer buttons are fixed/sticky
*/

/* ===== Variables ===== */
:root{
  --mbox-accent-1: #1a7049;
  --mbox-accent-2: #06ba63;
  --mbox-muted: #f4f6f5;
  --mbox-bg: #ffffff;
  --mbox-text: #163b31;
  --mbox-danger: #d24247;
  --mbox-shadow: 0 12px 34px rgba(12,18,23,0.08);
  --mbox-radius: 12px;
  --mbox-ease: cubic-bezier(.2,.9,.2,1);
  --mbox-top-offset: 28px; /* change this to give more top margin */
}

/* ===== Overlay ===== */
.mbox-sidecart-overlay,
#mbox-sidecart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12,18,23,0.48);
  z-index: 9996;
  display: none;
  opacity: 0;
  transition: opacity 200ms var(--mbox-ease);
}
.mbox-sidecart-overlay.is-open,
#mbox-sidecart-overlay.is-open { display:block; opacity: 1; }

/* ===== Drawer (support both ID and class naming) ===== */
.mbox-sidecart,
#mbox-sidecart {
  position: fixed;
  right: 0;
  top: var(--mbox-top-offset);
  height: calc(100vh - var(--mbox-top-offset) - 12px); /* leave small bottom breathing room */
  width: 380px;
  max-width: 96%;
  background: var(--mbox-bg);
  box-shadow: -18px 0 50px rgba(10,12,20,0.12);
  z-index: 9997;
  transform: translateX(110%);
  transition: transform 340ms var(--mbox-ease), box-shadow 220ms var(--mbox-ease);
  display: block;
  overflow: hidden;
  border-left: 1px solid #f2f2f2;
  will-change: transform;
  -webkit-overflow-scrolling: touch;
  border-radius: 10px 0 0 10px;
}

/* open state */
.mbox-sidecart.open,
#mbox-sidecart.open {
  transform: translateX(0);
}

/* inner wrapper with scroll - using flex so the middle area can grow and scroll */
.mbox-sidecart-inner,
#mbox-sidecart .mbox-sidecart-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* ===== Header ===== */
.mbox-sidecart-header,
#mbox-sidecart .mbox-sidecart-header {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:18px 18px;
  border-bottom:1px solid #f5f5f5;
  background: linear-gradient(135deg, var(--mbox-accent-2) 0%, var(--mbox-accent-1) 100%);
  color: white;
  border-top-right-radius: 8px;
}
.mbox-sidecart-title,
#mbox-sidecart .mbox-sidecart-title {
  font-size:18px;
  color:#fff;
  font-weight:700;
  margin:0;
}
.mbox-sidecart-close,
#mbox-sidecart .mbox-sidecart-close {
  background: #fff;
  border: 1px solid rgba(0,0,0,0.06);
  width:44px;
  height:44px;
  border-radius: 50%;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  font-size:18px;
  color:var(--mbox-accent-1);
  box-shadow: 0 6px 18px rgba(16,64,42,0.06);
}

/* ===== Body / Items list ===== */
.mbox-sidecart-body,
#mbox-sidecart .mbox-sidecart-body {
  /* This area will grow and scroll */
  padding: 14px;
  overflow-y: auto;
  flex: 1 1 auto;
}

/* Items container */
.mbox-sidecart-items,
#mbox-sidecart .mbox-sidecart-items {
  display:flex;
  flex-direction:column;
  gap:12px;
  padding-bottom: 6px; /* extra breathing room above footer */
}

/* Single item */
.mbox-sidecart-item,
#mbox-sidecart .mbox-sidecart-item {
  display:flex;
  gap:12px;
  padding:12px;
  border-radius: 12px;
  background: #fff;
  align-items:center;
  box-shadow: 0 6px 18px rgba(9,18,14,0.02);
  border: 1px solid #f6f7f6;
}

/* thumbnail */
.mbox-sidecart-item-thumb img,
#mbox-sidecart .mbox-sidecart-item-thumb img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  display:block;
  box-shadow: 0 6px 18px rgba(12,18,23,0.04);
}

/* meta */
.mbox-sidecart-item-meta,
#mbox-sidecart .mbox-sidecart-item-meta {
  display:flex;
  flex-direction:column;
  gap:6px;
  flex: 1 1 auto;
  min-width: 0;
}

/* title link */
.mbox-sidecart-item-title,
#mbox-sidecart .mbox-sidecart-item-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--mbox-text);
  text-decoration: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.2;
}

/* small meta row (cat / qty etc) */
.mbox-sidecart-item-meta-small {
  font-size: 12px;
  color: #6b6f6a;
}

/* actions column (remove button) */
.mbox-sidecart-item-actions,
#mbox-sidecart .mbox-sidecart-item-actions {
  display:flex;
  align-items:flex-end;
  gap:8px;
  margin-left: 8px;
}

/* remove button */
.mbox-sidecart-remove,
#mbox-sidecart .mbox-sidecart-remove {
  background: transparent;
  border: 0;
  color: var(--mbox-danger);
  font-weight: 700;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 8px;
}
.mbox-sidecart-remove:hover { background: rgba(210,66,71,0.06); }

/* empty state */
.mbox-sidecart-empty,
#mbox-sidecart .mbox-sidecart-empty {
  text-align:center;
  color:#6b6f6a;
  padding:28px 8px;
  font-size:14px;
}

/* ===== Footer (sticky) =====
   Footer is sticky at bottom of the drawer and always visible.
*/
.mbox-sidecart-footer,
#mbox-sidecart .mbox-sidecart-footer {
  padding: 14px;
  border-top: 1px solid #f3f3f3;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(255,255,255,1));
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 5; /* above list content */
}

/* count */
.mbox-sidecart-count,
#mbox-sidecart .mbox-sidecart-count {
  font-weight:700;
  color:var(--mbox-text);
}

/* actions buttons */
.mbox-sidecart-actions,
#mbox-sidecart .mbox-sidecart-actions { display:flex; gap:10px; align-items:center; }

/* primary / secondary buttons */
.mbox-btn-primary,
#mbox-sidecart .mbox-btn-primary {
  background: linear-gradient(135deg, var(--mbox-accent-2), var(--mbox-accent-1));
  color: #fff;
  border-radius: 12px;
  padding: 10px 14px;
  border: 0;
  cursor: pointer;
  font-weight: 800;
  box-shadow: 0 8px 22px rgba(20,88,58,0.12);
}
.mbox-btn-secondary,
#mbox-sidecart .mbox-btn-secondary {
  background: #f6f7f6;
  border-radius: 12px;
  padding: 10px 14px;
  border: 0;
  cursor: pointer;
  color: #163b31;
  font-weight: 700;
}

/* ===== Product card buttons (selection buttons) ===== */
/* ===== Cart button colors & states =====
   Replace the existing .mbox-add-basket / .mbox-add-basket.is-in
   / .mbox-add-basket.is-disabled definitions with this block.
*/

/* default look: solid green (matches the "wishlist" green you asked for) */
.mbox-add-basket {
  padding: 9px 12px;
  border-radius: 10px;
  border: 0;
  cursor: pointer;
  background: var(--mbox-green);       /* solid green when not selected */
  color: #fff;                         /* white icon/text for contrast */
  font-weight:700;
  display:inline-flex;
  align-items:center;
  gap:8px;
  transition: transform .12s, box-shadow .14s, background .18s, opacity .18s;
  box-shadow: 0 4px 10px rgba(26,112,73,0.08);
}

/* ensure SVG/icon in button shows white on green */
.mbox-add-basket svg,
.mbox-add-basket .icon {
  fill: #fff !important;
  color: #fff !important;
}

/* hover on active (not-disabled) keeps green but slightly darker */
.mbox-add-basket:hover:not(.is-disabled):not(.is-in) {
  transform: translateY(-2px);
  filter: brightness(.96);
  box-shadow: 0 8px 20px rgba(26,112,73,0.12);
}

/* selected state (gradient) */
.mbox-add-basket.is-in {
  background: linear-gradient(135deg, var(--mbox-accent-2), var(--mbox-accent-1));
  color: #fff;
  box-shadow: 0 12px 28px rgba(26,112,73,0.18);
}

/* selected hover tweak */
.mbox-add-basket.is-in:hover {
  transform: translateY(-2px);
  filter: none;
}

/* when plan limit is reached, remaining buttons show muted/gray and are not interactive */
.mbox-add-basket.is-disabled {
  background: #efefef;        /* pale gray background */
  color: #9aa0a6;             /* muted text color */
  cursor: not-allowed;
  opacity: 0.9;
  box-shadow: none;
  transform: none;
  pointer-events: none;       /* prevent clicks */
  border: 1px solid #e5e5e5;
}

/* ensure any icon inside disabled also appears muted */
.mbox-add-basket.is-disabled svg,
.mbox-add-basket.is-disabled .icon {
  fill: #9aa0a6 !important;
  color: #9aa0a6 !important;
}

/* small accessibility/focus styles (still visible when keyboard focused) */
.mbox-add-basket:focus {
  outline: 3px solid rgba(26,112,73,0.12);
  outline-offset: 3px;
  border-radius: 10px;
}

.mbox-add-wishlist {
  padding: 9px 11px;
  border-radius: 10px;
  border: 0;
  cursor: pointer;
  background: #fff;
  color: #6b6f6a;
  font-weight:700;
  transition: transform .12s, color .12s;
}
.mbox-add-wishlist.is-in {
  color: var(--mbox-danger);
  transform: scale(1.06);
}
.mbox-add-basket.is-loading,
.mbox-add-wishlist.is-loading {
  opacity: 0.6;
  pointer-events: none;
}

/* ===== Scrollbar styling (WebKit) ===== */
.mbox-sidecart-body::-webkit-scrollbar,
#mbox-sidecart .mbox-sidecart-body::-webkit-scrollbar { width:12px; }
.mbox-sidecart-body::-webkit-scrollbar-track,
#mbox-sidecart .mbox-sidecart-body::-webkit-scrollbar-track { background: transparent; }
.mbox-sidecart-body::-webkit-scrollbar-thumb,
#mbox-sidecart .mbox-sidecart-body::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(0,0,0,0.08), rgba(0,0,0,0.06));
  border-radius: 10px;
  border: 3px solid rgba(255,255,255,0.0);
}

/* ===== Animations & Reduced motion ===== */
@media (prefers-reduced-motion: no-preference) {
  .mbox-sidecart, #mbox-sidecart { transition: transform 340ms var(--mbox-ease); }
  .mbox-sidecart-overlay, #mbox-sidecart-overlay { transition: opacity 220ms var(--mbox-ease); }
}

/* ===== Responsive ===== */
@media (max-width: 880px) {
  .mbox-sidecart, #mbox-sidecart { width: 86%; top: var(--mbox-top-offset); height: calc(100vh - var(--mbox-top-offset) - 8px); }
  .mbox-sidecart-item-thumb img,
  #mbox-sidecart .mbox-sidecart-item-thumb img { width: 64px; height: 64px; }
}

@media (max-width: 520px) {
  .mbox-sidecart, #mbox-sidecart { width: 100%; max-width: 100%; right: 0; border-radius: 0; top: 0; height:100vh; }
  .mbox-sidecart-header, #mbox-sidecart .mbox-sidecart-header { padding: 14px; }
  .mbox-sidecart-body, #mbox-sidecart .mbox-sidecart-body { padding: 12px; }
  .mbox-btn-primary, #mbox-sidecart .mbox-btn-primary { padding: 10px 12px; }
}

/* Accessibility focus outlines */
.mbox-sidecart-close:focus,
.mbox-btn-primary:focus,
.mbox-btn-secondary:focus,
.mbox-sidecart-remove:focus,
.mbox-add-basket:focus,
.mbox-add-wishlist:focus {
  outline: 3px solid rgba(26,112,73,0.12);
  outline-offset: 2px;
  border-radius: 8px;
}
