/* SEPEX Shipment Tracker – Front-end Styles
   فونت وزیرمتن و آیکون‌های Remix Icon از طریق PHP فقط در صفحه شورت‌کد لود می‌شوند */

.sepex-tracker-wrapper {
	max-width: 100%;
	width: 100%;
	margin: 0;
	font-family: 'Vazirmatn', 'Tahoma', sans-serif;
	color: #16213e;
	box-sizing: border-box;
}

.sepex-tracker-wrapper *,
.sepex-tracker-wrapper *::before,
.sepex-tracker-wrapper *::after {
	box-sizing: border-box;
}

.sepex-tracker-wrapper .ltr-value {
	direction: ltr;
	display: inline-block;
	unicode-bidi: embed;
}

/* ================================================================
   کارت جستجو — مرکزچین با ورودی OTP
   ================================================================ */
.sepex-search-card {
	position: relative;
	max-width: 600px;
	margin: 0 auto 20px;
	padding: 28px 26px 22px;
	text-align: center;
	background: #fff;
	border: 1px solid #ecedf2;
	border-radius: 16px;
	overflow: hidden;
}

/* ---------- سربرگ کارت ---------- */
.sepex-search-head {
	position: relative;
	z-index: 1;
	margin-bottom: 20px;
}

.sepex-search-badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 1px;
	color: #ee6c2e;
	background: #fdf4ee;
	border: none;
	border-radius: 6px;
	padding: 5px 12px;
	margin-bottom: 12px;
	direction: ltr;
}

.sepex-search-badge i {
	font-size: 14px;
	letter-spacing: normal;
}

.sepex-search-title {
	margin: 0 0 6px;
	font-size: 21px;
	font-weight: 700;
	color: #16213e;
	line-height: 1.5;
}

.sepex-search-subtitle {
	margin: 0;
	font-size: 13px;
	color: #8990a3;
	line-height: 2;
}

/* ---------- ردیف ورودی ---------- */
.tracking-form {
	position: relative;
	z-index: 1;
	display: flex;
	gap: 14px;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	margin-bottom: 16px;
}

/* کل فیلد LTR است تا پیشوند SPX-A- پیش از خانه‌های عددی قرار بگیرد */
.sepex-code-field {
	display: flex;
	align-items: center;
	gap: 11px;
	direction: ltr;
	background: none;
	border: none;
	padding: 0;
}

/* پیشوند ثابت، بدون کادر و بدون جداکننده */
.sepex-code-prefix {
	font-size: 17px;
	font-weight: 800;
	letter-spacing: 0.8px;
	direction: ltr;
	white-space: nowrap;
	user-select: none;
	color: #ee6c2e;
}

.sepex-otp {
	display: flex;
	gap: 9px;
	direction: ltr;
	flex-wrap: wrap;
	justify-content: center;
}

.sepex-otp-digit {
	width: 44px;
	height: 48px;
	text-align: center;
	font-size: 19px;
	font-weight: 700;
	font-family: 'Vazirmatn', monospace;
	color: #16213e;
	background: #fff;
	border: 1.5px solid #e4e6ee;
	border-radius: 10px;
	padding: 0;
	transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
	-moz-appearance: textfield;
}

.sepex-otp-digit::-webkit-outer-spin-button,
.sepex-otp-digit::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.sepex-otp-digit:focus {
	outline: none;
	border-color: #ee6c2e;
	background: #fff;
}

/* خانه‌ای که پر شده، رنگ برند می‌گیرد */
.sepex-otp-digit.is-filled {
	border-color: #f3c3a0;
	background: #fff;
	color: #d85d22;
}

/* لرزش هنگام ارسال کد ناقص */
.sepex-otp.has-error .sepex-otp-digit {
	border-color: #e0574f;
	background: #fdf3f2;
	color: #c0392b;
}

.sepex-otp.has-error {
	animation: sepex-shake 0.4s ease;
}

@keyframes sepex-shake {
	0%, 100% { transform: translateX(0); }
	20%      { transform: translateX(-6px); }
	40%      { transform: translateX(6px); }
	60%      { transform: translateX(-4px); }
	80%      { transform: translateX(4px); }
}

/* ---------- دکمه ---------- */
#track-button {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 0 26px;
	min-height: 48px;
	border: none;
	border-radius: 10px;
	background: #ee6c2e;
	color: #fff;
	font-family: inherit;
	font-size: 15px;
	font-weight: 700;
	cursor: pointer;
	white-space: nowrap;
	transition: background 0.15s ease;
}

#track-button i {
	font-size: 18px;
}

#track-button:hover {
	background: #d85d22;
}

#track-button:active {
	background: #c15119;
}

#track-button:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

/* ---------- راهنمای زیر فرم ---------- */
.sepex-search-hint {
	position: relative;
	z-index: 1;
	margin: 0;
	font-size: 12px;
	color: #a2a7b6;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 5px;
}

.sepex-search-hint i {
	font-size: 14px;
	color: #c9ced9;
}

/* ================================================================
   بارگذاری و خطا
   ================================================================ */
.sepex-tracker-loading {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 4px;
	color: #666;
	font-size: 14px;
}

.sepex-spinner {
	width: 18px;
	height: 18px;
	border-radius: 50%;
	border: 2.5px solid #eee2d8;
	border-top-color: #ee6c2e;
	animation: sepex-spin 0.8s linear infinite;
	flex-shrink: 0;
}

@keyframes sepex-spin {
	from { transform: rotate(0deg); }
	to   { transform: rotate(360deg); }
}

.sepex-tracker-error {
	background: #fdeceb;
	border: 1px solid #f4b9b3;
	color: #9b2c26;
	border-radius: 10px;
	padding: 13px 16px;
	margin-bottom: 16px;
	font-size: 14px;
	display: flex;
	align-items: center;
	gap: 9px;
}

.sepex-tracker-error i {
	font-size: 19px;
	flex-shrink: 0;
}

/* ================================================================
   کارت خلاصه — باکس‌های کنار هم با آیکون
   ================================================================ */
.summary-card {
	background: #fff;
	border: 1px solid #ecedf2;
	border-radius: 14px;
	padding: 22px;
	margin-bottom: 18px;
}

.summary-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 12px;
	margin-bottom: 18px;
	padding-bottom: 15px;
	border-bottom: 1px dashed #e7e9f0;
}

.summary-eyebrow {
	font-size: 12.5px;
	color: #9096a8;
	display: block;
	margin-bottom: 3px;
}

.summary-head-title {
	font-size: 19px;
	font-weight: 700;
	margin: 0;
}

.summary-chip {
	display: flex;
	flex-direction: column;
	gap: 2px;
	background: #fdf4ee;
	border: none;
	border-radius: 8px;
	padding: 9px 18px;
}

.chip-label { font-size: 11px; color: #a56a2e; }
.chip-value { font-size: 14px; font-weight: 700; color: #ee6c2e; }

/* باکس‌های اطلاعات کنار هم */
.summary-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
	gap: 12px;
}

.summary-field {
	background: #fafbfc;
	border: 1px solid #eef0f5;
	border-radius: 10px;
	padding: 13px 15px;
	transition: border-color 0.16s ease;
}

.summary-field:hover {
	border-color: #f3c3a0;
}

/* باکس‌هایی که وب‌سرویس برایشان داده‌ای نداده است */
.summary-field.is-empty {
	opacity: 0.45;
	background: #fbfbfc;
}

.summary-field.is-empty:hover {
	transform: none;
	border-color: #eef0f5;
}

.summary-field .value-sub {
	display: block;
	font-size: 11px;
	font-weight: 400;
	color: #a2a7b6;
	direction: ltr;
	margin-top: 2px;
}

.summary-field .field-label {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	color: #8990a3;
	margin-bottom: 6px;
}

.summary-field .field-label i {
	font-size: 15px;
	color: #ee6c2e;
}

.summary-field .field-value {
	display: block;
	font-size: 14.5px;
	font-weight: 700;
	color: #16213e;
}

.summary-field .field-value small {
	font-size: 11.5px;
	font-weight: 400;
	color: #9096a8;
}


/* ================================================================
   نوار پیشرفت کلی مسیر — مبدا (راست) ← هواپیما ← مقصد (چپ)
   ================================================================ */
.sepex-journey {
	display: flex;
	align-items: center;
	gap: 18px;
	background: #fff;
	border: 1px solid #ecedf2;
	border-radius: 14px;
	padding: 30px 26px 22px;
	margin-bottom: 18px;
	direction: rtl;
}

.journey-point {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	flex-shrink: 0;
	width: 88px;
}

.journey-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 46px;
	height: 46px;
	border-radius: 13px;
	font-size: 24px;
	background: #f0f2f6;
	color: #9aa1b4;
	margin-bottom: 3px;
	transition: all 0.4s ease;
}

.journey-origin .journey-icon {
	background: #fdf4ee;
	color: #ee6c2e;
}

/* وقتی مرسوله به مقصد رسیده، آیکون مقصد سبز می‌شود */
.sepex-journey.is-arrived .journey-destination .journey-icon {
	background: #eaf7f0;
	color: #2fb572;
}

.journey-label-fa {
	font-size: 12px;
	font-weight: 700;
	color: #4a5163;
}

.journey-label {
	font-size: 9px;
	font-weight: 700;
	letter-spacing: 1.1px;
	color: #b4b9c6;
	direction: ltr;
}

/* ---------- ریل حرکت ---------- */
.journey-track {
	position: relative;
	flex: 1;
	height: 46px;
	min-width: 0;
}

/* خط نقطه‌چین پس‌زمینه */
.journey-line-dotted {
	position: absolute;
	top: 50%;
	left: 0;
	right: 0;
	height: 3px;
	transform: translateY(-50%);
	background-image: radial-gradient(circle, #d8dbe4 1.6px, transparent 1.6px);
	background-size: 11px 3px;
	background-repeat: repeat-x;
}

/* بخش طی‌شده مسیر — از سمت راست (مبدا) رشد می‌کند */
.journey-line-filled {
	position: absolute;
	top: 50%;
	right: 0;
	left: auto;
	height: 3px;
	width: 0;
	transform: translateY(-50%);
	border-radius: 3px;
	background: #ee6c2e;
	transition: width 1.4s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- هواپیما و بَج درصد ---------- */
.journey-plane {
	position: absolute;
	top: 50%;
	right: 0;
	margin-right: -21px;
	width: 42px;
	display: flex;
	flex-direction: column;
	align-items: center;
	transform: translateY(-50%);
	transition: right 1.4s cubic-bezier(0.22, 1, 0.36, 1);
	z-index: 2;
}

/* بَج درصد — جایگاه ثابت بالای هواپیما، همراه با آن حرکت می‌کند */
.journey-percent {
	position: absolute;
	bottom: calc(100% + 7px);
	font-size: 11.5px;
	font-weight: 700;
	color: #ee6c2e;
	background: #fdf4ee;
	border: none;
	border-radius: 6px;
	padding: 3px 9px;
	direction: ltr;
	white-space: nowrap;
	line-height: 1.6;
}

/* نوک کوچک زیر بَج که آن را به هواپیما وصل می‌کند */
.journey-percent::after {
	content: "";
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%);
	border: 4px solid transparent;
	border-top-color: #fdf4ee;
}

.journey-plane-icon {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	font-size: 23px;
	color: #ee6c2e;
	background: #fff;
	border: 2px solid #f3c3a0;
	border-radius: 50%;
}

/* هواپیما رو به چپ (سمت مقصد) می‌چرخد */
.journey-plane-icon i {
	transform: scaleX(-1);
	animation: sepex-hover 2.4s ease-in-out infinite;
}

@keyframes sepex-hover {
	0%, 100% { transform: scaleX(-1) translateY(0) rotate(0deg); }
	50%      { transform: scaleX(-1) translateY(-3px) rotate(3deg); }
}

/* هاله تپنده دور هواپیما */
.journey-plane-icon::before {
	content: "";
	position: absolute;
	inset: -5px;
	border-radius: 50%;
	border: 2px solid rgba(238, 108, 46, 0.35);
	animation: sepex-pulse 2s ease-out infinite;
}

@keyframes sepex-pulse {
	0%   { transform: scale(0.85); opacity: 0.9; }
	100% { transform: scale(1.5); opacity: 0; }
}

/* وقتی مرسوله کامل تحویل شده */
.journey-plane.is-arrived .journey-plane-icon {
	color: #2fb572;
	border-color: #9fdcbd;
}

.journey-plane.is-arrived .journey-plane-icon::before {
	border-color: rgba(47, 181, 114, 0.35);
	animation: none;
}

.journey-plane.is-arrived .journey-plane-icon i {
	animation: none;
}

.journey-plane.is-arrived .journey-percent {
	color: #2fb572;
	background: #eaf7f0;
}

.journey-plane.is-arrived .journey-percent::after {
	border-top-color: #eaf7f0;
}

/* احترام به تنظیم کاهش انیمیشن در سیستم کاربر */
@media (prefers-reduced-motion: reduce) {
	.journey-line-filled,
	.journey-plane {
		transition: none;
	}
	.journey-plane-icon i,
	.journey-plane-icon::before {
		animation: none;
	}
}

/* ================================================================
   مراحل مبدا و مقصد — دو ستون کنار هم
   ================================================================ */
.status-lanes {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 16px;
	align-items: stretch;
}

.status-lane {
	background: #fff;
	border: 1px solid #ecedf2;
	border-radius: 14px;
	overflow: hidden;
	height: 100%;
}

/* ستونی که مراحل کمتری دارد، فاصله‌ها را پخش می‌کند تا هر دو ستون هم‌ارتفاع بمانند */
.status-lane[open] {
	display: flex;
	flex-direction: column;
}

.status-lane[open] .status-list {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	min-height: 0;
}

/* هر مرحله سهم برابری از فضای باقی‌مانده می‌گیرد تا ته ستون خالی نماند */
.status-lane[open] .status-item {
	flex: 1 1 auto;
}

/* وقتی بخش بسته می‌شود فقط به اندازه سربرگش جا می‌گیرد و کشیده نمی‌ماند */
.status-lane:not([open]) {
	align-self: flex-start;
	height: auto;
}

.status-lane:not([open]) .lane-bar {
	border-radius: 0 0 14px 14px;
}

.status-lane > summary {
	list-style: none;
	cursor: pointer;
	padding: 15px 20px;
	display: flex;
	align-items: center;
	justify-content: flex-start;
	gap: 10px;
	background: #fafbfd;
	border-bottom: 1px solid #f0f2f6;
	font-weight: 700;
	font-size: 14.5px;
}

.status-lane > summary::-webkit-details-marker { display: none; }

.status-lane > summary::after {
	content: "\ea4e"; /* ri-arrow-down-s-line */
	font-family: 'remixicon' !important;
	font-weight: normal;
	color: #9096a8;
	transition: transform 0.2s ease;
}

.status-lane[open] > summary::after {
	transform: rotate(180deg);
}

.lane-title {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.lane-title i {
	font-size: 18px;
	color: #ee6c2e;
}

.lane-destination .lane-title i { color: #2fb572; }

.lane-progress {
	font-size: 12px;
	color: #6b7186;
	font-weight: 600;
	background: #f0f2f6;
	border-radius: 20px;
	padding: 3px 10px;
	direction: ltr;
	white-space: nowrap;
}

/* فلش باز/بسته به انتهای ردیف رانده می‌شود تا کپسول کنار عنوان بماند */
.status-lane > summary::after {
	margin-inline-start: auto;
}

/* ---------- نوار پیشرفت هر بخش ---------- */
.lane-bar {
	height: 4px;
	background: #f0f2f6;
	position: relative;
	overflow: hidden;
	flex-shrink: 0;
}

.lane-bar-fill {
	display: block;
	height: 100%;
	width: 0;
	border-radius: 0 3px 3px 0;
	background: #ee6c2e;
	transition: width 1.1s cubic-bezier(0.22, 1, 0.36, 1);
}

.lane-destination .lane-bar-fill {
	background: #2fb572;
}

@media (prefers-reduced-motion: reduce) {
	.lane-bar-fill {
		transition: none;
	}
}

/* ---------- لیست مراحل با دایره‌های متصل ---------- */
.status-list {
	padding: 8px 16px 16px;
	position: relative;
}

.status-item {
	display: flex;
	align-items: flex-start;
	gap: 11px;
	padding: 12px 0;
	position: relative;
}

/* خط عمودی یکپارچه پشت دایره‌ها — ارتفاع و موقعیتش با جاوااسکریپت
   از روی مرکز اولین و آخرین دایره محاسبه می‌شود، بنابراین با هر
   فاصله‌ای بین مراحل (حتی وقتی ستون کشیده می‌شود) پیوسته می‌ماند */
.lane-line-track,
.lane-line-done {
	position: absolute;
	right: 30px;
	width: 2px;
	border-radius: 2px;
	transform: translateX(50%);
	pointer-events: none;
}

.lane-line-track {
	top: 0;
	height: 0;
	background: #e6e8ef;
	z-index: 0;
}

/* بخش سبز خط، تا آخرین مرحله طی‌شده */
.lane-line-done {
	top: 0;
	height: 0;
	background: #2fb572;
	transition: height 1.2s cubic-bezier(0.22, 1, 0.36, 1);
	z-index: 0;
}

@media (prefers-reduced-motion: reduce) {
	.lane-line-done {
		transition: none;
	}
}

.status-dot {
	width: 28px;
	height: 28px;
	z-index: 1;
	border-radius: 50%;
	background: #f0f2f6;
	border: 2px solid #e6e8ef;
	color: #b7bbc9;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 14px;
	flex-shrink: 0;
	position: relative;
	z-index: 1;
}

.status-item.is-done .status-dot {
	background: #2fb572;
	border-color: #2fb572;
	color: #fff;
}

.status-main {
	flex: 1;
	min-width: 0;
	padding-top: 2px;
}

.status-name {
	font-size: 13.5px;
	font-weight: 600;
	color: #16213e;
	line-height: 1.5;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.status-item.is-pending .status-name {
	color: #9096a8;
	font-weight: 500;
}

/* معادل انگلیسی کوچک زیر عنوان فارسی */
.status-name-en {
	font-size: 10.5px;
	color: #a2a7b6;
	font-weight: 400;
	direction: ltr;
	text-align: right;
	margin-top: 1px;
	letter-spacing: 0.2px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.status-item.is-done .status-name-en { color: #8b94a8; }

.status-location {
	font-size: 12px;
	color: #9096a8;
	margin-top: 3px;
}

.status-meta {
	margin-inline-start: auto;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 1px;
	font-size: 11.5px;
	color: #b7bbc9;
	text-align: left;
	direction: ltr;
	padding-top: 4px;
	flex-shrink: 0;
}

.status-meta .meta-main {
	white-space: nowrap;
}

/* تاریخ میلادی کوچک زیر تاریخ شمسی، در حالت «هر دو» */
.status-meta .meta-sub {
	font-size: 10px;
	color: #c3c7d2;
	font-weight: 400;
	white-space: nowrap;
}

.status-item.is-done .status-meta .meta-sub {
	color: #9fb6a9;
}

.status-item.is-done .status-meta {
	color: #2fb572;
	font-weight: 600;
}

/* ================================================================
   واکنش‌گرا
   ================================================================ */
@media (max-width: 900px) {
	/* در صفحه‌های کوچک دو ستون به یک ستون تبدیل می‌شود */
	.status-lanes {
		grid-template-columns: minmax(0, 1fr);
	}
}

@media (max-width: 600px) {
	.sepex-search-card {
		padding: 26px 18px 20px;
		border-radius: 18px;
	}

	.sepex-search-title {
		font-size: 19px;
	}

	.sepex-search-subtitle {
		font-size: 12.5px;
	}

	.tracking-form {
		flex-direction: column;
	}

	.sepex-code-field {
		justify-content: center;
		width: 100%;
		flex-wrap: wrap;
	}

	#track-button {
		width: 100%;
		justify-content: center;
	}

	.sepex-otp {
		gap: 7px;
	}

	.sepex-otp-digit {
		width: 40px;
		height: 46px;
		font-size: 17px;
		border-radius: 11px;
	}

	.summary-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.summary-card {
		padding: 16px;
	}

	.status-list {
		padding: 8px 14px 14px;
	}

	.lane-line-track,
	.lane-line-done {
		right: 28px;
	}

	/* نوار مسیر در موبایل فشرده‌تر می‌شود */
	.sepex-journey {
		gap: 10px;
		padding: 28px 14px 18px;
	}

	.journey-point {
		width: 58px;
	}

	.journey-icon {
		width: 38px;
		height: 38px;
		font-size: 19px;
		border-radius: 11px;
	}

	.journey-label {
		font-size: 8px;
		letter-spacing: 0.6px;
	}

	.journey-label-fa {
		font-size: 11px;
	}

	.journey-plane {
		width: 34px;
		margin-right: -17px;
	}

	.journey-plane-icon {
		width: 34px;
		height: 34px;
		font-size: 18px;
	}

	.journey-percent {
		font-size: 10.5px;
		padding: 1px 7px;
	}
}

@media (max-width: 380px) {
	.summary-grid {
		grid-template-columns: minmax(0, 1fr);
	}

	.sepex-otp-digit {
		width: 34px;
		height: 42px;
		font-size: 15px;
	}

	.sepex-code-prefix {
		font-size: 14px;
	}
}
