/* =========================================================================================
   پاپ‌آپ مشترک «جزئیات تعرفه» (HsModal) — همه‌ی قواعد زیر .hs-modal-scope محدود شده‌اند تا در هر
   صفحه‌ای (تعرفه‌ها، تحلیل کشورها، آمار، ...) بدون تداخل با استایل همان صفحه قابل تزریق باشد.
   توکن‌های رنگ/اندازه هم روی خودِ scope تعریف شده‌اند تا کامپوننت به CSS صفحه وابسته نباشد.
   مارک‌آپ: templates/hs_codes/_hscode_modal.html · منطق: static/js/hscode_modal.js
   ========================================================================================= */
.hs-modal-scope {
    --primary: #2563eb; --primary-hover: #1d4ed8; --primary-soft: #eff6ff; --primary-soft-border: #bfdbfe;
    --success: #15803d; --success-soft: #f0fdf4; --success-soft-border: #bbf7d0;
    --danger: #dc2626; --danger-soft: #fef2f2; --danger-soft-border: #fecaca;
    --warning: #b45309; --warning-soft: #fffbeb; --warning-soft-border: #fde68a;
    --info: #0369a1; --info-soft: #f0f9ff; --info-soft-border: #bae6fd;
    --secondary: #64748b; --bg-main: #f8fafc; --bg-box: #ffffff;
    --text-main: #1e293b; --text-muted: #64748b; --border-color: #e2e8f0;
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 10px 25px -5px rgba(15, 23, 42, 0.12), 0 4px 6px -2px rgba(15, 23, 42, 0.05);
    --radius: 10px; --radius-sm: 6px; --transition: all 0.2s ease;
    --fs-xs: 0.8125rem; --fs-sm: 0.9375rem; --fs-base: 1rem; --fs-md: 1.0625rem; --fs-lg: 1.25rem; --fs-xl: 1.5rem;
    --fw-regular: 400; --fw-medium: 600; --fw-bold: 700;
    font-family: 'Vazirmatn', Tahoma, Arial, sans-serif;
    color: var(--text-main);
    direction: rtl;
}
.hs-modal-scope *, .hs-modal-scope *::before, .hs-modal-scope *::after { box-sizing: border-box; }
.hs-modal-scope button, .hs-modal-scope input, .hs-modal-scope a { font-family: inherit; }
body.hs-modal-open { overflow: hidden; }

.hs-modal-scope .icon {
    width: 1.2em; height: 1.2em; vertical-align: middle; fill: none; stroke: currentColor;
    stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; margin-left: 5px; flex-shrink: 0;
}
.hs-modal-scope .icon-spin { animation: hsModalSpin 0.85s linear infinite; transform-origin: center; }
@keyframes hsModalSpin { to { transform: rotate(360deg); } }
.hs-modal-scope .is-hidden { display: none !important; }

/* ---------- دکمه‌ها و کلاس‌های کمکی که داخل پاپ‌آپ استفاده می‌شوند ---------- */
.hs-modal-scope .btn {
    padding: 12px 24px; border-radius: var(--radius-sm); font-weight: var(--fw-medium); font-size: var(--fs-md);
    cursor: pointer; border: none; transition: var(--transition); text-decoration: none;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.hs-modal-scope .btn .icon { margin: 0; width: 16px; height: 16px; }
.hs-modal-scope .btn-primary { background: var(--primary); color: #fff; }
.hs-modal-scope .btn-primary:hover { background: var(--primary-hover); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2); }
.hs-modal-scope .btn-success { background: var(--success); color: #fff; }
.hs-modal-scope .btn-success:hover { background: #12692f; transform: translateY(-2px); }
.hs-modal-scope .btn-outline { background: var(--bg-box); border: 2px solid var(--primary); color: var(--primary); }
.hs-modal-scope .btn-outline:hover { background: var(--primary); color: #fff; }
.hs-modal-scope .btn-action { background: var(--primary-soft); color: var(--primary); padding: 8px 16px; font-size: var(--fs-sm); }
.hs-modal-scope .btn-action:hover { background: var(--primary); color: #fff; }
.hs-modal-scope .btn-action .icon { margin: 0; width: 15px; height: 15px; }
.hs-modal-scope .btn-action-sm { padding: 5px 12px; font-size: var(--fs-xs); }
.hs-modal-scope .btn-sm { padding: 8px 14px; font-size: var(--fs-sm); }
.hs-modal-scope .w-100 { width: 100%; }
.hs-modal-scope .w-50 { width: 50%; }
.hs-modal-scope .mt-2 { margin-top: 10px; }
.hs-modal-scope .mt-3 { margin-top: 15px; }
.hs-modal-scope .mb-3 { margin-bottom: 15px; }
.hs-modal-scope .text-center { text-align: center; }
.hs-modal-scope .text-gray { color: var(--text-muted); }
.hs-modal-scope .text-danger { color: var(--danger); }
.hs-modal-scope .text-blue { color: var(--primary); font-weight: var(--fw-medium); }
.hs-modal-scope .empty-state { padding: 30px 15px; color: var(--text-muted); font-size: var(--fs-md); font-weight: var(--fw-medium); }

/* ---------- چارچوب پاپ‌آپ (روکش تیره + محتوا) ---------- */
.hs-modal-scope .custom-modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(3px);
    display: flex; justify-content: center; align-items: center;
    z-index: 9999; opacity: 0; visibility: hidden; transition: 0.25s ease; padding: 15px;
}
.hs-modal-scope .custom-modal-overlay.active { opacity: 1; visibility: visible; }
.hs-modal-scope .custom-modal-overlay.hidden { opacity: 0 !important; visibility: hidden !important; pointer-events: none; }
.hs-modal-scope .custom-modal-overlay:not(.hidden) { opacity: 1; visibility: visible; pointer-events: auto; }
.hs-modal-scope .custom-modal-overlay--stacked { z-index: 10050; background: rgba(15, 23, 42, 0.45); }
.hs-modal-scope #modal-vip-subscription { z-index: 10060; }

.hs-modal-scope .custom-modal-content {
    background: var(--bg-box); width: 95%; max-width: 1000px; max-height: 90vh;
    border-radius: var(--radius); display: flex; flex-direction: column;
    transform: scale(0.95); transition: 0.25s ease; overflow: hidden; box-shadow: var(--shadow-md);
}
.hs-modal-scope .custom-modal-overlay.active .custom-modal-content { transform: scale(1); }
.hs-modal-scope .modal-md { max-width: 600px; }
.hs-modal-scope .modal-sm { max-width: 500px; }
.hs-modal-scope .modal-lg { max-width: 900px; }
.hs-modal-scope .modal-vip { max-width: 440px; text-align: center; }

.hs-modal-scope .modal-header {
    background: var(--bg-main); padding: 18px 24px; border-bottom: 1px solid var(--border-color);
    display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-shrink: 0;
}
.hs-modal-scope .modal-header--center { justify-content: center; position: relative; }
.hs-modal-scope .modal-header h4 { margin: 0; font-size: var(--fs-lg); font-weight: var(--fw-bold); color: var(--text-main); }
.hs-modal-scope .modal-header__main { min-width: 0; display: flex; flex-direction: column; gap: 4px; position: relative; z-index: 1; }
.hs-modal-scope .modal-header__subtitle { margin: 0; font-size: var(--fs-xs); color: rgba(255,255,255,.85); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 560px; }
.hs-modal-scope .modal-header__subtitle:empty { display: none; }
.hs-modal-scope .modal-header__actions { display: flex; align-items: center; gap: 8px; position: relative; z-index: 1; flex-shrink: 0; }
.hs-modal-scope .modal-title { font-size: var(--fs-lg); font-weight: var(--fw-bold); color: var(--text-main); display: flex; align-items: center; gap: 8px; margin: 0; }
.hs-modal-scope .modal-title .icon { margin: 0; width: 20px; height: 20px; color: var(--primary); }
.hs-modal-scope .badge-hscode { background: var(--primary); color: #fff; padding: 4px 10px; border-radius: var(--radius-sm); font-size: var(--fs-base); }
.hs-modal-scope .badge-hscode--btn { display: inline-flex; align-items: center; gap: 6px; border: none; cursor: pointer; font-weight: var(--fw-bold); transition: var(--transition); }
.hs-modal-scope .badge-hscode--btn .icon { margin: 0; width: 13px; height: 13px; flex-shrink: 0; }
.hs-modal-scope .badge-hscode--btn .check-icon { display: none; }
.hs-modal-scope .badge-hscode--btn:hover { background: var(--primary-hover); }
.hs-modal-scope .badge-hscode--btn.is-copied { background: var(--success); }
.hs-modal-scope .badge-hscode--btn.is-copied .copy-icon { display: none; }
.hs-modal-scope .badge-hscode--btn.is-copied .check-icon { display: inline-block; }

/* هدر گرادیانی اختصاصی پاپ‌آپ «جزئیات تعرفه» (سایر پاپ‌آپ‌های ساده از .modal-header مشترک استفاده می‌کنند) */
.hs-modal-scope #hs-modal .modal-header { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%); border-bottom: none; position: relative; overflow: hidden; }
.hs-modal-scope #hs-modal .modal-header::before { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(circle at 92% -40%, rgba(255,255,255,.22) 0%, transparent 55%); }
.hs-modal-scope #hs-modal .modal-title { color: #fff; position: relative; z-index: 1; }
.hs-modal-scope #hs-modal .modal-title > .icon { color: rgba(255,255,255,.85); }
.hs-modal-scope #hs-modal .badge-hscode--btn { background: rgba(255,255,255,.18); color: #fff; border: 1px solid rgba(255,255,255,.32); position: relative; z-index: 1; }
.hs-modal-scope #hs-modal .badge-hscode--btn:hover { background: rgba(255,255,255,.3); }
.hs-modal-scope #hs-modal .badge-hscode--btn.is-copied { background: var(--success); border-color: var(--success); }
.hs-modal-scope #hs-modal .btn-close-modal { background: rgba(255,255,255,.18); color: #fff; }
.hs-modal-scope #hs-modal .btn-close-modal:hover { background: var(--danger); color: #fff; }
.hs-modal-scope .btn-modal-page {
    display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 50rem;
    background: rgba(255,255,255,.18); color: #fff; border: 1px solid rgba(255,255,255,.32);
    font-size: var(--fs-xs); font-weight: var(--fw-medium); text-decoration: none; transition: var(--transition); white-space: nowrap;
}
.hs-modal-scope .btn-modal-page:hover { background: #fff; color: var(--primary-hover); }
.hs-modal-scope .btn-modal-page .icon { margin: 0; width: 14px; height: 14px; }

.hs-modal-scope .btn-close-modal {
    background: var(--border-color); border: none; width: 36px; height: 36px; border-radius: 50%;
    color: var(--text-main); cursor: pointer; transition: var(--transition);
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.hs-modal-scope .btn-close-modal:hover { background: var(--danger); color: #fff; }
.hs-modal-scope .btn-close-modal .icon { margin: 0; width: 16px; height: 16px; }
.hs-modal-scope .close-btn {
    background: var(--bg-main); border: 1px solid var(--border-color); width: 36px; height: 36px; border-radius: 50%;
    color: var(--text-main); cursor: pointer; font-size: 1.35rem; line-height: 1; transition: var(--transition);
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.hs-modal-scope .close-btn:hover { background: var(--danger); border-color: var(--danger); color: #fff; }

/* ---------- نوار فرعی چسبان: خلاصه‌ی وضعیت + ناوبری بخش‌ها ---------- */
.hs-modal-scope .modal-subheader { background: var(--bg-box); border-bottom: 1px solid var(--border-color); padding: 12px 24px; flex-shrink: 0; display: flex; flex-direction: column; gap: 10px; }
.hs-modal-scope .modal-quickfacts { display: flex; flex-wrap: wrap; gap: 8px; }
.hs-modal-scope .quickfact-chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 50rem;
    font-size: var(--fs-xs); font-weight: var(--fw-medium); border: 1px solid transparent; white-space: nowrap; box-shadow: var(--shadow);
}
.hs-modal-scope .quickfact-chip .icon { margin: 0; width: 13px; height: 13px; flex-shrink: 0; }
.hs-modal-scope .quickfact-chip strong { font-weight: var(--fw-bold); }
.hs-modal-scope .quickfact-chip--success { background: var(--success-soft); color: var(--success); border-color: var(--success-soft-border); }
.hs-modal-scope .quickfact-chip--warning { background: var(--warning-soft); color: var(--warning); border-color: var(--warning-soft-border); }
.hs-modal-scope .quickfact-chip--danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-soft-border); }
.hs-modal-scope .quickfact-chip--neutral { background: var(--bg-main); color: var(--text-muted); border-color: var(--border-color); }
.hs-modal-scope .quickfact-chip--action { background: var(--primary-soft); color: var(--primary); border-color: var(--primary-soft-border); text-decoration: none; cursor: pointer; transition: var(--transition); margin-inline-start: auto; }
.hs-modal-scope .quickfact-chip--action:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

.hs-modal-scope .modal-nav { display: flex; gap: 4px; overflow-x: auto; padding: 5px; background: var(--bg-main); border: 1px solid var(--border-color); border-radius: 50rem; }
.hs-modal-scope .modal-nav::-webkit-scrollbar { height: 4px; }
.hs-modal-scope .modal-nav::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: var(--radius-sm); }
.hs-modal-scope .modal-nav-btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 50rem;
    border: none; background: transparent; color: var(--text-muted);
    font-size: var(--fs-xs); font-weight: var(--fw-medium); cursor: pointer; transition: var(--transition);
    flex-shrink: 0; white-space: nowrap;
}
.hs-modal-scope .modal-nav-btn .icon { margin: 0; width: 14px; height: 14px; flex-shrink: 0; transition: var(--transition); }
.hs-modal-scope .modal-nav-btn:hover:not(.active) { background: var(--bg-box); color: var(--primary); box-shadow: var(--shadow); }
.hs-modal-scope .modal-nav-btn__count {
    background: var(--bg-box); color: var(--text-muted); border: 1px solid var(--border-color);
    border-radius: 50rem; min-width: 18px; height: 18px; padding: 0 5px;
    display: inline-flex; align-items: center; justify-content: center; font-size: 0.6875rem; font-weight: var(--fw-bold);
}
.hs-modal-scope .modal-nav-btn[data-target="modal-section-circulars"] .icon { color: var(--info); }
.hs-modal-scope .modal-nav-btn[data-target="modal-section-export-price"] .icon { color: var(--success); }
.hs-modal-scope .modal-nav-btn[data-target="modal-section-records"] .icon { color: var(--warning); }
.hs-modal-scope .modal-nav-btn.active { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%); color: #fff; box-shadow: var(--shadow); }
.hs-modal-scope .modal-nav-btn.active .icon { color: #fff; }
.hs-modal-scope .modal-nav-btn.active .modal-nav-btn__count { background: rgba(255,255,255,0.25); color: #fff; border-color: transparent; }

/* (آخرین بخش با رسیدن اسکرول به انتها فعال می‌شود — نیازی به پدینگ بزرگ پایین نیست) */
.hs-modal-scope .modal-body { padding: 20px 20px 28px; overflow-y: auto; background: var(--bg-main); font-size: var(--fs-base); scroll-behavior: smooth; }
.hs-modal-scope .modal-body p { line-height: 1.7; margin: 0; }
.hs-modal-scope .modal-body hr { border: none; border-top: 1px solid var(--border-color); margin: 16px 0; }
.hs-modal-scope .modal-section { scroll-margin-top: 8px; }
.hs-modal-scope .modal-section + .modal-section { margin-top: 26px; }

/* ---------- باکس‌های داخل پاپ‌آپ ---------- */
.hs-modal-scope .grid-2-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.hs-modal-scope .grid-2-col > * { min-width: 0; } /* آیتم گرید نباید از محتوای طولانی (اعداد ریالی) پهن‌تر شود */
.hs-modal-scope .info-box { background: var(--bg-box); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); border-top: 4px solid var(--border-color); height: 100%; }
.hs-modal-scope .border-blue { border-top-color: var(--primary); }
.hs-modal-scope .border-purple { border-top-color: var(--info); }
.hs-modal-scope .border-orange { border-top-color: var(--warning); }
.hs-modal-scope .border-green { border-top-color: var(--success); }
.hs-modal-scope .box-title { font-size: var(--fs-md); font-weight: var(--fw-medium); color: var(--text-main); margin: 0 0 15px; padding-bottom: 10px; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; gap: 8px; }
.hs-modal-scope .box-title .icon { margin: 0; width: 18px; height: 18px; color: var(--primary); }
.hs-modal-scope .border-purple .box-title .icon { color: var(--info); }
.hs-modal-scope .border-orange .box-title .icon { color: var(--warning); }
.hs-modal-scope .border-green .box-title .icon { color: var(--success); }
.hs-modal-scope .box-content { margin-top: 2px; }
.hs-modal-scope .hs-desc { line-height: 1.7; font-size: var(--fs-sm); color: var(--text-main); text-align: justify; }
.hs-modal-scope .rules-text { line-height: 1.8; font-size: var(--fs-sm); color: var(--text-muted); text-align: justify; white-space: pre-line; }

.hs-modal-scope .detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hs-modal-scope .detail-item { background: var(--bg-main); border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 9px 12px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.hs-modal-scope .detail-label { font-size: var(--fs-xs); color: var(--text-muted); }
.hs-modal-scope .detail-value { font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--text-main); overflow-wrap: anywhere; }

.hs-modal-scope .section-divider { font-size: var(--fs-lg); font-weight: var(--fw-bold); color: var(--text-main); margin: 0 0 15px; border-bottom: 2px solid var(--border-color); padding-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.hs-modal-scope .section-divider .icon { margin: 0; width: 19px; height: 19px; color: var(--primary); }
.hs-modal-scope .section-divider--success .icon { color: var(--success); }
.hs-modal-scope .section-divider--warning .icon { color: var(--warning); }
.hs-modal-scope .section-divider--info .icon { color: var(--info); }
.hs-modal-scope .section-divider__count { background: var(--info-soft); color: var(--info); border: 1px solid var(--info-soft-border); border-radius: 50rem; padding: 1px 10px; font-size: var(--fs-xs); font-weight: var(--fw-bold); }
.hs-modal-scope .section-divider__hint { font-size: var(--fs-xs); color: var(--text-muted); font-weight: var(--fw-regular); margin-inline-start: auto; text-align: left; }
.hs-modal-scope .box-title__count { background: var(--bg-main); color: var(--text-muted); border: 1px solid var(--border-color); border-radius: 50rem; padding: 0 8px; font-size: 0.72rem; font-weight: var(--fw-bold); min-width: 20px; text-align: center; }
.hs-modal-scope .hs-title { font-size: var(--fs-md); font-weight: var(--fw-medium); color: var(--text-main); line-height: 1.7; margin: 0 0 6px; }
.hs-modal-scope .trade-direction-btn__hint { font-size: 0.72rem; font-weight: var(--fw-regular); opacity: .8; direction: ltr; }
.hs-modal-scope .trade-direction-btn__hint:empty { display: none; }

/* ردیف آکاردئونی «مشاهده بخشنامه‌های مرتبط» */
.hs-modal-scope .accordion-row-btn { display: flex; align-items: center; justify-content: space-between; background: var(--bg-main); border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 12px 14px; cursor: pointer; transition: var(--transition); }
.hs-modal-scope .accordion-row-btn:hover { border-color: var(--info-soft-border); background: var(--info-soft); }
.hs-modal-scope .accordion-row-content { display: flex; align-items: center; gap: 8px; width: 100%; font-size: var(--fs-sm); color: var(--text-main); font-weight: var(--fw-medium); }
.hs-modal-scope .accordion-row-content .icon { margin: 0; width: 18px; height: 18px; color: var(--info); }
.hs-modal-scope .accordion-row-content .title { flex: 1; }
.hs-modal-scope .accordion-row-content .badge { background: var(--info-soft); color: var(--info); border: 1px solid var(--info-soft-border); border-radius: 50rem; padding: 2px 10px; font-size: var(--fs-xs); font-weight: var(--fw-bold); }
.hs-modal-scope .accordion-row-content .arrow-icon { margin: 0; width: 15px; height: 15px; color: var(--text-muted); }

.hs-modal-scope .custom-scrollbar { max-height: 250px; overflow-y: auto; padding-left: 5px; }
.hs-modal-scope .custom-scrollbar::-webkit-scrollbar { width: 6px; }
.hs-modal-scope .custom-scrollbar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: var(--radius-sm); }

/* آیتم‌های لیست (قیمت پایه / بار و سفارش / رکوردهای پیشین) */
.hs-modal-scope .record-item { background: var(--bg-main); border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 10px; border-right: 3px solid var(--border-color); transition: var(--transition); }
.hs-modal-scope .border-orange .record-item { border-right-color: var(--warning); }
.hs-modal-scope .border-green .record-item { border-right-color: var(--success); }
.hs-modal-scope .border-blue .record-item { border-right-color: var(--primary); }
.hs-modal-scope .record-item--selectable:hover { border-color: var(--primary-soft-border); box-shadow: var(--shadow); }
.hs-modal-scope .record-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: var(--fw-medium); font-size: var(--fs-sm); margin-bottom: 6px; color: var(--text-main); }
.hs-modal-scope .record-title .icon { margin: 0 0 0 4px; width: 14px; height: 14px; }
.hs-modal-scope .record-detail { font-size: var(--fs-xs); color: var(--text-muted); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.hs-modal-scope .record-detail .icon { margin: 0 3px 0 0; width: 13px; height: 13px; }
.hs-modal-scope .record-status { font-size: var(--fs-xs); font-weight: var(--fw-bold); color: var(--primary); }

/* حالت بلور برای کاربر مهمان (تب رکوردها) */
.hs-modal-scope .relative-box { position: relative; }
.hs-modal-scope .blur-content-wrapper { filter: blur(6px); opacity: 0.4; user-select: none; pointer-events: none; }
.hs-modal-scope .auth-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; background: rgba(255, 255, 255, 0.7); z-index: 10; border-radius: 0 0 var(--radius) var(--radius); }
.hs-modal-scope .auth-message { display: flex; align-items: center; font-weight: var(--fw-medium); color: var(--text-main); margin-bottom: 15px; text-align: center; background: var(--bg-box); padding: 6px 16px; border-radius: 50rem; box-shadow: var(--shadow); font-size: var(--fs-sm); }
.hs-modal-scope .auth-message .icon { margin: 0 0 0 6px; width: 15px; height: 15px; }
.hs-modal-scope .auth-buttons { display: flex; gap: 10px; }

/* ---------- آمار رسمی تجارت ---------- */
.hs-modal-scope .trade-direction-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; background: var(--bg-main); border: 1px solid var(--border-color); border-radius: var(--radius); padding: 6px; }
.hs-modal-scope .trade-direction-btn { display: flex; align-items: center; justify-content: center; gap: 8px; background: transparent; border: none; border-radius: var(--radius-sm); padding: 11px; font-size: var(--fs-md); font-weight: var(--fw-bold); color: var(--text-muted); cursor: pointer; transition: var(--transition); }
.hs-modal-scope .trade-direction-btn .icon { margin: 0; width: 18px; height: 18px; }
.hs-modal-scope .trade-direction-btn:hover { color: var(--text-main); }
.hs-modal-scope .trade-direction-btn.active { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%); color: #fff; box-shadow: var(--shadow); }

.hs-modal-scope .stats-empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 30px 15px; color: var(--text-muted); font-size: var(--fs-sm); background: var(--bg-box); border: 1px dashed var(--border-color); border-radius: var(--radius); text-align: center; }
.hs-modal-scope .stats-empty-state .icon { margin: 0; width: 28px; height: 28px; color: var(--border-color); }

.hs-modal-scope .stats-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.hs-modal-scope .stats-tab { background: var(--bg-main); border: 1px solid var(--border-color); color: var(--text-muted); border-radius: 50rem; padding: 7px 16px; font-size: var(--fs-sm); font-weight: var(--fw-medium); cursor: pointer; transition: var(--transition); }
.hs-modal-scope .stats-tab:hover { border-color: var(--primary-soft-border); color: var(--primary); }
.hs-modal-scope .stats-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.hs-modal-scope .stats-note { display: flex; align-items: center; gap: 6px; margin: 0 0 14px; padding: 8px 14px; background: var(--warning-soft); border: 1px solid var(--warning-soft-border); color: var(--warning); border-radius: var(--radius-sm); font-size: var(--fs-xs); font-weight: var(--fw-medium); }

.hs-modal-scope .stats-summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.hs-modal-scope .stats-summary-card { background: var(--bg-box); border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 12px; display: flex; align-items: center; gap: 10px; min-width: 0; }
.hs-modal-scope .stats-summary-card__icon { width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.hs-modal-scope .stats-summary-card__icon .icon { margin: 0; width: 18px; height: 18px; }
.hs-modal-scope .stats-summary-card__icon--primary { background: var(--primary-soft); color: var(--primary); }
.hs-modal-scope .stats-summary-card__icon--success { background: var(--success-soft); color: var(--success); }
.hs-modal-scope .stats-summary-card__icon--info { background: var(--info-soft); color: var(--info); }
.hs-modal-scope .stats-summary-card__icon--warning { background: var(--warning-soft); color: var(--warning); }
.hs-modal-scope .stats-summary-card__value { display: block; font-size: var(--fs-md); font-weight: var(--fw-bold); color: var(--text-main); overflow-wrap: anywhere; word-break: break-word; }
.hs-modal-scope .stats-summary-card__label { display: block; font-size: var(--fs-xs); color: var(--text-muted); margin-top: 2px; }

.hs-modal-scope .bar-chart-list { display: flex; flex-direction: column; gap: 12px; max-height: 300px; }
.hs-modal-scope .bar-chart-empty { color: var(--text-muted); font-size: var(--fs-sm); text-align: center; padding: 20px 0; }
.hs-modal-scope .bar-chart-row { min-width: 0; }
.hs-modal-scope .bar-chart-row__top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 5px; }
.hs-modal-scope .bar-chart-row__name { font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--text-main); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.hs-modal-scope .bar-chart-row__usd { font-size: var(--fs-xs); font-weight: var(--fw-bold); color: var(--primary); flex-shrink: 0; }
.hs-modal-scope .bar-chart-row__track { height: 8px; background: var(--bg-main); border-radius: 50rem; overflow: hidden; }
.hs-modal-scope .bar-chart-row__fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-hover)); border-radius: 50rem; }
.hs-modal-scope .bar-chart-row__metrics { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 5px; font-size: var(--fs-xs); color: var(--text-muted); }
.hs-modal-scope .bar-chart-row__metrics strong { color: var(--text-main); font-weight: var(--fw-medium); }
.hs-modal-scope .bar-chart-row__metrics span { min-width: 0; overflow-wrap: anywhere; }
.hs-modal-scope .bar-chart-row__link { color: var(--primary); text-decoration: none; font-weight: var(--fw-medium); display: inline-flex; align-items: center; gap: 2px; }
.hs-modal-scope .bar-chart-row__link:hover { text-decoration: underline; }
.hs-modal-scope .bar-chart-row__link .icon { width: 13px; height: 13px; margin: 0; }

/* ---------- گرید بخشنامه‌ها ---------- */
.hs-modal-scope .circulars-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; max-height: 340px; padding: 2px; }
.hs-modal-scope .circular-card-content h4 a { color: var(--text-main); text-decoration: none; }
.hs-modal-scope .circular-card-content h4 a:hover { color: var(--primary); }
.hs-modal-scope .circulars-grid__empty { grid-column: 1 / -1; text-align: center; color: var(--text-muted); padding: 20px 0; }
.hs-modal-scope .circular-card-item { background: var(--bg-box); border: 1px solid var(--border-color); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; justify-content: space-between; transition: var(--transition); }
.hs-modal-scope .circular-card-item:hover { box-shadow: var(--shadow); border-color: var(--primary-soft-border); }
.hs-modal-scope .circular-card-content h4 { font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--text-main); margin: 0 0 10px; line-height: 1.5; }
.hs-modal-scope .circular-card-content p { font-size: var(--fs-xs); color: var(--text-muted); margin: 0 0 4px; }
.hs-modal-scope .circular-card-content p strong { color: var(--text-main); font-weight: var(--fw-medium); }
.hs-modal-scope .circular-card-item__nofile { color: var(--text-muted); font-size: 12px; display: block; text-align: center; margin-top: 10px; padding: 5px; border: 1px dashed var(--border-color); border-radius: var(--radius-sm); }

/* ---------- واکنش‌گرایی ---------- */
@media (max-width: 768px) {
    .hs-modal-scope .grid-2-col { grid-template-columns: 1fr; }
    .hs-modal-scope .detail-grid { grid-template-columns: 1fr; }
    .hs-modal-scope .circulars-grid { grid-template-columns: 1fr; }
    .hs-modal-scope .stats-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hs-modal-scope .modal-header { padding: 14px 16px; }
    .hs-modal-scope .modal-subheader { padding: 10px 16px; }
    .hs-modal-scope .btn-modal-page span { display: none; }
    .hs-modal-scope .btn-modal-page { width: 36px; padding: 0; justify-content: center; }
}
@media (max-width: 480px) {
    .hs-modal-scope .stats-summary-grid { grid-template-columns: 1fr; }
    .hs-modal-scope #hs-modal .modal-title { font-size: var(--fs-md); }
    .hs-modal-scope .badge-hscode { font-size: var(--fs-sm); }
    .hs-modal-scope .custom-modal-overlay { padding: 8px; }
    .hs-modal-scope .custom-modal-content { max-height: 94vh; }
}

/* ---------- اسکلت بارگذاری (به‌جای اسپینر) ---------- */
.hs-modal-scope .hs-skeleton { display: grid; gap: 10px; }
.hs-modal-scope .hs-skeleton i, .hs-modal-scope .hs-skeleton b { display: block; border-radius: var(--radius-sm); background: linear-gradient(90deg, #eef2f7 25%, #f8fafc 50%, #eef2f7 75%); background-size: 200% 100%; animation: hsShimmer 1.2s ease-in-out infinite; }
.hs-modal-scope .hs-skeleton--rows i { height: 58px; }
.hs-modal-scope .hs-skeleton--cards { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.hs-modal-scope .hs-skeleton--cards i { height: 120px; }
.hs-modal-scope .hs-skeleton--stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.hs-modal-scope .hs-skeleton--stats i { height: 64px; }
.hs-modal-scope .hs-skeleton--stats b { height: 220px; grid-column: span 2; }
@keyframes hsShimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---------- toast (جایگزین alert) ---------- */
.hs-modal-scope .hs-toast {
    position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); z-index: 10070;
    background: var(--text-main); color: #fff; padding: 12px 20px; border-radius: 50rem; font-size: var(--fs-sm); font-weight: var(--fw-medium);
    box-shadow: var(--shadow-md); opacity: 0; visibility: hidden; transition: opacity .2s ease, transform .2s ease, visibility 0s linear .2s; max-width: calc(100vw - 32px);
}
.hs-modal-scope .hs-toast.is-visible { opacity: 1; visibility: visible; transform: translate(-50%, 0); transition-delay: 0s; }
.hs-modal-scope .hs-toast--success { background: var(--success); }
.hs-modal-scope .hs-toast--danger { background: var(--danger); }
.hs-modal-scope .hs-toast--warning { background: var(--warning); }

/* ---------- فرم‌های جریان همکاری ---------- */
.hs-modal-scope .form-group { min-width: 0; }
.hs-modal-scope .custom-form label, .hs-modal-scope .form-label { display: block; margin-bottom: 8px; font-weight: var(--fw-medium); font-size: var(--fs-sm); color: var(--text-main); }
.hs-modal-scope .modern-input {
    width: 100%; padding: 12px 14px; border: 2px solid var(--border-color); border-radius: var(--radius-sm); font-size: var(--fs-base);
    transition: var(--transition); background: var(--bg-main); color: var(--text-main); font-family: inherit;
}
.hs-modal-scope .modern-input:focus { border-color: var(--primary); background: var(--bg-box); outline: none; box-shadow: 0 0 0 4px var(--primary-soft); }
.hs-modal-scope .modern-input.input-readonly { cursor: not-allowed; color: var(--text-muted); direction: ltr; text-align: right; }
.hs-modal-scope textarea.modern-input { resize: vertical; min-height: 80px; }
.hs-modal-scope .radio-row { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.hs-modal-scope .custom-form .radio-choice { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; margin-bottom: 0; font-weight: var(--fw-regular); font-size: var(--fs-sm); color: var(--text-main); }
.hs-modal-scope .custom-form input[type="radio"] { accent-color: var(--primary); width: 16px; height: 16px; cursor: pointer; }
.hs-modal-scope #existing-records-list { max-height: 260px; overflow-y: auto; }
.hs-modal-scope .d-block { display: block; }
.hs-modal-scope .mb-2 { margin-bottom: 10px; }

/* ---------- پاپ‌آپ اشتراک ویژه ---------- */
.hs-modal-scope .vip-icon-circle { background: var(--warning-soft); color: var(--warning); width: 60px; height: 60px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; }
.hs-modal-scope .vip-icon-circle svg { width: 30px; height: 30px; }
.hs-modal-scope .vip-lead { color: var(--text-muted); font-size: var(--fs-sm); margin-bottom: 18px; }
.hs-modal-scope .vip-price-box { background: var(--bg-box); border: 1px solid var(--border-color); padding: 15px; border-radius: var(--radius-sm); margin-bottom: 14px; }
.hs-modal-scope .vip-price-box .vip-duration { margin: 0 0 6px; font-weight: var(--fw-medium); font-size: var(--fs-md); color: var(--text-main); }
.hs-modal-scope .vip-price-box .vip-price { margin: 0; color: var(--success); font-size: var(--fs-lg); font-weight: var(--fw-bold); }
.hs-modal-scope .vip-access-note { font-size: var(--fs-xs); color: var(--text-muted); margin-bottom: 20px; }
.hs-modal-scope .vip-actions { display: flex; gap: 10px; justify-content: center; }
.hs-modal-scope .modal-vip .modal-body, .hs-modal-scope .modal-md .modal-body, .hs-modal-scope .modal-sm .modal-body { padding-bottom: 24px; }

@media (max-width: 768px) {
    .hs-modal-scope .hs-skeleton--stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hs-modal-scope .section-divider__hint { display: none; }
    .hs-modal-scope .modal-header__subtitle { max-width: 220px; }
}
