/* =========================================
   SHOP STAR GLOW — CART DRAWER
   ========================================= */

:root {
  --ssg-cart-gold: #d5b56a;
  --ssg-cart-black: #171717;
  --ssg-cart-muted: #777;
  --ssg-cart-border: #e9e6e0;
  --ssg-cart-background: #fff;
}

/* Prevent background scrolling when drawer is open */
body.ssg-cart-is-open {
  overflow: hidden;
}

/* Dark overlay */
.ssg-cart-overlay {
  position: fixed;
  inset: 0;
  z-index: 99990;
  background: rgba(0, 0, 0, 0.42);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
}

.ssg-cart-overlay.is-visible {
  opacity: 1;
  visibility: visible;
}

.ssg-cart-overlay[hidden] {
  display: none !important;
}

/* Drawer panel */
.ssg-cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 99999;

  display: flex;
  flex-direction: column;

  width: min(460px, 100%);
  height: 100vh;
  height: 100dvh;

  padding: 0;
  overflow: hidden;

  background: var(--ssg-cart-background);
  color: var(--ssg-cart-black);

  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.08);

  transform: translateX(105%);
  visibility: hidden;
  pointer-events: none;

  transition:
    transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0.35s ease;

  font-family: inherit;
}

.ssg-cart-drawer.is-open {
  transform: translateX(0);
  visibility: visible;
  pointer-events: auto;
}

/* Drawer header */
.ssg-cart-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;

  flex: 0 0 auto;
  padding: 24px 26px;

  border-bottom: 1px solid var(--ssg-cart-border);
}

.ssg-cart-drawer__header h2 {
  margin: 0;
  color: var(--ssg-cart-black);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.4px;
}

.ssg-cart-drawer__close {
  display: grid;
  place-items: center;

  width: 38px;
  height: 38px;
  padding: 0;

  border: 1px solid var(--ssg-cart-border);
  border-radius: 50%;
  background: transparent;
  color: var(--ssg-cart-black);

  font-family: inherit;
  font-size: 27px;
  line-height: 1;

  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease;
}

.ssg-cart-drawer__close:hover {
  background: #f7f5f0;
  border-color: var(--ssg-cart-gold);
}

/* Scrollable product area */
.ssg-cart-drawer__body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 8px 26px 24px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.ssg-cart-drawer__loading {
  padding: 28px 0;
  color: var(--ssg-cart-muted);
  font-size: 14px;
}

/* Empty cart */
.ssg-cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  text-align: center;
}

.ssg-cart-empty__icon {
  margin-bottom: 18px;
  color: var(--ssg-cart-gold);
  font-size: 35px;
}

.ssg-cart-empty h3 {
  margin: 0 0 8px;
  font-size: 19px;
  font-weight: 600;
}

.ssg-cart-empty p {
  margin: 0 0 22px;
  color: var(--ssg-cart-muted);
  font-size: 14px;
}

/* Product rows — use these classes for the returned cart HTML */
.ssg-cart-item {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 16px;

  padding: 20px 0;
  border-bottom: 1px solid var(--ssg-cart-border);
}

.ssg-cart-item__image {
  display: block;
  width: 92px;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: #f7f6f3;
}

.ssg-cart-item__image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ssg-cart-item__details {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
}

.ssg-cart-item__name {
  margin: 0 0 6px;
  color: var(--ssg-cart-black);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  text-decoration: none;
}

.ssg-cart-item__name:hover {
  color: #8c6c25;
}

.ssg-cart-item__variation {
  margin-bottom: 7px;
  color: var(--ssg-cart-muted);
  font-size: 12px;
  line-height: 1.5;
}

.ssg-cart-item__price {
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 600;
}

/* Quantity and remove controls */
.ssg-cart-item__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
}

.ssg-cart-quantity {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--ssg-cart-border);
}

.ssg-cart-quantity button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ssg-cart-black);
  cursor: pointer;
}

.ssg-cart-quantity button:hover {
  background: #f7f5f0;
}

.ssg-cart-quantity span {
  min-width: 25px;
  text-align: center;
  font-size: 13px;
}

.ssg-cart-item__remove {
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--ssg-cart-muted);
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.ssg-cart-item__remove:hover {
  color: #a32626;
}

/* Drawer footer */
.ssg-cart-drawer__footer {
  flex: 0 0 auto;
  padding: 20px 26px 26px;
  background: #fff;
  border-top: 1px solid var(--ssg-cart-border);
  box-shadow: 0 -8px 20px rgba(0, 0, 0, 0.025);
}

.ssg-cart-drawer__subtotal {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 8px;
  font-size: 15px;
}

.ssg-cart-drawer__subtotal strong {
  font-size: 17px;
  font-weight: 600;
}

.ssg-cart-drawer__shipping-note {
  margin: 0 0 18px;
  color: var(--ssg-cart-muted);
  font-size: 12px;
  line-height: 1.6;
}

.ssg-cart-drawer__checkout,
.ssg-cart-drawer__view-cart {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 50px;
  box-sizing: border-box;
  text-align: center;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.4px;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease;
}

.ssg-cart-drawer__checkout {
  background: var(--ssg-cart-black);
  color: #fff;
  border: 1px solid var(--ssg-cart-black);
}

.ssg-cart-drawer__checkout:hover {
  background: var(--ssg-cart-gold);
  border-color: var(--ssg-cart-gold);
  color: #171717;
}

.ssg-cart-drawer__view-cart {
  min-height: 40px;
  margin-top: 5px;
  color: var(--ssg-cart-black);
  background: transparent;
}

.ssg-cart-drawer__view-cart:hover {
  color: #8c6c25;
}

/* Loading / updating state */
.ssg-cart-drawer.is-loading .ssg-cart-drawer__body {
  opacity: 0.55;
  pointer-events: none;
}

.ssg-cart-drawer [hidden] {
  display: none !important;
}

/* Shopping bag count */
.cart-icon {
  position: relative;
}

.cart-icon .cart-count {
  display: grid;
  place-items: center;

  position: absolute;
  top: -5px;
  right: -7px;

  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  box-sizing: border-box;

  border-radius: 50%;
  background: var(--ssg-cart-gold);
  color: #171717;

  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

/* Product image fly-to-cart animation */
.ssg-fly-image {
  position: fixed !important;
  z-index: 1000000 !important;
  margin: 0 !important;
  pointer-events: none !important;
  object-fit: cover !important;
  border-radius: 3px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
  transition:
    left 0.65s cubic-bezier(0.2, 0.7, 0.3, 1),
    top 0.65s cubic-bezier(0.2, 0.7, 0.3, 1),
    width 0.65s ease,
    height 0.65s ease,
    opacity 0.65s ease,
    transform 0.65s ease;
}

/* Tablet and mobile */
@media (max-width: 600px) {
  .ssg-cart-drawer {
    width: 100%;
    max-width: 100%;
  }

  .ssg-cart-drawer__header {
    padding: 19px 20px;
  }

  .ssg-cart-drawer__body {
    padding: 5px 20px 20px;
  }

  .ssg-cart-drawer__footer {
    padding: 16px 20px 20px;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }

  .ssg-cart-item {
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 13px;
    padding: 17px 0;
  }

  .ssg-cart-item__image {
    width: 82px;
  }
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  .ssg-cart-overlay,
  .ssg-cart-drawer,
  .ssg-fly-image,
  .ssg-cart-drawer__close,
  .ssg-cart-drawer__checkout,
  .ssg-cart-drawer__view-cart {
    transition: none !important;
  }
}

/* =========================================
   CART DRAWER — COMPACT QUANTITY CONTROLS
   ========================================= */

/* Keep quantity and Remove within the product column */
.ssg-cart-item__actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  min-width: 0;
}

/* Compact quantity selector */
.ssg-cart-quantity {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: fit-content;
  min-height: 34px;
  height: 34px;
  border: 1px solid #e9e6e0;
  background: #fff;
  box-sizing: border-box;
}

/* Small, consistent plus/minus buttons */
.ssg-cart-quantity button {
  display: grid !important;
  place-items: center;
  flex: 0 0 32px;
  width: 32px !important;
  min-width: 32px !important;
  max-width: 32px;
  height: 32px !important;
  min-height: 32px !important;
  margin: 0 !important;
  padding: 0 !important;

  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: #fff !important;
  color: #171717 !important;

  font-family: inherit;
  font-size: 16px !important;
  font-weight: 400;
  line-height: 1 !important;
  cursor: pointer;
}

.ssg-cart-quantity button:hover {
  background: #f7f5f0 !important;
}

/* Compact quantity input */
.ssg-cart-quantity input[data-cart-quantity] {
  display: block;
  flex: 0 0 42px;
  width: 42px !important;
  min-width: 42px !important;
  max-width: 42px;
  height: 32px !important;
  min-height: 32px !important;
  margin: 0 !important;
  padding: 0 !important;

  border: 0 !important;
  border-left: 1px solid #e9e6e0 !important;
  border-right: 1px solid #e9e6e0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  outline-offset: -2px;

  background: #fff !important;
  color: #171717 !important;

  font-family: inherit;
  font-size: 13px !important;
  font-weight: 400;
  line-height: 32px !important;
  text-align: center;
  appearance: textfield;
  -moz-appearance: textfield;
}

/* Hide browser number-input arrows */
.ssg-cart-quantity input[data-cart-quantity]::-webkit-inner-spin-button,
.ssg-cart-quantity input[data-cart-quantity]::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
}

/* Keep Remove beside the quantity selector */
.ssg-cart-item__remove {
  display: inline-block;
  flex: 0 0 auto;
  width: auto !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 5px 0 !important;

  border: 0 !important;
  background: transparent !important;
  color: #777 !important;

  font-family: inherit;
  font-size: 12px !important;
  line-height: 1.4;
  white-space: nowrap;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.ssg-cart-item__remove:hover {
  color: #a32626 !important;
}

/* On narrow screens, allow the controls to fit comfortably */
@media (max-width: 400px) {
  .ssg-cart-item__actions {
    gap: 8px;
  }

  .ssg-cart-quantity button {
    flex-basis: 28px;
    width: 28px !important;
    min-width: 28px !important;
    max-width: 28px;
  }

  .ssg-cart-quantity input[data-cart-quantity] {
    flex-basis: 36px;
    width: 36px !important;
    min-width: 36px !important;
    max-width: 36px;
  }
}

/* =========================================
   CART DRAWER — DISCOUNT ACCORDION
   ========================================= */

.ssg-cart-discount {
  margin: 0 0 18px;
  border-top: 1px solid var(--ssg-cart-border);
  border-bottom: 1px solid var(--ssg-cart-border);
}

.ssg-cart-discount summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 17px 0;
  cursor: pointer;
  list-style: none;
  font-size: 14px;
  font-weight: 500;
}

.ssg-cart-discount summary::-webkit-details-marker {
  display: none;
}

.ssg-cart-discount__icon {
  position: relative;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.ssg-cart-discount__icon::before,
.ssg-cart-discount__icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 1px;
  background: var(--ssg-cart-black);
  transform: translate(-50%, -50%);
}

.ssg-cart-discount__icon::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

.ssg-cart-discount[open] .ssg-cart-discount__icon::after {
  display: none;
}

.ssg-cart-discount__form {
  display: flex;
  align-items: stretch;
  gap: 8px;
  padding: 0 0 16px;
  margin: 0;
}

.ssg-cart-discount__form input {
  flex: 1 1 auto;
  width: 0;
  min-width: 0;
  height: 44px;
  margin: 0;
  padding: 0 12px;
  border: 1px solid var(--ssg-cart-border);
  border-radius: 0;
  box-shadow: none;
  background: #fff;
  color: var(--ssg-cart-black);
  font: inherit;
  font-size: 13px;
}

.ssg-cart-discount__form input:focus {
  border-color: var(--ssg-cart-gold);
  outline: 1px solid var(--ssg-cart-gold);
}

.ssg-cart-discount__form button {
  flex: 0 0 auto;
  min-width: 82px;
  height: 44px;
  margin: 0;
  padding: 0 16px;
  border: 1px solid var(--ssg-cart-black);
  border-radius: 0;
  background: var(--ssg-cart-black);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.ssg-cart-discount__form button:hover {
  background: var(--ssg-cart-gold);
  border-color: var(--ssg-cart-gold);
  color: var(--ssg-cart-black);
}

.ssg-cart-discount__form button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.ssg-cart-discount__message {
  padding: 0 0 12px;
  font-size: 12px;
  line-height: 1.5;
}

.ssg-cart-discount__message:empty {
  display: none;
}

.ssg-cart-discount__message.is-success {
  color: #28743a;
}

.ssg-cart-discount__message.is-error {
  color: #a32626;
}

.ssg-cart-applied-coupons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.ssg-cart-applied-coupon {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}

.ssg-cart-applied-coupon button {
  padding: 3px 0;
  border: 0;
  background: transparent;
  color: var(--ssg-cart-muted);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.ssg-cart-discount-total,
.ssg-cart-drawer__total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0;
  font-size: 14px;
}

.ssg-cart-discount-total[hidden] {
  display: none !important;
}

.ssg-cart-discount-total strong {
  color: #28743a;
}

.ssg-cart-drawer__total {
  padding-top: 15px;
  border-top: 1px solid var(--ssg-cart-border);
  font-weight: 600;
}

.ssg-cart-drawer__total strong {
  font-size: 17px;
}

.ssg-cart-drawer__footer .ssg-cart-drawer__checkout {
  margin-top: 18px;
}
