/* =========================================================
   المحترف — سلايدر الدفع والشحن  v2.0.0
   بناء من السيرفر + مؤشر CSS خالص عبر :has()
   الجافاسكربت تحسين اختياري فقط.
   ========================================================= */

.aps-switch,
.aps-switch * {
	box-sizing: border-box;
}

.aps-switch {
	--aps-r: 16px;
	--aps-pad: 5px;
	--aps-track: #EEF0F6;
	--aps-c: #1C61E7;
	--aps-g: rgba(28, 97, 231, .45);
	--n: 3;
	--i: 0;
	--dir: 1;

	position: relative !important;
	display: grid !important;
	grid-template-columns: repeat(var(--n), minmax(0, 1fr));
	grid-auto-rows: 1fr;
	gap: 0 !important;
	width: 100%;
	max-width: 100%;
	margin: 0 !important;
	padding: var(--aps-pad) !important;
	list-style: none !important;
	background: var(--aps-track);
	border: 1px solid rgba(16, 24, 40, .06);
	border-radius: var(--aps-r);
	box-shadow: inset 0 1px 2px rgba(16, 24, 40, .04);
	float: none !important;
	text-align: start;
}

/* فهرس الخانة المحددة — من السيرفر (بدون جافاسكربت وبدون :has) */
.aps-switch.aps-i-0 { --i: 0; }
.aps-switch.aps-i-1 { --i: 1; }
.aps-switch.aps-i-2 { --i: 2; }
.aps-switch.aps-i-3 { --i: 3; }
.aps-switch.aps-i-4 { --i: 4; }
.aps-switch.aps-i-5 { --i: 5; }
.aps-switch.aps-i-6 { --i: 6; }
.aps-switch.aps-i-7 { --i: 7; }

/* فهرس الخانة المحددة — CSS خالص يتفاعل مع النقر فوراً */
.aps-switch:has(> li:nth-of-type(1) > input:checked) { --i: 0; }
.aps-switch:has(> li:nth-of-type(2) > input:checked) { --i: 1; }
.aps-switch:has(> li:nth-of-type(3) > input:checked) { --i: 2; }
.aps-switch:has(> li:nth-of-type(4) > input:checked) { --i: 3; }
.aps-switch:has(> li:nth-of-type(5) > input:checked) { --i: 4; }
.aps-switch:has(> li:nth-of-type(6) > input:checked) { --i: 5; }
.aps-switch:has(> li:nth-of-type(7) > input:checked) { --i: 6; }
.aps-switch:has(> li:nth-of-type(8) > input:checked) { --i: 7; }

/* ---------- المؤشر المنزلق ---------- */
.aps-switch .aps-thumb {
	position: absolute;
	z-index: 1;
	top: var(--aps-pad);
	bottom: var(--aps-pad);
	inset-inline-start: var(--aps-pad);
	width: calc((100% - (var(--aps-pad) * 2)) / var(--n));
	margin: 0;
	padding: 0;
	border-radius: calc(var(--aps-r) - var(--aps-pad));
	background-color: var(--aps-c);
	box-shadow:
		inset 0 0 0 1px rgba(255, 255, 255, .13),
		0 1px 2px rgba(16, 24, 40, .16),
		0 10px 22px -10px var(--aps-g);
	transform: translateX(calc(var(--i) * var(--dir) * 100%));
	transition:
		transform .45s cubic-bezier(.34, 1.26, .4, 1),
		background-color .32s ease,
		box-shadow .32s ease,
		opacity .2s ease;
	pointer-events: none;
	will-change: transform;
}

.aps-switch .aps-thumb::after {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: inherit;
	background: linear-gradient(
		180deg,
		rgba(255, 255, 255, .17),
		rgba(255, 255, 255, 0) 46%,
		rgba(0, 0, 0, .06)
	);
}

.aps-switch.aps-boot .aps-thumb,
.aps-switch.aps-boot .aps-logo::after,
.aps-switch.aps-boot .aps-ico::after {
	transition: none !important;
}

.aps-switch.aps-empty .aps-thumb {
	opacity: 0;
}

/* ---------- الخانات ---------- */
.aps-switch > li {
	position: relative;
	z-index: 2;
	display: flex !important;
	flex-direction: column;
	min-width: 0;
	width: auto !important;
	margin: 0 !important;
	padding: 0 !important;
	list-style: none !important;
	background: none !important;
	border: 0 !important;
	float: none !important;
}

.aps-switch > li + li::after {
	content: '';
	position: absolute;
	inset-inline-start: 0;
	top: 18px;
	bottom: 18px;
	width: 1px;
	background: rgba(16, 24, 40, .1);
	transition: opacity .25s ease;
	pointer-events: none;
}

.aps-switch > li > input {
	position: absolute !important;
	top: 50%;
	inset-inline-start: 50%;
	width: 1px !important;
	height: 1px !important;
	margin: 0 !important;
	padding: 0 !important;
	opacity: 0;
	pointer-events: none;
	float: none !important;
}

.aps-switch > li > label {
	position: relative;
	display: flex !important;
	flex: 1 1 auto;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: auto !important;
	margin: 0 !important;
	padding: 11px 12px !important;
	min-height: 64px;
	border: 0 !important;
	border-radius: calc(var(--aps-r) - var(--aps-pad));
	background: none;
	color: #5A647B;
	cursor: pointer;
	text-align: start;
	transition: color .28s ease, background-color .22s ease, transform .16s ease;
	-webkit-tap-highlight-color: transparent;
}

/* تفاعل المرور — يأتي قبل قواعد التحديد حتى لا يطغى عليها */
.aps-switch > li > label:hover {
	color: var(--pm-deep, #1C61E7);
	background-color: var(--pm-soft, rgba(28, 97, 231, .08));
}

.aps-switch > li:active > label {
	transform: scale(.972);
}

.aps-switch > li > input:focus-visible + label {
	outline: 2px solid var(--pm, #1C61E7);
	outline-offset: -1px;
}

/* ---------- حالة "محدد" (نسختان: كلاس الجافاسكربت + :has الخالص) ---------- */
.aps-switch > li.is-on > label,
.aps-switch > li.is-on > label:hover {
	color: var(--pm-txt, #fff);
	background-color: transparent;
}

.aps-switch > li:has(> input:checked) > label,
.aps-switch > li:has(> input:checked) > label:hover,
.aps-switch > li:has(> input[type="hidden"]) > label,
.aps-switch > li:has(> input[type="hidden"]) > label:hover {
	color: var(--pm-txt, #fff);
	background-color: transparent;
}

.aps-switch > li.is-on::after,
.aps-switch > li.is-on + li::after {
	opacity: 0;
}

.aps-switch > li:has(> input:checked)::after,
.aps-switch > li:has(> input:checked) + li::after,
.aps-switch > li:has(> input[type="hidden"])::after,
.aps-switch > li:has(> input[type="hidden"]) + li::after {
	opacity: 0;
}

/* ---------- النص ---------- */
.aps-switch .aps-txt {
	display: flex;
	flex-direction: column;
	justify-content: center;
	min-width: 0;
	line-height: 1.25;
}

.aps-switch .aps-t1 {
	font-size: 14px;
	font-weight: 800;
	letter-spacing: -.1px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.aps-switch .aps-t2 {
	margin-top: 3px;
	font-size: 11px;
	font-weight: 600;
	opacity: .78;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.aps-switch .aps-t2 .amount,
.aps-switch .aps-t2 bdi {
	font-weight: 700;
	color: inherit !important;
}

/* ---------- الشرائح (شعار / أيقونة) ---------- */
.aps-switch .aps-logo,
.aps-switch .aps-ico {
	position: relative;
	flex: none;
	display: grid;
	place-items: center;
	width: 34px;
	height: 34px;
	border-radius: 10px;
	background: #fff;
	box-shadow:
		inset 0 0 0 1px rgba(16, 24, 40, .05),
		0 1px 2px rgba(16, 24, 40, .14);
	transition: box-shadow .28s ease;
}

.aps-switch .aps-logo {
	padding: 3px;
}

.aps-switch .aps-logo img {
	display: block;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	max-height: none !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 7px;
	object-fit: contain;
	float: none !important;
	box-shadow: none !important;
}

.aps-switch .aps-logo.is-wide {
	width: auto;
	min-width: 40px;
	max-width: 82px;
	padding: 0 8px;
}

.aps-switch .aps-logo.is-wide img {
	width: auto !important;
	height: 21px !important;
	max-width: 66px !important;
	border-radius: 0;
}

.aps-switch .aps-ico::before {
	content: '';
	width: 20px;
	height: 20px;
	background: center / contain no-repeat;
}

.aps-switch > li.is-on .aps-logo,
.aps-switch > li.is-on .aps-ico,
.aps-switch > li:has(> input:checked) .aps-logo,
.aps-switch > li:has(> input:checked) .aps-ico,
.aps-switch > li:has(> input[type="hidden"]) .aps-logo,
.aps-switch > li:has(> input[type="hidden"]) .aps-ico {
	box-shadow:
		0 0 0 1.5px rgba(255, 255, 255, .6),
		0 3px 10px rgba(0, 0, 0, .25);
}

/* ---------- شارة الصح على الشريحة المختارة ---------- */
.aps-switch .aps-logo::after,
.aps-switch .aps-ico::after {
	content: '';
	position: absolute;
	top: -5px;
	inset-inline-end: -5px;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background-color: #12B76A;
	background-position: center;
	background-repeat: no-repeat;
	background-size: 9px;
	border: 1.5px solid #fff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .28);
	transform: scale(0);
	transition: transform .3s cubic-bezier(.34, 1.5, .5, 1);
}

.aps-switch > li.is-on .aps-logo::after,
.aps-switch > li.is-on .aps-ico::after,
.aps-switch > li:has(> input:checked) .aps-logo::after,
.aps-switch > li:has(> input:checked) .aps-ico::after,
.aps-switch > li:has(> input[type="hidden"]) .aps-logo::after,
.aps-switch > li:has(> input[type="hidden"]) .aps-ico::after {
	transform: scale(1);
}

/* ---------- محتوى إضافي داخل الخانة (إضافات خارجية) ---------- */
.aps-switch .aps-after-rate {
	display: block;
	padding: 0 12px;
	font-size: 11px;
	line-height: 1.6;
}

.aps-switch .aps-after-rate:empty {
	display: none;
	padding: 0;
}

/* =========================================================
   الحالة المتوسطة — تصغير بسيط قبل الانتقال للعمودي
   ========================================================= */
.aps-switch.is-mid > li > label {
	gap: 8px;
	padding: 10px 9px !important;
	min-height: 58px;
}

.aps-switch.is-mid .aps-logo,
.aps-switch.is-mid .aps-ico {
	width: 30px;
	height: 30px;
	border-radius: 9px;
}

.aps-switch.is-mid .aps-ico::before {
	width: 17px;
	height: 17px;
}

.aps-switch.is-mid .aps-t1 {
	font-size: 13px;
}

.aps-switch.is-mid .aps-t2 {
	margin-top: 2px;
	font-size: 10.5px;
}

/* =========================================================
   الحالة المضغوطة — إخفاء السطر الفرعي
   ========================================================= */
.aps-switch.is-tight > li > label {
	gap: 8px;
	padding: 10px 9px !important;
	min-height: 56px;
}

.aps-switch.is-tight .aps-logo,
.aps-switch.is-tight .aps-ico {
	width: 29px;
	height: 29px;
	border-radius: 8px;
}

.aps-switch.is-tight .aps-ico::before {
	width: 17px;
	height: 17px;
}

.aps-switch.is-tight .aps-t1 {
	font-size: 12.5px;
}

.aps-switch.is-tight .aps-t2 {
	display: none;
}

/* =========================================================
   الحالة العمودية (تفعّلها الجافاسكربت حسب المساحة)
   ========================================================= */
.aps-switch.is-stacked {
	grid-template-columns: minmax(0, 1fr);
}

.aps-switch.is-stacked .aps-thumb {
	bottom: auto;
	width: calc(100% - (var(--aps-pad) * 2));
	height: calc((100% - (var(--aps-pad) * 2)) / var(--n));
	transform: translateY(calc(var(--i) * 100%));
}

.aps-switch.is-stacked > li > label {
	justify-content: flex-start;
	min-height: 58px;
	padding: 10px 14px !important;
	gap: 11px;
}

.aps-switch.is-stacked > li + li::after {
	top: 0;
	bottom: auto;
	inset-inline: 16px;
	width: auto;
	height: 1px;
}

.aps-switch.is-stacked .aps-t1 {
	font-size: 14px;
}

.aps-switch.is-stacked .aps-t2 {
	display: block;
	margin-top: 3px;
	font-size: 11.5px;
}

.aps-switch.is-stacked .aps-logo,
.aps-switch.is-stacked .aps-ico {
	width: 34px;
	height: 34px;
	border-radius: 10px;
}

/* الوضع العمودي على الشاشات الصغيرة بدون جافاسكربت */
@media (max-width: 600px) {
	.aps-switch.aps-stack-sm {
		grid-template-columns: minmax(0, 1fr);
	}

	.aps-switch.aps-stack-sm .aps-thumb {
		bottom: auto;
		width: calc(100% - (var(--aps-pad) * 2));
		height: calc((100% - (var(--aps-pad) * 2)) / var(--n));
		transform: translateY(calc(var(--i) * 100%));
	}

	.aps-switch.aps-stack-sm > li > label {
		justify-content: flex-start;
		min-height: 58px;
		padding: 10px 14px !important;
		gap: 11px;
	}

	.aps-switch.aps-stack-sm > li + li::after {
		top: 0;
		bottom: auto;
		inset-inline: 16px;
		width: auto;
		height: 1px;
	}

	.aps-switch.aps-stack-sm .aps-t1 {
		font-size: 14px;
	}

	.aps-switch.aps-stack-sm .aps-t2 {
		display: block;
		margin-top: 3px;
		font-size: 11.5px;
	}

	.aps-switch.aps-stack-sm .aps-logo,
	.aps-switch.aps-stack-sm .aps-ico {
		width: 34px;
		height: 34px;
		border-radius: 10px;
	}
}

/* ---------- ملاحظات طرق الدفع ---------- */
.aps-notes {
	margin-top: 12px;
}

.aps-notes .payment_box {
	position: relative;
	margin: 0 0 8px !important;
	padding: 13px 16px !important;
	background: var(--pm-soft, rgba(28, 97, 231, .08)) !important;
	border: 0 !important;
	border-inline-start: 3px solid var(--pm, #1C61E7) !important;
	border-radius: 10px;
	color: var(--pm-deep, #334155);
	font-size: 13.5px;
	line-height: 1.75;
}

.aps-notes .payment_box:last-child {
	margin-bottom: 0 !important;
}

.aps-notes .payment_box::before,
.aps-notes .payment_box::after {
	display: none !important;
}

.aps-notes .payment_box p {
	margin: 0 0 6px;
}

.aps-notes .payment_box p:last-child {
	margin-bottom: 0;
}

/* ---------- صف الشحن (سلة المشتريات + صفحة الدفع) ---------- */
tr.aps-ship-row > th {
	display: none !important;
}

tr.aps-ship-row > td {
	width: auto !important;
	text-align: start !important;
	padding-top: 16px !important;
	padding-bottom: 16px !important;
}

tr.aps-ship-row > td::before {
	display: none !important;
	content: none !important;
}

.aps-ship-title {
	display: block;
	margin: 0 0 10px;
	font-size: 13px;
	font-weight: 700;
	color: #5A647B;
}

.aps-ship-dest {
	margin: 10px 2px 0 !important;
	font-size: 12px;
	line-height: 1.7;
	color: #8A93A8;
}

.aps-ship-dest strong {
	color: #5A647B;
	font-weight: 700;
}

tr.aps-ship-row .woocommerce-shipping-contents {
	margin: 8px 2px 0;
	color: #8A93A8;
}

tr.aps-ship-row .woocommerce-shipping-calculator {
	margin-top: 10px;
}

tr.aps-ship-row .shipping-calculator-button {
	font-size: 12.5px;
	font-weight: 700;
	color: var(--aps-c, #1C61E7);
	text-decoration: none;
}

@media (prefers-reduced-motion: reduce) {
	.aps-switch .aps-thumb,
	.aps-switch > li > label,
	.aps-switch .aps-logo,
	.aps-switch .aps-ico,
	.aps-switch .aps-logo::after,
	.aps-switch .aps-ico::after {
		transition: none !important;
	}
}
