/* ==========================================================================
   NEXUS v333 — کارت محصول از صفر (سازگار با ریل / گرید / موبایل)
   مارک‌آپ: includes/functions.php → nx_render_product_card()
   ترتیب: عکس + نوار تخفیف → عنوان (۲ خط) → وضعیت → قیمت + درصد → دکمه سبد
   بدون توضیح / جمله / رم / موجودی / امتیاز
   ========================================================================== */

/* ---------- اندازه واحد برای همه کارت‌ها ---------- */
:root{
  --nxc-w:230px;
  --nxc-toman:27px;
  --nxc-title:14.5px;
  --nxc-price:18px;
}
@media(max-width:1100px){
  :root{--nxc-w:208px}
}
@media(max-width:700px){
  :root{
    --nxc-w:min(168px,calc((100vw - 36px)/2));
    --nxc-toman:23px;
    --nxc-title:12px;
    --nxc-price:14.5px;
  }
}
@media(max-width:380px){
  :root{
    --nxc-w:min(150px,calc((100vw - 30px)/2));
    --nxc-toman:20px;
    --nxc-title:11.5px;
    --nxc-price:13.5px;
  }
}

/* ---------- توکن تم ---------- */
.nxc-card{
  --nxc-bg:#101a29;
  --nxc-line:#223248;
  --nxc-text:#edf4ff;
  --nxc-muted:#9db0ca;
  --nxc-media-bg:#f1f5fb;
  --nxc-blue:#2f8dff;
  --nxc-blue-d:#0a5fd8;
  --nxc-btn:#5aa8ff;
  --nxc-red:#f0294b;
}
html[data-theme="light"] .nxc-card{
  --nxc-bg:#ffffff;
  --nxc-line:#d7e1ef;
  --nxc-text:#0f1d36;
  --nxc-muted:#5c6f89;
  --nxc-media-bg:#f3f6fb;
  --nxc-btn:#0a6bff;
}

/* ---------- پوسته کارت ---------- */
html body .nxc-card{
  position:relative;
  display:flex;
  flex-direction:column;
  min-width:0;
  box-sizing:border-box;
  background:var(--nxc-bg)!important;
  color:var(--nxc-text)!important;
  border:1px solid var(--nxc-line)!important;
  border-radius:16px!important;
  overflow:hidden;
  box-shadow:none!important;
  transition:border-color .2s;
}
html body .nxc-card:hover{
  border-color:var(--nxc-blue)!important;
}
html body .nxc-link{
  display:flex;
  flex-direction:column;
  flex:1 1 auto;
  color:inherit!important;
  text-decoration:none!important;
  min-width:0;
}
.nxc-link:focus-visible,
.nxc-btn:focus-visible{
  outline:2px solid var(--nxc-blue);
  outline-offset:-2px;
}

/* ---------- عکس ---------- */
.nxc-media{
  position:relative;
  aspect-ratio:1/1;
  width:100%;
  background:var(--nxc-media-bg);
  overflow:hidden;
}
html body .nxc-media .nxc-img{
  display:block;
  width:100%;
  height:100%;
  max-width:none;
  max-height:none;
  object-fit:cover;
  object-position:center;
  border-radius:0;
  padding:0;
  margin:0;
}
.nxc-noimg{
  position:absolute;
  inset:0;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:6px;
  color:#7f92aa;
  font-size:12px;
}
.is-out .nxc-img{
  filter:grayscale(.7);
  opacity:.65;
}

/* ---------- نوار تخفیف «نکسوس اف» ---------- */
.nxc-bar{
  position:absolute;
  inset-inline:0;
  bottom:0;
  z-index:2;
  height:30px;
  box-sizing:border-box;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  padding:0 10px;
  background:linear-gradient(90deg,var(--nxc-blue-d),var(--nxc-blue));
  color:#fff!important;
  font-size:12.5px;
  font-weight:800;
  line-height:1;
}
.nxc-bar-name{
  display:inline-flex;
  align-items:center;
  gap:5px;
  white-space:nowrap;
  color:#fff!important;
}
.nxc-timer{
  display:inline-flex;
  align-items:center;
  direction:ltr;
  white-space:nowrap;
  color:#fff!important;
  padding:2px 7px;
  border-radius:999px;
  background:rgba(255,255,255,.22);
  font-size:11.5px;
  font-weight:800;
  font-variant-numeric:tabular-nums;
}
.nxc-timer.is-urgent{
  background:var(--nxc-red);
  animation:nxc-pulse 1s ease-in-out infinite;
}
@keyframes nxc-pulse{50%{opacity:.55}}

/* ---------- عنوان (حداکثر ۲ خط) ---------- */
html body .nxc-card .nxc-title{
  margin:0;
  padding:9px 11px 0;
  font-family:inherit;
  font-size:var(--nxc-title);
  font-weight:700;
  line-height:1.65;
  color:var(--nxc-text)!important;
  text-align:right;
  display:-webkit-box;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:2;
  overflow:hidden;
  min-height:calc(1.65em * 2 + 9px);
}

/* ---------- وضعیت (چیپ کوچک) ---------- */
html body .nxc-card .nxc-cond{
  display:inline-flex!important;
  align-items:center;
  width:fit-content;
  margin:5px 11px 0!important;
  padding:2px 8px!important;
  border-radius:999px!important;
  font-size:10.5px!important;
  font-weight:600!important;
  line-height:1.5!important;
  background:rgba(120,170,230,.12)!important;
  color:var(--nxc-muted)!important;
  border:1px solid rgba(120,170,230,.18)!important;
}
html body .nxc-card .nxc-cond-new{
  background:rgba(34,197,94,.12)!important;
  color:#16a34a!important;
  border-color:rgba(34,197,94,.22)!important;
}
html body .nxc-card .nxc-cond-like_new{
  background:rgba(47,141,255,.12)!important;
  color:#2f8dff!important;
  border-color:rgba(47,141,255,.22)!important;
}
html body .nxc-card .nxc-cond-refurbished,
html body .nxc-card .nxc-cond-used{
  background:rgba(245,158,11,.12)!important;
  color:#d97706!important;
  border-color:rgba(245,158,11,.22)!important;
}

/* ---------- قیمت ---------- */
.nxc-prices{
  margin-top:auto;
  padding:5px 11px 8px;
  display:flex;
  flex-direction:column;
  gap:1px;
}
.nxc-oldrow{
  display:flex;
  align-items:center;
  min-height:18px;
}
html body .nxc-card .nxc-old{
  color:var(--nxc-muted)!important;
  font-size:12.5px;
  text-decoration:line-through;
  display:inline!important;
}
.nxc-nowrow{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:6px;
  flex-wrap:wrap;
  row-gap:2px;
}
html body .nxc-card .nxc-now{
  display:inline-flex!important;
  align-items:center;
  gap:3px;
  width:auto!important;
  color:var(--nxc-text)!important;
  direction:rtl;
}
html body .nxc-card .nxc-num{
  font-size:var(--nxc-price);
  font-weight:800;
  line-height:1.3;
  color:var(--nxc-text)!important;
  font-variant-numeric:tabular-nums;
  font-family:inherit;
}
html body .nxc-card .nxc-now .nx-toman-logo{
  width:var(--nxc-toman)!important;
  height:var(--nxc-toman)!important;
  max-width:none!important;
  max-height:none!important;
  flex:0 0 var(--nxc-toman);
  margin:0!important;
  vertical-align:middle;
}
html body .nxc-card .nxc-off{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  flex:0 0 auto;
  padding:2px 8px;
  border-radius:999px;
  background:var(--nxc-red)!important;
  color:#fff!important;
  font-size:12px;
  font-weight:800;
  line-height:1.4;
}

/* ---------- دکمه سبد ---------- */
.nxc-form{
  display:block;
  margin:0;
  padding:0 11px 11px;
}
html body .nxc-card .nxc-btn,
html body .add-cart-form .nx-buy-row button.nx-buy-btn{
  display:flex!important;
  align-items:center;
  justify-content:center;
  gap:7px;
  width:100%;
  margin:0;
  padding:0 10px;
  box-sizing:border-box;
  cursor:pointer;
  background:transparent!important;
  background-image:none!important;
  box-shadow:none!important;
  border:1.5px solid var(--nxc-btn,#0a6bff)!important;
  border-radius:11px!important;
  color:var(--nxc-btn,#0a6bff)!important;
  font-family:inherit;
  font-size:13.5px;
  font-weight:700;
  line-height:1;
  text-shadow:none!important;
  transition:background-color .18s,color .18s,border-color .18s,transform .1s;
}
html body .nxc-card .nxc-btn{height:40px}
.nxc-btn svg,.nx-buy-btn svg{flex:0 0 auto}
@media(hover:hover){
  html body .nxc-card .nxc-btn:hover:not(:disabled),
  html body .add-cart-form .nx-buy-row button.nx-buy-btn:hover:not(:disabled){
    background:var(--nxc-btn,#0a6bff)!important;
    color:#fff!important;
  }
}
html body .nxc-card .nxc-btn:active:not(:disabled),
html body .add-cart-form .nx-buy-row button.nx-buy-btn:active:not(:disabled){
  transform:scale(.97);
}
html body .nxc-card .nxc-btn:disabled,
html body .add-cart-form .nx-buy-row button.nx-buy-btn:disabled{
  opacity:.55;
  cursor:not-allowed;
  border-color:var(--nxc-muted)!important;
  color:var(--nxc-muted)!important;
}

/* ---------- گرید و ریل ---------- */
.nxc-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(var(--nxc-w),1fr));
  gap:14px;
}
html body .nxc-grid>.nxc-card{width:100%}
html body .nx-horizontal-products{
  display:flex!important;
  gap:12px!important;
  overflow-x:auto;
  scroll-snap-type:x mandatory;
  -webkit-overflow-scrolling:touch;
  padding-bottom:4px;
}
html body .nx-horizontal-products>.nxc-card{
  flex:0 0 var(--nxc-w);
  width:var(--nxc-w);
  scroll-snap-align:start;
}

/* ---------- موبایل فشرده ---------- */
@media(max-width:700px){
  html body .nxc-card{
    border-radius:13px!important;
  }
  /* پیش‌فرض ۲ ستون؛ اگر --nxc-cols-mobile ست شده باشد، آن اولویت دارد (v337) */
  html body .nxc-grid{
    grid-template-columns:repeat(var(--nxc-cols-mobile, 2),minmax(0,1fr))!important;
    gap:8px!important;
  }
  html body .nx-horizontal-products{gap:9px!important}
  .nxc-media{aspect-ratio:1/.92}
  .nxc-bar{height:26px;padding:0 8px;font-size:11.5px}
  .nxc-timer{font-size:10.5px;padding:2px 6px}
  html body .nxc-card .nxc-title{
    padding:7px 9px 0;
    line-height:1.55;
    min-height:calc(1.55em * 2 + 7px);
  }
  html body .nxc-card .nxc-cond{
    font-size:9.5px!important;
    padding:1.5px 6px!important;
    margin:3px 9px 0!important;
  }
  .nxc-prices{padding:3px 9px 6px}
  .nxc-oldrow{min-height:16px}
  html body .nxc-card .nxc-old{font-size:11.5px}
  html body .nxc-card .nxc-off{font-size:11px;padding:2px 6px}
  .nxc-form{padding:0 9px 9px}
  html body .nxc-card .nxc-btn{
    height:35px;
    font-size:12px;
    gap:5px;
    border-radius:9px!important;
  }
}

/* ---------- ریل شگفت‌انگیز (سازگاری) ---------- */
html body .nx-store-rail .nx-amazing-side{flex-basis:88px!important}
html body .nx-store-rail .nx-amazing-icon{
  width:42px!important;
  height:42px!important;
  font-size:20px!important;
}
html body .nx-store-rail .nx-amazing-title{font-size:13.5px!important}
html body .nx-store-rail .nx-amazing-timer .nx-cd-box{
  min-width:22px;
  height:22px;
  font-size:11px!important;
}
@media(max-width:700px){
  html body .nx-store-rail .nx-amazing-side{flex-basis:74px!important}
  html body .nx-store-rail .nx-amazing-icon{
    width:36px!important;
    height:36px!important;
    font-size:17px!important;
  }
  html body .nx-store-rail .nx-amazing-title{font-size:12px!important}
  html body .nx-store-rail .nx-amazing-timer .nx-cd-box{
    min-width:19px;
    height:19px;
    font-size:10px!important;
  }
}

/* ---------- موبایل خیلی کوچک: همچنان ۲ ستون، فقط فشرده‌تر ---------- */
@media(max-width:380px){
  html body .nxc-grid{gap:6px!important}
  html body .nxc-card .nxc-title{padding:6px 7px 0}
  .nxc-prices{padding:2px 7px 5px}
  .nxc-form{padding:0 7px 7px}
  html body .nxc-card .nxc-btn{height:32px;font-size:11.5px}
}

/* ---------- دسترسی و کاهش حرکت ---------- */
@media(prefers-reduced-motion:reduce){
  .nxc-card,.nxc-btn{transition:none}
  .nxc-timer.is-urgent{animation:none}
}

/* ---------- کارت‌های خانواده/دسته (بدون عکس) ---------- */
.family-card img,
.family-card .card-image,
.family-card .category-image,
.family-card .family-card-image,
.category-card img,
.category-card .card-image,
.category-card .category-image,
.category-family-card img,
.category-family-card .card-image{
  display:none!important;
}
.family-card,
.category-card,
.category-family-card{
  min-height:0!important;
}
.family-card .card-body,
.category-card .card-body,
.category-family-card .card-body{
  padding-top:18px!important;
}

/* ---------- غیرفعال کردن اسکرول مشخصات ---------- */
.property-scroll,.property-scroll-behavior,.property-scroll-behaviour,
.properties-scroll,.properties-list-scroll,.product-properties-scroll,
.specifications-scroll{
  max-height:none!important;
  height:auto!important;
  overflow:visible!important;
  overflow-y:visible!important;
  overscroll-behavior:auto!important;
}
