/**
 * رهجو — استایل بخش کاربری (RTL-first).
 *
 * فونت IRANSansX از دارایی خود افزونه لود می‌شود؛ در صورت نبود فایل،
 * زنجیرهٔ فونت جایگزین سیستمی فارسی به‌کار می‌رود.
 */

@font-face {
	font-family: 'IRANSansX';
	src: url('../fonts/IRANSansX-Regular.woff2') format('woff2');
	font-weight: 400;
	font-style: normal;
	font-display: swap;
}

@font-face {
	font-family: 'IRANSansX';
	src: url('../fonts/IRANSansX-Medium.woff2') format('woff2');
	font-weight: 500;
	font-style: normal;
	font-display: swap;
}

@font-face {
	font-family: 'IRANSansX';
	src: url('../fonts/IRANSansX-Bold.woff2') format('woff2');
	font-weight: 700;
	font-style: normal;
	font-display: swap;
}

.rj-wrap,
.rj-shipments,
.rj-standalone {
	--rj-accent: #2563eb;
	--rj-accent-soft: rgba(37, 99, 235, 0.1);
	--rj-text: #111827;
	--rj-muted: #6b7280;
	--rj-line: #e5e7eb;
	--rj-surface: #ffffff;
	--rj-surface-2: #f9fafb;
	--rj-radius: 14px;

	direction: rtl;
	text-align: right;
	font-family: 'IRANSansX', 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
	color: var(--rj-text);
	line-height: 1.9;
}

.rj-wrap *,
.rj-shipments * {
	box-sizing: border-box;
}

/* ---------- کارت و فرم ---------- */

.rj-card {
	background: var(--rj-surface);
	border: 1px solid var(--rj-line);
	border-radius: var(--rj-radius);
	padding: 24px;
	margin-bottom: 24px;
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.rj-card__head {
	margin-bottom: 18px;
}

.rj-title {
	margin: 0 0 6px;
	font-size: 1.35rem;
	font-weight: 700;
}

.rj-subtitle {
	margin: 0;
	color: var(--rj-muted);
	font-size: 0.92rem;
}

.rj-form {
	display: grid;
	gap: 14px;
	grid-template-columns: 1fr 1fr auto;
	align-items: end;
}

.rj-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
}

.rj-label {
	font-size: 0.86rem;
	font-weight: 500;
	color: var(--rj-muted);
}

.rj-input {
	width: 100%;
	padding: 11px 14px;
	border: 1px solid var(--rj-line);
	border-radius: 10px;
	background: var(--rj-surface-2);
	font-family: inherit;
	font-size: 0.95rem;
	color: var(--rj-text);
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.rj-input:focus {
	outline: none;
	border-color: var(--rj-accent);
	box-shadow: 0 0 0 3px var(--rj-accent-soft);
	background: var(--rj-surface);
}

.rj-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 11px 22px;
	border: 1px solid transparent;
	border-radius: 10px;
	font-family: inherit;
	font-size: 0.95rem;
	font-weight: 500;
	cursor: pointer;
	text-decoration: none;
	transition: opacity 0.15s ease, transform 0.15s ease;
}

.rj-btn--primary {
	background: var(--rj-accent);
	color: #fff;
}

.rj-btn--primary:hover {
	opacity: 0.92;
}

.rj-btn--primary:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

.rj-btn--ghost {
	background: transparent;
	border-color: var(--rj-line);
	color: var(--rj-accent);
	padding: 7px 14px;
	font-size: 0.85rem;
}

.rj-btn--ghost:hover {
	background: var(--rj-accent-soft);
}

.rj-spinner {
	display: none;
	width: 15px;
	height: 15px;
	border: 2px solid rgba(255, 255, 255, 0.4);
	border-top-color: #fff;
	border-radius: 50%;
	animation: rj-spin 0.7s linear infinite;
}

.rj-btn.is-loading .rj-spinner {
	display: inline-block;
}

@keyframes rj-spin {
	to {
		transform: rotate(360deg);
	}
}

/* ---------- پیام‌ها ---------- */

.rj-message {
	display: none;
	margin-top: 16px;
	padding: 12px 16px;
	border-radius: 10px;
	font-size: 0.9rem;
}

.rj-message.is-visible {
	display: block;
}

.rj-message--error {
	background: #fef2f2;
	color: #991b1b;
	border: 1px solid #fecaca;
}

.rj-message--info {
	background: var(--rj-accent-soft);
	color: var(--rj-text);
	border: 1px solid var(--rj-line);
}

.rj-empty {
	padding: 18px;
	background: var(--rj-surface-2);
	border: 1px dashed var(--rj-line);
	border-radius: var(--rj-radius);
	color: var(--rj-muted);
	text-align: center;
}

/* ---------- مرسوله ---------- */

.rj-order-head {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 12px;
	margin-bottom: 16px;
	flex-wrap: wrap;
}

.rj-order-no {
	font-weight: 700;
	font-size: 1.05rem;
}

.rj-order-date {
	color: var(--rj-muted);
	font-size: 0.86rem;
}

.rj-shipment {
	background: var(--rj-surface);
	border: 1px solid var(--rj-line);
	border-radius: var(--rj-radius);
	padding: 22px;
	margin-bottom: 18px;
}

.rj-shipment__head {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
	padding-bottom: 14px;
	border-bottom: 1px solid var(--rj-line);
}

.rj-shipment__index {
	display: block;
	font-size: 0.78rem;
	color: var(--rj-muted);
}

.rj-carrier {
	font-weight: 700;
	font-size: 1.02rem;
}

.rj-badge {
	--rj-status-color: var(--rj-accent);

	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 5px 12px;
	border-radius: 999px;
	font-size: 0.82rem;
	font-weight: 500;
	color: var(--rj-status-color);
	background: color-mix(in srgb, var(--rj-status-color) 12%, transparent);
	border: 1px solid color-mix(in srgb, var(--rj-status-color) 30%, transparent);
}

/* جایگزین برای مرورگرهایی که color-mix ندارند. */
@supports not (background: color-mix(in srgb, red 10%, transparent)) {
	.rj-badge {
		background: var(--rj-surface-2);
		border-color: var(--rj-line);
	}
}

.rj-meta {
	margin: 16px 0 0;
}

.rj-meta__row {
	display: flex;
	gap: 10px;
	padding: 7px 0;
	flex-wrap: wrap;
	align-items: center;
}

.rj-meta__row dt {
	min-width: 96px;
	color: var(--rj-muted);
	font-size: 0.86rem;
	margin: 0;
}

.rj-meta__row dd {
	margin: 0;
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
	font-size: 0.92rem;
}

.rj-code {
	direction: ltr;
	unicode-bidi: embed;
	display: inline-block;
	padding: 4px 10px;
	background: var(--rj-surface-2);
	border: 1px solid var(--rj-line);
	border-radius: 8px;
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 0.9rem;
	letter-spacing: 0.04em;
}

.rj-code--delivery {
	direction: rtl;
	color: var(--rj-accent);
	font-weight: 700;
}

.rj-copy {
	padding: 4px 12px;
	border: 1px solid var(--rj-line);
	border-radius: 8px;
	background: transparent;
	color: var(--rj-accent);
	font-family: inherit;
	font-size: 0.8rem;
	cursor: pointer;
	transition: background 0.15s ease;
}

.rj-copy:hover {
	background: var(--rj-accent-soft);
}

.rj-copy.is-copied {
	background: #dcfce7;
	border-color: #86efac;
	color: #166534;
}

.rj-ext {
	color: var(--rj-accent);
	font-size: 0.84rem;
	text-decoration: none;
	border-bottom: 1px dashed currentColor;
}

.rj-hint {
	color: var(--rj-muted);
	font-size: 0.8rem;
}

.rj-note {
	white-space: pre-line;
	word-break: break-word;
}

.rj-eta {
	color: var(--rj-accent);
	font-weight: 500;
}

/* ---------- بازخورد پس از تحویل ---------- */

.rj-feedback {
	margin-top: 20px;
	padding: 18px;
	background: var(--rj-surface-2);
	border: 1px solid var(--rj-line);
	border-radius: var(--rj-radius);
}

.rj-feedback__title {
	margin: 0 0 12px;
	font-size: 0.92rem;
	font-weight: 500;
}

.rj-feedback--done .rj-feedback__title {
	margin: 0;
}

.rj-feedback__stars {
	display: flex;
	gap: 4px;
	margin-bottom: 12px;
}

.rj-feedback__star {
	background: none;
	border: none;
	padding: 0;
	font-size: 1.6rem;
	line-height: 1;
	color: var(--rj-line);
	cursor: pointer;
	transition: color 0.1s ease, transform 0.1s ease;
}

.rj-feedback__star:hover {
	color: #fbbf24;
}

.rj-feedback__star.is-active {
	color: #f59e0b;
}

.rj-feedback__note {
	display: block;
	margin-bottom: 12px;
	resize: vertical;
	font-family: inherit;
}

.rj-feedback__rating {
	color: #f59e0b;
	letter-spacing: 2px;
}

.rj-feedback__message {
	margin-top: 12px;
}

/* ---------- تایم‌لاین ---------- */

.rj-timeline {
	list-style: none;
	margin: 22px 0 0;
	padding: 0 22px 0 0;
	position: relative;
}

.rj-timeline::before {
	content: '';
	position: absolute;
	top: 8px;
	bottom: 8px;
	right: 6px;
	width: 2px;
	background: var(--rj-line);
}

.rj-timeline__item {
	--rj-status-color: var(--rj-accent);

	position: relative;
	padding: 0 22px 22px 0;
}

.rj-timeline__item:last-child {
	padding-bottom: 0;
}

.rj-timeline__dot {
	position: absolute;
	top: 6px;
	right: -9px;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: var(--rj-surface);
	border: 3px solid var(--rj-status-color);
	z-index: 1;
}

.rj-timeline__item.is-current .rj-timeline__dot {
	background: var(--rj-status-color);
	box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.rj-timeline__body {
	display: flex;
	flex-direction: column;
	gap: 3px;
}

.rj-timeline__status {
	font-weight: 700;
	color: var(--rj-status-color);
	font-size: 0.96rem;
}

.rj-timeline__date {
	color: var(--rj-muted);
	font-size: 0.85rem;
}

.rj-timeline__note {
	margin: 4px 0 0;
	padding: 9px 12px;
	background: var(--rj-surface-2);
	border-right: 3px solid var(--rj-line);
	border-radius: 8px;
	font-size: 0.88rem;
	white-space: pre-line;
	word-break: break-word;
}

.rj-timeline__ago {
	color: var(--rj-muted);
	font-size: 0.78rem;
}

/* ---------- جدول پنل کاربری ---------- */

.rj-account-table {
	width: 100%;
	border-collapse: collapse;
	background: var(--rj-surface);
	border: 1px solid var(--rj-line);
	border-radius: var(--rj-radius);
	overflow: hidden;
}

.rj-account-table th,
.rj-account-table td {
	padding: 13px 16px;
	text-align: right;
	border-bottom: 1px solid var(--rj-line);
	font-size: 0.9rem;
}

.rj-account-table th {
	background: var(--rj-surface-2);
	font-weight: 500;
	color: var(--rj-muted);
}

.rj-account-table tr:last-child td {
	border-bottom: none;
}

.rj-back {
	color: var(--rj-accent);
	text-decoration: none;
	font-size: 0.9rem;
}

.rj-standalone {
	max-width: 820px;
	margin: 40px auto;
	padding: 0 18px;
}

/* ---------- واکنش‌گرا ---------- */

@media (max-width: 782px) {
	.rj-form {
		grid-template-columns: 1fr;
	}

	.rj-card {
		padding: 18px;
	}

	.rj-account-table thead {
		display: none;
	}

	.rj-account-table,
	.rj-account-table tbody,
	.rj-account-table tr,
	.rj-account-table td {
		display: block;
		width: 100%;
	}

	.rj-account-table tr {
		border-bottom: 1px solid var(--rj-line);
		padding: 8px 0;
	}

	.rj-account-table td {
		border-bottom: none;
		display: flex;
		justify-content: space-between;
		gap: 12px;
	}

	.rj-account-table td::before {
		content: attr(data-title);
		color: var(--rj-muted);
		font-size: 0.82rem;
	}
}
