/* Cart article customization modal.
   Scoped to #card_article_custom_modal so legacy cart logic remains untouched. */

:root {
  --cart-custom-ink: #262826;
  --cart-custom-muted: #70736b;
  --cart-custom-accent: #d72e43;
  --cart-custom-accent-hover: #bb2639;
  --cart-custom-line: #e8e5dd;
  --cart-custom-soft: #f7f6f2;
  --cart-custom-paper: #fff;
}

body .tingle-modal.popin-renferme:has(#card_article_custom_modal) {
  padding: 24px;
  background: rgba(24, 27, 25, .62);
  backdrop-filter: blur(5px);
}

body .tingle-modal.popin-renferme:has(#card_article_custom_modal) .tingle-modal-box {
  width: min(720px, calc(100vw - 48px));
  max-width: 720px;
  max-height: calc(100dvh - 48px);
  margin: 24px auto;
  overflow: hidden;
  border: 0;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 30px 90px rgba(24, 27, 25, .28);
}

body .tingle-modal.popin-renferme:has(#card_article_custom_modal) .tingle-modal-box__content {
  padding: 0;
}

body .tingle-modal.popin-renferme:has(#card_article_custom_modal) .tingle-modal__close {
  top: 15px;
  right: 15px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #f3f1eb;
  color: var(--cart-custom-ink);
}

body #card_article_custom_modal,
body #card_article_custom_modal *,
body #card_article_custom_modal *::before,
body #card_article_custom_modal *::after {
  box-sizing: border-box;
}

body #card_article_custom_modal {
  width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: var(--cart-custom-paper);
  color: var(--cart-custom-ink);
  text-align: left;
}

body #card_article_custom_modal .cart-custom-modal__form {
  display: flex;
  min-height: 0;
  max-height: calc(100dvh - 48px);
  flex-direction: column;
  margin: 0;
}

body #card_article_custom_modal .cart-custom-modal__header {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 82px;
  padding: 18px 62px 17px 24px;
  flex: 0 0 auto;
  border-bottom: 1px solid var(--cart-custom-line);
  background: #fff;
}

body #card_article_custom_modal .cart-custom-modal__icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 13px;
  background: #f8eaec;
  color: var(--cart-custom-accent);
}

body #card_article_custom_modal .cart-custom-modal__icon svg {
  width: 25px;
  height: 25px;
}

body #card_article_custom_modal .cart-custom-modal__heading {
  min-width: 0;
}

body #card_article_custom_modal .cart-custom-modal__title {
  margin: 0;
  color: var(--cart-custom-ink);
  font-size: 21px;
  line-height: 1.25;
  font-weight: 760;
  letter-spacing: -.025em;
}

body #card_article_custom_modal .cart-custom-modal__content {
  min-height: 0;
  margin: 0;
  padding: 22px 24px 28px;
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #fff;
  color: var(--cart-custom-ink);
  scrollbar-width: thin;
}

body #card_article_custom_modal .cart-custom-modal__content::-webkit-scrollbar {
  width: 8px;
}

body #card_article_custom_modal .cart-custom-modal__content::-webkit-scrollbar-thumb {
  border: 2px solid #fff;
  border-radius: 999px;
  background: #d8d5cd;
}

/* Product summary */
body #card_article_custom_modal .cart-custom-product {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  width: 100%;
  margin: 0 0 18px;
  padding: 0 0 20px;
  border-bottom: 1px solid var(--cart-custom-line);
}

body #card_article_custom_modal .cart-custom-product.no-pic {
  grid-template-columns: 1fr;
}

body #card_article_custom_modal .cart-custom-product__picture {
  width: 116px;
  height: 104px;
  overflow: hidden;
  border-radius: 14px;
  background: #f2f0ea;
}

body #card_article_custom_modal .cart-custom-product__picture img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

body #card_article_custom_modal .cart-custom-product__body {
  min-width: 0;
}

body #card_article_custom_modal .cart-custom-product__name {
  margin: 0 0 14px;
  color: var(--cart-custom-ink);
  font-size: 20px;
  line-height: 1.25;
  font-weight: 760;
  letter-spacing: -.02em;
}

body #card_article_custom_modal .cart-custom-product__badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin-left: 6px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #efede7;
  color: #6e716a;
  font-size: 9px;
  line-height: 1;
  font-weight: 750;
  vertical-align: middle;
}

body #card_article_custom_modal .cart-custom-description {
  margin: -4px 0 22px;
  padding: 0 0 18px;
  border-bottom: 1px solid var(--cart-custom-line);
  color: var(--cart-custom-muted);
  font-size: 12px;
  line-height: 1.65;
}

body #card_article_custom_modal .cart-custom-quantity {
  display: flex;
  align-items: center;
  gap: 12px;
  width: auto;
  margin: 0;
  padding: 0;
  float: none;
}

body #card_article_custom_modal .cart-custom-quantity > label {
  margin: 0;
  color: var(--cart-custom-muted);
  font-size: 11px;
  line-height: 1.35;
  font-weight: 650;
}

body #card_article_custom_modal .cart-custom-quantity__control {
  display: inline-grid;
  grid-template-columns: 36px 48px 36px;
  gap: 5px;
  align-items: center;
}

body #card_article_custom_modal .cart-custom-quantity__button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--cart-custom-line);
  border-radius: 9px;
  background: #fff;
  color: var(--cart-custom-ink);
  font-size: 18px;
  line-height: 1;
  font-weight: 500;
  cursor: pointer;
}

body #card_article_custom_modal .cart-custom-quantity__button:hover {
  border-color: #dfbec3;
  background: #fff6f7;
  color: var(--cart-custom-accent);
}

body #card_article_custom_modal .cart-custom-quantity__input {
  width: 48px;
  height: 36px;
  min-height: 36px;
  margin: 0;
  padding: 0 4px;
  border: 1px solid var(--cart-custom-line) !important;
  border-radius: 9px;
  background: #faf9f6 !important;
  color: var(--cart-custom-ink) !important;
  font-size: 12px;
  font-weight: 720;
  text-align: center;
  box-shadow: none !important;
  appearance: textfield;
}

body #card_article_custom_modal .cart-custom-quantity__input::-webkit-inner-spin-button,
body #card_article_custom_modal .cart-custom-quantity__input::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
}

/* Sections */
body #card_article_custom_modal .cart-custom-section-title {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 7px;
  margin: 24px 0 11px;
  color: var(--cart-custom-ink);
  font-size: 15px;
  line-height: 1.35;
  font-weight: 750;
  letter-spacing: -.012em;
}

body #card_article_custom_modal .cart-custom-section-title:first-of-type {
  margin-top: 4px;
}

body #card_article_custom_modal .cart-custom-advice,
body #card_article_custom_modal .advice {
  color: #8a8d85;
  font-size: 10px;
  line-height: 1.3;
  font-weight: 600;
}

/* Main option cards */
body #card_article_custom_modal ul.supplement,
body #card_article_custom_modal .cart-custom-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

body #card_article_custom_modal ul.supplement > li {
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: 50px;
  margin: 0;
  padding: 0;
  float: none;
  overflow: hidden;
  border: 1px solid var(--cart-custom-line);
  border-radius: 11px;
  background: #fff;
  color: var(--cart-custom-ink);
  list-style: none;
  transition: border-color .16s ease, background-color .16s ease, box-shadow .16s ease;
}

body #card_article_custom_modal ul.supplement > li:hover {
  border-color: #dcd7cc;
  background: #fdfcf9;
}

body #card_article_custom_modal ul.supplement > li:has(> input:checked) {
  border-color: #e4b3ba;
  background: #fff7f8;
  box-shadow: inset 0 0 0 1px rgba(215, 46, 67, .04);
}

body #card_article_custom_modal ul.supplement > li:has(> input:disabled) {
  background: #faf9f6;
  opacity: .64;
}

body #card_article_custom_modal ul.supplement > li > input[type="radio"],
body #card_article_custom_modal ul.supplement > li > input[type="checkbox"] {
  position: absolute;
  top: 16px;
  left: 14px;
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--cart-custom-accent);
  z-index: 2;
}

/* Legacy monresto.min.css also draws radio / checkbox controls on labels.
   Keep only the real input in this modal to avoid duplicated controls. */
body #card_article_custom_modal ul.supplement > li > input[type="radio"] + label::before,
body #card_article_custom_modal ul.supplement > li > input[type="radio"] + label::after,
body #card_article_custom_modal ul.supplement > li > input[type="checkbox"] + label::before,
body #card_article_custom_modal ul.supplement > li > input[type="checkbox"] + label::after {
  content: none !important;
  display: none !important;
}

body #card_article_custom_modal ul.supplement > li > label {
  display: block;
  width: 100%;
  min-height: 49px;
  margin: 0;
  padding: 15px 15px 14px 43px;
  color: var(--cart-custom-ink);
  font-size: 12px;
  line-height: 1.45;
  font-weight: 640;
  cursor: pointer;
}

body #card_article_custom_modal ul.supplement > li:has(> .wrapper) > label {
  padding-right: 56px;
}

body #card_article_custom_modal .dish-details {
  margin: 5px 0 0;
  color: var(--cart-custom-muted);
  font-size: 10px;
  line-height: 1.5;
  font-weight: 450;
}

body #card_article_custom_modal ul.supplement > li > label span[style] {
  color: #b43d4b !important;
  font-size: 10px;
  font-weight: 700;
}

/* Expander for options which themselves contain options. */
body #card_article_custom_modal ul.supplement > li > .wrapper {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 36px;
  height: 36px;
  margin: 0;
  border-radius: 9px;
  background: #f4f2ed;
  cursor: pointer;
  z-index: 3;
}

body #card_article_custom_modal ul.supplement > li > .wrapper::after {
  content: "⌄";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #777a73;
  font-size: 17px;
  line-height: 1;
  transition: transform .16s ease;
}

body #card_article_custom_modal ul.supplement > li.unwrapped > .wrapper::after {
  transform: rotate(180deg);
}

/* Nested customization */
body #card_article_custom_modal .supplement-nested {
  display: none;
  margin: 0;
  padding: 14px;
  border-top: 1px solid #eeeae2;
  background: #faf9f6;
}

body #card_article_custom_modal li.unwrapped > .supplement-nested {
  display: block;
}

body #card_article_custom_modal .cart-custom-nested-title,
body #card_article_custom_modal .supplement-nested h4 {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 9px;
  color: var(--cart-custom-ink);
  font-size: 11px;
  line-height: 1.4;
  font-weight: 730;
}

body #card_article_custom_modal .supplement-nested h4:not(:first-child) {
  margin-top: 15px;
}

body #card_article_custom_modal .supplement-nested > ul,
body #card_article_custom_modal .supplement-nested ul {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

body #card_article_custom_modal .supplement-nested ul > li {
  position: relative;
  width: 100%;
  min-height: 42px;
  margin: 0;
  padding: 0;
  float: none;
  border: 1px solid #e4e0d7;
  border-radius: 9px;
  background: #fff;
  list-style: none;
}

body #card_article_custom_modal .supplement-nested ul > li:has(input:checked) {
  border-color: #e3bac0;
  background: #fff8f9;
}

body #card_article_custom_modal .supplement-nested ul > li:has(input:disabled) {
  opacity: .58;
}

body #card_article_custom_modal .supplement-nested ul > li > input[type="radio"],
body #card_article_custom_modal .supplement-nested ul > li > input[type="checkbox"] {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--cart-custom-accent);
}

body #card_article_custom_modal .supplement-nested ul > li > input[type="radio"] + label::before,
body #card_article_custom_modal .supplement-nested ul > li > input[type="radio"] + label::after,
body #card_article_custom_modal .supplement-nested ul > li > input[type="checkbox"] + label::before,
body #card_article_custom_modal .supplement-nested ul > li > input[type="checkbox"] + label::after {
  content: none !important;
  display: none !important;
}

body #card_article_custom_modal .supplement-nested ul > li > label {
  display: block;
  min-height: 41px;
  margin: 0;
  padding: 11px 12px 10px 38px;
  color: var(--cart-custom-ink);
  font-size: 10px;
  line-height: 1.45;
  font-weight: 600;
  cursor: pointer;
}

/* Instructions */
body #card_article_custom_modal .cart-custom-instructions {
  margin-top: 25px;
  padding-top: 2px;
}

body #card_article_custom_modal .cart-custom-instructions .cart-custom-section-title {
  margin-top: 0;
}

body #card_article_custom_modal .cart-custom-instructions__input {
  display: block;
  width: 100%;
  min-height: 96px;
  margin: 0;
  padding: 12px 13px;
  resize: vertical;
  border: 1px solid var(--cart-custom-line) !important;
  border-radius: 11px;
  background: #fff !important;
  color: var(--cart-custom-ink) !important;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.55;
  box-shadow: none !important;
  outline: 0;
}

body #card_article_custom_modal .cart-custom-instructions__input:focus {
  border-color: #d99aa4 !important;
  box-shadow: 0 0 0 3px rgba(215, 46, 67, .09) !important;
}

/* Validation errors inserted by existing cart code. */
body #card_article_custom_modal .error,
body #card_article_custom_modal li.error {
  border-color: #d87884 !important;
  background: #fff4f5 !important;
}

body #card_article_custom_modal .error-msg,
body #card_article_custom_modal .invalid-feedback {
  margin: 6px 2px 0;
  color: #ac3e4b;
  font-size: 10px;
  line-height: 1.45;
}

/* Footer */
body #card_article_custom_modal .cart-custom-modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 0;
  padding: 15px 24px 20px;
  flex: 0 0 auto;
  border-top: 1px solid var(--cart-custom-line);
  background: #fff;
  box-shadow: 0 -8px 24px rgba(40, 37, 30, .035);
}

body #card_article_custom_modal .cart-custom-modal__cancel,
body #card_article_custom_modal .cart-custom-modal__submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin: 0;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.3;
  font-weight: 720;
  box-shadow: none;
}

body #card_article_custom_modal .cart-custom-modal__cancel {
  border: 1px solid var(--cart-custom-line);
  background: #fff;
  color: var(--cart-custom-ink);
}

body #card_article_custom_modal .cart-custom-modal__cancel:hover {
  background: #f7f5f0;
}

body #card_article_custom_modal .cart-custom-modal__submit {
  gap: 11px;
  min-width: 118px;
  border: 1px solid var(--cart-custom-accent);
  background: var(--cart-custom-accent);
  color: #fff;
}

body #card_article_custom_modal .cart-custom-modal__submit:hover {
  border-color: var(--cart-custom-accent-hover);
  background: var(--cart-custom-accent-hover);
}

/* Loading layer used by legacy AJAX helpers. */
body #card_article_custom_modal .loading {
  border-radius: inherit;
}

@media (max-width: 640px) {
  body .tingle-modal.popin-renferme:has(#card_article_custom_modal) {
    padding: 0;
    align-items: flex-end;
  }

  body .tingle-modal.popin-renferme:has(#card_article_custom_modal) .tingle-modal-box {
    width: 100%;
    max-width: none;
    max-height: calc(100dvh - 8px);
    margin: 8px 0 0;
    border-radius: 20px 20px 0 0;
  }

  body .tingle-modal.popin-renferme:has(#card_article_custom_modal) .tingle-modal__close {
    top: 12px;
    right: 12px;
  }

  body #card_article_custom_modal .cart-custom-modal__form {
    max-height: calc(100dvh - 8px);
  }

  body #card_article_custom_modal .cart-custom-modal__header {
    min-height: 70px;
    padding: 14px 56px 13px 17px;
  }

  body #card_article_custom_modal .cart-custom-modal__icon {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
  }

  body #card_article_custom_modal .cart-custom-modal__title {
    font-size: 18px;
  }

  body #card_article_custom_modal .cart-custom-modal__content {
    padding: 17px 17px 22px;
  }

  body #card_article_custom_modal .cart-custom-product {
    grid-template-columns: 84px minmax(0, 1fr);
    gap: 13px;
    padding-bottom: 17px;
  }

  body #card_article_custom_modal .cart-custom-product.no-pic {
    grid-template-columns: 1fr;
  }

  body #card_article_custom_modal .cart-custom-product__picture {
    width: 84px;
    height: 84px;
    border-radius: 12px;
  }

  body #card_article_custom_modal .cart-custom-product__name {
    margin-bottom: 10px;
    font-size: 16px;
  }

  body #card_article_custom_modal .cart-custom-quantity {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  body #card_article_custom_modal .cart-custom-quantity__control {
    grid-template-columns: 34px 45px 34px;
  }

  body #card_article_custom_modal .cart-custom-quantity__button {
    width: 34px;
    height: 34px;
  }

  body #card_article_custom_modal .cart-custom-quantity__input {
    width: 45px;
    height: 34px;
    min-height: 34px;
  }

  body #card_article_custom_modal .cart-custom-section-title {
    margin-top: 21px;
    font-size: 14px;
  }

  body #card_article_custom_modal ul.supplement > li > label {
    padding-top: 14px;
    padding-bottom: 13px;
    font-size: 11px;
  }

  body #card_article_custom_modal .cart-custom-modal__footer {
    padding: 11px 17px max(14px, env(safe-area-inset-bottom));
  }

  body #card_article_custom_modal .cart-custom-modal__cancel,
  body #card_article_custom_modal .cart-custom-modal__submit {
    flex: 1;
    min-width: 0;
    min-height: 48px;
  }
}

@media (max-width: 390px) {
  body #card_article_custom_modal .cart-custom-product {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  body #card_article_custom_modal .cart-custom-product__picture {
    width: 72px;
    height: 72px;
  }

  body #card_article_custom_modal .cart-custom-quantity__control {
    grid-template-columns: 32px 42px 32px;
  }

  body #card_article_custom_modal .cart-custom-quantity__button {
    width: 32px;
    height: 32px;
  }

  body #card_article_custom_modal .cart-custom-quantity__input {
    width: 42px;
    height: 32px;
    min-height: 32px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body #card_article_custom_modal *,
  body #card_article_custom_modal *::before,
  body #card_article_custom_modal *::after {
    transition: none !important;
  }
}
