/* ============================================================
   کارت باران — استایل کارت محصولات ووکامرس
   سازنده: abrbaranidc.ir
   متغیرهای تم از طریق کنترل‌های المنتور روی wrapper تنظیم می‌شوند.
   مقادیر :root صرفاً به‌عنوان پیش‌فرض پشتیبان هستند.
   ============================================================ */
.kb-baran{
  --wc-card:        #ffffff;
  --wc-ink:         #14161c;
  --wc-muted:       #767b86;
  --wc-line:        #ececf0;
  --wc-sale:        #e11d48;
  --wc-star:        #ffb300;
  --wc-ok:          #16a34a;
  --wc-accent:      #14161c;
  --wc-radius:      18px;
  --wc-radius-sm:   10px;
  --wc-gap:         20px;
  --wc-ratio:       1 / 1;
  --wc-shadow:      0 1px 2px rgba(20,22,28,.04), 0 8px 24px -12px rgba(20,22,28,.18);
  --wc-shadow-h:    0 8px 18px -6px rgba(20,22,28,.14), 0 26px 50px -20px rgba(20,22,28,.30);
}

.kb-baran *,.kb-baran *::before,.kb-baran *::after{box-sizing:border-box}

/* ============================================================
   آرمور — خنثی‌سازی تداخل استایل قالب و ووکامرس
   (قالب‌ها روی .products/.product/.price/.button/.onsale استایل می‌زنند
    و طرح را به‌هم می‌ریزند؛ این بخش کنترل را به طرح کارت باران برمی‌گرداند)
   ============================================================ */
.kb-baran,.kb-baran *{box-sizing:border-box}
.kb-baran .wc-grid{
  display:grid!important;float:none!important;width:auto!important;max-width:none!important;
  margin:0!important;padding:0!important;list-style:none!important;
}
.kb-baran .wc-grid::before,.kb-baran .wc-grid::after,
.kb-baran .wc-card::before,.kb-baran .wc-card::after{display:none!important;content:none!important}
.kb-baran .wc-card{
  float:none!important;clear:none!important;width:auto!important;max-width:none!important;min-width:0!important;
  margin:0!important;padding:0!important;text-align:start!important;
}
.kb-baran .wc-card__media{padding:0!important;margin:0!important}
.kb-baran .wc-card__img{max-width:100%!important;height:100%!important;margin:0!important;padding:0!important;border-radius:0!important;box-shadow:none!important}
/* قیمت */
.kb-baran .wc-card .wc-price,
.kb-baran .wc-card .wc-price.price{
  margin:0!important;padding:0!important;display:flex!important;flex-direction:column!important;
  float:none!important;min-width:0!important;font-size:inherit;color:inherit!important;line-height:1.2;
}
.kb-baran .wc-card .wc-price__new{color:var(--wc-ink)}
.kb-baran .wc-card .wc-price__new.is-sale{color:var(--wc-sale)}
.kb-baran .wc-card .wc-price ins{text-decoration:none!important;background:transparent!important}
.kb-baran .wc-card .wc-price del{color:var(--wc-muted)}
/* دکمه‌ها — خنثی‌سازی استایل دکمه‌ی قالب */
.kb-baran .wc-card .wc-cart,
.kb-baran .wc-card a.wc-cart,
.kb-baran .wc-card button.wc-cart{
  border:0!important;outline:0;text-transform:none!important;text-decoration:none!important;
  letter-spacing:normal!important;line-height:1!important;text-shadow:none!important;margin:0!important;
  min-width:0!important;max-width:none!important;font-family:inherit!important;
}
.kb-baran .wc-card .wc-cart{padding:0 16px}
.kb-baran .wc-card .wc-cart--icon{padding:0}
.kb-baran .wc-card .added_to_cart{display:none!important}
/* نشان حراج — جلوگیری از تبدیل به دایره توسط ووکامرس */
.kb-baran .wc-card .wc-badge{
  position:static!important;inset:auto!important;width:auto!important;height:auto!important;
  min-width:0!important;min-height:0!important;line-height:1!important;
}

/* ============================================================
   گرید محصولات
   ============================================================ */
.kb-baran .wc-grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:var(--wc-gap);
  margin:0;padding:0;list-style:none;
}

/* ============================================================
   کارت محصول
   ============================================================ */
.kb-baran .wc-card{
  position:relative;display:flex;flex-direction:column;
  background:var(--wc-card);border:1px solid var(--wc-line);
  border-radius:var(--wc-radius);box-shadow:var(--wc-shadow);overflow:hidden;
  transition:transform .35s cubic-bezier(.2,.7,.2,1), box-shadow .35s ease, border-color .35s ease;
  will-change:transform;margin:0;
}
.kb-baran .wc-card:hover{transform:translateY(-6px);box-shadow:var(--wc-shadow-h);border-color:#e0e1e6}

/* ---- تصویر ---- */
.kb-baran .wc-card__media{position:relative;aspect-ratio:var(--wc-ratio);background:linear-gradient(135deg,#eef0f3,#e3e6ea);overflow:hidden}
.kb-baran .wc-card__img-link{display:block;width:100%;height:100%}
.kb-baran .wc-card__img{width:100%;height:100%;object-fit:cover;display:block;transition:transform .6s cubic-bezier(.2,.7,.2,1);margin:0}
.kb-baran .wc-card:hover .wc-card__img{transform:scale(1.07)}

/* ---- نشان‌ها ---- */
.kb-baran .wc-badges{position:absolute;inset-block-start:12px;inset-inline-start:12px;display:flex;flex-direction:column;gap:7px;z-index:3}
.kb-baran .wc-badge{font-size:12px;font-weight:700;line-height:1;padding:7px 10px;border-radius:100px;color:#fff;box-shadow:0 4px 10px -3px rgba(0,0,0,.25)}
.kb-baran .wc-badge--sale{background:var(--wc-sale)}
.kb-baran .wc-badge--new{background:var(--wc-ink)}
.kb-baran .wc-badge--out{background:#64748b}

/* ---- دکمه‌های شناور ---- */
.kb-baran .wc-actions{position:absolute;inset-block-start:12px;inset-inline-end:12px;display:flex;flex-direction:column;gap:8px;z-index:3}
.kb-baran .wc-act{width:38px;height:38px;border:none;cursor:pointer;border-radius:50%;background:rgba(255,255,255,.92);backdrop-filter:blur(6px);display:grid;place-items:center;color:var(--wc-ink);box-shadow:0 4px 12px -4px rgba(0,0,0,.22);opacity:0;transform:translateX(8px);transition:opacity .3s ease, transform .3s ease, background .2s ease, color .2s ease}
.kb-baran .wc-card:hover .wc-act{opacity:1;transform:translateX(0)}
.kb-baran .wc-card:hover .wc-act:nth-child(2){transition-delay:.05s}
.kb-baran .wc-card:hover .wc-act:nth-child(3){transition-delay:.1s}
.kb-baran .wc-act:hover{background:var(--wc-ink);color:#fff}
.kb-baran .wc-act svg{width:18px;height:18px}
.kb-baran .wc-act.is-active{background:var(--wc-sale);color:#fff}
.kb-baran .wc-act.is-active svg{fill:#fff}

/* ---- بدنه ---- */
.kb-baran .wc-card__body{display:flex;flex-direction:column;gap:9px;padding:16px 16px 18px;flex:1}
.kb-baran .wc-card__cat{font-size:12px;font-weight:600;color:var(--wc-muted);letter-spacing:.02em;text-decoration:none}
.kb-baran .wc-card__cat:hover{color:var(--wc-ink)}
.kb-baran .wc-card__title{margin:0;font-size:15.5px;font-weight:700;line-height:1.55;letter-spacing:-.01em;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;min-height:2.6em}
.kb-baran .wc-card__title a{color:inherit;text-decoration:none;transition:color .2s ease}
.kb-baran .wc-card__title a:hover{color:var(--wc-sale)}

/* ---- امتیاز ---- */
.kb-baran .wc-rating{display:flex;align-items:center;gap:7px}
.kb-baran .wc-stars{--rating:5;direction:ltr;font-size:14px;letter-spacing:2px;line-height:1}
.kb-baran .wc-stars::before{content:"\2605\2605\2605\2605\2605";background:linear-gradient(90deg,var(--wc-star) calc(var(--rating)/5*100%),#d9dbe0 calc(var(--rating)/5*100%));-webkit-background-clip:text;background-clip:text;color:transparent}
.kb-baran .wc-rating__count{font-size:12px;color:var(--wc-muted)}

/* ---- سواچ متغیرها ---- */
.kb-baran .wc-swatches{display:flex;align-items:center;gap:8px;flex-wrap:wrap;min-height:26px}
.kb-baran .wc-swatch{border:2px solid transparent;cursor:pointer;padding:0;border-radius:50%;width:22px;height:22px;background:var(--sw,#ccc);box-shadow:inset 0 0 0 2px #fff;transition:transform .15s ease, box-shadow .15s ease}
.kb-baran .wc-swatch:hover{transform:scale(1.12)}
.kb-baran .wc-swatch.is-active{box-shadow:inset 0 0 0 2px #fff,0 0 0 2px var(--wc-ink)}
.kb-baran .wc-swatch--text{width:auto;min-width:30px;height:26px;border-radius:8px;background:#fff;border:1.5px solid var(--wc-line);box-shadow:none;font-size:12px;font-weight:600;color:var(--wc-ink);padding:0 8px}
.kb-baran .wc-swatch--text.is-active{background:var(--wc-ink);color:#fff;border-color:var(--wc-ink);box-shadow:none}
.kb-baran .wc-swatch--text:hover{transform:none;border-color:var(--wc-ink)}
.kb-baran .wc-swatch__more{font-size:12px;color:var(--wc-muted);font-weight:600}

/* ---- قیمت + دکمه ---- */
.kb-baran .wc-card__foot{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:auto;padding-top:6px}
/* چیدمان عمودی: قیمت بالا، دکمه تمام‌عرض پایین (پیش‌فرض — مناسب قیمت‌های بلند) */
.kb-baran .wc-card__foot.is-col{flex-direction:column;align-items:stretch;gap:10px}
.kb-baran .wc-card__foot.is-col .wc-cart{width:100%}
/* چیدمان افقی: کنار هم، با شکست خط در صورت کمبود جا */
.kb-baran .wc-card__foot.is-row{flex-wrap:wrap}
.kb-baran .wc-card__foot.is-row .wc-price{flex:1 1 auto;min-width:0}
.kb-baran .wc-card__foot.is-row .wc-cart{flex-shrink:0}
.kb-baran .wc-price{display:flex;flex-direction:column;line-height:1.2;min-width:0}
/* متن «تماس بگیرید» / قیمت خالی */
.kb-baran .wc-price__call{font-size:16px;font-weight:800;color:var(--wc-ink);white-space:normal}
.kb-baran .wc-price__call .amount,.kb-baran .wc-price__call .woocommerce-Price-amount,.kb-baran .wc-price__call ins,.kb-baran .wc-price__call span{font-size:inherit;color:inherit;text-decoration:none}
.kb-baran .wc-price__old,.kb-baran .wc-price del{font-size:13px;color:var(--wc-muted);text-decoration:line-through;text-decoration-color:var(--wc-sale)}
.kb-baran .wc-price__new{font-size:18px;font-weight:800;letter-spacing:-.01em;text-decoration:none;color:var(--wc-ink)}
.kb-baran ins.wc-price__new{text-decoration:none;background:transparent}
.kb-baran .wc-price__new.is-sale{color:var(--wc-sale)}
.kb-baran .wc-price__unit{font-size:12px;font-weight:600;color:var(--wc-muted);margin-inline-start:3px}
.kb-baran .wc-price__from{font-size:11px;color:var(--wc-muted);font-weight:600}

.kb-baran .wc-cart{flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;gap:7px;border:none;cursor:pointer;font-family:inherit;font-size:13.5px;font-weight:700;height:44px;padding:0 16px;border-radius:12px;background:var(--wc-accent);color:#fff;transition:filter .2s ease, transform .15s ease, background .2s ease;white-space:nowrap;text-decoration:none}
.kb-baran .wc-cart svg{width:17px;height:17px;flex-shrink:0}
.kb-baran .wc-cart:hover{filter:brightness(1.18);transform:translateY(-1px);color:#fff}
.kb-baran .wc-cart:active{transform:translateY(0)}
.kb-baran .wc-cart.loading,.kb-baran .wc-cart.is-loading{pointer-events:none;opacity:.7}
.kb-baran .wc-cart.added,.kb-baran .wc-cart.is-done{background:var(--wc-ok)}
.kb-baran .wc-cart--icon{width:44px;padding:0}
.kb-baran .wc-cart--icon .wc-cart__label{display:none}
.kb-baran .wc-cart--outline{background:transparent;color:var(--wc-ink);box-shadow:inset 0 0 0 1.5px var(--wc-line)}
.kb-baran .wc-cart--outline:hover{background:var(--wc-ink);color:#fff;filter:none;box-shadow:none}
/* پیام «به سبد افزوده شد» پیش‌فرض ووکامرس را داخل کارت پنهان می‌کنیم */
.kb-baran .wc-card .added_to_cart{display:none!important}

/* ---- حالت ناموجود ---- */
.kb-baran .wc-card.outofstock .wc-card__img{filter:grayscale(.5) brightness(.97)}
.kb-baran .wc-card.outofstock .wc-card__media::after{content:"";position:absolute;inset:0;background:rgba(255,255,255,.18)}
.kb-baran .wc-cart--out,.kb-baran .wc-cart:disabled{background:#eceef1;color:var(--wc-muted);cursor:not-allowed;box-shadow:none}
.kb-baran .wc-cart--out:hover,.kb-baran .wc-cart:disabled:hover{filter:none;transform:none;background:#eceef1}

/* ============================================================
   ریسپانسیو (پیش‌فرض؛ ستون‌ها از کنترل المنتور هم قابل تنظیم‌اند)
   ============================================================ */
@media (max-width:1024px){
  .kb-baran .wc-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
}
@media (max-width:767px){
  .kb-baran{--wc-radius:14px}
  .kb-baran .wc-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
  .kb-baran .wc-card__body{padding:12px 12px 14px;gap:6px}
  .kb-baran .wc-card__cat{font-size:11px}
  .kb-baran .wc-card__title{font-size:13.5px;min-height:0;line-height:1.5}
  .kb-baran .wc-rating{gap:5px}
  .kb-baran .wc-stars{font-size:13px}
  .kb-baran .wc-price__new{font-size:15.5px}
  .kb-baran .wc-price__unit{font-size:11px}
  .kb-baran .wc-price__old{font-size:12px}
  .kb-baran .wc-card__foot{flex-direction:column!important;align-items:stretch!important;gap:9px}
  .kb-baran .wc-cart{width:100%!important;height:42px;font-size:13px;padding:0 12px!important}
  .kb-baran .wc-cart--icon{width:100%!important}
  .kb-baran .wc-cart--icon .wc-cart__label{display:inline}
  .kb-baran .wc-act{opacity:1;transform:none;width:32px;height:32px}
  .kb-baran .wc-act svg{width:15px;height:15px}
  .kb-baran .wc-badge{font-size:11px;padding:6px 9px}
  .kb-baran .wc-swatch{width:20px;height:20px}
}
@media (max-width:360px){
  .kb-baran .wc-grid{grid-template-columns:1fr}
}

@media (prefers-reduced-motion:reduce){
  .kb-baran *{transition:none!important;animation:none!important}
  .kb-baran .wc-card:hover{transform:none}
  .kb-baran .wc-card:hover .wc-card__img{transform:none}
}

.kb-baran .wc-act:focus-visible,.kb-baran .wc-cart:focus-visible,.kb-baran .wc-swatch:focus-visible,.kb-baran .wc-card__title a:focus-visible{outline:3px solid color-mix(in srgb,var(--wc-ink) 35%,transparent);outline-offset:2px;border-radius:6px}

/* ---- توست ---- */
.kb-toast{position:fixed;inset-block-end:24px;inset-inline-start:50%;transform:translate(50%,140%);background:#14161c;color:#fff;font-size:13.5px;font-weight:600;padding:12px 20px;border-radius:100px;z-index:99999;box-shadow:0 12px 30px -8px rgba(0,0,0,.4);transition:transform .4s cubic-bezier(.2,.8,.2,1);display:flex;align-items:center;gap:8px;font-family:"Vazirmatn",Tahoma,sans-serif}
.kb-toast.is-show{transform:translate(50%,0)}
html[dir="ltr"] .kb-toast{inset-inline-start:50%;transform:translate(-50%,140%)}
html[dir="ltr"] .kb-toast.is-show{transform:translate(-50%,0)}
.kb-toast svg{width:18px;height:18px}
