/* پنل اپراتور — موبایل‌محور، راست‌چین، سازگار iOS و اندروید */

.udf-wrap { max-width: 560px; margin: 10px auto; }

.udf-card {
	background: #fff;
	border: 1px solid #e3e6ea;
	border-top: 5px solid var(--udf-accent, #2e86de);
	border-radius: 16px;
	padding: 18px 16px 22px;
	box-shadow: 0 2px 12px rgba(0,0,0,.05);
	font-family: Vazirmatn, IRANSans, IRANYekan, Tahoma, sans-serif;
}

.udf-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.udf-title { font-size: 20px; font-weight: 800; margin: 0; color: #1f2733; }
.udf-user { font-size: 13px; color: #fff; background: var(--udf-accent,#2e86de); padding: 4px 12px; border-radius: 999px; }

/* آمار */
.udf-stats { display: flex; gap: 8px; margin-bottom: 16px; }
.udf-stats .st {
	flex: 1; text-align: center; background: #f7f8fa;
	border: 1px solid #edeff2; border-radius: 12px; padding: 10px 4px;
}
.udf-stats .st .n { display: block; font-size: 22px; font-weight: 800; color: var(--udf-accent,#2e86de); }
.udf-stats .st .l { font-size: 12px; color: #8a929c; }

.udf-sub { margin: 0 0 8px; color: #5b636d; font-size: 14px; font-weight: 600; }

/* جستجو */
.udf-search { display: flex; gap: 8px; margin-bottom: 14px; }
#udf-order-id {
	flex: 1; font-size: 24px; font-weight: 700; text-align: center;
	letter-spacing: 2px; padding: 16px 10px; border: 2px solid #d4d9df;
	border-radius: 12px; direction: ltr; -webkit-appearance: none;
}
#udf-order-id:focus { outline: none; border-color: var(--udf-accent,#2e86de); }

.udf-btn { border: none; border-radius: 12px; font-family: inherit; font-weight: 700; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: filter .15s, transform .05s; }
.udf-btn:active { transform: translateY(1px); filter: brightness(.95); }
.udf-btn-search { background: #1f2733; color: #fff; font-size: 16px; padding: 0 20px; }

/* نتیجه */
.udf-result { border: 1px solid #eceef1; border-radius: 14px; overflow: hidden; margin-bottom: 12px; }
.udf-row { display: flex; justify-content: space-between; gap: 12px; padding: 11px 14px; border-bottom: 1px solid #f1f3f5; font-size: 15px; }
.udf-row:last-child { border-bottom: none; }
.udf-row .k { color: #8a929c; flex-shrink: 0; }
.udf-row .v { color: #1f2733; font-weight: 600; text-align: left; }
.udf-badge { display: inline-block; padding: 3px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; color: #fff; }
.udf-items { background: #fafbfc; padding: 10px 14px; font-size: 14px; max-height: 340px; overflow-y: auto; }
.udf-items .it { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px dashed #e6e9ec; }
.udf-items .it:last-child { border-bottom: none; }
.udf-items .it .it-name { flex: 1; }
.udf-items .it .q { color: var(--udf-accent,#2e86de); font-weight: 800; flex-shrink: 0; }
.udf-item-thumb {
	width: 52px; height: 52px; object-fit: cover; border-radius: 8px;
	border: 1px solid #e0e4e8; cursor: pointer; flex-shrink: 0; background: #fff;
	transition: transform .12s;
}
.udf-item-thumb:hover { transform: scale(1.06); border-color: var(--udf-accent,#2e86de); }
.udf-item-noimg {
	width: 52px; height: 52px; flex-shrink: 0; border-radius: 8px; border: 1px dashed #ccd2d8;
	display: flex; align-items: center; justify-content: center; font-size: 10px; color: #9aa1a9; text-align: center;
}

/* لایت‌باکس */
#udf-lightbox { position: fixed; inset: 0; z-index: 999999; display: none; align-items: center; justify-content: center; }
#udf-lightbox.open { display: flex; }
.udf-lb-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.82); }
.udf-lb-content { position: relative; max-width: 92vw; max-height: 92vh; }
#udf-lb-img { max-width: 92vw; max-height: 92vh; border-radius: 10px; box-shadow: 0 10px 40px rgba(0,0,0,.5); display: block; }
.udf-lb-close {
	position: absolute; top: -14px; left: -14px; width: 40px; height: 40px; border-radius: 50%;
	background: #fff; border: none; font-size: 26px; line-height: 1; cursor: pointer; color: #333;
	box-shadow: 0 3px 10px rgba(0,0,0,.3);
}

.udf-warn { background: #fff7e6; border: 1px solid #ffd98a; color: #8a5a00; padding: 12px 14px; border-radius: 12px; font-size: 14px; margin-bottom: 12px; }

.udf-actions { margin-top: 4px; }

/* فیلد کد رهگیری */
.udf-track-box { margin: 4px 0 12px; }
.udf-track-box label {
	display: block; font-size: 14px; font-weight: 700;
	color: #5b636d; margin-bottom: 6px;
}
.udf-track-box input {
	width: 100%; box-sizing: border-box;
	font-size: 18px; font-weight: 700; text-align: center;
	letter-spacing: 1px; padding: 14px 10px;
	border: 2px dashed #b6d7f5; border-radius: 12px;
	direction: ltr; background: #f5faff;
}
.udf-track-box input:focus { outline: none; border-color: #2e86de; border-style: solid; }
.udf-btn-done {
	width: 100%;
	background: linear-gradient(180deg,#16c460,#0f9d4e);
	color: #fff !important;
	font-size: 22px;
	font-weight: 900;
	padding: 26px 18px;
	margin-top: 10px;
	border-radius: 16px;
	box-shadow: 0 8px 20px rgba(15,157,78,.45);
	letter-spacing: .3px;
	border: none;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	text-shadow: 0 1px 2px rgba(0,0,0,.18);
	animation: udf-pulse 1.8s ease-in-out infinite;
}
.udf-btn-done::before {
	content: "✓";
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	background: rgba(255,255,255,.25);
	border-radius: 50%;
	font-size: 22px;
	font-weight: 900;
	flex-shrink: 0;
}
.udf-btn-done.contrast { color: #fff !important; }
.udf-btn-done:active { animation: none; transform: translateY(2px); box-shadow: 0 4px 10px rgba(15,157,78,.4); }

@keyframes udf-pulse {
	0%, 100% { box-shadow: 0 8px 20px rgba(15,157,78,.45); }
	50% { box-shadow: 0 10px 28px rgba(15,157,78,.65); }
}

/* لینک تاریخچهٔ کامل */
.udf-history-link {
	display: block;
	text-align: center;
	margin-top: 14px;
	padding: 12px;
	background: #f0f2f5;
	border-radius: 10px;
	color: #2e86de;
	font-weight: 700;
	text-decoration: none;
	font-size: 15px;
}
.udf-history-link:active { background: #e6e9ec; }

/* بنر مجموع کل در صفحهٔ تاریخچه */
.udf-total-banner {
	background: var(--udf-accent,#2e86de);
	color: #fff;
	padding: 16px;
	border-radius: 12px;
	text-align: center;
	font-size: 17px;
	margin-bottom: 12px;
}
.udf-total-banner strong { font-size: 24px; }

.udf-back-btn {
	display: block;
	text-align: center;
	padding: 12px;
	background: #1f2733;
	color: #fff;
	border-radius: 10px;
	text-decoration: none;
	font-weight: 700;
}

.udf-pager {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-top: 14px;
	gap: 10px;
}
.udf-pager a {
	padding: 10px 18px;
	background: var(--udf-accent,#2e86de);
	color: #fff;
	border-radius: 8px;
	text-decoration: none;
	font-weight: 700;
}
.udf-pager-info { color: #8a929c; font-size: 14px; }

/* پیام */
.udf-msg { padding: 14px; border-radius: 12px; font-size: 16px; font-weight: 700; margin-top: 12px; text-align: center; }
.udf-msg.ok { background: #e8f7ee; border: 1px solid #9fdcb5; color: #1c7a3e; }
.udf-msg.err { background: #fdecea; border: 1px solid #f3b4ad; color: #b03127; }

/* پیشینه */
.udf-recent { margin-top: 20px; }
.udf-recent-title { font-size: 15px; font-weight: 700; color: #5b636d; margin: 0 0 10px; padding-top: 14px; border-top: 1px dashed #e6e9ec; }
.udf-recent-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; background: #f7f8fa; border-radius: 10px; margin-bottom: 7px; font-size: 14px; }
.udf-recent-item .oid { font-weight: 800; color: #1f2733; direction: ltr; }
.udf-recent-item .tm { color: #8a929c; margin-right: auto; direction: ltr; }
.udf-recent-item .ooo { color: #e74c3c; font-size: 12px; font-weight: 700; }
.udf-empty { color: #9aa1a9; font-size: 14px; }

.udf-spinner { opacity: .6; pointer-events: none; }

@media (min-width: 600px) { .udf-card { padding: 24px 22px; } }

/* پیام‌های فرانت‌اند */
.udf-front-msg {
	max-width: 480px; margin: 40px auto; padding: 20px;
	background: #fff; border: 1px solid #e3e6ea; border-radius: 14px;
	text-align: center; font-size: 16px; color: #1f2733;
	font-family: Vazirmatn, IRANSans, Tahoma, sans-serif; direction: rtl;
}
.udf-front-msg a { color: #2e86de; font-weight: 700; }

/* روی فرانت‌اند، کارت را وسط و با فاصله از بالا */
body:not(.wp-admin) .udf-wrap { margin: 24px auto; padding: 0 12px; }

/* ── ناقصی اقلام (بخش جمع‌آوری) ── */
.udf-miss-box {
	display: flex; align-items: center; gap: 5px; flex-shrink: 0;
	background: #fff; border: 1.5px solid #ffc9d4; border-radius: 9px;
	padding: 6px 9px; cursor: pointer; font-size: 12px; font-weight: 700;
	color: #c4002a; -webkit-tap-highlight-color: transparent;
}
.udf-miss-box input[type=checkbox] {
	width: 18px; height: 18px; margin: 0; accent-color: #ff0032; cursor: pointer;
}
.udf-miss-box:active { background: #fff0f3; }
.udf-items .it.is-missing {
	background: #fff0f3; border-radius: 8px;
}
.udf-items .it.is-missing .it-name { color: #c4002a; text-decoration: line-through; }
.udf-items .it.is-missing .udf-miss-box { border-color: #ff0032; background: #ffe3e9; }

/* دکمهٔ «ناقصی دارد» */
.udf-btn-shortage {
	width: 100%;
	background: linear-gradient(180deg,#ff2350,#d2002a);
	color: #fff !important;
	font-size: 19px; font-weight: 900;
	padding: 20px 18px; margin-bottom: 10px;
	border-radius: 14px;
	box-shadow: 0 6px 16px rgba(255,0,50,.4);
	display: flex; align-items: center; justify-content: center; gap: 10px;
	text-shadow: 0 1px 2px rgba(0,0,0,.18);
}
.udf-btn-shortage::before { content: "⚠"; font-size: 20px; }
.udf-btn-shortage:active { transform: translateY(2px); }

/* دکمهٔ جمع‌آوری وقتی به‌خاطر ناقصی غیرفعال است */
.udf-btn-done.udf-btn-disabled,
.udf-btn-done:disabled {
	background: #cfd5db !important;
	color: #7b848d !important;
	box-shadow: none !important;
	animation: none !important;
	cursor: not-allowed;
	text-shadow: none;
}
.udf-btn-done.udf-btn-disabled::before,
.udf-btn-done:disabled::before { background: rgba(0,0,0,.08); }

/* نشان ریز «ناموجود» کنار نام قلم (سابقهٔ ناقصی) */
.udf-miss-badge {
	display: inline-block; margin-right: 6px; padding: 2px 7px;
	background: #ff0032; color: #fff; border-radius: 5px;
	font-size: 10.5px; font-weight: 800; vertical-align: middle;
	white-space: nowrap;
}
.udf-items .it.was-missing { border-right: 3px solid #ff0032; padding-right: 8px; }

/* هشدار سابقهٔ ناقصی */
.udf-warn-shortage {
	background: #fff0f3 !important;
	border-color: #ffc9d4 !important;
	color: #c4002a !important;
}
