/*
 * Crush Theme — single-product AJAX tabs.
 *
 * Light palette matched to woo.css (the single-product page): white rounded
 * panel (#fff / #eef2f6 / radius 24), navy #0f1b3d headings, muted #64748b tabs,
 * orange #EA8F09 active state + underline. Horizontal, scrollable on mobile.
 */
.cwc-tabs {
	margin-top: clamp(28px, 4vw, 48px);
	direction: rtl;
}

/*
 * نوار تب‌ها: افقی، بدون شکستن به خط دوم، بدون هیچ اسکرول‌بار دیده‌شدنی.
 * overflow-y:hidden اجباری‌ست — با تنها overflow-x:auto مرورگر محور دیگر را هم
 * به auto ارتقا می‌دهد و خطِ زیر تب فعال یک اسکرول‌بار عمودیِ الکی می‌سازد.
 */
.cwc-tabs__navwrap {
	position: relative;
	border-bottom: 2px solid #eef2f6;
}

.cwc-tabs__nav {
	display: flex;
	flex-wrap: nowrap;
	gap: 4px;
	overflow-x: auto;
	overflow-y: hidden;
	-webkit-overflow-scrolling: touch;
	scroll-behavior: smooth;
	scroll-padding-inline: 32px;
	scrollbar-width: none;
	-ms-overflow-style: none;
}
.cwc-tabs__nav::-webkit-scrollbar { display: none; }

/* لبه‌های محوشونده — فقط وقتی در آن جهت محتوای پنهان هست. */
.cwc-tabs__navwrap::before,
.cwc-tabs__navwrap::after {
	content: '';
	position: absolute;
	inset-block: 0;
	width: 46px;
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.2s ease;
	z-index: 2;
}
/* لبهٔ راست = ابتدای لیست در RTL */
.cwc-tabs__navwrap::before {
	right: 0;
	background: linear-gradient(to left, #f8fafc 25%, rgba(248, 250, 252, 0));
}
/* لبهٔ چپ = انتهای لیست در RTL */
.cwc-tabs__navwrap::after {
	left: 0;
	background: linear-gradient(to right, #f8fafc 25%, rgba(248, 250, 252, 0));
}
.cwc-tabs__navwrap.has-start::before { opacity: 1; }
.cwc-tabs__navwrap.has-end::after { opacity: 1; }

/* فلش‌ها فقط وقتی واقعاً سرریز هست و ورودی ماوس داریم. */
.cwc-tabs__arrow {
	display: none;
	position: absolute;
	inset-block-start: 50%;
	transform: translateY(-50%);
	z-index: 3;
	width: 30px;
	height: 30px;
	padding: 0;
	align-items: center;
	justify-content: center;
	background: #fff;
	border: 1px solid #e2e8f0;
	border-radius: 50%;
	color: #64748b;
	cursor: pointer;
	box-shadow: 0 3px 10px rgba(15, 23, 42, 0.08);
	transition: color 0.2s ease, border-color 0.2s ease;
}
.cwc-tabs__navwrap.is-scrollable .cwc-tabs__arrow { display: inline-flex; }
.cwc-tabs__arrow:hover { color: #EA8F09; border-color: #EA8F09; }
.cwc-tabs__arrow svg { width: 14px; height: 14px; }
.cwc-tabs__arrow[data-dir="prev"] { inset-inline-start: 0; }
.cwc-tabs__arrow[data-dir="next"] { inset-inline-end: 0; }
.cwc-tabs__navwrap.is-scrollable .cwc-tabs__nav { padding-inline: 34px; }

@media (hover: none) {
	.cwc-tabs__navwrap.is-scrollable .cwc-tabs__arrow { display: none; }
	.cwc-tabs__navwrap.is-scrollable .cwc-tabs__nav { padding-inline: 0; }
}

.cwc-tab {
	flex: 0 0 auto;
	position: relative;
	scroll-snap-align: end;
	padding: 14px 18px;
	color: #64748b;
	font-weight: 700;
	font-size: 0.98rem;
	white-space: nowrap;
	text-decoration: none;
	background: none;
	border: none;
	cursor: pointer;
	transition: color 0.2s ease;
}
.cwc-tab:hover { color: #0f1b3d; }
.cwc-tab.is-active { color: #EA8F09; }

.cwc-tab::after {
	content: '';
	position: absolute;
	inset-inline: 12px;
	bottom: 0; /* داخل کادر بماند تا overflow-y:hidden آن را نبُرد */
	height: 3px;
	background: #EA8F09;
	border-radius: 3px 3px 0 0;
	transform: scaleX(0);
	transition: transform 0.24s ease;
}
.cwc-tab.is-active::after { transform: scaleX(1); }
.cwc-tab:focus-visible { outline: 2px solid #EA8F09; outline-offset: 2px; border-radius: 6px; }

.cwc-tabs__panels {
	background: #fff;
	border: 1px solid #eef2f6;
	border-top: none;
	border-radius: 0 0 24px 24px;
	padding: clamp(20px, 3.4vw, 40px);
}

.cwc-tab-panel:not(.is-active),
.cwc-tab-panel[hidden] { display: none; }
.cwc-tab-panel:focus { outline: none; }
.cwc-tab-panel.is-loading { min-height: 120px; }

/* Reuse the .cwc-details__title / .cwc-content look inside panels (loaded from
 * woo.css). Only tab-specific extras live here. */
.cwc-tab-panel .cwc-details__title:first-child { margin-top: 0; }

.cwc-tab-panel__spinner {
	width: 34px;
	height: 34px;
	margin: 34px auto;
	border-radius: 50%;
	border: 3px solid #eef2f6;
	border-top-color: #EA8F09;
	animation: cwc-tab-spin 0.7s linear infinite;
}
@keyframes cwc-tab-spin { to { transform: rotate(360deg); } }

.cwc-pdp-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.cwc-pdp-tag {
	display: inline-block;
	font-size: 0.82rem;
	font-weight: 700;
	color: #c99617;
	background: #fff4cf;
	padding: 6px 14px;
	border-radius: 999px;
	text-decoration: none;
	transition: background 0.2s ease;
}
.cwc-pdp-tag:hover { background: #ffe9a8; }

/* ---------- بخش‌های محصولات داخل تب ---------- *
 * هر دو نوع (کروسل و لیست) همان کارت .cwc-card «محصولات مرتبط» را رندر می‌کنند
 * (crush_render_product_card)؛ این‌جا فقط چیدمانِ مخصوصِ داخل پنل تنظیم می‌شود.
 * پنل از کانتینر باریک‌تر است، پس ۴ ستون معادل ۵ ستونِ بخش «محصولات مرتبط» است. */
.cwc-pdp-grid { margin-top: 6px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1024px) { .cwc-pdp-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px)  { .cwc-pdp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 420px)  { .cwc-pdp-grid { grid-template-columns: 1fr; } }

/*
 * .spc-swiper عمداً overflow:visible است (کروسل‌های تمام‌عرض صفحهٔ اصلی)، ولی
 * این‌جا داخل کادر سفید پنل است و اسلایدها از بردر بیرون می‌زدند. این‌جا خودِ
 * بخش کلیپ می‌کند و ۱۴px حاشیهٔ منفی/پدینگ جا برای سایهٔ هاور کارت‌ها می‌گذارد.
 */
.cwc-pdp-carousel { overflow: hidden; margin: -14px; padding: 14px; }
.cwc-pdp-carousel .cwc-details__title { margin-bottom: 14px; }
/* اسلایدِ سوایپر flex است؛ کارت باید کل عرضش را بگیرد. */
.cwc-pdp-carousel .swiper-slide > .cwc-card { width: 100%; }
/*
 * اسلایدهای بعدی افقی بیرون از ویوپورت‌اند، پس observer اسکرول هیچ‌وقت به آن‌ها
 * نمی‌رسد و نامرئی می‌ماندند. کروسل خودش fade-in دارد؛ گیت reveal را برمی‌داریم.
 */
.cwc-pdp-carousel .cwc-card.crush-reveal { opacity: 1; transform: none; animation: none; }

.cwc-pdp-pagination { margin-top: clamp(20px, 3vw, 32px); flex-wrap: wrap; gap: 4px 0; }
.cwc-pdp-pagination .page-numbers.dots { border-color: transparent; background: none; }
/* هنگام واکشی صفحهٔ بعد، پنل نیمه‌محو و غیرقابل‌کلیک می‌شود. */
.cwc-tab-panel.is-paging { opacity: 0.5; pointer-events: none; transition: opacity 0.2s ease; }

@media (max-width: 600px) {
	.cwc-tab { padding: 12px 14px; font-size: 0.9rem; }
	.cwc-tabs__panels { border-radius: 0 0 18px 18px; padding: 18px; }
}

@media (prefers-reduced-motion: reduce) {
	.cwc-tab::after { transition: none; }
	.cwc-tab-panel__spinner { animation-duration: 1.4s; }
	.cwc-tabs__nav { scroll-behavior: auto; }
}
