/* NEXUS v767 — final product UI pass. Loaded LAST so legacy gallery rules cannot collapse the layout. */
body.nxd-page{--nx767-blue:#1687ff;--nx767-blue2:#39a8ff;--nx767-red:#e92f4f;--nx767-red-dark:#c91f3d;--nx767-sale-bg:#fff1f4;--nx767-sale-line:#ef3150}

/* ===== 1. Digikala-style media grid: one large right + two small left ===== */
html body.nxd-page .nxd-wrap .nxd-stage.nx-dk-gallery{
  position:relative!important;
  display:grid!important;
  grid-template-columns:minmax(0,2.08fr) minmax(118px,.78fr)!important;
  grid-template-rows:minmax(0,1fr)!important;
  grid-template-areas:"main side"!important;
  direction:rtl!important;
  gap:8px!important;
  width:100%!important;
  max-width:100%!important;
  height:auto!important;
  min-height:0!important;
  aspect-ratio:1.34/1!important;
  padding:8px!important;
  margin:0!important;
  box-sizing:border-box!important;
  overflow:hidden!important;
  border:1px solid rgba(120,140,165,.14)!important;
  border-radius:18px!important;
  background:#f5f6f8!important;
  line-height:normal!important;
}
html[data-theme="dark"] body.nxd-page .nxd-wrap .nxd-stage.nx-dk-gallery{background:#0d1726!important;border-color:rgba(180,210,245,.12)!important}
html body.nxd-page .nx-dk-main-tile{
  grid-area:main!important;position:relative!important;display:flex!important;align-items:center!important;justify-content:center!important;
  width:auto!important;height:auto!important;min-width:0!important;min-height:0!important;overflow:hidden!important;
  border-radius:14px!important;background:#fff!important;box-sizing:border-box!important;
}
html[data-theme="dark"] body.nxd-page .nx-dk-main-tile{background:#111b2b!important}
html body.nxd-page .nx-dk-main-tile>#mainImg,
html body.nxd-page .nx-dk-main-tile>.nx-gallery-main-img{
  display:block!important;width:100%!important;height:100%!important;max-width:100%!important;max-height:100%!important;
  min-width:0!important;min-height:0!important;margin:0!important;padding:12px!important;box-sizing:border-box!important;
  object-fit:contain!important;object-position:center center!important;border-radius:14px!important;background:transparent!important;
}
html body.nxd-page .nx-dk-side{
  grid-area:side!important;display:grid!important;grid-template-rows:repeat(2,minmax(0,1fr))!important;grid-template-columns:minmax(0,1fr)!important;
  gap:8px!important;width:auto!important;height:auto!important;min-width:0!important;min-height:0!important;
}
html body.nxd-page .nx-dk-side-tile{
  position:relative!important;display:flex!important;align-items:center!important;justify-content:center!important;width:100%!important;height:100%!important;
  min-width:0!important;min-height:0!important;padding:0!important;margin:0!important;box-sizing:border-box!important;
  border:1px solid rgba(100,116,139,.14)!important;border-radius:14px!important;overflow:hidden!important;background:#fff!important;
  cursor:pointer!important;-webkit-tap-highlight-color:transparent!important;
}
html[data-theme="dark"] body.nxd-page .nx-dk-side-tile{background:#111b2b!important;border-color:rgba(180,200,225,.14)!important}
html body.nxd-page .nx-dk-side-tile img{display:block!important;width:100%!important;height:100%!important;max-width:100%!important;max-height:100%!important;padding:4px!important;box-sizing:border-box!important;object-fit:contain!important;object-position:center!important;background:transparent!important}
html body.nxd-page .nx-dk-side-tile::after{content:"";position:absolute;inset:0;border-radius:14px;box-shadow:inset 0 0 0 1px rgba(255,255,255,.30);pointer-events:none}
html body.nxd-page .nx-dk-more{position:absolute!important;right:8px!important;bottom:8px!important;z-index:3!important;display:inline-flex!important;align-items:center!important;justify-content:center!important;min-width:42px!important;height:28px!important;padding:0 9px!important;border-radius:999px!important;background:rgba(15,23,42,.76)!important;color:#fff!important;font-size:12px!important;font-weight:900!important;line-height:1!important}

/* Progress line like the reference: inside the gallery, below the image group. */
html body.nxd-page .nx-dk-progress{position:absolute!important;left:16px!important;right:16px!important;bottom:8px!important;height:3px!important;z-index:10!important;border-radius:999px!important;background:rgba(100,116,139,.22)!important;overflow:hidden!important;direction:ltr!important;pointer-events:none!important}
html body.nxd-page .nx-dk-progress-fill{display:block!important;height:100%!important;width:33.33%!important;border-radius:999px!important;background:var(--nx767-blue)!important;transition:width .18s ease!important}
html body.nxd-page .nx-dk-count{position:absolute!important;left:16px!important;bottom:16px!important;z-index:11!important;display:inline-flex!important;align-items:baseline!important;gap:3px!important;min-width:50px!important;padding:4px 8px!important;border-radius:999px!important;background:rgba(15,23,42,.70)!important;color:#fff!important;font-size:10px!important;line-height:1!important;direction:ltr!important;pointer-events:none!important}
html body.nxd-page .nx-dk-count b{font-size:12px!important;font-weight:900!important}
html body.nxd-page .nx-dk-count span{opacity:.78!important;font-weight:700!important}
html body.nxd-page .nx-dk-gallery>.nx-gal-nav{display:none!important}
html body.nxd-page .nxd-thumbs{display:none!important}
html body.nxd-page .nx-dk-side-count-0{display:none!important}
html body.nxd-page .nxd-stage.nx-dk-gallery:has(.nx-dk-side-count-0){grid-template-columns:minmax(0,1fr)!important;grid-template-areas:"main"!important}
html body.nxd-page .nx-dk-side-count-1{grid-template-rows:minmax(0,1fr)!important}

/* ===== 2. Red sale strip — separate from the gallery, no overlap ===== */
html body.nxd-page .nxd-gallery .nx767-sale-strip{
  position:relative!important;display:flex!important;align-items:center!important;justify-content:space-between!important;gap:14px!important;
  width:100%!important;min-height:58px!important;margin:0 0 10px!important;padding:9px 14px!important;box-sizing:border-box!important;
  border:0!important;border-top:3px solid var(--nx767-sale-line)!important;border-bottom:1px solid rgba(233,47,79,.12)!important;
  border-radius:16px!important;background:var(--nx767-sale-bg)!important;color:var(--nx767-red-dark)!important;overflow:hidden!important;z-index:2!important;
}
html body.nxd-page .nx767-sale-main{display:flex!important;align-items:center!important;gap:10px!important;min-width:0!important}
html body.nxd-page .nx767-sale-kicker{font-size:13px!important;font-weight:800!important;white-space:nowrap!important}
html body.nxd-page .nx767-sale-main strong{font-size:15px!important;font-weight:950!important;white-space:nowrap!important}
html body.nxd-page .nx767-sale-meta{display:flex!important;align-items:center!important;justify-content:flex-end!important;min-width:0!important}
html body.nxd-page .nx767-sale-cut{display:flex!important;align-items:center!important;gap:7px!important;font-size:11.5px!important;white-space:nowrap!important;color:#7d2939!important}
html body.nxd-page .nx767-sale-cut b{font-size:12.5px!important;font-variant-numeric:tabular-nums!important;color:var(--nx767-red-dark)!important}
html body.nxd-page .nx767-sale-stock{font-size:11.5px!important;font-weight:800!important;white-space:nowrap!important;color:#8f3040!important}
html[data-theme="dark"] body.nxd-page .nxd-gallery .nx767-sale-strip{background:rgba(233,47,79,.10)!important;border-bottom-color:rgba(233,47,79,.18)!important;color:#ffb5c2!important}
html[data-theme="dark"] body.nxd-page .nx767-sale-cut,html[data-theme="dark"] body.nxd-page .nx767-sale-stock{color:#ffc1cb!important}
html[data-theme="dark"] body.nxd-page .nx767-sale-cut b{color:#ff9bad!important}

/* ===== 3. Other models: five items vertically, then the next column ===== */
html body.nxd-page .nxd-vars{
  display:grid!important;
  grid-template-rows:repeat(5,minmax(0,1fr))!important;
  grid-auto-flow:column!important;
  grid-auto-columns:minmax(250px,1fr)!important;
  grid-auto-rows:minmax(0,auto)!important;
  gap:8px!important;
  width:100%!important;
  max-width:100%!important;
  overflow-x:auto!important;
  overflow-y:hidden!important;
  padding:2px 2px 8px!important;
  box-sizing:border-box!important;
  scrollbar-width:thin!important;
  scroll-snap-type:x proximity!important;
  overscroll-behavior-x:contain!important;
}
html body.nxd-page .nxd-vars .nxd-var{
  display:grid!important;grid-template-columns:44px minmax(0,1fr)!important;grid-template-rows:auto auto!important;
  width:auto!important;min-width:0!important;max-width:none!important;flex:none!important;box-sizing:border-box!important;
  scroll-snap-align:start!important;
}
html body.nxd-page .nxd-vars::-webkit-scrollbar{height:5px!important}
html body.nxd-page .nxd-vars::-webkit-scrollbar-thumb{background:rgba(100,130,170,.28)!important;border-radius:999px!important}
@media(max-width:760px){
  html body.nxd-page .nxd-vars{grid-template-rows:repeat(5,minmax(0,1fr))!important;grid-auto-columns:minmax(235px,82vw)!important;gap:7px!important;padding-bottom:7px!important}
}

/* ===== 4. Sticky section tabs: preserve the measured header offset ===== */
html body.nxd-page .nxd-tabs{position:sticky!important;top:var(--nx-h,72px)!important;z-index:900!important;background:var(--nxd-card,#fff)!important;box-shadow:0 5px 18px rgba(15,23,42,.06)!important}
html[data-theme="light"] body.nxd-page .nxd-tabs{background:rgba(255,255,255,.96)!important;backdrop-filter:blur(14px)!important;-webkit-backdrop-filter:blur(14px)!important}
html[data-theme="dark"] body.nxd-page .nxd-tabs{background:rgba(15,27,45,.96)!important}

/* ===== 5. Mobile product summary: never covers the tabs ===== */
@media(max-width:760px){
  html body.nxd-page .nx765-mobile-product{top:var(--nx-h,56px)!important}
  html body.nxd-page.nx765-summary-on .nxd-tabs{top:calc(var(--nx-h,56px) + 58px)!important}
}

/* ===== 6. Mobile gallery keeps the same 1+2 composition, not a vertical stack ===== */
@media(max-width:900px){
  html body.nxd-page .nxd-wrap .nxd-stage.nx-dk-gallery{
    width:100%!important;max-width:100%!important;margin:0!important;padding:6px!important;gap:6px!important;
    aspect-ratio:1.28/1!important;border-radius:0!important;background:#f5f6f8!important;
  }
  html[data-theme="dark"] body.nxd-page .nxd-wrap .nxd-stage.nx-dk-gallery{background:#0d1726!important}
  html body.nxd-page .nx-dk-side{gap:6px!important}
  html body.nxd-page .nx-dk-main-tile,html body.nxd-page .nx-dk-side-tile{border-radius:12px!important}
  html body.nxd-page .nx-dk-main-tile>#mainImg,html body.nxd-page .nx-dk-main-tile>.nx-gallery-main-img{padding:8px!important;border-radius:12px!important}
  html body.nxd-page .nx-dk-side-tile img{padding:2px!important}
  html body.nxd-page .nx-dk-progress{left:11px!important;right:11px!important;bottom:6px!important}
  html body.nxd-page .nx-dk-count{left:11px!important;bottom:14px!important}
  html body.nxd-page .nx767-sale-strip{min-height:52px!important;margin-bottom:8px!important;padding:8px 11px!important;border-radius:13px!important}
}
@media(max-width:420px){
  html body.nxd-page .nxd-wrap .nxd-stage.nx-dk-gallery{aspect-ratio:1.20/1!important}
  html body.nxd-page .nx767-sale-kicker{font-size:12px!important}
  html body.nxd-page .nx767-sale-main strong{font-size:13px!important}
  html body.nxd-page .nx767-sale-cut,html body.nxd-page .nx767-sale-stock{font-size:10.5px!important}
}

/* Reduce motion: gallery remains fully functional without transitions. */
@media(prefers-reduced-motion:reduce){html body.nxd-page .nx-dk-progress-fill{transition:none!important}}
