/* Shared purchase controls. Scoped to search; theme button defaults must not
   change either stock or supplier dimensions. No changes to quantity logic. */
.ty-smart-search-content {
  --smart-buy-width: 166px;
  --smart-control-height: 36px;
}
.ty-smart-search-content :is(.ty-smart-search-grid-card__buy-form, .smart-supplier-offer__actions) {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 36px !important;
  grid-template-rows: 36px 36px !important;
  gap: 6px !important;
  align-items: center !important;
  justify-content: start !important;
  box-sizing: border-box !important;
  width: var(--smart-buy-width) !important;
  min-width: var(--smart-buy-width) !important;
  height: 78px !important;
  min-height: 78px !important;
  max-height: none !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  position: relative;
}
.ty-smart-search-content .ty-smart-search-grid-card__actions { display: contents !important; }
.ty-smart-search-content .ty-smart-search-grid-card__tooltip:not([hidden]) { position: absolute; bottom: calc(100% + 8px); right: 0; z-index: 25; width: max-content; max-width: 250px; }
.ty-smart-search-content :is(.ty-smart-search-grid-card__qty-box, .smart-supplier-offer__qty) {
  display: grid !important;
  grid-column: 1 / -1 !important;
  grid-row: 1 !important;
  grid-template-columns: 34px minmax(0, 1fr) 34px !important;
  grid-template-rows: 34px !important;
  align-items: center !important;
  flex: none !important;
  box-sizing: border-box !important;
  width: 100% !important;
  min-width: 0 !important;
  height: 36px !important;
  min-height: 36px !important;
  max-height: 36px !important;
  gap: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 1px solid #d5dfe3 !important;
  border-radius: 7px !important;
  background: #fff !important;
  overflow: visible !important;
}
.ty-smart-search-content :is(.ty-smart-search-grid-card__qty-btn, .ty-smart-search-grid-card__qty-input, .smart-supplier-offer__qty-btn, .smart-supplier-offer__qty-input) {
  box-sizing: border-box !important;
  width: 100% !important;
  min-width: 0 !important;
  height: 34px !important;
  min-height: 34px !important;
  max-height: 34px !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  color: #1e3029 !important;
  font: 400 16px/34px Arial, sans-serif !important;
  text-align: center !important;
  appearance: textfield;
  -moz-appearance: textfield;
}
.ty-smart-search-content :is(.ty-smart-search-grid-card__qty-input, .smart-supplier-offer__qty-input) {
  border-inline: 1px solid #e4e9eb !important;
}
.ty-smart-search-content input[type=number]::-webkit-inner-spin-button,
.ty-smart-search-content input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.ty-smart-search-content :is(.ty-smart-search-grid-card__cart-btn, .smart-supplier-offer__cart, .ty-smart-search-grid-card__fav-btn, .smart-supplier-offer__wish) {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
  width: 100% !important;
  min-width: 0 !important;
  height: 36px !important;
  min-height: 36px !important;
  max-height: 36px !important;
  margin: 0 !important;
  padding: 0 8px !important;
  border: 0 !important;
  border-radius: 7px !important;
  box-shadow: none !important;
  font: 700 13px/1 Arial, sans-serif !important;
  text-decoration: none !important;
  white-space: nowrap !important;
  cursor: pointer;
}
.ty-smart-search-content :is(.ty-smart-search-grid-card__cart-btn, .smart-supplier-offer__cart) { grid-column: 1 !important; grid-row: 2 !important; color: #fff !important; }
.ty-smart-search-content .ty-smart-search-grid-card__cart-btn { background: #31933b !important; }
.ty-smart-search-content .smart-supplier-offer__cart { background: #2878c7 !important; }
.ty-smart-search-content .ty-smart-search-grid-card__cart-btn:hover { background: #267d31 !important; }
.ty-smart-search-content .smart-supplier-offer__cart:hover { background: #1f65a9 !important; }
.ty-smart-search-content .smart-supplier-offer__cart.is-added { background: #516a80 !important; }
.ty-smart-search-content :is(.ty-smart-search-grid-card__fav-btn, .smart-supplier-offer__wish-form, .smart-supplier-offer__actions > .smart-supplier-offer__wish) { grid-column: 2 !important; grid-row: 2 !important; }
.ty-smart-search-content .smart-supplier-offer__wish-form { display: block !important; width: 36px !important; height: 36px !important; margin: 0 !important; padding: 0 !important; }
.ty-smart-search-content :is(.ty-smart-search-grid-card__fav-btn, .smart-supplier-offer__wish) { font-size: 0 !important; padding: 0 !important; }
.ty-smart-search-content .ty-smart-search-grid-card__fav-btn { color: #25834f !important; background: #edf7f1 !important; }
.ty-smart-search-content .smart-supplier-offer__wish { color: #2878c7 !important; background: #eaf3fb !important; }
.ty-smart-search-content :is(.ty-smart-search-grid-card__fav-btn, .smart-supplier-offer__wish)::before { content: '♡' !important; display: block !important; font: 400 24px/1 Arial, sans-serif !important; color: inherit !important; }
.ty-smart-search-content :is(.ty-smart-search-grid-card__fav-btn, .smart-supplier-offer__wish)::after { content: none !important; }
.ty-smart-search-content :is(button:disabled, input:disabled) { cursor: not-allowed; opacity: .5; }
.ty-smart-search-content :is(button, a):focus-visible { outline: 2px solid #2878c7; outline-offset: 3px; }
.ty-smart-search-content :is(.ty-smart-search-grid-card__price, .ty-smart-search-grid-card__price *, .smart-supplier-offer__price) { font: 700 18px/1.3 Arial, sans-serif !important; color: #14221b !important; white-space: nowrap; }
.ty-smart-search-content.smart-view-list .ty-smart-search-grid-card__meta-item:first-child::before { content: '•'; margin: 0 6px 0 2px; color: #8b9790; pointer-events: none; user-select: none; }
.ty-smart-search-content.smart-view-list :is(.ty-smart-search-grid-card__buy-form, .smart-supplier-offer__actions) { justify-self: end; }
@media (min-width: 1400px) {
  .ty-smart-search-content.smart-view-list { --smart-row-columns: 90px minmax(180px, 1.5fr) 215px 90px 135px 125px 182px; }
  .ty-smart-search-content.smart-view-list :is(.smart-results-table-head, .smart-supplier-offer, .ty-smart-search-grid-card:not(.is-filter-hidden)) { grid-template-columns: var(--smart-row-columns) !important; }
  .ty-smart-search-content.smart-view-list :is(.ty-smart-search-grid-card__price, .ty-smart-search-grid-card__price-request, .smart-supplier-offer__price) { padding-right: 12px !important; }
}
.smart-image-zoom-open { overflow: hidden !important; }
.smart-image-dialog { position: fixed; inset: 0; box-sizing: border-box; width: min(920px, 94vw); max-width: 94vw; max-height: 92vh; margin: auto; padding: 44px 20px 16px; border: 0; border-radius: 12px; background: #fff; box-shadow: 0 20px 80px #0006; }
.smart-image-dialog::backdrop { background: #000a; }
.smart-image-dialog__picture { display: block; width: 100%; height: min(68vh, 700px); object-fit: contain; }
.smart-image-dialog__caption { margin: 12px 0 0; text-align: center; font: 14px/1.4 Arial, sans-serif; }
.smart-image-dialog__close { position: absolute; top: 6px; right: 8px; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 6px; background: #f0f3f5; color: #24342c; cursor: pointer; font: 28px/1 Arial, sans-serif; }
[data-smart-image-zoom] { cursor: zoom-in; }

.ty-smart-search-content .ty-smart-search-grid-card__description { display: contents; }
.ty-smart-search-content .smart-supplier-card__relation--direct { display: none !important; }
.smart-gallery-open { overflow: hidden !important; }
dialog.smart-gallery {
  position: fixed !important; inset: 0 !important; box-sizing: border-box !important;
  width: 100vw !important; max-width: 100vw !important; height: 100vh; height: 100dvh;
  max-height: none !important; margin: 0 !important; padding: 20px 0 0 !important;
  border: 0 !important; background: transparent !important; overflow: hidden;
  opacity: 0; transition: opacity 180ms ease;
}
dialog.smart-gallery[open] { display: grid !important; grid-template-rows: minmax(0, 1fr) 98px; gap: 16px; }
dialog.smart-gallery.is-visible { opacity: 1; }
dialog.smart-gallery::backdrop { background: rgba(0,0,0,.55); opacity: 0; transition: opacity 180ms ease; }
dialog.smart-gallery.is-visible::backdrop { opacity: 1; }
.smart-gallery__panel {
  position: relative; justify-self: center; align-self: center; display: grid;
  grid-template-rows: minmax(0, 1fr) auto; box-sizing: border-box;
  width: min(940px, 94vw); height: 100%; min-height: 0;
  padding: 52px 22px 14px; border-radius: 14px; background: #fff;
  transform: translateY(8px) scale(.985); transition: transform 180ms ease;
}
.smart-gallery.is-visible .smart-gallery__panel { transform: none; }
.smart-gallery__picture { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.smart-gallery__caption { margin: 10px 0 0; text-align: center; font: 14px/1.3 Arial,sans-serif; }
.smart-gallery .smart-gallery__close {
  position: absolute !important; top: 10px !important; right: 10px !important;
  left: auto !important; bottom: auto !important; display: grid !important; place-items: center;
  width: 36px !important; height: 36px !important; min-width: 0 !important;
  margin: 0 !important; padding: 0 !important; border: 0 !important; border-radius: 6px;
  background: #f3f5f6; color: #47544d; font: 30px/1 Arial,sans-serif; cursor: pointer;
}
.smart-gallery__strip {
  display: flex; gap: 10px; width: 100%; box-sizing: border-box; align-items: center;
  padding: 10px 18px; overflow-x: auto; background: rgba(20,25,29,.8); overscroll-behavior: contain;
}
.smart-gallery .smart-gallery__thumb {
  flex: 0 0 76px; width: 76px; height: 76px; box-sizing: border-box;
  margin: 0; padding: 4px; border: 3px solid transparent; border-radius: 5px;
  background: #fff; cursor: pointer;
}
.smart-gallery__thumb[aria-pressed=true] { border-color: #2878c7 !important; }
.smart-gallery__thumb img { width: 100%; height: 100%; object-fit: contain; }
.smart-gallery button:focus-visible { outline: 2px solid #72b9ff; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  dialog.smart-gallery, dialog.smart-gallery::backdrop, .smart-gallery__panel { transition: none !important; }
}

/* Equal card structure; expanded supplier offers may naturally increase height. */
.ty-smart-search-content.smart-view-grid :is(.smart-direct-results__list, .smart-supplier-results__list, .ty-smart-search-results-grid) {
  display: grid !important; grid-template-columns: repeat(auto-fill, minmax(min(270px, 100%), 1fr)) !important;
  gap: 14px !important; align-items: stretch;
}
.ty-smart-search-content.smart-view-grid :is(.ty-smart-search-grid-card:not(.is-filter-hidden), .smart-supplier-card:not(.is-filter-hidden)) {
  box-sizing: border-box !important; width: 100% !important; min-width: 0 !important;
  height: auto !important; padding: 16px !important; border: 1px solid #dfe7e2 !important; border-radius: 12px !important;
}
.ty-smart-search-content.smart-view-grid .ty-smart-search-grid-card:not(.is-filter-hidden),
.ty-smart-search-content.smart-view-grid .smart-supplier-offer {
  display: grid; grid-template-columns: minmax(0,1fr) !important;
  grid-template-rows: 150px minmax(105px,1fr) 64px 24px 24px 28px 78px;
  grid-template-areas: 'photo' 'description' 'delivery' 'stock' 'freshness' 'price' 'buy';
  gap: 8px !important; align-items: center !important; min-width: 0;
}
.ty-smart-search-content.smart-view-grid .ty-smart-search-grid-card:not(.is-filter-hidden) {
  display: grid !important;
  grid-template-rows: 150px minmax(105px,1fr) 64px 24px 24px 28px 78px 24px;
  grid-template-areas: 'photo' 'description' 'delivery' 'stock' 'freshness' 'price' 'buy' 'extra';
}
.ty-smart-search-content.smart-view-grid .smart-supplier-card:not(.is-filter-hidden) { display: grid; grid-template-rows: 1fr 24px; gap: 8px; }
.ty-smart-search-content.smart-view-grid :is(.smart-supplier-card__head, .smart-supplier-card__title, .smart-supplier-offer__source, .smart-supplier-offer__badge) { display: none !important; }
.ty-smart-search-content.smart-view-grid .smart-supplier-card__offers { display: grid; margin: 0; gap: 16px; }
.ty-smart-search-content.smart-view-grid .smart-supplier-offer { padding: 0; border-top: 0; }
.ty-smart-search-content.smart-view-grid .smart-supplier-offer:not(:first-child) { display: none; }
.ty-smart-search-content.smart-view-grid .smart-supplier-card.is-expanded .smart-supplier-offer:not(:first-child),
.ty-smart-search-content.smart-view-grid .smart-supplier-card.has-filtered-offers .smart-supplier-offer:not(.is-filter-hidden) { display: grid; }
.ty-smart-search-content.smart-view-grid :is(.ty-smart-search-grid-card__image-wrap, .smart-supplier-offer__image-cell) { display: flex !important; grid-area: photo !important; justify-content: center; align-items: center; width: 100% !important; height: 150px !important; margin: 0 !important; padding: 0 !important; }
.ty-smart-search-content.smart-view-grid :is(.ty-smart-search-grid-card__image-link, .smart-supplier-offer__image-link) { display: flex; justify-content: center; align-items: center; width: 100%; height: 150px; }
.ty-smart-search-content.smart-view-grid :is(.ty-smart-search-grid-card__image, .smart-supplier-offer__image) { width: auto !important; max-width: 100% !important; height: auto !important; max-height: 150px !important; object-fit: contain; }
.ty-smart-search-content.smart-view-grid .smart-supplier-offer__image-placeholder { width: 100px; height: 100px; border-radius: 8px; background: #f4f7f5; }
.ty-smart-search-content.smart-view-grid .ty-smart-search-grid-card__quick-view { display: none !important; }
.ty-smart-search-content.smart-view-grid :is(.ty-smart-search-grid-card__description, .smart-supplier-offer__primary) { display: block; grid-area: description !important; min-width: 0; align-self: start; }
.ty-smart-search-content.smart-view-grid :is(.smart-supplier-offer__identity, .smart-supplier-offer__part, .smart-supplier-offer__name) { display: block; }
.ty-smart-search-content.smart-view-grid :is(.ty-smart-search-grid-card__title, .smart-supplier-offer__name) { display: block; margin: 8px 0 0 !important; min-height: 0 !important; font-size: 14px !important; line-height: 1.4; overflow-wrap: anywhere; }
.ty-smart-search-content.smart-view-grid .smart-supplier-offer__part { font-weight: 700; }
.ty-smart-search-content.smart-view-grid :is(.ty-smart-search-grid-card__footer, .ty-smart-search-grid-card__price-block) { display: contents !important; }
.ty-smart-search-content.smart-view-grid :is(.ty-smart-search-grid-card__delivery-cell, .smart-supplier-offer__delivery) { display: block !important; grid-area: delivery !important; min-width: 0; font-size: 13px; }
.ty-smart-search-content.smart-view-grid .smart-supplier-offer__delivery-warehouse { display: block; overflow-wrap: anywhere; }
.ty-smart-search-content.smart-view-grid :is(.ty-smart-search-grid-card__stock, .ty-smart-search-grid-card__preorder, .smart-supplier-offer__stock) { grid-area: stock !important; margin: 0 !important; font-size: 13px; }
.ty-smart-search-content.smart-view-grid :is(.ty-smart-search-grid-card__freshness-cell, .smart-supplier-offer__freshness) { display: flex !important; grid-area: freshness !important; }
.ty-smart-search-content.smart-view-grid :is(.ty-smart-search-grid-card__price, .ty-smart-search-grid-card__price-request, .smart-supplier-offer__price) { grid-area: price !important; text-align: left !important; margin: 0 !important; }
.ty-smart-search-content.smart-view-grid :is(.ty-smart-search-grid-card__buy-form, .smart-supplier-offer__actions) { grid-area: buy !important; justify-self: start; }
.ty-smart-search-content.smart-view-grid .smart-supplier-card__toggle { margin: 0; align-self: center; justify-self: start; }

/* The first VISIBLE offer carries the shared product information. The sibling
   selector automatically promotes the next offer when filters hide that row. */
.ty-smart-search-content .smart-supplier-offer:not(.is-filter-hidden) ~ .smart-supplier-offer .smart-supplier-offer__image-cell {
  display: none !important;
}
.ty-smart-search-content.smart-view-grid .smart-supplier-offer:not(.is-filter-hidden) ~ .smart-supplier-offer .smart-supplier-offer__primary {
  display: none !important;
}
.ty-smart-search-content.smart-view-grid .smart-supplier-offer:not(.is-filter-hidden) ~ .smart-supplier-offer {
  grid-template-rows: auto 24px 24px 28px 78px !important;
  grid-template-areas: 'delivery' 'stock' 'freshness' 'price' 'buy' !important;
  min-height: 0 !important;
  padding-top: 14px !important;
  border-top: 1px solid #dfe7e2 !important;
}
.ty-smart-search-content.smart-view-grid .smart-supplier-card.is-expanded .smart-supplier-card__offers,
.ty-smart-search-content.smart-view-grid .smart-supplier-card.has-filtered-offers .smart-supplier-card__offers { align-content: start; }
.ty-smart-search-content .smart-supplier-card.is-expanded { align-self: start; }
.ty-grid-list__image > a:has(img),
.ty-product-list__image > a:has(img),
.ty-compact-list__image > a:has(img),
.ty-product-img a.cm-image-previewer { cursor: zoom-in; }
