/* Crib Flag | Popup-only decor upsell UI, 2026-11-07.
   Scoped to .decor-* so the existing storefront styles stay unchanged. */
body.decor-modal-open { overflow: hidden !important; }

.decor-modal-overlay {
  position: fixed; inset: 0; z-index: 100500;
  display: flex; justify-content: center; align-items: center;
  padding: 18px; background: rgba(10, 23, 47, .64);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  overscroll-behavior: contain;
}
.decor-modal, .decor-modal * { box-sizing: border-box; }
.decor-modal {
  --decor-ink: #172b4d;
  --decor-blue: #1457ff;
  --decor-muted: #697992;
  direction: rtl; display: flex; flex-direction: column; min-width: 0;
  width: min(880px, 100%);
  max-height: min(92vh, 900px); max-height: min(92dvh, 900px);
  overflow: hidden; border: 1px solid rgba(220, 230, 249, .9);
  border-radius: 26px; background: #fff;
  color: var(--decor-ink); text-align: right;
  font-family: 'Vazirmatn', system-ui, sans-serif;
  box-shadow: 0 30px 100px rgba(3, 15, 38, .32);
}
.decor-modal-header {
  position: relative; flex: 0 0 auto;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  padding: 21px 27px 16px;
  background: linear-gradient(105deg,#ffffff 35%, #f4f7ff 100%);
  border-bottom: 1px solid #edf1f8;
}
.decor-heading-content { flex: 1; min-width: 0; }
.decor-kicker {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 850; color: var(--decor-blue);
}
.decor-kicker-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--decor-blue); box-shadow: 0 0 0 4px #e6edff; }
.decor-modal-header h2 { margin: 5px 0 4px; font-size: clamp(19px, 2.4vw, 24px); line-height: 1.65; font-weight: 900; color: #142b53; }
.decor-modal-header p { margin: 0; font-size: 12px; line-height: 1.8; color: var(--decor-muted); }
.decor-dismiss {
  flex: 0 0 38px; width: 38px; height: 38px;
  display: grid; place-items: center; border-radius: 12px;
  color: #495e7c; background: #fff; border: 1px solid #e2e9f4;
  box-shadow: 0 4px 13px rgba(36, 57, 91, .045); cursor: pointer;
}
.decor-dismiss svg { width: 17px; height: 17px; }
.decor-dismiss:hover { color: #173c8c; background: #eef3ff; border-color: #b9cdf9; }
.decor-dismiss:focus-visible, .decor-modal button:focus-visible, .decor-modal select:focus-visible, .decor-modal input:focus-visible { outline: 3px solid #90b2ff; outline-offset: 2px; }

.decor-form { min-height: 0; flex: 1 1 auto; display: flex; flex-direction: column; }
.decor-modal-body {
  min-height: 0; flex: 1 1 auto; overflow-y: auto; overflow-x: hidden;
  overscroll-behavior: contain; padding: 17px 27px 20px;
  scrollbar-width: thin; scrollbar-color: #c4d1e7 transparent;
}
.decor-source-summary {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; background: #f8faff;
  border: 1px solid #e1e9fa; border-radius: 15px;
}
.decor-source-picture {
  display: grid; place-items: center; overflow: hidden;
  flex: 0 0 49px; width: 49px; height: 49px;
  border-radius: 10px; background: #edf2fc; color: var(--decor-blue);
}
.decor-source-picture img { display: block; width: 100% !important; height: 100% !important; object-fit: contain !important; }
.decor-source-summary > span:nth-child(2) { flex: 1; min-width: 0; }
.decor-source-summary small { display: block; color: #7a8aa5; font-size: 10px; }
.decor-source-summary strong { display: block; font-size: 13px; line-height: 1.6; color: #203858; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.decor-source-check { display: grid; place-items: center; width: 24px; height: 24px; flex: 0 0 24px; border-radius: 50%; color: #13875e; background: #e5f7ec; font-size: 15px; }

.decor-options { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); align-items: stretch; gap: 16px; margin-top: 15px; }
.decor-choice {
  min-width: 0; display: flex; flex-direction: column; gap: 0;
  padding: 12px; border: 1.5px solid #e0e7f2; border-radius: 20px;
  background: #fff; transition: border-color .16s, box-shadow .16s, background .16s;
}
.decor-choice.is-selected { border-color: #3b6cff; background: #fbfcff; box-shadow: 0 0 0 3px rgba(20, 87, 255, .065); }
.decor-product-visual {
  position: relative; display: block; overflow: hidden;
  height: clamp(195px, 28vh, 264px); height: clamp(195px, 28dvh, 264px);
  min-width: 0; border-radius: 14px;
  background: #f1f5fa; border: 1px solid #e6ebf3;
}
.decor-visual-stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 0; overflow: hidden; padding: 8px; }
/* Always show the whole uploaded product photograph. No cropping, regardless of source aspect ratio. */
.decor-product-visual .decor-visual-stage > img {
  display: block !important; width: 100% !important; height: 100% !important;
  min-width: 0; min-height: 0; max-width: 100%; max-height: 100%;
  object-fit: contain !important; object-position: center center !important;
  border-radius: 8px;
}
.decor-photo-placeholder { color: #8a9ab4; font-size: 26px; }
.decor-photo-badge {
  position: absolute; top: 10px; right: 10px; z-index: 1;
  max-width: calc(100% - 20px); padding: 5px 9px;
  border: 1px solid rgba(219, 228, 243, .9); border-radius: 9px;
  background: rgba(255,255,255,.96); color: #264c88;
  font-size: 10px; font-weight: 850; line-height: 1.5;
  box-shadow: 0 3px 10px rgba(12, 31, 65, .07);
}
.decor-choice-details { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; padding: 12px 3px 2px; gap: 12px; }
.decor-choice-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; cursor: pointer; }
.decor-choice-name { display: block; min-width: 0; flex: 1; }
.decor-choice-name strong { display: block; font-size: 14px; line-height: 1.7; font-weight: 850; color: #172f53; overflow-wrap: anywhere; }
.decor-choice-name small { display: block; margin-top: 3px; font-size: 11px; line-height: 1.7; color: #8290a6; }
.decor-check { appearance: none; -webkit-appearance: none; position: relative; width: 23px; height: 23px; flex: 0 0 23px; margin: 1px 0 0; border: 1.5px solid #b9c8e0; border-radius: 8px; background: white; cursor: pointer; }
.decor-check:checked { background: var(--decor-blue); border-color: var(--decor-blue); }
.decor-check:checked:after { content: ''; position: absolute; top: 4px; right: 7px; width: 5px; height: 9px; border: solid white; border-width: 0 0 2px 2px; transform: rotate(-45deg); }
.decor-variants { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
.decor-variants .decor-field:only-child { grid-column: 1 / -1; }
.decor-field { display: grid; gap: 6px; min-width: 0; color: #64738b; font-size: 11px; font-weight: 750; }
.decor-field select {
  width: 100%; min-width: 0; height: 42px; margin: 0;
  padding: 7px 10px; border: 1px solid #dbe4f1; border-radius: 11px;
  background: #fff; color: #193354; font-family: inherit; font-size: 11px;
  cursor: pointer; outline: none; text-overflow: ellipsis;
}
.decor-field select:hover { border-color: #9ab6e7; }
.decor-choice-bottom { display: flex; justify-content: space-between; gap: 6px; align-items: center; margin-top: auto; padding-top: 1px; }
.decor-item-price { display: block; font-size: 16px; line-height: 1.8; font-weight: 900; color: #1953e2; text-align: right; }
.decor-choice-flag { visibility: hidden; color: #a3afc2; font-size: 10px; font-weight: 800; white-space: nowrap; }
.decor-choice.is-selected .decor-choice-flag { visibility: visible; color: #16794e; }
.decor-note { margin: 14px 0 0; color: #8290a6; font-size: 11px; line-height: 1.8; }

.decor-form-bottom {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 27px; background: #fff; border-top: 1px solid #e9eef7;
  box-shadow: 0 -9px 24px rgba(20, 36, 74, .035);
}
.decor-cart-total { display: grid; gap: 3px; min-width: 0; }
.decor-cart-total small { color: #77869f; font-size: 10px; font-weight: 750; }
.decor-selected-summary { color: #1a3f8c; font-size: 14px; font-weight: 900; line-height: 1.7; }
.decor-form-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: center; gap: 10px; flex: 0 1 410px; width: 410px; }
.decor-form-actions .decor-add { width: 100%; min-width: 0; min-height: 46px; padding: 0 12px; border-radius: 13px; font-size: 13px; justify-content: center; }
.decor-add svg { width: 18px; height: 18px; }
.decor-form-actions .decor-add:disabled { cursor: not-allowed; opacity: .46; transform: none; box-shadow: none; }
.decor-skip { display: inline-flex; align-items: center; justify-content: center; width: 100%; min-width: 0; min-height: 46px; padding: 0 12px; border: 1px solid #dc3545; border-radius: 13px; background: #dc3545; color: #fff; font-size: 13px; font-weight: 750; font-family: inherit; cursor: pointer; white-space: nowrap; }
.decor-skip:hover { background: #b92738; border-color: #b92738; color: #fff; }

/* The mobile layout is a true product list, not two squashed desktop cards. */
@media (max-width: 680px) {
  .decor-modal-overlay { align-items: flex-end; padding: 0; }
  .decor-modal {
    width: 100%; max-width: none;
    max-height: 96vh; max-height: 96dvh;
    border-radius: 23px 23px 0 0; border-bottom: 0;
    box-shadow: 0 -18px 60px rgba(6, 19, 45, .25);
  }
  .decor-modal:before { content: ''; flex: 0 0 auto; display: block; height: 4px; width: 38px; margin: 9px auto 0; border-radius: 8px; background: #cfdaea; }
  .decor-modal-header { padding: 11px 17px 12px; gap: 12px; }
  .decor-modal-header h2 { font-size: 18px; margin: 3px 0; }
  .decor-modal-header p { font-size: 11px; line-height: 1.55; }
  .decor-kicker { font-size: 10px; }
  .decor-dismiss { width: 34px; height: 34px; flex-basis: 34px; border-radius: 10px; }
  .decor-modal-body { padding: 12px 15px 16px; }
  .decor-source-summary { padding: 8px 9px; border-radius: 13px; }
  .decor-source-picture { width: 40px; height: 40px; flex-basis: 40px; }
  .decor-source-summary strong { font-size: 11px; }
  .decor-options { grid-template-columns: minmax(0,1fr); gap: 11px; margin-top: 12px; }
  .decor-choice { display: grid; grid-template-columns: minmax(112px, 39%) minmax(0,1fr); gap: 11px; align-items: stretch; padding: 10px; border-radius: 16px; }
  .decor-product-visual { height: auto; min-height: 186px; border-radius: 12px; }
  .decor-visual-stage { padding: 5px; }
  .decor-photo-badge { top: 6px; right: 6px; font-size: 9px; padding: 3px 6px; border-radius: 6px; }
  .decor-choice-details { padding: 2px 0; gap: 8px; }
  .decor-choice-head { gap: 5px; }
  .decor-choice-name strong { font-size: 12px; line-height: 1.65; }
  .decor-choice-name small { font-size: 9px; line-height: 1.5; }
  .decor-check { width: 22px; height: 22px; flex-basis: 22px; }
  .decor-variants { grid-template-columns: minmax(0,1fr); gap: 7px; }
  .decor-variants .decor-field:only-child { grid-column: auto; }
  .decor-field { font-size: 10px; gap: 3px; }
  .decor-field select { height: 37px; padding: 5px 6px; font-size: 10px; border-radius: 9px; }
  .decor-item-price { font-size: 13px; }
  .decor-choice-flag { font-size: 9px; }
  .decor-note { font-size: 10px; }
  .decor-form-bottom { display: grid; grid-template-columns: 1fr; gap: 7px; padding: 11px 17px max(12px, env(safe-area-inset-bottom)); }
  .decor-cart-total { display: flex; gap: 10px; justify-content: space-between; align-items: center; }
  .decor-selected-summary { font-size: 13px; }
  .decor-form-actions { width: 100%; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
  .decor-form-actions .decor-add { min-width: 0; width: 100%; min-height: 44px; font-size: 12px; }
  .decor-skip { min-height: 44px; padding: 0 7px; font-size: 12px; }
}
@media (max-width: 359px) {
  .decor-modal-header { padding-inline: 13px; }
  .decor-modal-body { padding-inline: 11px; }
  .decor-choice { grid-template-columns: minmax(99px, 36%) minmax(0,1fr); gap: 8px; padding: 8px; }
  .decor-product-visual { min-height: 176px; }
  .decor-choice-name strong { font-size: 11px; }
  .decor-choice-flag { display: none; }
  .decor-form-bottom { padding-inline: 12px; }
}
@media (max-height: 560px) and (min-width: 681px) {
  .decor-modal { max-height: 96vh; max-height: 96dvh; }
  .decor-modal-header { padding-block: 12px; }
  .decor-product-visual { height: 180px; }
}
@media (prefers-reduced-motion: reduce) { .decor-choice { transition: none; } }

/* Legacy add-on cart thumbnails remain uncropped for existing purchases. */
.decor-cart-line .cart-thumb,.decor-cart-line .cart-page-image,.decor-cart-line .summary-thumb { background: #f3f6fa; }
.decor-cart-line .cart-thumb > img,.decor-cart-line .cart-page-image img,.decor-cart-line .summary-thumb > img,
.decor-cart-line .cart-thumb .static-image-box img,.decor-cart-line .cart-page-image .static-image-box img,.decor-cart-line .summary-thumb .static-image-box img { object-fit: contain !important; padding: 3px; }
