/* =========================================================================
 *  Product card V3 — Figma
 *  scope: .tk-archive-v2 .tk_v3_card  (فقط آرشیو v2؛ کارت v1 دست‌نخورده)
 * ====================================================================== */

/* قالب پایه روی همه‌چیز border-box نمی‌گذارد؛ بدون این، height+padding جمع می‌شود
   و دکمه‌ی ۳۶px تبدیل به ۵۶px و width:100% از کارت بیرون می‌زند. */
.tk-archive-v2 .tk_v3_card,
.tk-archive-v2 .tk_v3_card *,
.tk-archive-v2 .tk_v3_card *::before,
.tk-archive-v2 .tk_v3_card *::after {
  box-sizing: border-box;
}

.tk-archive-v2 ul.products.tk_v3_grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tk-archive-v2 .tk_v3_card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  padding: 0;
  margin: 0;
  background: #fff;
  border-radius: 0px;
  box-shadow: 0px 4px 6px 0px #0607070D;
  overflow: hidden;
  direction: rtl;
}

/* ---------------------------------------------------------------- top ---- */
.tk-archive-v2 .tk_v3_card .tk_v3_top {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 24px 16px 20px;
  isolation: isolate;
}

.tk-archive-v2 .tk_v3_card .tk_v3_thumb_link {
  display: block;
  width: 112px;
  height: 112px;
  z-index: 0;
}

.tk-archive-v2 .tk_v3_card .tk_v3_thumb {
  width: 112px;
  height: 112px;
  object-fit: contain;
  display: block;
}

/* --- pill های شناور بالا-راست ------------------------------------------ */
.tk-archive-v2 .tk_v3_card .tk_v3_float_badges {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.tk-archive-v2 .tk_v3_card .tk_v3_fbadge {
  cursor: pointer;
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  gap: 2px;
  height: 28px;
  padding: 0 4px 0 8px;
  border-radius: 999px;
  background: rgba(6, 7, 7, .02);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.tk-archive-v2 .tk_v3_card .tk_v3_fbadge:hover {
  background: #0607070D;
}

.tk-archive-v2 .tk_v3_card .tk_v3_fbadge_txt {
  font-weight: 300;
  font-size: 8px;
  line-height: 110%;
  letter-spacing: .015em;
  text-align: right;
  color: #394040;
  white-space: nowrap;
}

.tk-archive-v2 .tk_v3_card .tk_v3_fbadge img {
  width: 24px;
  height: 24px;
  flex: none;
}

.tk-archive-v2 .tk_v3_card .tk_v3_fbadge_store img {
  width: 22px;
  height: 22px;
}

/* --- هدر: وضعیت موجودی + عنوان ----------------------------------------- */
.tk-archive-v2 .tk_v3_card .tk_v3_head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  align-self: stretch;
  z-index: 1;
}

.tk-archive-v2 .tk_v3_card .tk_v3_stock {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 6px 0 8px;
  /* RTL: فرزندِ اول سمت راست می‌افتد؛ row-reverse یعنی متن چپ و آیکون راست (مثل طرح) */
  flex-direction: row-reverse;
  border: 1px solid #E4E9E9;
  border-radius: 999px;
  font-weight: 500;
  font-size: 11px;
  line-height: 140%;
  letter-spacing: .01em;
  color: #394040;
  white-space: nowrap;
}

.tk-archive-v2 .tk_v3_card .tk_v3_stock_out {
  border-color: #F1D6D7;
  color: #B4181E;
}

.tk-archive-v2 .tk_v3_card .tk_v3_ico {
  width: 16px;
  height: 16px;
  flex: none;
}

.tk-archive-v2 .tk_v3_card .tk_v3_title {
  margin: 0;
  padding: 0 0 0 12px;
  align-self: stretch;
  /* !important لازم است: بلوک CSS سراسری سایت h3{font-size:20px!important} دارد
     و header.css هم *{font-family:'Estedad-FD'!important}. عنوان طبق فیگما
     Estedad (بدون FD) است تا شماره‌مدل لاتین بماند. */
  font-family: 'Estedad' !important;
  font-weight: 400;
  font-size: 13px !important;
  line-height: 190%;
  letter-spacing: .015em;
  text-align: right;
  color: #060707;
  /* دقیقاً ۳ خط — ارتفاع کارت ثابت بماند */
  height: calc(13px * 1.9 * 3);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.tk-archive-v2 .tk_v3_card .tk_v3_title a {
  color: inherit;
  text-decoration: none;
  /* style.css: a{font-weight:500} */
  font-weight: 400;
  font-size: inherit;
  font-family: inherit;
}

/* ------------------------------------------------------------- bottom ---- */
.tk-archive-v2 .tk_v3_card .tk_v3_bottom {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 16px 16px;
  margin-top: auto;
}

.tk-archive-v2 .tk_v3_card .tk_v3_priceblock {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  align-self: stretch;
}

.tk-archive-v2 .tk_v3_card .tk_v3_fresh {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 6px 0 8px;
  flex-direction: row-reverse;
  background: rgba(4, 114, 77, .05);
  font-weight: 500;
  font-size: 11px;
  line-height: 140%;
  letter-spacing: .01em;
  color: #04724D;
  white-space: nowrap;
}

.tk-archive-v2 .tk_v3_card .tk_v3_stale {
  background: rgba(126, 146, 143, .08);
  color: #7E928F;
}

.tk-archive-v2 .tk_v3_card .tk_v3_price_row {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;
  align-self: stretch;
  min-height: 44px;
}

.tk-archive-v2 .tk_v3_card .tk_v3_price_col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  flex: 1 1 auto;
}

.tk-archive-v2 .tk_v3_card .tk_v3_price_now {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
}

.tk-archive-v2 .tk_v3_card .tk_v3_price_num {
  font-weight: 500;
  font-size: 16px;
  line-height: 140%;
  text-align: right;
  color: #060707;
}

.tk-archive-v2 .tk_v3_card .tk_v3_price_cur {
  font-weight: 500;
  font-size: 10px;
  line-height: 140%;
  color: #7E928F;
}

.tk-archive-v2 .tk_v3_card .tk_v3_price_old {
  font-weight: 400;
  font-size: 11px;
  line-height: 140%;
  text-align: right;
  text-decoration-line: line-through;
  color: #7E928F;
}

.tk-archive-v2 .tk_v3_card .tk_v3_discount {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  height: 20px;
  padding: 1px 6px 0;
  border-radius: 999px;
  background: #ED1C24;
  font-weight: 500;
  font-size: 12px;
  line-height: 140%;
  text-align: center;
  color: #fff;
}

/* ------------------------------------------------------------ actions ---- */
.tk-archive-v2 .tk_v3_card .tk_v3_actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-self: stretch;
}

.tk-archive-v2 .tk_v3_card .tk_v3_cart_form {
  margin: 0;
}

.tk-archive-v2 .tk_v3_card .tk_v3_actions .tk_v3_btn {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 36px;
  padding: 10px 24px;
  border: 0;
  border-radius: 2px;
  font-family: 'Estedad-FD';
  font-weight: 500;
  font-size: 12px;
  line-height: 140%;
  text-align: center;
  cursor: pointer;
  transition: background .15s ease;
}

.tk-archive-v2 .tk_v3_card .tk_v3_actions .tk_v3_btn_gold {
  /* طرح: «افزودن به سبد» سمت چپ، آیکون سبد سمت راست */
  flex-direction: row-reverse;
  background: #FFD500;
  color: #060707;
  text-decoration: none;
}

.tk-archive-v2 .tk_v3_card .tk_v3_actions .tk_v3_btn_gold:hover {
  background: #FF9900; /* --tk-orange */
  color: #060707;
}

.tk-archive-v2 .tk_v3_card .tk_v3_ico_cart {
  width: 20px;
  height: 20px;
  flex: none;
}

.tk-archive-v2 .tk_v3_card .tk_v3_actions .tk_v3_btn_ghost {
  gap: 4px;
  padding: 6px 16px 6px 20px;
  background: transparent;
  font-weight: 400;
  color: #060707;
}

.tk-archive-v2 .tk_v3_card .tk_v3_actions .tk_v3_btn_ghost:hover {
  background: #F5F6F6; /* --tk-bg */
}

.tk-archive-v2 .tk_v3_card .tk_v3_ico_chev {
  width: 20px;
  height: 20px;
  flex: none;
  transition: transform .2s ease;
}

.tk-archive-v2 .tk_v3_card .tk_v3_specs_toggle[aria-expanded="true"] .tk_v3_ico_chev {
  transform: rotate(180deg);
}

.tk-archive-v2 .tk_v3_card .tk_v3_specs_panel {
  padding: 4px 0 0;
  font-size: 12px;
  line-height: 1.9;
  color: #394040;
  text-align: right;
}

.tk-archive-v2 .tk_v3_card .tk_v3_specs_panel .archive_top_attribute {
  display: block !important;
}

.tk-archive-v2 .tk_v3_card .tk_v3_specs_panel .archive_attribute_display {
  margin: 0 0 2px;
}

.tk-archive-v2 .tk_v3_card .tk_v3_specs_panel .archive_attribute_display_title {
  color: #7E928F;
}

/* ------------------------------------------------------------ responsive - */
@media only screen and (max-width: 1024px) {
  .tk-archive-v2 ul.products.tk_v3_grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media only screen and (max-width: 767px) {
  .tk-archive-v2 ul.products.tk_v3_grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .tk-archive-v2 .tk_v3_card .tk_v3_top {
    padding: 16px 12px 12px;
    gap: 12px;
  }

  .tk-archive-v2 .tk_v3_card .tk_v3_bottom {
    padding: 0 12px 12px;
  }

  .tk-archive-v2 .tk_v3_card .tk_v3_float_badges {
    top: 12px;
    right: 12px;
  }

  .tk-archive-v2 .tk_v3_card .tk_v3_title {
    font-size: 12px !important;
    height: calc(12px * 1.9 * 3);
  }
}


/* =========================================================================
 *  استپر تعداد + حالت «در سبد شما»
 *  کارت V3 دیگر کلاس archive_product_box را ندارد، پس استایل استپر از
 *  product-cat-v2.css به آن نمی‌رسد؛ اینجا پورت شده و با طرح V3 هماهنگ شد.
 *  ⚠️ روی display هیچ‌جا !important نگذار — تاگل AJAX در functions.php
 *     با inline style دکمه/استپر را نشان و پنهان می‌کند.
 * ====================================================================== */
/* ⚠️ display اینجا لازم است: jQuery .show() مقدارِ inline را پاک می‌کند
   (style.display = "")، و بدون این قاعده <div> به block پیش‌فرض برمی‌گشت. */
.tk-archive-v2 .tk_v3_card .incartquantity {
  display: flex;
  width: 100%;
  margin: 0;
}

/* ردیفِ واقعی — هیچ JSای این المان را لمس نمی‌کند، پس چیدمان همیشه پایدار است */
.tk-archive-v2 .tk_v3_card .tk_v3_cart_row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 0;
}

/* استپر = pillِ سفید با سایه‌ی مویی؛ کشیده تا فضای باقی‌مانده را پر کند */
.tk-archive-v2 .tk_v3_card .quantity {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  height: 36px;
  margin: 0;
  float: none;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 1px 0 #394040;
}

/* آیکون‌ها به‌صورت background می‌آیند نه <img>: updateQuantityButtons در
   js/responsive.js با show()/hide() جی‌کوئری روی همین دکمه‌ها display را
   inline ست می‌کند، پس نباید لِی‌اوتِ داخلی دکمه به display وابسته باشد. */
.tk-archive-v2 .tk_v3_card .quantity .plus,
.tk-archive-v2 .tk_v3_card .quantity .minus,
.tk-archive-v2 .tk_v3_card .quantity .trash {
  flex: none;
  width: 48px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background-color: #E4E9E9;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 24px 24px;
  font-size: 0;
  line-height: 0;
  text-align: center;
  cursor: pointer;
}

.tk-archive-v2 .tk_v3_card .quantity .plus  { background-image: url('../../icon/v3-plus.svg'); }
.tk-archive-v2 .tk_v3_card .quantity .minus { background-image: url('../../icon/v3-minus.svg'); }
.tk-archive-v2 .tk_v3_card .quantity .trash { background-image: url('../../icon/v3-trash.svg'); }

.tk-archive-v2 .tk_v3_card .quantity .plus:hover,
.tk-archive-v2 .tk_v3_card .quantity .minus:hover,
.tk-archive-v2 .tk_v3_card .quantity .trash:hover {
  background-color: #CCD5D3; /* --tk-line2 */
}

.tk-archive-v2 .tk_v3_card .quantity .plus img,
.tk-archive-v2 .tk_v3_card .quantity .minus img,
.tk-archive-v2 .tk_v3_card .quantity .trash img {
  display: none;
}

.tk-archive-v2 .tk_v3_card .quantity .input-text.qty {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  height: 36px;
  margin: 0;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-family: 'Estedad-FD';
  font-weight: 500;
  font-size: 16px;
  line-height: 140%;
  text-align: center;
  color: #060707;
  -moz-appearance: textfield;
}

.tk-archive-v2 .tk_v3_card .quantity .input-text.qty::-webkit-outer-spin-button,
.tk-archive-v2 .tk_v3_card .quantity .input-text.qty::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.tk-archive-v2 .tk_v3_card .incart {
  position: static;
  display: flex;
  flex: none;
  align-items: center;
  width: auto;
  height: 36px;
  margin: 0;
}

/* «مشاهده سبد» — طرح: chevron سمت چپِ متن (padding: راست ۸ / چپ ۴) */
.tk-archive-v2 .tk_v3_card .tk_v3_view_cart {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 36px;
  padding: 0 8px 0 4px;
  border-radius: 2px;
  font-family: 'Estedad-FD';
  font-weight: 400;
  font-size: 12px;
  line-height: 140%;
  text-align: center;
  color: #060707;
  text-decoration: none;
  white-space: nowrap;
}

.tk-archive-v2 .tk_v3_card .tk_v3_view_cart:hover {
  background: #F5F6F6; /* --tk-bg */
  color: #060707;
}

.tk-archive-v2 .tk_v3_card .tk_v3_view_cart img {
  flex: none;
  width: 16px;
  height: 16px;
}

/* شناسه‌ی محصول (کپی‌کننده‌ی sale-flash) در کارت V3 جایی ندارد */
.tk-archive-v2 .tk_v3_card .product-id {
  display: none;
}


/* فرم افزودن‌به‌سبد: خنثی‌کردن رول‌های عمومی .woocommerce .cart قالب */
.tk-archive-v2 .tk_v3_card .tk_v3_actions .tk_v3_cart_form {
  margin: 0;
  padding: 0;
  float: none;
  width: 100%;
  text-align: right;
}

/* form.cart تمیزکاری */

/* =========================================================================
 *  مودال «همه مشخصات» — Figma 13417:29811
 *  اسکوپ سراسری (مودال خارج از .tk-archive-v2 نیست ولی کلاس‌ها یکتا هستند)
 * ====================================================================== */
.tk_v3_modal_overlay,
.tk_v3_modal_overlay * {
  box-sizing: border-box;
}

.tk_v3_modal_overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(6, 7, 7, .45);
  direction: rtl;
}

.tk_v3_modal_overlay[hidden] {
  display: none;
}

body.tk_v3_modal_open {
  overflow: hidden;
}

.tk_v3_modal {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 412px;
  /* ارتفاع ثابت حتی با محتوای کم؛ max-height برای نمایشگرِ کوتاه نگه داشته شده */
  height: 560px;
  max-height: 88vh;
  overflow: hidden;
  background: #fff;
  border: 2px solid #E4E9E9;
  border-radius: 16px;
}

/* ---- هدر ---- */
.tk_v3_modal_head {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: none;
  padding: 16px;
  border-bottom: 1px solid #E4E9E9;
}

.tk_v3_modal_h {
  flex: 1 1 auto;
  font-family: 'Estedad-FD';
  font-weight: 700;
  font-size: 18px;
  line-height: 140%;
  text-align: right;
  color: #060707;
}

.tk_v3_modal_close {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 40px;
  height: 40px;
  padding: 8px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
}

.tk_v3_modal_close:hover {
  background: #F5F6F6;
}

.tk_v3_modal_close img {
  width: 14px;
  height: 14px;
}

/* ---- بدنه ---- */
.tk_v3_modal_body {
  display: flex;
  flex-direction: column;
  gap: 32px;
  flex: 1 1 auto;
  position: relative; /* مرجعِ وسط‌چین‌کردنِ اسپینر */
  padding: 32px 24px 24px;
  overflow-x: hidden;
  overflow-y: auto;
}

.tk_v3_modal_ptitle {
  margin: 0;
  padding: 0 0 0 8px;
  font-family: 'Estedad-FD';
  font-weight: 400;
  font-size: 14px;
  line-height: 190%;
  letter-spacing: .015em;
  text-align: right;
  color: #060707;
}

.tk_v3_modal_ptitle:empty {
  display: none;
}

/* ---- جدول مشخصات ---- */
.tk_v3_specs_table {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.tk_v3_spec_row {
  display: flex;
  align-items: stretch;
  width: 100%;
  background: #F5F6F6;
}

.tk_v3_spec_row + .tk_v3_spec_row {
  border-top: 1px solid #E4E9E9;
}

/* راست: نامِ ویژگی (روی زمینه‌ی خاکستری ردیف) */
.tk_v3_spec_label {
  flex: none;
  width: 152px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 8px;
  font-family: 'Estedad-FD';
  font-weight: 400;
  font-size: 14px;
  line-height: 140%;
  text-align: right;
  color: #394040;
}

/* چپ: مقدار (زمینه‌ی سفید، کشیده تا انتهای ردیف) */
.tk_v3_spec_value {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 8px;
  background: #fff;
  text-align: right;
}

.tk_v3_spec_link {
  padding: 4px 0;
  font-family: 'Estedad-FD';
  font-weight: 500;
  font-size: 14px;
  line-height: 140%;
  color: #2A4ACA;
  text-decoration: none;
}

.tk_v3_spec_link:hover {
  text-decoration: underline;
  color: #2A4ACA;
}

.tk_v3_spec_text {
  font-family: 'Estedad-FD';
  font-weight: 500;
  font-size: 14px;
  line-height: 140%;
  color: #060707;
}

/* کی‌فریمِ مشترکِ tk-loading-spin در product-cat-v2.css داخلِ خودش
   translateX(-50%) دارد (برای ::after ی گرید که left:50% است) و هر المانِ
   دیگری را ۲۰px به چپ می‌کشد؛ پس اینجا کی‌فریمِ خالصِ چرخش لازم است. */
@keyframes tk-v3-spin {
  to { transform: rotate(360deg); }
}

.tk_v3_specs_loading {
  position: absolute;
  inset: 0;
  width: 40px;
  height: 40px;
  margin: auto;
  background: url("../../icon/loading40.svg") center / contain no-repeat;
  animation: tk-v3-spin 0.8s linear infinite;
}

.tk_v3_specs_msg {
  margin: 0;
  padding: 24px 0;
  font-family: 'Estedad-FD';
  font-size: 13px;
  text-align: center;
  color: #7E928F;
}

@media only screen and (max-width: 767px) {
  /* روی موبایل تمام‌صفحه: نه حاشیه‌ی اطراف، نه گوشه‌ی گرد، نه بوردر */
  .tk_v3_modal_overlay {
    padding: 0;
  }

  .tk_v3_modal {
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    border: 0;
    border-radius: 0;
  }

  .tk_v3_modal_body {
    padding: 24px 16px 16px;
    gap: 24px;
  }

  .tk_v3_spec_label {
    width: 132px;
  }
}
