/* Cross-browser helpers for primbas storefront */

/* aspect-ratio fallback for older Safari / Chromium */
@supports not (aspect-ratio: 1 / 1) {
  #gallery-main-frame,
  .gallery-thumb,
  .product-photo-placeholder--lg {
    height: 0;
    padding-bottom: 100%;
    position: relative;
  }
  #gallery-main-frame > img,
  #gallery-main-frame > model-viewer,
  .gallery-thumb > img,
  .product-photo-placeholder--lg > * {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
  }
}

/* sticky is widely supported; keep -webkit for older iOS */
.sticky-top {
  position: -webkit-sticky;
  position: sticky;
}

/* Safer flex gap fallback via margins when gap unsupported (very old engines) */
@supports not (gap: 1rem) {
  .site-header__top,
  .site-header__main,
  .social-ico--row {
    margin-left: -6px;
  }
  .site-header__top > *,
  .site-header__main > *,
  .social-ico--row > * {
    margin-left: 6px;
  }
}

/* Compact add-to-cart toasts (bas-like), not full-width banners */
.pb-toast-stack {
  position: fixed;
  top: 72px;
  right: 12px;
  z-index: 1080;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(360px, calc(100vw - 24px));
  pointer-events: none;
}
.pb-toast-stack:empty { display: none; }
.pb-toast {
  pointer-events: auto;
  position: relative;
  padding: 10px 32px 10px 12px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  font-size: 13px;
  line-height: 1.35;
  color: #1f2937;
  animation: pb-toast-in .18s ease-out;
}
.pb-toast--success { border-left: 3px solid #16a34a; }
.pb-toast--info { border-left: 3px solid #0d9488; }
.pb-toast--warning { border-left: 3px solid #d97706; }
.pb-toast--danger { border-left: 3px solid #dc2626; }
.pb-toast__close {
  position: absolute;
  top: 4px;
  right: 6px;
  border: 0;
  background: transparent;
  color: #64748b;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
}
.pb-toast__body strong { font-weight: 600; }
.pb-toast__actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.pb-toast__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #f8fafc;
  color: #0f172a;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
}
.pb-toast__btn--primary {
  background: #0d9488;
  border-color: #0d9488;
  color: #fff;
}
.pb-toast__btn:hover { filter: brightness(0.97); color: inherit; }
.pb-toast__btn--primary:hover { color: #fff; filter: brightness(1.05); }
@keyframes pb-toast-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}
@media (max-width: 575.98px) {
  .pb-toast-stack { top: auto; bottom: 72px; right: 10px; left: 10px; width: auto; }
}

/* ===== One-page basket checkout (bas-like) ===== */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.basket-page-title {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 18px;
  color: #111827;
}

.basket-layout--checkout {
  grid-template-columns: minmax(0, 1.65fr) minmax(300px, 0.8fr);
  gap: 28px 36px;
}

.basket-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.cart-block {
  background: #fff;
  border: 1px solid #e8eaee;
  border-radius: 14px;
  padding: 22px 24px;
}

.cart-block--items {
  padding: 8px 18px 10px;
}

.cart-block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.cart-block-head h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #111827;
}

.cart-block-hint {
  font-size: 13px;
  color: #6b7280;
}
.cart-block-hint a { color: #0d9488; }

.cart-block-note {
  margin: 0 0 14px;
  font-size: 14px;
}

/* ---- cart item rows (bas) ---- */
.cart-item {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 16px;
  padding: 18px 6px;
  border-bottom: 1px solid #eceff3;
}
.cart-item:last-child { border-bottom: 0; }

.cart-item__img {
  width: 88px;
  height: 88px;
  border-radius: 10px;
  overflow: hidden;
  background: #f3f4f6;
}
.cart-item__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-item__body { min-width: 0; }

.cart-item__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.cart-item__code {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 4px;
}
.cart-item__copy {
  border: 0;
  background: transparent;
  color: #9ca3af;
  padding: 0;
  line-height: 1;
  cursor: pointer;
}
.cart-item__copy.is-copied { color: #0d9488; }

.cart-item__name {
  display: block;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  color: #111827;
  text-decoration: none;
}
.cart-item__name:hover { color: #0d9488; }

.cart-item__avail {
  margin: 4px 0 0;
  font-size: 12px;
  color: #9ca3af;
}

.cart-item__actions { flex: 0 0 auto; }
.cart-item__remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: #9ca3af;
  text-decoration: none;
  border-radius: 8px;
}
.cart-item__remove:hover { color: #dc2626; background: #fef2f2; }

.cart-item__bottom {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 14px;
}
.cart-item__price {
  font-size: 18px;
  font-weight: 700;
  color: #111827;
  min-width: 96px;
}

.cart-block--items .basket-qty-stepper {
  border-radius: 999px;
  border-color: #dbe0e6;
}
.cart-block--items .qty-btn {
  width: 34px;
  height: 34px;
  background: transparent;
}
.cart-block--items .basket-qty-input {
  width: 40px;
  font-weight: 600;
}

/* ---- floating fields ---- */
.cart-fields { display: flex; flex-direction: column; gap: 12px; }
.cart-fields--double {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
.cart-delivery-address { margin-top: 16px; margin-bottom: 0; }

.cart-field--select label {
  display: block;
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 6px;
}
.cart-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7280' d='M1.4.6 6 5.2 10.6.6 12 2 6 8 0 2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}
.cart-field-note {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.35;
  color: #7a7f89;
}
.cart-field-note.is-error { color: #dc2626; }
#pb-bank-name[readonly],
#pb-bank-corr[readonly],
#pb-company-name[readonly],
#pb-company-address[readonly] {
  background: #f3f4f6;
  color: #111827;
}
.cart-field--suggest { position: relative; }
.cart-suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 40;
  margin: 0;
  padding: 0;
  list-style: none;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(17, 24, 39, 0.12);
  max-height: 280px;
  overflow: auto;
}
.cart-suggest__btn {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid #f1f5f9;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.cart-suggest__btn:last-child { border-bottom: 0; }
.cart-suggest__btn:hover,
.cart-suggest__btn.is-active { background: #f5f7f9; }
.cart-suggest__name {
  font-weight: 600;
  font-size: 14px;
  line-height: 1.3;
}
.cart-suggest__meta {
  font-size: 12px;
  color: #6b7280;
  line-height: 1.35;
}
#pb-tk-wrap[hidden],
#pb-delivery-address-wrap[hidden],
#pb-pickup-note[hidden] {
  display: none !important;
}

.cart-field--float {
  position: relative;
}
.cart-field--float .cart-input {
  padding: 18px 14px 8px;
}
.cart-field--float label {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
  font-size: 14px;
  color: #9ca3af;
  pointer-events: none;
  transition: top .12s ease, font-size .12s ease, color .12s ease, transform .12s ease;
}
.cart-field--float .cart-input:focus + label,
.cart-field--float .cart-input:not(:placeholder-shown) + label,
.cart-field--float .cart-input[readonly]:not([value=""]) + label {
  top: 8px;
  transform: none;
  font-size: 11px;
  color: #6b7280;
}
.cart-field label em {
  color: #ef4444;
  font-style: normal;
}

.cart-input {
  width: 100%;
  border: 1px solid #dce1e8;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 15px;
  line-height: 1.3;
  background: #fff;
  color: #111827;
  font-family: inherit;
}
.cart-input:focus {
  outline: none;
  border-color: #0d9488;
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}
.cart-input--area {
  resize: vertical;
  min-height: 84px;
  padding-top: 14px;
}

.cart-shipmethods,
.cart-paymethods {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.cart-shipmethod,
.cart-paymethod {
  display: block;
  cursor: pointer;
  margin: 0;
}

.cart-shipmethod__body,
.cart-paymethod-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 12px 14px;
  border: 1px solid #dce1e8;
  border-radius: 12px;
  background: #fafbfc;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}

.cart-shipmethod.is-selected .cart-shipmethod__body,
.cart-paymethod.is-selected .cart-paymethod-inner {
  border-color: #0d9488;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}

.cart-shipmethod__title,
.cart-paymethod-title {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #111827;
}

.cart-shipmethod__info,
.cart-paymethod-info {
  display: block;
  font-size: 12px;
  color: #6b7280;
  margin-top: 2px;
}

.cart-paymethod-badge {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
}
.cart-paymethod-badge--sbp { background: #1d4ed8; }
.cart-paymethod-badge--card { background: #0f766e; font-size: 10px; }
.cart-paymethod-badge--cod { background: #475569; font-size: 16px; }
.cart-paymethod-badge--invoice { background: #7c3aed; font-size: 11px; }
#pb-invoice-hint[hidden],
#pb-org-details[hidden] { display: none !important; }
#pb-org-details {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#pb-org-details .cart-fields--double {
  margin-bottom: 0;
}
#pb-org-details .cart-fields {
  margin: 0;
}

.cart-field--file label {
  display: block;
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 6px;
}
.cart-file {
  width: 100%;
  border: 1px dashed #dce1e8;
  border-radius: 10px;
  padding: 12px 14px;
  background: #fafbfc;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
}
.cart-file:hover { border-color: #0d9488; }

/* ---- sticky sidebar ---- */
.cart-sidebar {
  position: sticky;
  top: 88px;
  align-self: start;
}

.cart-options {
  background: #fff;
  border: 1px solid #e8eaee;
  border-radius: 14px;
  padding: 6px 18px;
  margin-bottom: 12px;
}
.cart-option {
  padding: 14px 0;
  border-bottom: 1px solid #eceff3;
}
.cart-option:last-child { border-bottom: 0; }
.cart-option-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}
.cart-option-title {
  font-size: 14px;
  font-weight: 700;
  color: #111827;
}
.cart-option-anchor {
  font-size: 13px;
  color: #0d9488;
  text-decoration: none;
  white-space: nowrap;
}
.cart-option-anchor:hover { text-decoration: underline; }
.cart-option-body {
  font-size: 13px;
  color: #6b7280;
  line-height: 1.4;
}

.cart-summary {
  background: #fff;
  border: 1px solid #e8eaee;
  border-radius: 14px;
  padding: 16px 18px 14px;
  margin-bottom: 12px;
}
.cart-summary__row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  margin-bottom: 8px;
  color: #4b5563;
}
.cart-summary__val { color: #111827; font-weight: 600; }
.cart-summary__val--sale { color: #dc2626; }
.cart-summary__val--free { color: #0d9488; }
.cart-summary__total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid #eceff3;
}
.cart-summary__total-label {
  font-size: 15px;
  font-weight: 700;
  color: #111827;
}
.cart-summary__total-amount {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #111827;
}

.pb-checkout-form .basket-checkout-btn {
  width: 100%;
  justify-content: center;
  min-height: 48px;
  font-weight: 700;
}
.cart-legal {
  margin: 10px 0 0;
  line-height: 1.4;
  font-size: 12px;
  color: #9ca3af;
}
.cart-legal a { color: #0d9488; }

.cart-mobile-bar { display: none; }

@media (max-width: 992px) {
  .basket-layout--checkout {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .cart-sidebar { position: static; }
  .cart-fields--double { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  body { padding-bottom: 78px; }
  .cart-item {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 12px;
  }
  .cart-item__img { width: 72px; height: 72px; }
  .cart-options.desktop-element { display: none; }
  .cart-mobile-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1040;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
    background: #fff;
    border-top: 1px solid rgba(15, 23, 42, 0.1);
    box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.08);
  }
  .cart-mobile-bar__label {
    display: block;
    font-size: 11px;
    color: #64748b;
  }
  .cart-mobile-bar__amount {
    display: block;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.01em;
  }
  .cart-mobile-bar__btn {
    flex: 0 0 auto;
    min-width: 132px;
    justify-content: center;
  }
  .basket-aside .basket-checkout-btn { display: none; }
}

/* ===== Thank-you / order confirmation ===== */
.ty-page {
  max-width: 920px;
  margin: 12px auto 48px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.ty-hero {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  background:
    radial-gradient(1200px 220px at 0% 0%, rgba(15, 118, 110, 0.10), transparent 55%),
    #fff;
}
.ty-hero__mark {
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #0f766e;
  color: #ecfeff;
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
}
.ty-hero__body { min-width: 0; flex: 1; }
.ty-eyebrow {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #0f766e;
}
.ty-title {
  margin: 0 0 8px;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 750;
  color: #111827;
}
.ty-lead {
  margin: 0 0 16px;
  color: #4b5563;
  font-size: 15px;
  line-height: 1.45;
  max-width: 54ch;
}
.ty-number {
  font-variant-numeric: tabular-nums;
  color: #0f766e;
}
.ty-actions,
.ty-footer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.ty-footer-actions {
  justify-content: flex-end;
  margin-top: 4px;
}
.ty-actions .btn,
.ty-footer-actions .btn {
  margin: 0;
  text-decoration: none !important;
}
.ty-actions .btn--outline,
.ty-footer-actions .btn--outline {
  background: transparent;
  color: var(--c-ink, #0b1f2a);
  border: 1.5px solid var(--c-ink, #0b1f2a);
}
.ty-actions .btn--outline:hover,
.ty-footer-actions .btn--outline:hover {
  background: var(--c-ink, #0b1f2a);
  color: #fff !important;
}
.ty-invoice .ty-text,
.ty-text {
  margin: 0;
  color: #4b5563;
  font-size: 14px;
  line-height: 1.45;
}
.ty-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.ty-dl {
  margin: 0;
  display: grid;
  gap: 12px;
}
.ty-dl dt {
  margin: 0 0 2px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6b7280;
}
.ty-dl dd {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: #111827;
}
.ty-sum {
  font-size: 20px !important;
  font-weight: 750;
  letter-spacing: -0.01em;
}
.ty-lines { display: flex; flex-direction: column; }
.ty-line {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #eef1f4;
}
.ty-line:last-child { border-bottom: 0; }
.ty-line__img {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  overflow: hidden;
  background: #f3f4f6;
}
.ty-line__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ty-line__title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
}
.ty-line__title a { color: #111827; text-decoration: none; }
.ty-line__title a:hover { color: #0f766e; }
.ty-line__meta {
  margin-top: 2px;
  font-size: 12px;
  color: #6b7280;
}
.ty-line__qty {
  font-size: 13px;
  color: #6b7280;
  white-space: nowrap;
}
.ty-line__price {
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  text-align: right;
}
.ty-totals {
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid #e8eaee;
  display: grid;
  gap: 8px;
}
.ty-totals__row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 14px;
  color: #4b5563;
}
.ty-totals__row--total {
  margin-top: 4px;
  font-size: 18px;
  font-weight: 750;
  color: #111827;
}
@media (max-width: 767.98px) {
  .ty-page { margin-top: 4px; }
  .ty-hero { flex-direction: column; gap: 12px; }
  .ty-title { font-size: 24px; }
  .ty-grid { grid-template-columns: 1fr; }
  .ty-line {
    grid-template-columns: 48px minmax(0, 1fr);
    grid-template-areas:
      "img body"
      "img qty"
      "img price";
  }
  .ty-line__img { grid-area: img; width: 48px; height: 48px; }
  .ty-line__body { grid-area: body; }
  .ty-line__qty { grid-area: qty; }
  .ty-line__price { grid-area: price; text-align: left; }
  .ty-footer-actions { justify-content: stretch; }
  .ty-footer-actions .btn { flex: 1 1 auto; justify-content: center; }
}
@media print {
  .ty-actions,
  .ty-footer-actions { display: none !important; }
  .ty-page { max-width: none; margin: 0; }
  .cart-block { box-shadow: none; break-inside: avoid; }
}
