/* ════════════════════════════════════════════════════════════════════
   ایمپورت لید (/sales/import) — روی theme-vivid.css سوار می‌شود.
   کادر رها کردن فایل، حلقه و نوار پیشرفت هنگام ایمپورت، و کارت گزارش پایان.
   رنگ‌ها از --primary و --brand-2 می‌آیند تا برند اختصاصی مستاجر هم اعمال شود.
   ════════════════════════════════════════════════════════════════════ */

.imp { max-width: 860px; }

/* ── فرمت‌های مجاز ── */
.imp-formats { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); margin-bottom: var(--s-3); }
.imp-format {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: var(--r-pill);
    background: var(--t-emerald-soft);
    color: var(--t-emerald);
    font-size: var(--text-xs);
    font-weight: 600;
}
.imp-format + .imp-format { background: var(--t-sky-soft); color: var(--t-sky); }
.imp-format b { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-weight: 700; direction: ltr; unicode-bidi: isolate; }
.imp-format-note { color: var(--muted); font-size: var(--text-xs); }

/* ── کادر رها کردن فایل ── */
.imp-drop {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 200px;
    padding: var(--s-5);
    border: 2px dashed color-mix(in srgb, var(--primary) 28%, var(--line));
    border-radius: var(--r-panel);
    background:
        radial-gradient(420px 160px at 50% 0%, color-mix(in srgb, var(--primary) 7%, transparent), transparent 70%),
        color-mix(in srgb, var(--surface-sunken) 55%, var(--surface));
    text-align: center;
    transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.25s var(--ease-out), transform 0.25s var(--ease-out);
}
.imp-drop > input[type="file"] { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.imp-drop:hover, .imp-drop:focus-within, .imp-drop.is-over {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 12%, transparent);
}
.imp-drop.is-over { transform: scale(1.01); background-color: color-mix(in srgb, var(--primary) 6%, var(--surface)); }
.imp-drop.has-file { border-style: solid; background: var(--surface); }
.imp-drop.has-file > input[type="file"] { display: none; }
.imp-drop.is-busy { border-style: solid; border-color: color-mix(in srgb, var(--primary) 35%, var(--line)); background: var(--surface); cursor: progress; }

.imp-empty { display: grid; justify-items: center; gap: 6px; pointer-events: none; }
.imp-empty b { color: var(--ink); font-size: var(--text-md, 1rem); }
.imp-empty small { color: var(--muted); }
.imp-empty-icon {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    margin-bottom: var(--s-1);
    border-radius: 20px;
    background: var(--grad-brand);
    color: #fff;
    font-size: 1.7rem;
    box-shadow: var(--glow-primary);
    animation: vv-float 3.2s ease-in-out infinite;
}
.imp-empty-icon .button-spinner { width: 24px; height: 24px; border-width: 3px; }
.imp-drop.is-over .imp-empty-icon { animation: none; transform: translateY(-4px) scale(1.06); transition: transform 0.25s var(--ease-spring); }

/* ── فایل انتخاب‌شده ── */
.imp-file { display: flex; align-items: center; gap: var(--s-3); width: min(100%, 520px); text-align: start; animation: vv-rise 0.3s var(--ease-out) both; }
.imp-file-icon {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--t-emerald), color-mix(in srgb, var(--t-emerald) 60%, #fff));
    color: #fff;
    font-size: 1.5rem;
    box-shadow: 0 8px 18px -8px var(--t-emerald);
}
.imp-file-icon.is-csv { background: linear-gradient(135deg, var(--t-sky), color-mix(in srgb, var(--t-sky) 60%, #fff)); box-shadow: 0 8px 18px -8px var(--t-sky); }
.imp-file-meta { display: grid; min-width: 0; flex: 1; }
.imp-file-meta b { overflow: hidden; color: var(--ink); text-overflow: ellipsis; white-space: nowrap; }
.imp-file-meta small { color: var(--muted); }
.imp-file-remove { position: relative; z-index: 3; border-radius: 50%; width: 34px; height: 34px; padding: 0; }

/* ── در حال ایمپورت ── */
.imp-working { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: var(--s-3) var(--s-5); width: min(100%, 560px); text-align: start; }
.imp-ring { position: relative; width: 112px; height: 112px; }
.imp-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.imp-ring circle { fill: none; stroke-width: 10; }
.imp-ring-track { stroke: var(--surface-sunken); }
.imp-ring-bar {
    stroke: var(--primary);
    stroke-linecap: round;
    stroke-dasharray: 100;
    stroke-dashoffset: calc(100 - var(--p, 0));
    transition: stroke-dashoffset 0.35s var(--ease-out);
    filter: drop-shadow(0 4px 8px color-mix(in srgb, var(--primary) 45%, transparent));
}
/* تا وقتی درصد صفر است (خواندن فایل) حلقه می‌چرخد */
.imp-ring.is-indeterminate svg { animation: ds-spin 1.1s linear infinite; }
.imp-ring.is-indeterminate .imp-ring-bar { stroke-dashoffset: 72; }
.imp-ring strong {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: var(--ink);
    font-size: 1.6rem;
    font-weight: 800;
}
.imp-ring strong small { font-size: 0.9rem; font-weight: 600; margin-inline-start: 1px; }
.imp-working-text { display: grid; gap: 4px; }
.imp-working-text b { color: var(--ink); font-size: 1.05rem; }
.imp-working-text span { color: var(--muted); }
.imp-working-text small { color: var(--faint); }
.imp-bar { grid-column: 1 / -1; height: 8px; overflow: hidden; border-radius: var(--r-pill); background: var(--surface-sunken); }
.imp-bar > span {
    display: block;
    height: 100%;
    min-width: 8%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), var(--brand-2), var(--primary)) 0 0 / 200% 100%;
    transition: width 0.35s var(--ease-out);
    animation: vv-progress-bg 1.4s linear infinite;
}

.imp-error { display: flex; align-items: center; gap: var(--s-2); margin: var(--s-3) 0 0; animation: vv-rise 0.25s var(--ease-out) both; }

/* ── گزینه‌ها و دکمه ── */
.imp-options { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s-3); margin-top: var(--s-4); }
.imp-options > div { flex: 1 1 220px; max-width: 320px; }
.imp-options small { display: block; margin-top: 4px; font-size: var(--text-xs); }
.imp-start {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--s-2);
    min-width: 170px;
    min-height: 42px;
    margin-inline-start: auto;
    margin-bottom: 22px;
    font-weight: 700;
    background-image: var(--grad-brand);
    border: 0;
    box-shadow: var(--glow-primary);
}
.imp-start:disabled { background-image: none; box-shadow: none; opacity: 0.55; }

.imp-help { margin-top: var(--s-4); padding: var(--s-3) var(--s-4); border-radius: var(--r-control); background: var(--surface-sunken); font-size: var(--text-sm); }
.imp-help summary { color: var(--primary); font-weight: 600; cursor: pointer; }
.imp-help summary i { margin-inline-end: 4px; }
.imp-help ul { margin: var(--s-2) 0 0; padding-inline-start: var(--s-4); color: var(--muted); }
.imp-help li + li { margin-top: 4px; }

/* ── گزارش پایان ── */
.imp-result { animation: vv-rise 0.35s var(--ease-out) both; }
.imp-result-head { display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-4); }
.imp-result-head h5 { margin: 0; font-weight: 800; }
.imp-result-icon {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--success-soft);
    color: var(--success);
    font-size: 1.7rem;
    animation: vv-pop 0.4s var(--ease-spring) both;
}
.imp-result.is-empty .imp-result-icon { background: var(--warning-soft); color: var(--warning); }
.imp-kpis { margin-bottom: var(--s-4); }
.imp-subtitle { margin-bottom: var(--s-2); font-weight: 700; }
.imp-reasons { margin: 0 0 var(--s-3); padding: 0; list-style: none; border: 1px solid var(--line); border-radius: var(--r-control); overflow: hidden; }
.imp-reasons li { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: 10px var(--s-4); }
.imp-reasons li + li { border-top: 1px solid var(--line); }
.imp-reasons b { padding: 2px 10px; border-radius: var(--r-pill); background: var(--warning-soft); color: var(--warning); }
.imp-errors { margin: 0 0 var(--s-3); padding: 0; list-style: none; color: var(--danger); font-size: var(--text-sm); }
.imp-errors li + li { margin-top: 4px; }
.imp-columns { margin: 0 0 var(--s-4); color: var(--muted); font-size: var(--text-xs); }
.imp-columns i { margin-inline-end: 4px; }
.imp-result-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); }

@media (max-width: 575.98px) {
    .imp-drop { min-height: 170px; padding: var(--s-4); }
    .imp-working { grid-template-columns: 1fr; justify-items: center; text-align: center; }
    .imp-start { width: 100%; margin-bottom: 0; }
    .imp-options > div { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
    .imp-empty-icon, .imp-ring svg, .imp-bar > span { animation: none !important; }
}
