/* ─────────────────────────────────────────────────────────────
   وب وان — سامانه مصاحبه هوشمند
   سیستم طراحی (Design Tokens + کامپوننت‌ها) — RTL / فارسی
   ───────────────────────────────────────────────────────────── */

:root {
    /* رنگ برند */
    --brand: #2456a6;
    --brand-600: #2b5fd0;
    --brand-500: #3b74e8;
    --brand-700: #1e4bab;
    --brand-grad: linear-gradient(135deg, #3b74e8 0%, #2456a6 100%);
    --brand-soft: #eaf1fc;
    --ring: rgba(59, 116, 232, .28);

    /* خنثی‌ها */
    --bg: #eef1f6;
    --bg-2: #f6f8fb;
    --surface: #ffffff;
    --text: #171a21;
    --text-2: #4a505b;
    --muted: #8b909c;
    --line: #e6e9ef;
    --line-2: #d7dbe3;

    /* سمنتیک */
    --ok: #15803d;        --ok-bg: #e7f6ec;   --ok-line: #b6e2c4;
    --warn: #b45309;      --warn-bg: #fdf3e2; --warn-line: #f0d8a8;
    --bad: #c02a22;       --bad-bg: #fdecea;  --bad-line: #f4c9c4;
    --neutral: #64707f;   --neutral-bg: #eef1f5; --neutral-line: #d9dee6;

    /* سایه */
    --sh-xs: 0 1px 2px rgba(20, 30, 55, .06);
    --sh-sm: 0 2px 6px rgba(20, 30, 55, .07);
    --sh-md: 0 8px 24px rgba(20, 30, 55, .09);
    --sh-lg: 0 18px 48px rgba(20, 30, 55, .14);
    --sh-brand: 0 8px 20px rgba(36, 86, 166, .28);

    /* شعاع */
    --r-sm: 9px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-xl: 20px;
    --r-pill: 999px;
}

* { box-sizing: border-box; font-family: 'Vazirmatn', system-ui, sans-serif; }
html, body { margin: 0; height: 100%; }
body {
    background: radial-gradient(1200px 600px at 100% -10%, #e9eef8 0%, transparent 60%),
                radial-gradient(1000px 500px at -10% 110%, #eaf0f7 0%, transparent 55%),
                var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.app { min-height: 100vh; display: flex; flex-direction: column; }
.main { flex: 1; display: flex; flex-direction: column; }

/* ── هدر ── */
.topbar {
    position: sticky; top: 0; z-index: 40;
    display: flex; align-items: center; justify-content: space-between;
    padding: 13px 24px;
    background: rgba(255, 255, 255, .78);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--sh-xs);
}
.logo { display: flex; align-items: center; gap: 11px; text-decoration: none; color: inherit; }
.logo-mark {
    background: var(--brand-grad); color: #fff;
    border-radius: 11px; width: 36px; height: 36px;
    display: grid; place-items: center; font-weight: 800; font-size: 13px;
    box-shadow: var(--sh-brand); letter-spacing: .5px;
}
.logo-text { font-weight: 800; font-size: 17px; letter-spacing: -.2px; }
.topbar-tag { font-size: 12.5px; color: var(--muted); font-weight: 500; }

/* ── عمومی ── */
.center { flex: 1; display: grid; place-items: center; padding: 24px; }
.card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--r-xl); padding: 32px 30px;
    max-width: 460px; width: 100%;
    box-shadow: var(--sh-md);
    animation: rise .4s cubic-bezier(.2, .7, .3, 1) both;
}
.card.wide { max-width: none; margin-top: 16px; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.h1 { font-size: 22px; margin: 0 0 14px; font-weight: 800; letter-spacing: -.3px; }
.h2 { font-size: 16px; margin: 26px 0 12px; font-weight: 700; letter-spacing: -.2px; }
.lead { font-size: 14.5px; line-height: 2; color: var(--text-2); margin: 0 0 18px; }
.tips { font-size: 13.5px; line-height: 2.1; color: var(--text-2); padding-inline-start: 18px; margin: 0 0 22px; }
.tips li { margin-bottom: 4px; }
.meta { font-size: 12.5px; color: var(--muted); }
.err { color: var(--bad); font-size: 13.5px; margin: 8px 0; font-weight: 500; }

/* ── ورودی‌ها ── */
.inp {
    width: 100%; padding: 12px 14px;
    border: 1px solid var(--line-2); border-radius: var(--r-md);
    font-size: 15px; margin: 6px 0 14px;
    background: #fff; color: var(--text); outline: none;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.inp::placeholder { color: #aab0bc; }
.inp:hover { border-color: #c3c9d3; }
.inp:focus { border-color: var(--brand-500); box-shadow: 0 0 0 4px var(--ring); background: #fff; }
select.inp { cursor: pointer; }
textarea.inp { resize: vertical; }

/* ── دکمه‌ها ── */
.btn {
    display: block; width: 100%; padding: 12px 16px;
    border-radius: var(--r-md); border: 1px solid transparent;
    font-size: 15px; font-weight: 600; font-family: inherit; cursor: pointer;
    margin-top: 12px; text-align: center; text-decoration: none;
    transition: transform .12s ease, box-shadow .15s ease, background .15s, opacity .15s, border-color .15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; transform: none; box-shadow: none; }
.btn.primary { background: var(--brand-grad); color: #fff; box-shadow: var(--sh-brand); }
.btn.primary:hover:not(:disabled) { box-shadow: 0 10px 26px rgba(36, 86, 166, .38); }
.btn.ghost { background: #fff; color: var(--text-2); border-color: var(--line-2); box-shadow: var(--sh-xs); }
.btn.ghost:hover:not(:disabled) { border-color: var(--brand-500); color: var(--brand-600); background: var(--brand-soft); }
.btn.slim { width: auto; display: inline-block; padding: 8px 15px; font-size: 13px; margin-top: 0; }

/* ── چت ── */
.chat-wrap { flex: 1; display: flex; flex-direction: column; max-width: 720px; width: 100%; margin: 0 auto; padding: 0 14px; height: calc(100vh - 63px); }
.chat-scroll { flex: 1; overflow-y: auto; padding: 24px 4px; }
.bubble-row { display: flex; margin-bottom: 14px; animation: rise .32s ease both; }
.bubble-row.ai { justify-content: flex-start; }
.bubble-row.me { justify-content: flex-end; }
.bubble {
    max-width: 82%; padding: 12px 16px; border-radius: 18px;
    font-size: 14.5px; line-height: 2; white-space: pre-wrap;
    box-shadow: var(--sh-sm);
}
.bubble-row.ai .bubble { background: #fff; border: 1px solid var(--line); border-start-start-radius: 5px; }
.bubble-row.me .bubble { background: var(--brand-grad); color: #fff; border-start-end-radius: 5px; box-shadow: var(--sh-brand); }
.bubble.typing { color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }

/* سه‌نقطه‌ی متحرک «در حال نوشتن» */
.typing-dots { display: inline-flex; gap: 4px; }
.typing-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--brand-500); opacity: .5; animation: blink 1.2s infinite ease-in-out; }
.typing-dots i:nth-child(2) { animation-delay: .2s; }
.typing-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.input-bar { display: flex; gap: 10px; padding: 12px 0 18px; align-items: flex-end; }
.chat-inp { margin: 0; resize: none; border-radius: 14px; box-shadow: var(--sh-xs); }
.send-btn { width: auto; padding: 12px 28px; margin: 0; }

/* ── پنل مدیریت ── */
.admin-wrap { flex: 1; max-width: 880px; width: 100%; margin: 0 auto; padding: 24px 16px 48px; }
.admin-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 6px; }
.row-btns { display: flex; gap: 8px; }
.invite-form { display: grid; grid-template-columns: 2fr 1.5fr 1fr auto; gap: 10px; align-items: start; }
.invite-form .inp { margin: 0; }
.invite-form .btn { margin: 0; width: auto; padding: 12px 18px; }
.link-box { display: block; background: var(--brand-soft); border: 1px dashed #b9cdf0; color: var(--brand-700); border-radius: var(--r-sm); padding: 11px 14px; font-size: 13px; word-break: break-all; margin: 10px 0; }

.list-row {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
    padding: 15px 18px; margin-top: 11px;
    display: flex; justify-content: space-between; align-items: center;
    cursor: pointer; flex-wrap: wrap; gap: 10px;
    box-shadow: var(--sh-xs);
    transition: transform .14s ease, box-shadow .16s ease, border-color .16s ease;
}
.list-row:hover { border-color: #c7d4ec; box-shadow: var(--sh-md); transform: translateY(-1px); }
.row-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.score { font-weight: 800; font-size: 17px; color: var(--brand-600); }
.score-big {
    font-weight: 800; font-size: 30px;
    background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
    line-height: 1;
}
.score-big small { font-size: 13px; color: var(--muted); -webkit-text-fill-color: var(--muted); }

/* بج‌های حکم — پیل با پس‌زمینه‌ی ملایم */
.verdict { font-size: 12px; border: 1px solid; border-radius: var(--r-pill); padding: 4px 12px; font-weight: 600; white-space: nowrap; }
.verdict.ok { color: var(--ok); border-color: var(--ok-line); background: var(--ok-bg); }
.verdict.mid { color: var(--warn); border-color: var(--warn-line); background: var(--warn-bg); }
.verdict.bad { color: var(--bad); border-color: var(--bad-line); background: var(--bad-bg); }
.verdict.pending { color: var(--neutral); border-color: var(--neutral-line); background: var(--neutral-bg); }

.detail-top { display: flex; align-items: center; gap: 18px; margin: 16px 0 22px; flex-wrap: wrap; }
.bars { margin: 6px 0 18px; }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.bar-label { width: 92px; font-size: 13px; color: var(--text-2); }
.bar-track { flex: 1; height: 9px; background: #eceef3; border-radius: var(--r-pill); overflow: hidden; }
.bar-fill { height: 100%; background: var(--brand-grad); border-radius: var(--r-pill); transition: width .5s cubic-bezier(.2, .7, .3, 1); }
.bar-num { width: 24px; font-size: 13px; font-weight: 700; text-align: left; color: var(--brand-600); }
.summary-box { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; font-size: 14px; line-height: 2; color: var(--text-2); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; font-size: 13.5px; margin-top: 16px; }
.two-col b { font-size: 13px; color: var(--text); }
.two-col ul { padding-inline-start: 18px; line-height: 2.1; color: var(--text-2); margin: 8px 0; }
.flag-box { background: var(--bad-bg); border: 1px solid var(--bad-line); color: #8f2c22; border-radius: var(--r-md); padding: 11px 15px; font-size: 13.5px; margin-top: 16px; line-height: 2; }
.transcript { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px 18px; font-size: 13.5px; line-height: 2; max-height: 440px; overflow-y: auto; }
.transcript p { margin: 0 0 12px; }
.t-ai { color: var(--brand-600); }
.t-me { color: var(--text); }

@media (max-width: 720px) {
    .invite-form { grid-template-columns: 1fr; }
    .two-col { grid-template-columns: 1fr; }
    .send-btn { padding: 12px 18px; }
    .card { padding: 26px 20px; }
}

/* دسترس‌پذیری */
:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ── لیبل‌ها و اجزای پنل ── */
.labels-box { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0 4px; }
.chip { background: var(--brand-soft); color: var(--brand-700); border-radius: var(--r-pill); padding: 5px 13px; font-size: 13px; display: inline-flex; align-items: center; gap: 7px; font-weight: 500; }
.chip a { cursor: pointer; color: var(--muted); text-decoration: none; font-weight: 800; line-height: 1; }
.chip a:hover { color: var(--bad); }
.chip.small { font-size: 11.5px; padding: 3px 10px; margin-inline-end: 4px; }
.filter-bar { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.slim-inp { width: auto; min-width: 190px; margin: 0; padding: 10px 12px; font-size: 13.5px; }
.pos-form { grid-template-columns: 1fr; }
.pointer { cursor: pointer; }
.list-row.static { cursor: default; box-shadow: none; }
.list-row.static:hover { border-color: var(--line); transform: none; box-shadow: none; }
.list-row.unsuitable { opacity: .5; }
.list-row.unsuitable:hover { opacity: 1; }
.resume-details { margin-top: 16px; }
.resume-details summary { cursor: pointer; font-size: 13.5px; color: var(--text-2); }
.resume-details .transcript { margin-top: 8px; white-space: pre-wrap; }

/* کارت‌های آکاردئونی */
details.card.wide summary { list-style: none; }
details.card.wide summary::-webkit-details-marker { display: none; }
summary.h2 { display: flex; align-items: center; gap: 10px; }
summary.h2::before {
    content: ""; flex: 0 0 auto; width: 8px; height: 8px;
    border-inline-end: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
    transform: rotate(45deg); transition: transform .2s; margin-inline-start: 2px;
}
details[open] > summary.h2::before { transform: rotate(225deg); }

/* آیکن درون دکمه‌ها */
.btn svg { vertical-align: -3px; margin-inline-end: 5px; }
.btn.slim { display: inline-flex; align-items: center; gap: 5px; }
.btn.slim svg { margin: 0; }

/* نشان موفقیت صفحه‌ی پایان مصاحبه */
.center-card { text-align: center; }
.success-badge {
    width: 62px; height: 62px; margin: 0 auto 18px;
    display: grid; place-items: center; border-radius: 50%;
    color: var(--ok); background: var(--ok-bg); border: 1px solid var(--ok-line);
    box-shadow: 0 6px 18px rgba(21, 128, 61, .18);
    animation: pop .35s cubic-bezier(.2, .8, .3, 1.4) both;
}
@keyframes pop { from { opacity: 0; transform: scale(.7); } to { opacity: 1; transform: scale(1); } }

/* ── غربال گروهی رزومه (Drag & Drop) ── */
.dropzone {
    position: relative; display: block; margin: 14px 0 6px;
    border: 2px dashed var(--line-2); border-radius: var(--r-lg);
    background: var(--bg-2);
    transition: border-color .16s, background .16s, box-shadow .16s;
    cursor: pointer;
}
.dropzone:hover { border-color: var(--brand-500); background: var(--brand-soft); box-shadow: 0 0 0 4px var(--ring); }
.dropzone.busy { opacity: .6; pointer-events: none; }
.dropzone-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; margin: 0; }
.dropzone-input::file-selector-button { display: none; }
.dropzone-inner { display: flex; flex-direction: column; align-items: center; gap: 9px; text-align: center; padding: 32px 18px; pointer-events: none; }
.dropzone-icon {
    display: grid; place-items: center; width: 48px; height: 48px;
    border-radius: 50%; background: #fff; color: var(--brand-600);
    font-size: 22px; box-shadow: var(--sh-sm); border: 1px solid var(--line);
}
.dropzone-inner > span:nth-child(2) { font-size: 14.5px; color: var(--text); font-weight: 600; }

.bulk-table { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.bulk-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); padding: 11px 14px; box-shadow: var(--sh-xs); }
.bulk-row.ok-row { border-inline-start: 3px solid var(--ok); }
.bulk-row.warn-row { border-inline-start: 3px solid var(--warn); background: #fffdf7; }
.bulk-row.err-row { border-inline-start: 3px solid var(--bad); background: #fdf7f6; }
.bulk-file { font-size: 12.5px; color: var(--muted); max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bulk-name { font-weight: 700; font-size: 14px; flex: 1; min-width: 120px; }
.bulk-row .btn.slim { margin: 0; }

/* ── ویرایش مشخصات کاندیدا ── */
.edit-info { margin: 6px 0 10px; padding: 4px 0; }
.edit-info summary { cursor: pointer; font-weight: 600; }
.edit-grid { display: grid; grid-template-columns: 2fr 1.5fr 1fr auto; gap: 10px; align-items: start; margin-top: 12px; }
.edit-grid .inp { margin: 0; }
.edit-grid .btn { margin: 0; width: auto; padding: 12px 18px; }
@media (max-width: 720px) { .edit-grid { grid-template-columns: 1fr; } }

/* ── اعتبار سرویس‌های هوش مصنوعی ── */
.credit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin: 14px 0 12px; }
.credit-card { background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; box-shadow: var(--sh-xs); }
.credit-card.ok { border-inline-start: 3px solid var(--ok); }
.credit-card.bad { border-inline-start: 3px solid var(--bad); }
.credit-card.mid { border-inline-start: 3px solid var(--warn); }
.credit-card.pending { border-inline-start: 3px solid var(--neutral); }
.credit-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.credit-amount { display: flex; align-items: baseline; gap: 8px; margin: 8px 0 4px; }
.credit-usd { font-size: 26px; font-weight: 800; letter-spacing: -.5px; }
.credit-usd.muted-amount { color: var(--muted); font-weight: 600; }
.credit-card .meta { margin: 0; line-height: 1.7; }

/* ── فیلدهای دلخواه کلید/مقدار ── */
.kv-list { display: flex; flex-direction: column; gap: 7px; margin: 12px 0; }
.kv-row {
    display: grid; grid-template-columns: minmax(120px, 200px) 1fr auto; gap: 12px; align-items: center;
    background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 14px;
}
.kv-key { font-weight: 700; font-size: 13.5px; color: var(--text-2); }
.kv-val { font-size: 14px; }
.kv-actions { display: flex; gap: 12px; }
.kv-actions a { cursor: pointer; font-size: 12.5px; color: var(--brand-600); text-decoration: none; }
.kv-actions a.danger { color: var(--bad); }
.kv-add { display: grid; grid-template-columns: minmax(140px, 240px) 1fr auto; gap: 10px; align-items: start; margin-top: 10px; }
.kv-add .inp { margin: 0; }
.kv-add .btn { margin: 0; width: auto; padding: 12px 20px; }
.chip.kv-chip { background: var(--neutral-bg); color: var(--text-2); }
@media (max-width: 720px) { .kv-row, .kv-add { grid-template-columns: 1fr; } }

/* ── گالری نمونه‌کارها ── */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin: 16px 0; }
.media-card {
    margin: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--r-md);
    overflow: hidden; box-shadow: var(--sh-xs); display: flex; flex-direction: column;
}
.media-card img, .media-card video {
    width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: #0d1117;
}
.media-card figcaption { padding: 9px 11px; display: flex; flex-direction: column; gap: 3px; }
.media-name { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-meta { font-size: 11.5px; color: var(--muted); }
.media-del { align-self: flex-start; margin-top: 3px; cursor: pointer; font-size: 11.5px; color: var(--bad); text-decoration: none; }
.portfolio-actions { align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.portfolio-actions .meta { margin: 0; max-width: 520px; }
.media-tag { align-self: flex-start; margin-top: 4px; font-size: 10.5px; padding: 2px 8px; border-radius: var(--r-pill); }
.media-tag.manual { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-line); }

/* ── آزمون عملی ── */
.test-actions { align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.test-actions .btn { margin: 0; width: auto; display: inline-block; padding: 10px 22px; font-size: 14px; }
.sub-list { display: flex; flex-direction: column; gap: 7px; margin: 12px 0; }
.sub-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
           background: #fff; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 9px 14px; box-shadow: var(--sh-xs); }
.sub-name { font-size: 13px; font-weight: 600; color: var(--brand-600); text-decoration: none;
            max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub-name:hover { text-decoration: underline; }
.sub-row .media-meta { flex: 1; }
.test-focus { margin-bottom: 4px; resize: vertical; }
