/* Page Q&A — flat list + modal form */

.page-qa {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.page-qa__items {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.page-qa__item {
    overflow: hidden;
    border-radius: 0.625rem;
    border: 1px solid #e2e8f0;
    background: #fff;
}

.page-qa__question-row,
.page-qa__answer-row {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
}

.page-qa__question-row {
    padding: 0.625rem 0.75rem;
    background: #f8fbff;
    border-bottom: 1px solid #eef2f7;
}

.page-qa__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.375rem;
    height: 1.375rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
    border-radius: 0.375rem;
    font-size: 0.6875rem;
    font-weight: 800;
    line-height: 1;
}

.page-qa__badge--q {
    background: #2563eb;
    color: #fff;
}

.page-qa__badge--a {
    background: #0f766e;
    color: #fff;
}

.page-qa__question {
    margin: 0;
    min-width: 0;
    flex: 1;
    font-size: 0.8125rem;
    font-weight: 700;
    line-height: 1.7;
    color: #0f172a;
    text-align: justify;
}

.page-qa__answer-card {
    padding: 0.625rem 0.75rem 0.75rem;
    background: #fff;
}

.page-qa__answer-text {
    margin: 0;
    min-width: 0;
    flex: 1;
    font-size: 0.8125rem;
    line-height: 1.75;
    color: #475569;
    white-space: pre-line;
    text-align: justify;
}

.page-qa__meta {
    margin: 0.5rem 0 0 2rem;
    font-size: 0.6875rem;
    font-weight: 600;
    color: #94a3b8;
}

.page-qa__meta strong {
    color: #0f766e;
    font-weight: 700;
}

.page-qa__empty-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.875rem;
    padding: 1.25rem 1rem;
    border-radius: 0.625rem;
    border: 1px dashed #dbe3ee;
    background: #f8fafc;
    text-align: center;
}

.page-qa__empty-text {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.6;
    color: #64748b;
}

.page-qa__actions {
    display: flex;
    justify-content: center;
    width: 100%;
    padding-top: 0.25rem;
}

.page-qa__open-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-width: 11rem;
    border: 1px solid #bfdbfe;
    border-radius: 0.5rem;
    background: #eff6ff;
    padding: 0.5625rem 1.125rem;
    font-size: 0.8125rem;
    font-weight: 700;
    color: #1d4ed8;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.page-qa__open-btn:hover {
    background: #dbeafe;
    border-color: #93c5fd;
}

.page-qa__open-btn svg {
    width: 1rem;
    height: 1rem;
}

/* Modal */

.page-qa-modal {
    position: fixed;
    inset: 0;
    z-index: 85;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.page-qa-modal.is-open {
    display: flex;
}

.page-qa-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgb(15 23 42 / 0.55);
    backdrop-filter: blur(4px);
}

.page-qa-modal__panel {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 28rem;
    max-height: min(92vh, 640px);
    overflow: auto;
    border-radius: 1rem;
    background: #fff;
    box-shadow:
        0 24px 48px rgb(15 23 42 / 0.2),
        0 0 0 1px rgb(226 232 240);
}

.page-qa-modal__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1rem 0.75rem;
    border-bottom: 1px solid #f1f5f9;
    background: linear-gradient(180deg, #eff6ff 0%, #fff 100%);
}

.page-qa-modal__header-text {
    min-width: 0;
}

.page-qa-modal__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.45;
    color: #0f172a;
}

.page-qa-modal__subtitle {
    margin: 0.3rem 0 0;
    font-size: 0.75rem;
    line-height: 1.65;
    color: #64748b;
}

.page-qa-modal__close {
    display: flex;
    height: 2rem;
    width: 2rem;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 9999px;
    background: #f1f5f9;
    color: #475569;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.page-qa-modal__close:hover {
    background: #fee2e2;
    color: #dc2626;
}

.page-qa-modal__close svg {
    width: 1rem;
    height: 1rem;
}

.page-qa-modal__body {
    padding: 0.875rem 1rem 1rem;
}

/* Form */

.page-qa__form {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.page-qa__label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #334155;
}

.page-qa__label--optional::after {
    content: " (اختیاری)";
    font-weight: 500;
    color: #94a3b8;
}

.page-qa__field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.page-qa__field--grow {
    min-width: 0;
    flex: 1;
}

.page-qa__textarea,
.page-qa__input {
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    background: #f8fafc;
    font-size: 0.8125rem;
    color: #0f172a;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.page-qa__textarea {
    min-height: 5.5rem;
    resize: vertical;
    padding: 0.5rem 0.625rem;
    line-height: 1.6;
}

.page-qa__input {
    padding: 0.5rem 0.625rem;
}

.page-qa__textarea::placeholder,
.page-qa__input::placeholder {
    color: #94a3b8;
}

.page-qa__textarea:focus,
.page-qa__input:focus {
    outline: none;
    border-color: #3b82f6;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.page-qa__input[readonly],
.page-qa__input.is-anonymous-disabled {
    background: #f1f5f9;
    color: #64748b;
}

.page-qa__input.is-anonymous-disabled {
    cursor: not-allowed;
}

.page-qa__input--error,
.page-qa__textarea--error {
    border-color: #ef4444;
    background: #fff5f5;
}

.page-qa__row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

@media (min-width: 640px) {
    .page-qa__row {
        flex-direction: row;
    }
}

.page-qa__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 0.25rem;
}

.page-qa__anonymous {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    user-select: none;
}

.page-qa__anonymous-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.page-qa__anonymous-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    border-radius: 0.25rem;
    border: 1.5px solid #cbd5e1;
    background: #fff;
}

.page-qa__anonymous-box::after {
    content: "";
    width: 0.3rem;
    height: 0.55rem;
    border: solid #fff;
    border-width: 0 1.5px 1.5px 0;
    transform: rotate(45deg) scale(0);
    margin-top: -0.08rem;
}

.page-qa__anonymous-input:checked + .page-qa__anonymous-box {
    border-color: #2563eb;
    background: #2563eb;
}

.page-qa__anonymous-input:checked + .page-qa__anonymous-box::after {
    transform: rotate(45deg) scale(1);
}

.page-qa__anonymous-text {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
}

.page-qa__error {
    margin: 0;
    font-size: 0.6875rem;
    font-weight: 600;
    color: #dc2626;
}

.page-qa__error[hidden] {
    display: none;
}

.page-qa__submit {
    flex-shrink: 0;
    border: 0;
    border-radius: 0.5rem;
    background: #2563eb;
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    transition: background 0.15s ease;
}

.page-qa__submit:hover {
    background: #1d4ed8;
}

.page-qa__submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.page-qa__field.is-disabled .page-qa__input {
    background: #f1f5f9;
    color: #94a3b8;
}
