/* Template 4 cart and checkout. Logical spacing applies equally in LTR and RTL. */
#cart.t4-cart {
  position: fixed;
  inset: 0;
  padding: 16px !important;
  overflow: hidden;
  z-index: 1060;
}
#cart.t4-cart .modal-dialog {
  position: relative;
  inset: auto !important;
  margin: 0 auto !important;
  width: 100% !important;
  max-width: 820px !important;
  height: calc(100vh - 32px);
  height: calc(100dvh - 32px);
  min-height: 0;
  transform: none !important;
}
#cart.t4-cart .modal-dialog::before { display: none; }
#cart.t4-cart .modal-content {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: 100%;
  height: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--gray-200, #e5e7eb);
  border-radius: 20px;
  background: var(--card-background, #fff);
  color: var(--gray-900, #202124);
  text-align: start;
}
#cart.t4-cart .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-direction: row;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200, #e5e7eb);
}
.t4-cart-heading { display: flex; align-items: center; gap: 12px; min-width: 0; }
.t4-cart-heading > i { font-size: 30px; color: var(--primary-600, #d42b73); }
#cart.t4-cart .modal-title { margin: 0; font-size: 23px; line-height: 1.25; font-weight: 700; }
#cart.t4-cart .items-count-wrapper { margin: 3px 0 0; color: var(--gray-600, #5d636b); font-size: 13px; }
#cart.t4-cart .close-btn {
  flex: 0 0 44px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  margin: 0;
  border: 1px solid var(--gray-200, #e5e7eb);
  border-radius: 50%;
  background: var(--gray-100, #f4f5f7);
  color: inherit;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}
#cart.t4-cart .modal-body {
  display: grid;
  min-width: 0;
  min-height: 0;
  height: 100%;
  max-height: none;
  padding: 0;
  overflow: hidden;
}
#cart.t4-cart .cart-content-modal:not([style*="display: none"]):not([style*="display:none"]) {
  display: grid !important;
  grid-template-rows: minmax(0, 1fr) auto;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
#cart.t4-cart .cart-items-modern {
  min-height: 0;
  max-height: none;
  padding: 16px 20px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}
#cart.t4-cart .cart-item-modern {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: start;
  gap: 12px 16px;
  padding: 16px;
  margin: 0 0 12px;
  border: 1px solid var(--gray-200, #e5e7eb);
  border-radius: 12px;
  min-width: 0;
}
#cart.t4-cart .cart-item-modern:last-child { margin-bottom: 0; }
#cart.t4-cart .cart-item-image { margin: 0; }
#cart.t4-cart .cart-item-image img { width: 72px; height: 84px; object-fit: contain; border-radius: 8px; }
#cart.t4-cart .cart-item-details { min-width: 0; overflow-wrap: anywhere; }
#cart.t4-cart .cart-item-name { display: block; margin: 0 0 6px; font-size: 16px; font-weight: 600; line-height: 1.4; white-space: normal; }
#cart.t4-cart .cart-item-category { display: block; margin-bottom: 6px; font-size: 13px; color: var(--gray-600, #5d636b); }
#cart.t4-cart .price-unit { display: block; margin-top: 8px; font-weight: 600; }
.t4-cart-item-actions { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; }
.t4-cart-item-total { display: flex; align-items: center; gap: 12px; min-width: 0; }
#cart.t4-cart .price-total { font-size: 15px; font-weight: 700; white-space: nowrap; }
#cart.t4-cart .quantity-controls-modern { display: inline-flex; align-items: center; flex: none; border: 1px solid var(--gray-300, #d5d8df); border-radius: 24px; overflow: hidden; }
#cart.t4-cart .quantity-btn,
#cart.t4-cart .remove-item-btn { position: static; display: grid; place-items: center; width: 44px; height: 44px; flex: 0 0 44px; margin: 0; padding: 0; border: 0; background: transparent; color: inherit; font-size: 19px; line-height: 1; cursor: pointer; }
#cart.t4-cart .remove-item-btn { border: 1px solid var(--gray-200, #e5e7eb); border-radius: 50%; }
#cart.t4-cart .quantity-value { min-width: 28px; text-align: center; font-weight: 600; }
#cart.t4-cart .cart-footer-section { margin: 0; padding: 12px 20px 0; border-top: 1px solid var(--gray-200, #e5e7eb); min-width: 0; }
.t4-cart-promo { margin-bottom: 8px; }
.t4-cart-promo summary { min-height: 32px; display: list-item; cursor: pointer; font-size: 13px; padding-block: 6px; color: var(--gray-600, #5d636b); }
.t4-cart-promo__fields { display: flex; gap: 8px; margin-block: 6px 12px; }
.t4-cart-promo__fields input { flex: 1; min-width: 0; width: 100%; height: 44px; border: 1px solid var(--gray-300, #d5d8df); border-radius: 8px; padding: 10px; }
.t4-cart-promo__fields button { border: 1px solid var(--gray-300, #d5d8df); border-radius: 8px; background: transparent; padding: 8px 14px; }
.t4-cart-totals { margin: 0 0 12px; }
.t4-cart-totals > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 4px 0; font-size: 14px; }
.t4-cart-totals dt { margin: 0; font-weight: 400; color: var(--gray-600, #5d636b); }
.t4-cart-totals dd { margin: 0; font-weight: 600; white-space: nowrap; }
.t4-cart-totals .t4-cart-total { border-top: 1px solid var(--gray-200, #e5e7eb); margin-top: 5px; padding-top: 10px; font-size: 19px; font-weight: 700; }
.t4-cart-total dt { font-weight: 700; color: inherit; }
.t4-cart-total dd { color: var(--primary-600, #d42b73); }
.t4-cart-actions { display: grid; gap: 8px; }
#cart.t4-cart .t4-cart-primary,
#cart.t4-cart .t4-cart-secondary { display: flex; justify-content: center; align-items: center; width: 100%; min-height: 44px; height: auto; margin: 0; padding: 10px 16px; border-radius: 10px; font: inherit; font-size: 14px; font-weight: 600; line-height: 1.4; text-align: center; text-decoration: none; cursor: pointer; }
#cart.t4-cart .t4-cart-primary { min-height: 48px; border: 1px solid var(--primary-600, #d42b73); background: var(--primary-600, #d42b73); color: var(--button-text, #fff); }
#cart.t4-cart .t4-cart-secondary { border: 1px solid var(--gray-300, #d5d8df); background: transparent; color: var(--gray-700, #454b53); }
#cart.t4-cart .t4-cart-primary[aria-disabled="true"] { pointer-events: none; opacity: .5; }
#cart.t4-cart button:focus-visible,
#cart.t4-cart a:focus-visible,
#cart.t4-cart summary:focus-visible { outline: 2px solid var(--primary-600, #d42b73); outline-offset: 2px; }
.t4-cart-reassurance { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 10px 4px; margin-top: 8px; border-top: 1px solid var(--gray-200, #e5e7eb); color: var(--gray-600, #5d636b); font-size: 11px; line-height: 1.4; text-align: center; }
#cart.t4-cart .empty-cart-modal:not([style*="display: none"]):not([style*="display:none"]) { display: flex !important; flex-direction: column; align-items: center; justify-content: center; gap: 16px; min-height: 0; overflow: auto; padding: 24px; text-align: center; }
#cart.t4-cart .empty-cart-modal > i { font-size: 44px; color: var(--primary-600, #d42b73); }
#cart.t4-cart .empty-cart-modal h3,
#cart.t4-cart .empty-cart-modal p { margin: 0; }
#cart.t4-cart .empty-cart-modal .t4-cart-primary { width: auto; }
.t4-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#PageCheckoutForm .t4-checkout-table { table-layout: fixed; width: 100%; }
#PageCheckoutForm .t4-checkout-table th:last-child,
#PageCheckoutForm .t4-checkout-table td:last-child { width: 104px; text-align: end !important; padding-inline-start: 10px; }
.t4-checkout-product { display: flex; align-items: start; gap: 10px; min-width: 0; }
#PageCheckoutForm .t4-checkout-product img { width: 50px; height: 60px; object-fit: contain; flex: 0 0 50px; }
.t4-checkout-product > div { min-width: 0; overflow-wrap: anywhere; }
.t4-checkout-product strong,
.t4-checkout-product small { display: block; }
.t4-checkout-product small { margin-top: 5px; color: var(--gray-600, #5d636b); }
@media (max-width: 767px) {
  #PageCheckoutForm .t4-checkout-table,
  #PageCheckoutForm .t4-checkout-table tbody { display: block; width: 100%; }
  #PageCheckoutForm .t4-checkout-table thead { display: none; }
  #PageCheckoutForm .t4-checkout-table tbody tr { display: grid; gap: 8px; padding: 16px 0; border-bottom: 1px solid var(--gray-200, #e5e7eb); }
  #PageCheckoutForm .t4-checkout-table td { display: block !important; width: 100% !important; padding: 0 !important; border: 0; }
  #PageCheckoutForm .t4-checkout-table td:last-child { text-align: end !important; font-size: 16px; }
}
@media (max-width: 599px) {
  #cart.t4-cart { padding: 8px !important; }
  #cart.t4-cart .modal-dialog { height: calc(100vh - 16px); height: calc(100dvh - 16px); }
  #cart.t4-cart .modal-header { padding: 12px 16px; }
  #cart.t4-cart .modal-title { font-size: 21px; }
  #cart.t4-cart .cart-items-modern { padding: 12px; }
  #cart.t4-cart .cart-item-modern { grid-template-columns: 56px minmax(0, 1fr); gap: 10px; padding: 12px; }
  #cart.t4-cart .cart-item-image img { width: 56px; height: 68px; }
  #cart.t4-cart .cart-item-name { font-size: 14px; }
  #cart.t4-cart .cart-footer-section { padding-inline: 16px; }
  .t4-cart-item-actions, .t4-cart-item-total { gap: 6px; }
  #cart.t4-cart .price-total { font-size: 13px; }
}
@media (max-height: 520px) {
  #cart.t4-cart .cart-footer-section { max-height: 65vh; max-height: 65dvh; overflow-y: auto; }
}

/* Floating contact actions must not cover an open dialog. */
body.modal-open a[href*="wa.me"],
body.modal-open a[href*="api.whatsapp.com"] { visibility: hidden; }

#cart.t4-cart .modal-body,
#cart.t4-cart .cart-content-modal {
    grid-template-columns: minmax(0, 1fr);
    justify-content: stretch;
    justify-items: stretch;
}

#cart.t4-cart .modal-dialog { min-width: 0 !important; }
body.modal-open .header-area,
body.modal-open .intelligent-header { z-index: 1000 !important; }

body .mobile-header-bar {
    inline-size: 100%;
    max-inline-size: 100%;
    margin-inline: 0;
    box-sizing: border-box;
}
