/* ==================================================================
   سامانه نظرسنجی کسب‌وکار  |  استایل اصلی
   ================================================================== */

@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-ExtraBold.woff2') format('woff2');
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}

:root {
    --brand: #2563eb;
    --brand-dark: #1d4ed8;
    --brand-soft: #eff6ff;
    --bg: #f1f5f9;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text: #0f172a;
    --muted: #64748b;
    --success: #16a34a;
    --success-soft: #dcfce7;
    --warning: #d97706;
    --warning-soft: #fef3c7;
    --danger: #dc2626;
    --danger-soft: #fee2e2;
    --info: #0ea5e9;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, .08);
    --shadow: 0 6px 24px rgba(15, 23, 42, .08);
    --shadow-lg: 0 18px 45px rgba(15, 23, 42, .12);
    --sidebar-w: 264px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: Vazirmatn, "Vazir", "IRANSans", "Segoe UI", Tahoma, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.8;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }

h1, h2, h3, h4 { margin: 0 0 .5rem; font-weight: 700; line-height: 1.5; }
p { margin: 0 0 1rem; }

.container { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 20px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, Consolas, monospace; letter-spacing: 1px; }
.nowrap { white-space: nowrap; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; } .mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; } .flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.flex-wrap { flex-wrap: wrap; } .gap-1 { gap: .5rem; } .gap-2 { gap: 1rem; }
.items-center { align-items: center; }

/* ---------------- دکمه‌ها ---------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 20px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text); font: inherit; font-weight: 600;
    cursor: pointer; transition: .18s ease; white-space: nowrap; text-decoration: none;
}
.btn:hover { border-color: #cbd5e1; background: #f8fafc; color: var(--text); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(.94); color: #fff; }
.btn-danger { background: var(--danger-soft); border-color: #fecaca; color: var(--danger); }
.btn-danger:hover { background: #fecaca; color: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: #f1f5f9; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 14px 30px; font-size: 16px; }
.btn-block { width: 100%; }
.btn:disabled, .btn.is-disabled { opacity: .55; cursor: not-allowed; }

/* ---------------- نشان‌ها ---------------- */
.badge {
    display: inline-block; padding: 3px 11px; border-radius: 999px;
    font-size: 12px; font-weight: 700; line-height: 1.7;
}
.badge-new { background: var(--danger-soft); color: var(--danger); }
.badge-read { background: var(--warning-soft); color: var(--warning); }
.badge-archived { background: #e2e8f0; color: #475569; }
.badge-active { background: var(--success-soft); color: #15803d; }
.badge-draft { background: #e0e7ff; color: #4338ca; }
.badge-closed { background: #e2e8f0; color: #475569; }
.badge-criticism { background: var(--danger-soft); color: var(--danger); }
.badge-suggestion { background: var(--brand-soft); color: var(--brand-dark); }
.badge-compliment { background: var(--success-soft); color: #15803d; }
.badge-other { background: #e2e8f0; color: #475569; }
.badge-person { background: var(--brand-soft); color: var(--brand-dark); }
.badge-branch { background: #f3e8ff; color: #7e22ce; }
.badge-business { background: #ccfbf1; color: #0f766e; }

/* ---------------- فرم‌ها ---------------- */
.form-group { margin-bottom: 1.1rem; }
.form-label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 14px; }
.form-label .req { color: var(--danger); }
.form-control, .form-select, textarea.form-control {
    width: 100%; padding: 10px 14px; font: inherit; color: var(--text);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
    transition: .18s ease;
}
.form-control:focus, .form-select:focus {
    outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .14);
}
textarea.form-control { min-height: 110px; resize: vertical; line-height: 1.9; }
.form-hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.form-error { font-size: 12.5px; color: var(--danger); margin-top: 4px; }
.form-control.is-invalid { border-color: var(--danger); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.checkbox { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.checkbox input { width: 17px; height: 17px; accent-color: var(--brand); }
.form-actions { display: flex; gap: 10px; align-items: center; padding-top: 1rem; border-top: 1px solid var(--border); margin-top: 1.5rem; }

/* ---------------- پیام‌ها ---------------- */
.alert { padding: 13px 18px; border-radius: var(--radius-sm); margin-bottom: 1.2rem; font-weight: 600; border: 1px solid transparent; }
.alert-success { background: var(--success-soft); color: #15803d; border-color: #bbf7d0; }
.alert-error { background: var(--danger-soft); color: #b91c1c; border-color: #fecaca; }
.alert-warning { background: var(--warning-soft); color: #b45309; border-color: #fde68a; }
.alert-info { background: var(--brand-soft); color: var(--brand-dark); border-color: #bfdbfe; }

/* ==================================================================
   بخش عمومی
   ================================================================== */
.public-body { background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%); display: flex; flex-direction: column; min-height: 100vh; }

.public-header { background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.public-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 20px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); }
.brand__mark {
    width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
    background: var(--brand); color: #fff; font-weight: 800; font-size: 20px;
}
.brand__logo { width: 44px; height: 44px; border-radius: 12px; object-fit: cover; }
.brand__text { display: flex; flex-direction: column; line-height: 1.4; }
.brand__text strong { font-size: 15px; }
.brand__text small { color: var(--muted); font-size: 12px; }
.public-nav { display: flex; gap: 18px; font-size: 14px; font-weight: 600; }

.public-main { flex: 1; padding: 40px 0 60px; }
.public-footer { padding: 20px 0; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; text-align: center; }

.hero { text-align: center; margin-bottom: 36px; }
.hero__badge {
    display: inline-block; padding: 5px 16px; border-radius: 999px;
    background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; font-size: 13px; margin-bottom: 16px;
}
.hero__title { font-size: 30px; margin-bottom: 10px; }
.hero__subtitle { color: var(--muted); max-width: 640px; margin: 0 auto; }

.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow-sm); }
.card__icon { font-size: 30px; margin-bottom: 12px; }
.card__title { font-size: 17px; margin-bottom: 8px; }
.card__text { color: var(--muted); font-size: 14px; margin-bottom: 16px; }

.info-bar {
    display: flex; flex-wrap: wrap; gap: 30px; justify-content: center;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 18px 26px; margin: 28px 0; box-shadow: var(--shadow-sm);
}
.info-bar__label { display: block; font-size: 12px; color: var(--muted); }
.info-bar strong { font-size: 15px; }

/* --- کد رهگیری --- */
.receipt-box { text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 40px 30px; box-shadow: var(--shadow); max-width: 560px; margin: 20px auto; }
.receipt-code {
    font-size: 30px; font-weight: 800; letter-spacing: 4px; color: var(--brand-dark);
    background: var(--brand-soft); border: 2px dashed #bfdbfe; border-radius: var(--radius-sm);
    padding: 16px; margin: 20px 0; font-family: ui-monospace, Consolas, monospace;
}
.receipt-success-icon { font-size: 54px; }

/* ==================================================================
   نظرسنجی
   ================================================================== */
.survey-shell { max-width: 900px; margin: 0 auto; }
.survey-progress { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.survey-progress__bar { flex: 1; height: 8px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.survey-progress__fill { height: 100%; background: var(--brand); width: 0; transition: width .3s ease; }

.survey-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 20px; box-shadow: var(--shadow-sm); }
.survey-section__head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.survey-section__num { width: 30px; height: 30px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark); display: grid; place-items: center; font-weight: 800; font-size: 14px; }
.survey-section__title { font-size: 18px; margin: 0; }
.survey-section__desc { color: var(--muted); font-size: 13.5px; margin-bottom: 18px; }

.person-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 18px; margin-bottom: 14px; background: #fcfdff; }
.person-card__head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.person-avatar { width: 46px; height: 46px; border-radius: 12px; object-fit: cover; background: var(--brand-soft); display: grid; place-items: center; font-weight: 800; color: var(--brand-dark); }
.person-avatar--lg { width: 64px; height: 64px; font-size: 22px; }
.person-card__name { font-weight: 700; font-size: 15.5px; }
.person-card__role { color: var(--muted); font-size: 12.5px; }

.score-item { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; padding: 12px 0; border-top: 1px dashed var(--border); }
.score-item:first-of-type { border-top: none; }
.score-item__title { font-size: 14px; font-weight: 600; }
.score-item__cat { font-size: 11.5px; color: var(--muted); }

.score-picker { display: flex; flex-wrap: wrap; gap: 5px; direction: ltr; justify-content: flex-end; }
.score-picker input { position: absolute; opacity: 0; pointer-events: none; }
.score-picker label {
    width: 38px; height: 38px; display: grid; place-items: center; cursor: pointer;
    border: 1px solid var(--border); border-radius: 9px; background: var(--surface);
    font-weight: 700; font-size: 14px; transition: .15s ease; color: var(--muted);
}
.score-picker label:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.score-picker input:checked + label { background: var(--brand); border-color: var(--brand); color: #fff; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37,99,235,.35); }
.score-picker input:focus-visible + label { box-shadow: 0 0 0 3px rgba(37,99,235,.3); }

.comment-block { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; margin-bottom: 14px; }
.comment-type-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.comment-type-tabs input { position: absolute; opacity: 0; }
.comment-type-tabs label { padding: 7px 16px; border: 1px solid var(--border); border-radius: 999px; cursor: pointer; font-size: 13px; font-weight: 600; background: var(--surface); }
.comment-type-tabs input:checked + label { background: var(--brand); border-color: var(--brand); color: #fff; }

.sticky-submit {
    position: sticky; bottom: 0; background: rgba(255,255,255,.94); backdrop-filter: blur(8px);
    border-top: 1px solid var(--border); padding: 14px 0; margin-top: 10px; z-index: 5;
}

/* ==================================================================
   پنل مدیریت
   ================================================================== */
.admin-body { background: var(--bg); }

.admin-layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w); flex-shrink: 0; background: #0f172a; color: #cbd5e1;
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar__brand { padding: 20px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid #1e293b; }
.sidebar__brand .brand__mark { background: var(--brand); }
.sidebar__brand strong { color: #fff; font-size: 15px; display: block; }
.sidebar__brand small { color: #64748b; font-size: 11.5px; }
.sidebar__group { padding: 14px 20px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: #475569; font-weight: 700; }
.sidebar__link {
    display: flex; align-items: center; gap: 11px; padding: 10px 20px; color: #cbd5e1;
    font-size: 14px; font-weight: 600; border-right: 3px solid transparent; transition: .15s ease;
}
.sidebar__link:hover { background: #1e293b; color: #fff; }
.sidebar__link.active { background: #1e293b; color: #fff; border-right-color: var(--brand); }
.sidebar__link .icon { font-size: 17px; width: 20px; text-align: center; }
.sidebar__foot { margin-top: auto; padding: 16px 20px; border-top: 1px solid #1e293b; }

.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.admin-topbar {
    background: var(--surface); border-bottom: 1px solid var(--border);
    padding: 14px 26px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
    position: sticky; top: 0; z-index: 20;
}
.admin-topbar h1 { font-size: 19px; margin: 0; }
.admin-topbar__sub { font-size: 12.5px; color: var(--muted); }
.admin-user { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.admin-user__avatar { width: 36px; height: 36px; border-radius: 10px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; }
.admin-content { padding: 26px; flex: 1; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { color: var(--muted); font-size: 13.5px; margin: 0; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); margin-bottom: 22px; }
.panel__head { padding: 16px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.panel__title { font-size: 16px; margin: 0; }
.panel__body { padding: 22px; }
.panel__body--flush { padding: 0; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; margin-bottom: 24px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); }
.kpi__label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.kpi__value { font-size: 30px; font-weight: 800; margin-top: 6px; line-height: 1.2; }
.kpi__meta { font-size: 12px; color: var(--muted); margin-top: 4px; }
.kpi__icon { float: left; font-size: 24px; opacity: .85; }

.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.table th, table.table td { padding: 12px 16px; text-align: right; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.table th { background: #f8fafc; font-size: 12.5px; color: #475569; font-weight: 700; white-space: nowrap; }
table.table tbody tr:hover { background: #f8fafc; }
table.table td.actions { white-space: nowrap; text-align: left; }
.table-empty { padding: 44px 20px; text-align: center; color: var(--muted); }

.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filters .form-group { margin-bottom: 0; min-width: 170px; }

.chart-box { position: relative; min-height: 300px; }
.chart-box--sm { min-height: 240px; }

.score-pill {
    display: inline-block; min-width: 46px; padding: 4px 10px; border-radius: 8px;
    font-weight: 800; text-align: center;
}
.score-good { background: var(--success-soft); color: #15803d; }
.score-mid { background: var(--warning-soft); color: #b45309; }
.score-bad { background: var(--danger-soft); color: #b91c1c; }
.score-none { background: #f1f5f9; color: var(--muted); }

.ranking { list-style: none; padding: 0; margin: 0; }
.ranking li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.ranking li:last-child { border-bottom: none; }
.ranking__rank { width: 26px; height: 26px; border-radius: 8px; background: #f1f5f9; color: #475569; display: grid; place-items: center; font-weight: 800; font-size: 12.5px; flex-shrink: 0; }
.ranking__rank--top { background: var(--brand-soft); color: var(--brand-dark); }
.ranking__name { flex: 1; font-weight: 600; font-size: 14px; }
.ranking__meta { font-size: 12px; color: var(--muted); }

.comment-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 18px; margin-bottom: 14px; background: var(--surface); }
.comment-card--new { border-right: 4px solid var(--danger); }
.comment-card--read { border-right: 4px solid var(--warning); }
.comment-card--archived { border-right: 4px solid #cbd5e1; }
.comment-card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.comment-card__body { background: #f8fafc; border-radius: var(--radius-sm); padding: 14px 16px; font-size: 14.5px; line-height: 2; white-space: pre-wrap; }
.comment-card__meta { display: flex; flex-wrap: wrap; gap: 16px; font-size: 12.5px; color: var(--muted); margin-top: 12px; }

.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { padding: 4px 12px; border-radius: 999px; background: #f1f5f9; font-size: 12.5px; font-weight: 600; color: #475569; }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 20px; flex-wrap: wrap; }
.tabs a { padding: 10px 18px; font-weight: 600; font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }

.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.pagination a, .pagination span { padding: 7px 13px; border: 1px solid var(--border); border-radius: 8px; font-size: 13.5px; background: var(--surface); }
.pagination .current { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 700; }

/* ورود */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #0f172a, #1e3a8a); padding: 24px; }
.login-card { width: 100%; max-width: 420px; background: var(--surface); border-radius: 20px; padding: 38px 34px; box-shadow: var(--shadow-lg); }
.login-card__logo { width: 60px; height: 60px; border-radius: 16px; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 26px; margin: 0 auto 18px; }
.login-card h1 { text-align: center; font-size: 21px; }
.login-card p.sub { text-align: center; color: var(--muted); font-size: 13.5px; margin-bottom: 24px; }

.matrix-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.matrix-table th, .matrix-table td { border: 1px solid var(--border); padding: 8px 10px; text-align: center; }
.matrix-table th { background: #f8fafc; }
.matrix-table td.name { text-align: right; font-weight: 600; white-space: nowrap; }

.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }
.qr-item { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; text-align: center; background: var(--surface); }
.qr-item img { width: 150px; height: 150px; margin: 0 auto 10px; display: block; }
.qr-item__label { font-size: 13px; font-weight: 700; }

.token-code { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; letter-spacing: 1px; background: #f1f5f9; padding: 3px 8px; border-radius: 6px; display: inline-block; }

.sidebar-toggle { display: none; background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text); }

@media (max-width: 980px) {
    .sidebar {
        position: fixed; inset: 0 auto 0 0; z-index: 60; transform: translateX(-100%);
        transition: transform .25s ease; height: 100vh;
    }
    .sidebar.is-open { transform: translateX(0); }
    .sidebar-toggle { display: block; }
    .admin-content { padding: 18px; }
    .admin-topbar { padding: 12px 16px; }
    .hero__title { font-size: 24px; }
    .public-header__inner { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 620px) {
    .score-picker label { width: 34px; height: 34px; font-size: 13px; }
    .score-item { grid-template-columns: 1fr; }
    .score-picker { justify-content: flex-start; }
    .receipt-code { font-size: 22px; letter-spacing: 2px; }
}

@media print {
    .sidebar, .admin-topbar, .no-print, .public-header, .public-footer { display: none !important; }
    .admin-layout, .admin-main, .admin-content { display: block; padding: 0; }
    body { background: #fff; }
    .panel { box-shadow: none; border-color: #cbd5e1; page-break-inside: avoid; }
}
