/* =========================================================
   Size Guide — frontend  v2
   ---------------------------------------------------------
   الفكرة: ورقة مواصفات، مش جدول بيانات.
   موبايل  = مقاس واحد مختار + أرقام كبيرة.
   ديسكتوب = جدول كامل للمقارنة.
   ========================================================= */

.wcsg {
	/* الألوان — عدّل من هنا بس */
	--wcsg-ink: #101113;
	--wcsg-soft: #71767e;
	--wcsg-faint: #a4a9b0;
	--wcsg-line: #ebecee;
	--wcsg-surface: #fff;
	--wcsg-tint: #f7f8f9;
	--wcsg-accent: #1f3d3a;      /* أخضر داكن هادي — حطّ لون البراند هنا */

	/* الخطوط */
	--wcsg-num: ui-monospace, "SF Mono", SFMono-Regular, Menlo, "Roboto Mono", monospace;
	--wcsg-radius: 12px;

	color: var(--wcsg-ink);
	font-size: 15px;
	line-height: 1.5;
	max-width: 100%;
	text-align: start;
}

/* ---------------- الهيدر ---------------- */

.wcsg__head {
	display: flex;
	flex-wrap: wrap;
	gap: 12px 16px;
	align-items: flex-end;
	justify-content: space-between;
}

.wcsg__eyebrow {
	margin: 0 0 6px;
	font-size: 10px;
	font-weight: 600;
	letter-spacing: 0.22em;
	text-transform: uppercase;
	color: var(--wcsg-faint);
}

.wcsg__title {
	margin: 0;
	font-size: 24px;
	font-weight: 500;
	letter-spacing: -0.01em;
	line-height: 1.2;
	color: var(--wcsg-ink);
}

/* المسطرة — الفاصل المميز */
.wcsg__rule {
	height: 14px;
	margin: 18px 0 4px;
	border-top: 1px solid var(--wcsg-ink);
	background-image: repeating-linear-gradient(
		to right,
		var(--wcsg-ink) 0 1px,
		transparent 1px 12px
	);
	background-size: 100% 5px;
	background-repeat: no-repeat;
	opacity: 0.5;
}

/* مبدّل الوحدات */
.wcsg__units {
	display: inline-flex;
	gap: 2px;
	padding: 3px;
	border-radius: 999px;
	background: var(--wcsg-tint);
}

.wcsg__unit {
	appearance: none;
	border: 0;
	background: transparent;
	color: var(--wcsg-soft);
	font: inherit;
	font-size: 12px;
	letter-spacing: 0.02em;
	padding: 7px 14px;
	border-radius: 999px;
	cursor: pointer;
	transition: background 0.18s ease, color 0.18s ease;
}

.wcsg__unit.is-active {
	background: var(--wcsg-surface);
	color: var(--wcsg-ink);
	box-shadow: 0 1px 3px rgba(16, 17, 19, 0.1);
}

.wcsg__unit:focus-visible {
	outline: 2px solid var(--wcsg-accent);
	outline-offset: 2px;
}

/* ---------------- أزرار المقاسات (موبايل) ---------------- */

.wcsg__sizes {
	display: none;
	gap: 8px;
	margin: 16px 0 4px;
	overflow-x: auto;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
}

.wcsg__sizes::-webkit-scrollbar {
	display: none;
}

.wcsg__sizebtn {
	flex: 1 0 auto;
	min-width: 58px;
	appearance: none;
	padding: 12px 14px;
	border: 1px solid var(--wcsg-line);
	border-radius: 10px;
	background: var(--wcsg-surface);
	color: var(--wcsg-soft);
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.06em;
	cursor: pointer;
	transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
}

.wcsg__sizebtn.is-active {
	background: var(--wcsg-ink);
	border-color: var(--wcsg-ink);
	color: #fff;
}

.wcsg__sizebtn:focus-visible {
	outline: 2px solid var(--wcsg-accent);
	outline-offset: 2px;
}

/* ---------------- الجدول ---------------- */

.wcsg__scroll {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	margin-top: 14px;
}

.wcsg__scroll:focus-visible {
	outline: 2px solid var(--wcsg-accent);
	outline-offset: 2px;
}

.wcsg .wcsg__table {
	width: 100%;
	margin: 0;
	border: 0;
	border-collapse: collapse;
	background: transparent;
}

.wcsg .wcsg__th,
.wcsg .wcsg__td,
.wcsg .wcsg__size {
	border: 0;
	border-bottom: 1px solid var(--wcsg-line);
	padding: 14px 16px;
	text-align: center;
	white-space: nowrap;
	background: transparent;
}

.wcsg .wcsg__th {
	padding-top: 0;
	padding-bottom: 10px;
	font-size: 10px;
	font-weight: 600;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--wcsg-faint);
	border-bottom-color: var(--wcsg-ink);
}

.wcsg .wcsg__td {
	font-family: var(--wcsg-num);
	font-size: 15px;
	font-variant-numeric: tabular-nums;
	letter-spacing: -0.01em;
	color: var(--wcsg-ink);
}

.wcsg .wcsg__tr:last-child .wcsg__td,
.wcsg .wcsg__tr:last-child .wcsg__size {
	border-bottom: 0;
}

.wcsg .wcsg__tr:hover .wcsg__td,
.wcsg .wcsg__tr:hover .wcsg__size {
	background: var(--wcsg-tint);
}

/* عمود المقاس ثابت وقت السحب */
.wcsg .wcsg__th--size,
.wcsg .wcsg__size {
	position: sticky;
	inset-inline-start: 0;
	z-index: 2;
	text-align: start;
	background: var(--wcsg-surface);
}

.wcsg .wcsg__th--size {
	z-index: 3;
}

.wcsg__chip {
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.08em;
}

.wcsg__empty {
	color: #ccd0d5;
}

.wcsg__hint,
.wcsg__note {
	margin: 14px 0 0;
	font-size: 12.5px;
	line-height: 1.6;
	color: var(--wcsg-soft);
}

.wcsg__hint {
	display: none;
}

.wcsg__note {
	padding-inline-start: 12px;
	border-inline-start: 2px solid var(--wcsg-line);
}

/* ---------------- زر «Size Guide» ---------------- */

.wcsg-trigger-row {
	/* ياخد سطر لوحده وسط الصفحة، والزر جواه بعرض محتواه بس */
	flex: 0 0 100% !important;
	width: 100% !important;
	max-width: 100%;
	display: flex;
	justify-content: center;
	margin: 16px 0 18px;
	clear: both;
}

.wcsg-trigger {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: auto !important;
	flex: 0 0 auto;
	min-height: 0;
	margin: 0;
	padding: 12px 20px;
	appearance: none;
	background: #fff;
	border: 1px solid #d7dade;
	border-radius: 4px;
	box-shadow: none;
	color: #101113;
	font-family: inherit;
	line-height: 1.2;
	text-align: center;
	cursor: pointer;
}

/* الشكل ثابت تماماً: مفيش تغيير عند الوقوف أو الضغط */
.wcsg-trigger:hover,
.wcsg-trigger:focus,
.wcsg-trigger:active,
.wcsg-trigger:visited {
	background: #fff;
	border-color: #d7dade;
	color: #101113;
	box-shadow: none;
	transform: none;
	opacity: 1;
}

/* للكيبورد فقط — مطلوب لإمكانية الوصول */
.wcsg-trigger:focus-visible {
	outline: 2px solid #1f3d3a;
	outline-offset: 3px;
}

.wcsg-trigger__icon {
	width: 19px;
	height: 19px;
	flex: none;
	opacity: 0.9;
}

.wcsg-trigger__label {
	font-size: 11.5px;
	font-weight: 600;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	white-space: nowrap;
}

.wcsg-trigger__arrow {
	width: 14px;
	height: 14px;
	flex: none;
	opacity: 0.55;
}

.wcsg-trigger:hover .wcsg-trigger__arrow {
	opacity: 0.55;
	transform: none;
}

[dir="rtl"] .wcsg-trigger__arrow,
[dir="rtl"] .wcsg-trigger:hover .wcsg-trigger__arrow {
	transform: scaleX(-1);
}

/* عناصر الماركب القديم لو لسه موجودة */
.wcsg-trigger__rule {
	display: none;
}

.wcsg-trigger__main {
	display: inline-flex;
	align-items: center;
	gap: 10px;
}

@media (max-width: 480px) {
	.wcsg-trigger {
		padding: 13px 18px;
		gap: 9px;
	}

	.wcsg-trigger__label {
		font-size: 11px;
		letter-spacing: 0.14em;
	}
}

/* ---------------- النافذة ---------------- */

.wcsg-modal[hidden] {
	display: none;
}

.wcsg-modal {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
}

.wcsg-modal__overlay {
	position: absolute;
	inset: 0;
	background: rgba(16, 17, 19, 0.5);
	backdrop-filter: blur(3px);
	animation: wcsg-fade 0.2s ease;
}

.wcsg-modal__panel {
	position: relative;
	width: 100%;
	max-width: 760px;
	max-height: 86vh;
	overflow-y: auto;
	padding: 34px 34px 30px;
	background: #fff;
	border-radius: 4px;
	box-shadow: 0 30px 70px rgba(16, 17, 19, 0.25);
	animation: wcsg-pop 0.22s ease;
}

.wcsg-modal__close {
	position: absolute;
	top: 16px;
	inset-inline-end: 18px;
	width: 32px;
	height: 32px;
	display: grid;
	place-items: center;
	appearance: none;
	border: 0;
	background: transparent;
	border-radius: 50%;
	font-size: 22px;
	line-height: 1;
	color: #a4a9b0;
	cursor: pointer;
	transition: color 0.16s ease, background 0.16s ease;
}

.wcsg-modal__close:hover {
	background: #f7f8f9;
	color: #101113;
}

body.wcsg-locked {
	overflow: hidden;
}

@keyframes wcsg-fade {
	from { opacity: 0; }
}

@keyframes wcsg-pop {
	from { opacity: 0; transform: translateY(10px) scale(0.99); }
}

/* =========================================================
   موبايل: مقاس واحد مختار + أرقام كبيرة
   ========================================================= */

@media (max-width: 680px) {

	.wcsg__head {
		flex-direction: column;
		align-items: stretch;
		gap: 14px;
	}

	.wcsg__title {
		font-size: 21px;
	}

	.wcsg__units {
		align-self: flex-start;
	}

	.wcsg__rule {
		margin: 4px 0 0;
	}

	.wcsg__sizes {
		display: flex;
	}

	.wcsg__scroll {
		overflow: visible;
		margin-top: 6px;
	}

	.wcsg .wcsg__table,
	.wcsg .wcsg__table tbody,
	.wcsg .wcsg__tr,
	.wcsg .wcsg__td {
		display: block;
		width: auto;
	}

	.wcsg .wcsg__table thead,
	.wcsg .wcsg__size {
		display: none;
	}

	/* الصف المختار بس */
	.wcsg .wcsg__tr {
		display: none;
	}

	.wcsg .wcsg__tr.is-active {
		display: block;
		animation: wcsg-swap 0.2s ease;
	}

	.wcsg .wcsg__td,
	.wcsg .wcsg__tr:hover .wcsg__td {
		display: flex;
		align-items: baseline;
		justify-content: space-between;
		gap: 16px;
		padding: 16px 2px;
		text-align: end;
		white-space: normal;
		background: transparent;
		border-bottom: 1px solid var(--wcsg-line);
		font-size: 19px;
	}

	.wcsg .wcsg__tr .wcsg__td:last-child {
		border-bottom: 0;
	}

	.wcsg .wcsg__td::before {
		content: attr(data-label);
		flex: 1 1 auto;
		font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
		font-size: 11px;
		font-weight: 600;
		letter-spacing: 0.14em;
		text-transform: uppercase;
		color: var(--wcsg-faint);
		text-align: start;
	}

	@keyframes wcsg-swap {
		from { opacity: 0; transform: translateY(4px); }
	}

	/* النافذة = bottom sheet */
	.wcsg-modal {
		padding: 0;
		align-items: flex-end;
	}

	.wcsg-modal__panel {
		max-width: 100%;
		max-height: 90vh;
		padding: 26px 20px 32px;
		border-radius: 16px 16px 0 0;
		animation: wcsg-sheet 0.26s cubic-bezier(0.32, 0.72, 0, 1);
	}

	.wcsg-modal__panel::before {
		content: "";
		position: absolute;
		top: 9px;
		inset-inline-start: 50%;
		transform: translateX(-50%);
		width: 38px;
		height: 4px;
		border-radius: 999px;
		background: #e3e5e8;
	}

	.wcsg-modal__close {
		top: 20px;
	}

	@keyframes wcsg-sheet {
		from { transform: translateY(100%); }
	}
}

/* تابلت: تنبيه السحب الأفقي */
@media (min-width: 681px) and (max-width: 920px) {
	.wcsg__hint {
		display: block;
	}
}

@media (prefers-reduced-motion: reduce) {
	.wcsg-modal__panel,
	.wcsg-modal__overlay,
	.wcsg .wcsg__tr.is-active {
		animation: none;
	}
}