/* ============================================================
   IMAKE — COMPLETE CAKE RECEIPT + PREMIUM CHECKOUT BORDERS
   Only styles #modal receipt and its component listing.
   Does NOT alter .stage, .layer, decoration offsets, screenshot/export,
   the thumbnail slideshow rail, or builder step/price calculations.
   ============================================================ */
:root {
  --receipt-rose: #a33d66;
  --receipt-blush: #f7d8e4;
  --receipt-chocolate: #46242f;
}
#modal .checkout-panel {
  background: #fffbfc;
  border: 2px solid #edbdd0;
  box-shadow: 0 32px 95px rgba(69, 19, 39, .27),
              0 0 0 5px rgba(255,255,255,.85);
}
#modal .checkout-panel > header {
  border-bottom: 1px solid #f0ccda;
  background: linear-gradient(100deg, #fff, #fff1f6 65%, #fffaf4);
}
#modal .checkout-panel > header h2 {
  color: var(--receipt-chocolate);
  letter-spacing: -.015em;
}
#modal .checkout-panel > header .x {
  border: 1px solid #ebc5d2;
  border-radius: 12px;
  background: #fff6fa;
  color: #7d3454;
}
#modal .checkout-layout {
  background: linear-gradient(140deg, #fffbfa, #fff1f6 60%, #fff9f5);
}
#modal .summary-card,
#modal .checkout-card {
  border: 1.5px solid #efceda;
  box-shadow: 0 11px 26px rgba(110,39,73,.075), inset 0 1px 0 #fff;
  background: #fffcfc;
}
#modal .preview-card {
  /* Scroll inside the left card to see every selected component; the image
     itself still uses the original .stage/.layer stacking implementation. */
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #d39bb1 #fff5f8;
}
#modal .preview-card::-webkit-scrollbar { width: 7px; }
#modal .preview-card::-webkit-scrollbar-thumb { background: #d39bb1; border-radius: 99px; }
#modal .summary-preview {
  flex: 0 0 auto;
  width: 100%;
  height: min(45dvh, 445px);
  min-height: 245px;
  border: 1.5px solid #f1d4e0;
  border-radius: 18px;
  box-shadow: inset 0 0 0 6px rgba(255,255,255,.55);
}
#modal .preview-details {
  padding: 13px 5px 7px;
}
#modal .preview-details h3 { color: var(--receipt-chocolate); }
#modal .preview-thumbs {
  padding: 3px 1px 7px;
}
#modal .preview-thumb {
  border: 1.5px solid #eac5d3;
  background: #fffafa;
  box-shadow: 0 2px 8px rgba(84,27,52,.055);
}
#modal .preview-thumb.active {
  border-color: var(--receipt-rose);
  box-shadow: 0 0 0 2px #fae1eb;
}
/* ----- MIDDLE: illustrated Order Summary (the only full selected-item list) ----- */
#modal .order-summary-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}
#modal .receipt-order-subtitle {
  margin: 6px 0 0;
  color: #906b7b;
  line-height: 1.35;
  font-size: .72rem;
}
#modal .receipt-components-count {
  flex: 0 0 auto;
  padding: 6px 8px;
  border-radius: 999px;
  background: #fce4ed;
  border: 1px solid #f1c6d7;
  color: #982d59;
  font-size: .64rem;
  font-weight: 850;
  white-space: nowrap;
}
#modal .order-card .receipt-order-items {
  padding: 10px 11px 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin: 0;
  list-style: none;
}
#modal .order-card .receipt-order-items li.receipt-order-item {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 56px minmax(0,1fr) auto;
  align-items: center;
  gap: 9px;
  margin: 0;
  padding: 10px 9px;
  min-width: 0;
  border: 1.5px solid #edcad8;
  border-radius: 14px;
  background: linear-gradient(120deg,#fff 0%,#fff8fb 100%);
  box-shadow: 0 3px 9px rgba(111,47,73,.055),inset 0 1px 0 #fff;
}
#modal .receipt-order-item .receipt-component-visual {
  width: 56px;
  height: 58px;
  min-width: 0;
  border: 1px solid #f0cfdd;
  background: #fff;
  border-radius: 11px;
  display: grid;
  place-items: center;
  overflow: hidden;
  font-size: 1.38rem;
  color: #a33d66;
}
#modal .receipt-order-item .receipt-component-visual img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
#modal .receipt-order-item .receipt-component-visual.receipt-component-fallback {
  background: #fff1f6;
}
#modal .receipt-order-item .receipt-component-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}
#modal .receipt-order-item .receipt-component-category {
  display: block;
  color: #a34d72;
  font-size: .64rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .02em;
}
#modal .receipt-order-item .receipt-component-name {
  display: block;
  color: #45242f;
  font-size: .81rem;
  font-weight: 800;
  line-height: 1.3;
}
#modal .receipt-order-item .receipt-component-description {
  display: block;
  font-size: .7rem;
  color: #86697a;
  font-weight: 400;
  line-height: 1.35;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
#modal .order-card .receipt-order-items .receipt-component-price {
  flex: 0 0 auto;
  justify-self: end;
  align-self: center;
  max-width: 88px;
  padding: 0;
  font-size: .73rem;
  font-weight: 900;
  text-align: right;
  color: #a1335e;
  overflow-wrap: anywhere;
}
#modal .order-card .receipt-order-items .receipt-component-price:last-child { padding-left: 0; }
#modal .preview-card { overflow-x: hidden; }
#modal .preview-card .preview-details { flex: 0 0 auto; }
#modal .order-card .section-heading,
#modal #orderForm > .section-heading {
  background: linear-gradient(110deg, #fff7fa, #fffdfc);
  border-bottom: 1px solid #efd3dd;
}
#modal .order-card .total-row {
  background: linear-gradient(135deg, #ffe8f1, #fff5f8);
  border-top: 2px solid #eec2d2;
}
#modal .order-card .total-row span:last-child {
  color: #952c59;
}
#modal #orderForm input:focus-visible,
#modal #orderForm button:focus-visible {
  outline: 3px solid #efb3c9;
  outline-offset: 2px;
}
#modal .receipt-card {
  border: 1.5px solid #e6bacb;
  background: #fff8fa;
}
/* Keep the original modal column layout and image stacking on all screens. */
@media (max-width: 980px) {
  #modal .preview-card { overflow: visible; }
  #modal .summary-preview {
    height: auto;
    min-height: 0;
    max-height: none;
    aspect-ratio: 10 / 11;
  }
}

@media (max-height: 720px) and (min-width:981px) {
  #modal .summary-preview { height: min(43dvh, 365px); min-height: 200px; }
}

/* ---------- receipt: ALL selected component thumbnails ----------
   Horizontal scroll is kept; no change to the actual layered cake preview. */
#modal .preview-thumbs {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 7px;
  min-height: 88px;
  padding: 4px 2px 10px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  scrollbar-width: auto;
  scrollbar-color: #c77f9c #fff1f6;
}
#modal .preview-thumbs::-webkit-scrollbar { height: 7px; }
#modal .preview-thumbs::-webkit-scrollbar-track { background: #fff1f6; border-radius: 99px; }
#modal .preview-thumbs::-webkit-scrollbar-thumb { background: #c77f9c; border-radius: 99px; }
#modal .preview-thumbs .receipt-thumb {
  flex: 0 0 76px;
  width: 76px;
  min-width: 76px;
  height: 85px;
  min-height: 85px;
  padding: 5px 3px 4px;
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 4px;
  border: 1.5px solid #e9b3c8;
  border-radius: 12px;
  overflow: hidden;
  scroll-snap-align: start;
  background: linear-gradient(180deg, #fff, #fff4f8);
  box-sizing: border-box;
}
#modal .preview-thumbs .receipt-thumb .receipt-thumb-visual {
  width: 60px;
  height: 52px;
  min-height: 52px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
#modal .preview-thumbs .receipt-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
#modal .preview-thumbs .receipt-thumb .receipt-thumb-visual.is-fallback {
  background: #fff2f7;
  font-size: 1.4rem;
}
#modal .preview-thumbs .receipt-thumb .receipt-thumb-label {
  display: block;
  max-width: 100%;
  font-size: .61rem;
  line-height: 1.12;
  font-weight: 800;
  color: #963757;
  text-align: center;
  white-space: normal;
  overflow: hidden;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
#modal #receiptThumbScrollHint {
  margin: 1px 0 6px;
  color: #9c5270;
  font-size: .69rem;
  text-align: left;
}
#modal #receiptThumbScrollHint[hidden] { display: none; }
@media (max-width: 600px) {
  #modal .preview-thumbs .receipt-thumb { flex-basis: 70px; width: 70px; min-width: 70px; }
  #modal .preview-thumbs .receipt-thumb .receipt-thumb-visual { width: 56px; }
}

/* Item cards shrink gracefully, without resizing the actual cake preview. */
@media (max-width: 1180px) {
  #modal .order-card .receipt-order-items li.receipt-order-item {
    grid-template-columns: 48px minmax(0,1fr);
    grid-template-areas: "visual text" "visual price";
    align-items: center;
    gap: 3px 9px;
  }
  #modal .receipt-order-item .receipt-component-visual { grid-area: visual; width: 48px; height: 54px; }
  #modal .receipt-order-item .receipt-component-copy { grid-area: text; }
  #modal .order-card .receipt-order-items .receipt-component-price {
    grid-area: price;
    justify-self: start;
    text-align: left;
    max-width: none;
  }
}
@media (max-width: 600px) {
  #modal .order-card .receipt-order-items { padding: 9px; gap: 8px; }
  #modal .order-card .receipt-order-items li.receipt-order-item { padding: 9px; }
  #modal .order-summary-heading { gap: 7px; }
  #modal .receipt-order-subtitle { font-size: .68rem; }
}
