/*********************************************
 * SET STATUS BAR (Collapsed Preview)
   Preview Trigger & Container
 *********************************************/
.set-status-trigger {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: min(92%, 720px);
  min-height: 72px;
  padding: 12px 18px;
  border: 2px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
  box-shadow: 0 8px 24px var(--shadow-color);
  cursor: pointer;
  transition:
    bottom 1.05s ease,
    width 0.55s ease,
    transform 0.55s ease,
    box-shadow 0.3s ease,
    background 0.3s ease;
}

/* Expanded state: status bar becomes drawer header */
.set-status-trigger.is-open {
  left: 50%;
  bottom: calc(24px + min(62vh, 620px) - 38px);
  transform: translateX(-50%);
  width: min(92%, 1100px);
  z-index: 1001;
}

.set-status-trigger:hover {
  transform: translateX(-50%) translateY(-2px);
  box-shadow: 0 10px 28px var(--shadow-color);
}

.set-status-trigger.cart-glow {
  animation: sasaCartGlow 1.1s ease !important;
}

@keyframes sasaCartGlow {
  0% {
    box-shadow: 0 8px 24px var(--shadow-color);
  }

  30% {
    box-shadow:
      0 0 0 10px rgba(255, 105, 180, 0.35),
      0 0 60px rgba(255, 105, 180, 0.95),
      0 8px 24px var(--shadow-color);
  }

  100% {
    box-shadow: 0 8px 24px var(--shadow-color);
  }
}

.set-status-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  flex: 1;
  min-width: 0;
}

#set-status-count {
  font-size: 1rem;
  color: #222;
}

#set-status-message {
  font-size: 0.82rem;
  color: #555;
  margin-top: 2px;
}

.set-status-action {
  color: white;
  background: var(--primary);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: bold;
  white-space: nowrap;
  box-shadow: 2px 2px 0 #333;
}

.set-status-thumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 54px;
}

.set-status-thumb {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid white;
  object-fit: cover;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  margin-left: -8px;
  background: #f3f3f3;
}

.set-status-thumb:first-child {
  margin-left: 0;
}


/* preview card pop-in */
.preview-item.pop-in {
  animation: previewPopIn 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes previewPopIn {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.96);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* quantity pill feedback */
.preview-qty.bump {
  animation: qtyPulse 0.35s ease;
}

@keyframes qtyPulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.12);
  }

  100% {
    transform: scale(1);
  }
}

/* subtotal refresh */
.preview-subtotal.bump {
  animation: subtotalGlow 0.45s ease;
}

@keyframes subtotalGlow {
  0% {
    opacity: 0.65;
    transform: translateY(4px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/*********************************************
 * PREVIEW DRAWER – BASE
 *********************************************/
.preview-container {
  position: fixed;
  left: 50%;
  right: auto;
  bottom: 24px;
  z-index: 999;
  width: min(92%, 1100px);
  height: min(62vh, 620px);
  background: linear-gradient(
    180deg,
    rgba(255,255,255,0.92),
    rgba(248,240,248,0.96)
  );  
  border: 2px solid var(--border, #c9c9d9);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
  padding: 16px 16px 80px;
  box-sizing: border-box;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(calc(100% + 48px));
  transition:
  transform 1.99s cubic-bezier(0.22, 1, 0.36, 1),
  opacity 0.65s ease;
  will-change: transform, opacity;
}
.preview-container.open { 
  display: block;
  opacity: 1;
  left: 50%;
  right: auto;
  bottom: 24px;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
  width: min(92%, 1100px);
  height: min(62vh, 620px);
  max-height: none;
  overflow-y: auto;
  padding-top: 12px;
  padding-bottom: 10px;
}

/* Rail: default = one row, horizontally scrollable (desktop). 
   Responsive overrides adjust this. */
.preview-rail {
  display: grid;
  grid-auto-flow: column;                        
  grid-auto-columns: clamp(17px, 22vw, 230px);   
  gap: 22px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 8px 6px 0 4px;
  scroll-snap-type: x proximity;
  overscroll-behavior-x: contain;

}
.preview-rail::-webkit-scrollbar { height: 8px; }
.preview-rail::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,.15); border-radius: 8px;
}

/* Tile */
.preview-tile {
  position: relative;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 12px;
  border: 1px solid rgba(255, 105, 180, 0.38);
  background: rgba(255, 255, 255, 0.72);
  border-radius: 14px;
  box-shadow:
    0 8px 22px rgba(255, 105, 180, 0.12),
    0 2px 8px rgba(0, 0, 0, 0.06);
  width: 170px;
  min-height: 0;  
}

/* Image */
.preview-tile .tile-img {
  width: 118px;
  height: 118px;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid rgba(255, 105, 180, 0.45);
}

/* Chips stacked under image */
.preview-tile .tile-meta {
  display: flex;
  flex-direction: column;   /* <-- stack vertically */
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.preview-tile .chip {
  border: 1px solid var(--border, #d8d8e6);
  background: #fff;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: .85rem;
  line-height: 1.4;
  white-space: nowrap;
}

/* Remove button */
.preview-tile .tile-remove {
  position: absolute;
  top: 6px; right: 6px;
  width: 24px; height: 24px;
  border-radius: 999px;
  border: 1px solid var(--border, #d8d8e6);
  background: #fff;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.preview-tile .tile-remove:hover { background: var(--hover, #f4e6ff); }

/* Busy state overlay + spinner */
.preview-tile.is-busy {
  opacity: .65;
  position: relative;
  pointer-events: none;
}
.preview-tile.is-busy::after {
  content: "";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}
.preview-tile.is-busy::before {
  content: "";
  position: absolute;
  top: 10px;
  right: 10px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(0,0,0,.2);
  border-top-color: rgba(0,0,0,.55);
  animation: sasaspin .8s linear infinite;
}
@keyframes sasaspin { to { transform: rotate(360deg); } }

.preview-tile:focus-visible,
.preview-tile button:focus-visible,
.set-status-trigger:focus-visible,
#preview-checkout:focus-visible {
  outline: 3px solid #222;
  outline-offset: 4px;
}

 
/* Hand section headers - mockup style */
.preview-hand-section {
  position: relative;
  margin: 28px 0 38px;
  padding-top: 24px;
}

.preview-hand-section::before {
  content: "❤︎";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 0.99rem;
  background:
    linear-gradient(
      90deg,
      rgba(255, 105, 180, 0.25),
      rgba(255, 105, 180, 0.25)
    )
    left center / calc(50% - 18px) 1px no-repeat,
    linear-gradient(
      90deg,
      rgba(255, 105, 180, 0.25),
      rgba(255, 105, 180, 0.25)
    )
    right center / calc(50% - 18px) 1px no-repeat;
}

.hand-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 20px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  color: var(--primary);
  font-family: "Courier Prime", monospace;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* Preview checkout tray */
.preview-total {
  position: sticky;
  bottom: 0;
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: 32px -16px -80px;
  padding: 22px 28px 26px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255, 105, 180, 0.28);
  border-radius: 0 0 10px 10px;
  box-shadow: 0 -10px 26px rgba(255, 105, 180, 0.10);
  z-index: 8;
}
.preview-total::before {
  content: "";
  position: absolute;
  top: 0;
  left: 8%;
  width: 84%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 105, 180, 0.65),
    transparent
  );
}
.preview-total-icon {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at top, #ffffff 0%, #fff8fc 100%);
  border: 1px solid rgba(255, 105, 180, 0.08);
  box-shadow:
    0 12px 30px rgba(255, 105, 180, 0.16),
    0 2px 10px rgba(255,255,255,0.9) inset,
    0 0 0 6px rgba(255,255,255,0.35);

  backdrop-filter: blur(10px);
  flex-shrink: 0;
}
.preview-total-icon img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  filter:
    drop-shadow(0 4px 10px rgba(255, 105, 180, 0.18));
}
.preview-total-divider {
  width: 2px;
  align-self: stretch;
  background: linear-gradient(
    180deg,
    transparent,
    rgba(255, 105, 180, 0.35),
    transparent
  );
  opacity: 0.8;
  flex-shrink: 0;
}

.preview-total-right {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.preview-checkout-secure {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: none;
  color: rgba(60, 60, 60, 0.58);
}
.preview-total-left p {
  margin: 0;
  color: #555;
  font-size: .75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 800;
}

.preview-total-left p span:first-child {
  display: block;
}

.preview-total-left p span:first-child::after {
  content: " ✨";
}

#preview-subtotal {
  display: block;
  margin-top: 8px;
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: var(--primary);
}

.checkout-button {
  color: white;
  border: none;
  min-width: 300px;
  padding: 13px 30px;
  font-size: 0.95rem;
  border-radius: 999px;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  background: linear-gradient(135deg, var(--primary), #ff4fa3);
  box-shadow:
    0 10px 24px rgba(255, 105, 180, 0.28),
    0 3px 0 rgba(0,0,0,0.22);
  transition:
    transform 0.22s ease,
    box-shadow 0.22s ease,
    filter 0.22s ease;
}

.checkout-button:hover {
  transform: translateY(-2px);
  filter: brightness(1.04);
  box-shadow:
    0 16px 32px rgba(255, 105, 180, 0.34),
    0 4px 0 rgba(0,0,0,0.22);
}

.checkout-button:active {
  transform: translateY(1px);
}

#preview-checkout:disabled,
#preview-checkout[aria-disabled="true"],
#preview-checkout.is-disabled {
  opacity: .55;
  cursor: not-allowed;
  filter: saturate(0.6);
  pointer-events: none; /* no clicks for links */
}

/*********************************************
 * PREVIEW BAR MINIMIZE / RESTORE PILL
 *********************************************/
.preview-status-shell {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1001;
  width: min(92%, 720px);
  display: flex;
  align-items: center;
  transition:
    bottom 1.05s ease,
    width 0.55s ease,
    left 0.55s ease,
    right 0.55s ease,
    transform 0.55s ease;
}

/* Move fixed positioning responsibility from the trigger to the shell. */
.preview-status-shell .set-status-trigger {
  position: relative;
  inset: auto;
  left: auto;
  right: auto;
  bottom: auto;
  transform: none;
  z-index: auto;
  width: 100%;
  padding-right: 112px;
}

.preview-status-shell .set-status-trigger:hover {
  transform: none;
}

.preview-status-shell.is-open {
  bottom: calc(24px + min(62vh, 620px) - 38px);
  width: min(92%, 1100px);
}

.preview-status-shell.is-open .set-status-trigger {
  width: 100%;
}

/* Your old open positioning can stay in the file; this neutralizes it inside the shell. */
.preview-status-shell .set-status-trigger.is-open {
  left: auto;
  bottom: auto;
  transform: none;
  width: 100%;
}

.preview-minimize {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 105, 180, 0.36);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--primary);
  font-weight: 900;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(255, 105, 180, 0.18);
}

.preview-minimize:hover {
  transform: translateY(-50%) translateY(-1px);
  box-shadow: 0 6px 16px rgba(255, 105, 180, 0.26);
}

.preview-status-shell.is-open .preview-minimize {
  display: none;
}

.preview-restore-pill {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 48px;
  padding: 10px 18px;
  border: 2px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 8px 24px var(--shadow-color);
  color: #222;
  cursor: pointer;
  font: inherit;
}

.preview-restore-pill strong {
  font-size: 1rem;
  line-height: 1;
}

.preview-status-shell.is-minimized {
  left: auto;
  right: 18px;
  bottom: 18px;
  transform: none;
  width: auto;
}

.preview-status-shell.is-minimized .set-status-trigger,
.preview-status-shell.is-minimized .preview-minimize {
  display: none;
}

.preview-status-shell.is-minimized .preview-restore-pill {
  display: inline-flex;
}

.preview-restore-pill:focus-visible,
.preview-minimize:focus-visible {
  outline: 3px solid #222;
  outline-offset: 4px;
}

@media (max-width: 640px) {
  .preview-status-shell {
    width: calc(100% - 18px);
  }

  .preview-status-shell .set-status-trigger {
    padding-right: 62px;
  }

  .preview-minimize {
    right: 14px;
    width: 30px;
    height: 30px;
    font-size: 1.1rem;
  }

  .set-status-action {
    padding: 8px 12px;
    font-size: 0.72rem;
  }

  .preview-status-shell.is-minimized {
    right: 12px;
    bottom: 12px;
    width: auto;
  }
}
