/*
 * Ucuzabulan B173 - screenshot verified mobile visual/outbound doctor hotfix
 * Loaded after B172 and legacy bundles. Purpose: force mobile-safe layouts even when
 * older bundle rules use sticky/z-index or desktop-first flex grids.
 */
html,body{max-width:100%;overflow-x:hidden!important;}
.ub-home2-main,.ub-home-block,.ub-prod-grid,.grid-prod,.grid-prod--market,.ub-compare-pair-grid,#ubHomeComparedGrid{min-width:0!important;max-width:100%!important;}
.ub-compare-pair-card,.ub-compare-pair-card *,.ub-mkt-card,.ub-mkt-card *,.ub-pdp,.ub-pdp *{box-sizing:border-box;min-width:0;}

/* Home compared products: phones must be one full-width pair, never two squeezed columns. */
@media (max-width: 760px){
  html body #ubHomeComparedGrid,
  html body .ub-home2-main #ubHomeComparedGrid.ub-compare-pair-grid,
  html body .ub-home-block #ubHomeComparedGrid.ub-compare-pair-grid{display:grid!important;grid-template-columns:1fr!important;gap:12px!important;width:100%!important;}
  html body #ubHomeComparedGrid>.ub-compare-pair-card,
  html body #ubHomeComparedGrid>a.card{width:100%!important;max-width:100%!important;margin:0!important;padding:10px!important;border-radius:18px!important;overflow:hidden!important;}
  html body #ubHomeComparedGrid .ub-compare-pair-card__products{display:grid!important;grid-template-columns:minmax(0,1fr) 36px minmax(0,1fr)!important;gap:7px!important;align-items:stretch!important;}
  html body #ubHomeComparedGrid .ub-compare-side{display:grid!important;grid-template-rows:auto 1fr auto!important;gap:6px!important;padding:8px!important;border-radius:15px!important;overflow:hidden!important;}
  html body #ubHomeComparedGrid .ub-compare-side__img{width:100%!important;height:82px!important;max-height:82px!important;object-fit:contain!important;background:#fff!important;margin:0!important;}
  html body #ubHomeComparedGrid .ub-compare-side__title{font-size:12px!important;line-height:1.18!important;min-height:0!important;max-height:2.5em!important;display:-webkit-box!important;-webkit-line-clamp:2!important;-webkit-box-orient:vertical!important;overflow:hidden!important;overflow-wrap:anywhere!important;}
  html body #ubHomeComparedGrid .ub-compare-side__price{font-size:14px!important;line-height:1.1!important;white-space:nowrap!important;}
  html body #ubHomeComparedGrid .badge,
  html body #ubHomeComparedGrid .ub-compare-side__badges .badge{font-size:10.5px!important;line-height:1.12!important;white-space:normal!important;overflow-wrap:anywhere!important;padding:5px 6px!important;min-height:0!important;}
  html body #ubHomeComparedGrid .ub-compare-vs{width:34px!important;height:34px!important;min-width:34px!important;font-size:11px!important;align-self:center!important;justify-self:center!important;position:relative!important;inset:auto!important;transform:none!important;margin:0!important;z-index:1!important;}
  html body #ubHomeComparedGrid .ub-compare-pair-card__meta{display:grid!important;grid-template-columns:1fr!important;gap:7px!important;margin-top:9px!important;}
}
@media (max-width: 390px){
  html body #ubHomeComparedGrid .ub-compare-pair-card__products{grid-template-columns:minmax(0,1fr) 30px minmax(0,1fr)!important;gap:5px!important;}
  html body #ubHomeComparedGrid .ub-compare-side{padding:7px!important;}
  html body #ubHomeComparedGrid .ub-compare-side__img{height:74px!important;}
  html body #ubHomeComparedGrid .ub-compare-vs{width:29px!important;height:29px!important;min-width:29px!important;font-size:10px!important;}
}

/* Home market rails: keep compact cards readable and image-first on mobile. */
@media (max-width: 760px){
  html body .ub-home-block[aria-label="Market"] .ub-rail{display:grid!important;grid-auto-flow:row!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px!important;overflow:visible!important;padding-bottom:0!important;}
  html body .ub-home-block[aria-label="Market"] .ub-rail-card{width:100%!important;min-width:0!important;max-width:100%!important;padding:10px!important;border-radius:18px!important;overflow:hidden!important;}
  html body .ub-home-block[aria-label="Market"] .ub-rail-card img{width:100%!important;height:116px!important;object-fit:contain!important;background:#fff!important;border-radius:14px!important;}
  html body .ub-home-block[aria-label="Market"] .ub-rail-card h3,
  html body .ub-home-block[aria-label="Market"] .ub-rail-card .ub-rail-title{font-size:13px!important;line-height:1.22!important;display:-webkit-box!important;-webkit-line-clamp:2!important;-webkit-box-orient:vertical!important;overflow:hidden!important;}
}
@media (max-width: 360px){html body .ub-home-block[aria-label="Market"] .ub-rail{grid-template-columns:1fr!important;}}

/* Market listing/store/product grids: screenshot fix for squeezed horizontal cards. */
@media (max-width: 640px){
  html body .grid-prod--market,
  html body .ub-market-grid{display:grid!important;grid-template-columns:1fr!important;gap:12px!important;width:100%!important;}
  html body .grid-prod--market>.ub-mkt-card,
  html body .ub-market-grid>.ub-mkt-card{width:100%!important;max-width:100%!important;padding:12px!important;border-radius:20px!important;overflow:hidden!important;}
  html body .grid-prod--market .ub-mkt-card__main,
  html body .ub-market-grid .ub-mkt-card__main{display:grid!important;grid-template-columns:1fr!important;gap:10px!important;width:100%!important;align-items:start!important;}
  html body .grid-prod--market .ub-mkt-card__img,
  html body .ub-market-grid .ub-mkt-card__img{width:100%!important;height:176px!important;max-width:100%!important;flex:0 0 auto!important;margin:0!important;border-radius:16px!important;background:#fff!important;}
  html body .grid-prod--market .ub-mkt-card__img img,
  html body .ub-market-grid .ub-mkt-card__img img{width:100%!important;height:100%!important;object-fit:contain!important;mix-blend-mode:normal!important;background:#fff!important;}
  html body .grid-prod--market .ub-mkt-card__body,
  html body .ub-market-grid .ub-mkt-card__body{width:100%!important;max-width:100%!important;display:grid!important;gap:7px!important;}
  html body .ub-mkt-card__title,
  html body .ub-mkt-title{font-size:16px!important;line-height:1.24!important;display:-webkit-box!important;-webkit-line-clamp:2!important;-webkit-box-orient:vertical!important;overflow:hidden!important;overflow-wrap:anywhere!important;}
  html body .ub-mkt-card__price{font-size:22px!important;line-height:1.1!important;white-space:nowrap!important;}
  html body .ub-mkt-card__meta{display:grid!important;grid-template-columns:1fr!important;gap:8px!important;align-items:start!important;width:100%!important;}
  html body .ub-mkt-store{width:100%!important;max-width:100%!important;display:flex!important;align-items:center!important;gap:8px!important;}
  html body .ub-mkt-store__name,
  html body .ub-mkt-store span{max-width:100%!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;}
  html body .ub-mkt-card__footer{display:grid!important;grid-template-columns:1fr!important;gap:8px!important;width:100%!important;}
  html body .ub-mkt-card__footer .btn,
  html body .ub-mkt-card__footer a{width:100%!important;min-height:44px!important;justify-content:center!important;white-space:normal!important;text-align:center!important;}
}
@media (min-width:641px) and (max-width:920px){
  html body .grid-prod--market,
  html body .ub-market-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:12px!important;}
  html body .grid-prod--market .ub-mkt-card__main,
  html body .ub-market-grid .ub-mkt-card__main{display:grid!important;grid-template-columns:1fr!important;gap:10px!important;}
  html body .grid-prod--market .ub-mkt-card__img,
  html body .ub-market-grid .ub-mkt-card__img{width:100%!important;height:150px!important;margin:0!important;}
  html body .ub-mkt-card__footer{display:grid!important;grid-template-columns:1fr!important;gap:8px!important;}
}

/* PDP topdock: on phones it must stay in normal flow and never cover the gallery. */
@media (max-width: 860px){
  html body .ub-pdp .ub-pdp-topdock,
  html body .ub-pdp .ub-pdp-topdock.card,
  html body .ub-pdp-topdock,
  html body section.ub-pdp-topdock{position:static!important;top:auto!important;left:auto!important;right:auto!important;bottom:auto!important;z-index:1!important;max-height:none!important;overflow:visible!important;transform:none!important;contain:none!important;margin:12px 0 16px!important;clear:both!important;}
  html body .ub-pdpsticky,
  html body .ub-pdp-sticky,
  html body .ub-pdp-stickybar{display:none!important;position:static!important;}
  html body .ub-pdp-topdock__summary{display:grid!important;grid-template-columns:1fr!important;gap:10px!important;align-items:stretch!important;}
  html body .ub-pdp-topdock__left,
  html body .ub-pdp-topdock__right{width:100%!important;max-width:100%!important;}
  html body .ub-pdp-topdock__right{display:grid!important;grid-template-columns:1fr!important;gap:9px!important;justify-items:stretch!important;}
  html body .ub-pdp-topdock__right .btn,
  html body .ub-pdp-topdock__right a{width:100%!important;justify-content:center!important;text-align:center!important;}
  html body .ub-pdp-topdock__nav,
  html body .ub-pdp-topdock__tabs{position:relative!important;z-index:1!important;overflow-x:auto!important;-webkit-overflow-scrolling:touch!important;white-space:nowrap!important;max-width:100%!important;}
  html body .ub-pdp__main{position:relative!important;z-index:2!important;clear:both!important;margin-top:14px!important;display:block!important;}
  html body .ub-pdp__gallery,
  html body .ub-pdp-gallery,
  html body .ub-pdp__galleryCard,
  html body .ub-pdp-hero,
  html body .ub-pdp__media{position:relative!important;z-index:2!important;overflow:visible!important;max-width:100%!important;}
  html body .ub-pdp__image,
  html body .ub-pdp-gallery img,
  html body .ub-product-media img,
  html body .ub-pdp__gallery img{max-width:100%!important;height:auto!important;object-fit:contain!important;display:block!important;margin:0 auto!important;}
}
