/* «پرس‌وجو» (templates/community/page.html, static/js/community/porsojoo.js).
   Laid out like the reference screens the owner chose: borderless rows split by
   thin lines, outlined pills, black buttons, a tinted header in the group's own
   colour, and the question written on a thread line under its group. The app
   copies these values (mobile/lib/features/community/community_widgets.dart → Psj). */
.psj {
    --psj-ink: #0c0c0c;
    --psj-text: #3f4064;
    --psj-muted: #81858b;
    --psj-faint: #a1a3a8;
    --psj-line: #f0f0f1;
    --psj-border: #e0e0e2;
    --psj-chip: #f0f0f1;
    --psj-black: #19191b;
    --psj-red: #d32f2f;
    --psj-tip: #eaf0fb;
    --psj-group: #4c1d95;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    max-width: 760px;
    margin: 0 auto;
    padding: 0 0 110px;
    font-family: Estedad, Vazirmatn, tahoma, sans-serif;
    color: var(--psj-ink);
    background: #fff;
}
.psj *, .psj *::before, .psj *::after { box-sizing: border-box; }
.psj svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
/* zero specificity, so each button class sets its own colour */
:where(.psj) button { font: inherit; color: inherit; }
.psj .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.psj-pad { padding: 12px 16px; }

/* ---- phones: an app-like screen (no site header/footer; bars stick to the bottom) */
@media (max-width: 1023px) {
    .psj-page .platform-shared-header, .psj-page .info-footer { display: none !important; }
    .psj-page-question .psj, .psj-page-ask .psj { padding-bottom: 96px; }
}

/* ---- feed top: «پرس‌وجو» and the reader's avatar */
.psj-top { display: flex; align-items: center; justify-content: space-between; height: 56px; padding: 0 16px; border-bottom: 1px solid var(--psj-line); }
.psj-top h1 { margin: 0; font-size: 18px; font-weight: 800; }
.psj-me { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; color: var(--psj-muted); background: var(--psj-chip); border: 0; border-radius: 50%; cursor: pointer; }
.psj-me svg { width: 20px; height: 20px; }

/* ---- chips */
.psj-chips { display: flex; gap: 8px; overflow-x: auto; padding: 12px 16px; scrollbar-width: none; }
.psj-chips::-webkit-scrollbar { display: none; }
.psj-chip { display: inline-flex; align-items: center; gap: 6px; flex: none; height: 36px; padding: 0 14px; font-size: 14px; font-weight: 500; color: var(--psj-ink); text-decoration: none; background: var(--psj-chip); border: 0; border-radius: 999px; cursor: pointer; }
.psj-chip svg { width: 18px; height: 18px; }
.psj-chip.is-active { color: #fff; background: var(--psj-black); }
.psj-chip[hidden] { display: none; }

/* ---- «با پرس‌وجو آشنا شو» */
.psj-tip { display: flex; align-items: center; gap: 8px; margin: 0 16px 8px; padding: 10px 12px; background: var(--psj-tip); border-radius: 8px; }
.psj-tip[hidden] { display: none; }
.psj-tip-icon { width: 22px !important; height: 22px !important; color: #1d4ed8; }
.psj-tip-text { flex: 1; font-size: 14px; font-weight: 600; }
.psj-tip-link { padding: 0; font-size: 13px; font-weight: 600; text-decoration: underline; text-underline-offset: 5px; background: none; border: 0; cursor: pointer; }

/* ---- a question / an answer row */
.psj-post { padding: 16px; border-bottom: 1px solid var(--psj-line); }
.psj-post.is-hidden { background: #fffbf5; }
.psj-post-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.psj-post-head .psj-author { flex: 1; }
.psj-author { display: flex; align-items: center; gap: 8px; min-width: 0; }
.psj-avatar { width: 32px; height: 32px; flex: none; object-fit: cover; border-radius: 50%; background: var(--psj-chip); }
.psj-avatar.is-letter { display: grid; place-items: center; font-size: 14px; font-weight: 700; color: var(--psj-text); background: #ffe7a3; }
.psj-author-copy { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; min-width: 0; }
.psj-author-copy strong { overflow: hidden; max-width: 160px; font-size: 14px; font-weight: 700; white-space: nowrap; text-overflow: ellipsis; }
.psj-author-copy time { font-size: 12px; color: var(--psj-muted); }
.psj-badge { align-self: center; padding: 0 6px; font-size: 11px; font-weight: 600; line-height: 20px; color: #067647; background: #ecfdf3; border-radius: 4px; }
.psj-group-chip { flex: none; max-width: 42%; overflow: hidden; padding: 3px 10px; font-size: 12px; font-weight: 600; color: var(--psj-text); text-decoration: none; white-space: nowrap; text-overflow: ellipsis; background: color-mix(in srgb, var(--chip, #4c1d95) 14%, #fff); border-radius: 999px; }
.psj-icon-btn { display: inline-grid; place-items: center; flex: none; width: 32px; height: 32px; padding: 0; color: var(--psj-muted); background: none; border: 0; border-radius: 50%; cursor: pointer; }
.psj-icon-btn:hover { background: var(--psj-line); }
.psj-icon-btn svg { width: 20px; height: 20px; }

.psj-text { display: block; margin: 12px 0 0; font-size: 15px; font-weight: 500; line-height: 2.1; color: var(--psj-ink); text-decoration: none; white-space: pre-line; overflow-wrap: anywhere; }
.psj-text.is-clamped { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.psj-more-link { display: inline-block; margin-top: 4px; padding: 0; font-size: 13px; font-weight: 600; color: var(--psj-ink); text-decoration: underline; text-underline-offset: 6px; background: none; border: 0; cursor: pointer; }
.psj-more-link[hidden] { display: none; }
.psj-hidden-note { margin: 10px 0 0; padding: 8px 10px; font-size: 12.5px; line-height: 1.8; color: #b54708; background: #fffaeb; border-radius: 8px; }

.psj-product { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 8px 10px 8px 8px; color: inherit; text-decoration: none; background: #fff; border: 1px solid var(--psj-border); border-radius: 12px; }
.psj-product img, .psj-product-noimg { width: 64px; height: 64px; flex: none; object-fit: cover; border-radius: 8px; background: var(--psj-chip); }
.psj-product-copy { display: grid; gap: 8px; flex: 1; min-width: 0; }
.psj-product-name { overflow: hidden; font-size: 14px; font-weight: 700; white-space: nowrap; text-overflow: ellipsis; }
.psj-product-price { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--psj-text); }
.psj-product-price strong { font-size: 15px; font-weight: 700; color: var(--psj-ink); }
.psj-off { padding: 0 6px; font-size: 12px; font-weight: 700; line-height: 20px; color: #fff; background: var(--psj-red); border-radius: 999px; }
.psj-remove { display: grid; place-items: center; width: 34px; height: 34px; flex: none; padding: 0; color: #fff; background: #9e9fb1; border: 0; border-radius: 50%; cursor: pointer; }
.psj-remove svg { width: 18px; height: 18px; stroke-width: 2.2; }

.psj-post-foot { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.psj-pill { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; font-size: 14px; color: var(--psj-ink); text-decoration: none; background: #fff; border: 1px solid var(--psj-border); border-radius: 999px; cursor: pointer; }
.psj-pill svg { width: 18px; height: 18px; }
.psj-pill.is-on { color: #fff; background: var(--psj-black); border-color: var(--psj-black); }
.psj-pill.is-static { cursor: default; }
.psj-pill[disabled] { opacity: .6; }
.psj-react { display: inline-flex; align-items: center; gap: 6px; padding: 4px 2px; font-size: 14px; color: var(--psj-text); background: none; border: 0; cursor: pointer; }
.psj-react svg { width: 20px; height: 20px; }
.psj-react.is-on { color: var(--psj-ink); }
.psj-react.is-on svg { fill: var(--psj-ink); stroke: var(--psj-ink); }

/* ---- a group's header and the question page's: tinted with the group's colour */
.psj-head { display: flex; align-items: center; gap: 10px; height: 64px; padding: 0 12px; color: #fff; background: var(--psj-group); }
.psj-head h1 { flex: 1; margin: 0; overflow: hidden; font-size: 16px; font-weight: 700; white-space: nowrap; text-overflow: ellipsis; }
.psj-head-btn { display: grid; place-items: center; width: 40px; height: 40px; flex: none; padding: 0; color: #fff; background: rgba(255, 255, 255, .14); border: 0; border-radius: 50%; cursor: pointer; }
.psj-head-btn[hidden] { display: none; }
.psj-head-group { display: flex; flex: 1; align-items: center; gap: 10px; min-width: 0; color: #fff; text-decoration: none; }
.psj-head-group span:last-child { overflow: hidden; font-size: 16px; font-weight: 700; white-space: nowrap; text-overflow: ellipsis; }
.psj-group-about { margin: 0; padding: 12px 16px 0; font-size: 13.5px; line-height: 1.9; color: var(--psj-muted); }
.psj-sep { height: 8px; background: var(--psj-line); }
.psj-answers-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 4px; }
.psj-answers-head h2 { margin: 0; font-size: 16px; font-weight: 800; }
.psj-sort { display: inline-flex; align-items: center; gap: 6px; padding: 4px; font-size: 14px; background: none; border: 0; cursor: pointer; }
.psj-sort svg { width: 20px; height: 20px; }
.psj-answer .psj-text { margin-top: 10px; font-weight: 400; }
.psj-answer .psj-product { margin-top: 10px; }

/* the reply box under a question */
.psj-reply { position: fixed; inset-inline: 0; bottom: 0; z-index: 30; max-width: 760px; margin: 0 auto; padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)); background: #fff; border-top: 1px solid var(--psj-line); }
.psj-reply-row { display: flex; align-items: flex-end; gap: 8px; }
.psj-reply [data-psj-reply-picked] .psj-product { margin: 0 0 10px; }
.psj-reply-add { display: grid; place-items: center; width: 44px; height: 44px; flex: none; padding: 0; color: var(--psj-ink); background: var(--psj-chip); border: 0; border-radius: 8px; cursor: pointer; }
.psj-reply-add svg { width: 22px; height: 22px; }
.psj-reply-add.is-on { color: #fff; background: var(--psj-black); }
.psj-reply textarea { flex: 1; min-height: 44px; max-height: 180px; padding: 10px 14px; font: inherit; font-size: 14px; line-height: 1.7; color: var(--psj-ink); resize: none; background: var(--psj-chip); border: 0; border-radius: 8px; outline: none; }
.psj-send { display: grid; place-items: center; width: 44px; height: 44px; flex: none; color: #fff; background: var(--psj-black); border: 0; border-radius: 50%; cursor: pointer; }
.psj-send svg { width: 19px; height: 19px; transform: scaleX(-1); }
.psj-send[disabled] { background: var(--psj-border); cursor: default; }

/* ---- page bars (groups, asking) */
.psj-bar { display: flex; align-items: center; gap: 8px; height: 60px; padding: 0 8px; border-bottom: 1px solid var(--psj-border); }
.psj-bar h1 { margin: 0; overflow: hidden; font-size: 17px; font-weight: 800; white-space: nowrap; text-overflow: ellipsis; }
.psj-back { display: inline-grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0; color: var(--psj-ink); background: none; border: 0; border-radius: 50%; cursor: pointer; }
.psj-back svg { width: 24px; height: 24px; }

/* ---- search */
.psj-search { display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 14px; color: var(--psj-faint); background: var(--psj-chip); border-radius: 8px; }
.psj-search input { flex: 1; min-width: 0; height: 100%; font: inherit; font-size: 14px; color: var(--psj-ink); background: none; border: 0; outline: none; }
.psj-search input::placeholder { color: var(--psj-muted); }

/* ---- group rows (the list, and step 1 of asking) */
.psj-section-title { margin: 0; padding: 14px 16px 6px; font-size: 15px; font-weight: 800; }
.psj-group-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; color: inherit; text-decoration: none; border-bottom: 1px solid var(--psj-line); cursor: pointer; }
.psj-group-row[hidden], .psj-section-title[hidden] { display: none; }
.psj-group-row:hover { background: #fcfcfd; }
.psj-group-icon { display: grid; place-items: center; width: 44px; height: 44px; flex: none; overflow: hidden; font-size: 17px; font-weight: 800; color: #fff; background: var(--chip, var(--psj-group)); border: 1px solid var(--psj-line); border-radius: 10px; }
.psj-group-icon img { width: 100%; height: 100%; object-fit: cover; background: #fff; }
.psj-group-icon.is-head { width: 40px; height: 40px; font-size: 16px; color: var(--psj-group); background: #fff; border: 0; border-radius: 8px; }
.psj-group-icon.is-small { width: 36px; height: 36px; font-size: 14px; border-radius: 8px; }
.psj-group-copy { display: grid; gap: 4px; flex: 1; min-width: 0; }
.psj-group-copy strong { font-size: 15px; font-weight: 700; }
.psj-group-copy small { overflow: hidden; font-size: 13px; color: var(--psj-muted); white-space: nowrap; text-overflow: ellipsis; }
.psj-chevron { width: 20px !important; height: 20px !important; color: var(--psj-faint); }
.psj-radio-dot { position: relative; width: 24px; height: 24px; flex: none; margin: 0; appearance: none; -webkit-appearance: none; border: 2px solid var(--psj-text); border-radius: 50%; cursor: pointer; }
.psj-radio-dot:checked { border-color: var(--psj-ink); }
.psj-radio-dot:checked::after { content: ""; position: absolute; inset: 3px; background: var(--psj-ink); border-radius: 50%; }

/* ---- writing: the group on top, then a thread line down the side */
.psj-step[hidden] { display: none; }
.psj-compose { position: relative; padding: 16px 16px 0; }
.psj-compose-group { display: flex; align-items: center; gap: 10px; width: 100%; padding: 0; text-align: start; background: none; border: 0; cursor: pointer; }
.psj-compose-group span:last-child { font-size: 15px; font-weight: 700; }
.psj-thread-body { position: relative; margin: 8px 0 0; padding: 4px 0 8px; padding-inline-start: 44px; }
.psj-thread-body::before { content: ""; position: absolute; top: 0; bottom: 0; inset-inline-start: 17px; width: 2px; background: var(--psj-border); border-radius: 2px; }
.psj-thread-body .psj-avatar { width: 36px; height: 36px; }
.psj-compose textarea { display: block; width: 100%; min-height: 96px; margin-top: 8px; padding: 0; font: inherit; font-size: 15px; line-height: 2; color: var(--psj-ink); resize: none; background: none; border: 0; outline: none; }
.psj-compose textarea::placeholder { color: var(--psj-muted); }
.psj-compose-tools { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.psj-add { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; font-size: 14px; font-weight: 600; background: var(--psj-chip); border: 0; border-radius: 8px; cursor: pointer; }
.psj-add svg { width: 20px; height: 20px; }
.psj-add[hidden] { display: none; }
.psj-counter { font-size: 13px; font-weight: 600; color: var(--psj-ink); }
.psj-note { margin: 8px 0 0; font-size: 12px; color: var(--psj-muted); }
.psj-error { margin: 10px 0 0; font-size: 13px; font-weight: 600; color: var(--psj-red); }
.psj-error[hidden] { display: none; }

/* ---- buttons stuck to the bottom */
.psj-sticky { position: fixed; inset-inline: 0; bottom: 0; z-index: 30; max-width: 760px; margin: 0 auto; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); background: #fff; border-top: 1px solid var(--psj-line); }
.psj-btn { display: flex; align-items: center; justify-content: center; width: 100%; height: 52px; padding: 0 18px; font-size: 16px; font-weight: 800; color: #fff; text-decoration: none; background: var(--psj-black); border: 0; border-radius: 8px; cursor: pointer; }
.psj-btn[disabled] { color: #fff; background: #e0e0e2; cursor: default; }
.psj-btn.is-light { color: var(--psj-ink); background: #fff; border: 1px solid var(--psj-border); }
.psj-btn.is-inline { display: inline-flex; width: auto; height: 44px; margin-top: 12px; font-size: 14px; }

/* ---- «بپرسید» */
.psj-fab { position: fixed; inset-inline-end: max(16px, calc(50% - 364px)); bottom: calc(80px + env(safe-area-inset-bottom, 0px)); z-index: 40; display: inline-flex; align-items: center; gap: 8px; height: 52px; padding: 0 22px; font-size: 16px; font-weight: 800; color: #fff; text-decoration: none; background: var(--psj-black); border-radius: 999px; box-shadow: 0 6px 20px rgba(0, 0, 0, .22); }
.psj-fab svg { width: 22px; height: 22px; }
.psj-fab[hidden] { display: none; }

/* ---- states */
.psj-loading { display: flex; align-items: center; justify-content: center; min-height: 160px; margin: 0; }
.psj-more { display: flex; justify-content: center; padding: 18px; }
.psj-more[hidden] { display: none; }
.psj-empty { display: grid; justify-items: center; gap: 8px; padding: 48px 24px; text-align: center; }
.psj-empty-art { display: grid; place-items: center; width: 96px; height: 96px; margin-bottom: 8px; color: #8d8e99; background: linear-gradient(145deg, #f7f7f8, #e4e4e7); border-radius: 26px; box-shadow: 0 10px 24px rgba(0, 0, 0, .08), inset 0 2px 0 #fff; }
.psj-empty-art svg { width: 44px !important; height: 44px !important; stroke-width: 2.2; }
.psj-empty strong { font-size: 16px; font-weight: 800; }
.psj-empty p { margin: 0; font-size: 14px; line-height: 1.9; color: var(--psj-muted); }

/* ---- bottom sheets (⋮, report, guide) */
.psj-sheet { width: 100%; max-width: 520px; max-height: 90vh; margin: auto auto 0; padding: 0; color: #0c0c0c; background: #fff; border: 0; border-radius: 16px 16px 0 0; font-family: Estedad, Vazirmatn, tahoma, sans-serif; overflow: hidden; }
.psj-sheet::backdrop { background: rgba(0, 0, 0, .45); }
.psj-sheet-box { padding: 8px 24px calc(16px + env(safe-area-inset-bottom, 0px)); }
.psj-sheet svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.psj-sheet-title { margin: 8px 0; font-size: 16px; font-weight: 800; }
.psj-sheet-text { margin: 12px 0 16px; font-size: 15px; line-height: 1.9; }
.psj-sheet-actions { display: flex; gap: 10px; margin-top: 12px; }
.psj-menu-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 18px 0; font: inherit; font-size: 15px; color: inherit; text-align: start; background: none; border: 0; cursor: pointer; }
.psj-menu-row + .psj-menu-row { border-top: 1px solid #f0f0f1; }
.psj-menu-row.is-danger { color: #d32f2f; }
.psj-reason { display: flex; align-items: center; gap: 12px; padding: 14px 0; font-size: 15px; border-bottom: 1px solid #f0f0f1; cursor: pointer; }
.psj-guide-art { position: relative; display: grid; place-items: center; height: 230px; background: #fbe9f2; }
.psj-guide-art > svg { width: 96px !important; height: 96px !important; stroke-width: 1.3 !important; }
.psj-guide-close { position: absolute; top: 16px; inset-inline-end: 16px; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; color: #fff; background: rgba(0, 0, 0, .3); border: 0; border-radius: 50%; cursor: pointer; }
.psj-guide-body { padding: 20px 24px calc(20px + env(safe-area-inset-bottom, 0px)); }
.psj-guide-body h2 { margin: 0 0 8px; font-size: 17px; font-weight: 800; }
.psj-guide-body p { min-height: 84px; margin: 0; font-size: 15px; line-height: 2; color: #3f4064; }
.psj-guide-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 20px; }
.psj-dots { display: flex; gap: 6px; }
.psj-dots i { width: 8px; height: 8px; background: #c0c2c5; border-radius: 999px; }
.psj-dots i.is-on { width: 22px; background: #0c0c0c; }
.psj-next { display: inline-flex; align-items: center; gap: 8px; height: 48px; padding: 0 20px; font: inherit; font-size: 15px; font-weight: 800; color: #fff; background: #19191b; border: 0; border-radius: 8px; cursor: pointer; }
.psj-next svg { width: 18px; height: 18px; }

/* ---- «انتخاب کالا»: a full screen over the form */
.psj-picker { position: fixed; inset: 0; z-index: 6000; display: flex; flex-direction: column; max-width: 760px; margin: 0 auto; background: #fff; }
.psj-picker[hidden] { display: none; }
.psj-picker .psj-pad { border-bottom: 1px solid var(--psj-border); }
.psj-picker-caption { margin: 0; padding: 12px 16px 4px; font-size: 13px; font-weight: 700; color: var(--psj-text); }
.psj-picker-list { flex: 1; overflow-y: auto; padding: 0 16px 16px; }
.psj-pick { display: block; width: 100%; padding: 0; text-align: start; background: none; border: 0; cursor: pointer; }
.psj-pick.is-on .psj-product { border: 2px solid var(--psj-ink); }
.psj-picker-foot { display: flex; flex-direction: column; gap: 12px; padding: 16px 16px calc(12px + env(safe-area-inset-bottom, 0px)); background: #fff; border-radius: 16px 16px 0 0; box-shadow: 0 -6px 16px rgba(0, 0, 0, .06); }
.psj-slots { display: flex; gap: 12px; }
.psj-slot { display: grid; place-items: center; width: 96px; height: 96px; overflow: hidden; border: 1px dashed #c0c2c5; border-radius: 8px; }
.psj-slot.is-current { border: 1.5px solid var(--psj-ink); }
.psj-slot img { width: 100%; height: 100%; object-fit: cover; }

/* ---- desktop: inside the site's own header and footer */
@media (min-width: 1024px) {
    .psj { margin-top: 24px; margin-bottom: 40px; padding-bottom: 24px; border: 1px solid var(--psj-border); border-radius: 12px; overflow: clip; }
    .psj-page-question .psj, .psj-page-ask .psj { padding-bottom: 100px; }
    .psj-fab { bottom: 28px; }
    .psj-sheet { margin: auto; border-radius: 16px; }
    .psj-sticky, .psj-reply, .psj-reply-login { border-inline: 1px solid var(--psj-border); }
    .psj-picker { inset: 40px 0; border: 1px solid var(--psj-border); border-radius: 12px; box-shadow: 0 20px 60px rgba(0, 0, 0, .18); }
}
