/* ═══════════════════════════════════════════════════════════
   بخش پرسش و پاسخ محصول - Product Q&A Section
   طراحی یکپارچه با بخش نظرات کاربران
   ═══════════════════════════════════════════════════════════ */

.khabco-qa-section {
    max-width: 900px;
    margin: 40px auto;
    padding: 0 20px;
    direction: rtl;
}

/* ─────────────────────────────────────────────────────────
   هدر بخش پرسش و پاسخ
   ───────────────────────────────────────────────────────── */

.khabco-qa-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.khabco-qa-header-right {
    display: flex;
    gap: 20px;
    align-items: center;
}

.khabco-qa-title {
    font-weight: 600;
    color: #0f4f59;
    margin: 0;
}

.khabco-qa-count {
    color: #6b7280;
}

.khabco-qa-submit-btn {
    padding: 10px 32px;
    background: #e8f5f3;
    color: #0f4f59;
    border: 1px solid #0f4f59;
    border-radius: 22px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    font-family: inherit;
}

.khabco-qa-submit-btn:hover {
    background: #0f4f59;
    color: #fff;
}

/* ─────────────────────────────────────────────────────────
   لیست پرسش‌ها
   ───────────────────────────────────────────────────────── */

.khabco-question-wrapper {
    margin-bottom: 14px;
    animation: qa-fadeInUp 0.4s ease;
}

@keyframes qa-fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* کانتینر کارت — بدون border/radius: آنها روی question-body هستند */
.khabco-question-box {
    background: #fff;
}

.khabco-admin-question {
    border-color: rgba(15, 79, 89, 0.18);
}

/* ─────────────────────────────────────────────────────────
   هدر کارت — طراحی pill شناور مثل نظرات
   ───────────────────────────────────────────────────────── */

.khabco-question-header .khabco-user-header-content {
    position: relative;
    top: 10px;
    right: 0;
    left: 0;
    background: #f5f5f5;
    padding: 15px 20px;
    border-radius: 16px;
    width: 92%;
    margin: auto;
    z-index: 100;
}

.khabco-question-header .khabco-admin-header-content {
    position: relative;
    top: 0;
    right: 0;
    left: 0;
    background: #0f4f59;
    padding: 15px 20px;
    border-radius: 16px;
    width: 92%;
    margin: auto;
    z-index: 100;
}

.khabco-user-header-content,
.khabco-admin-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.khabco-user-name {
    font-size: 14px;
    font-weight: 700;
    color: #1a1a1a;
}

.khabco-admin-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.khabco-admin-brand {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
}

.khabco-question-header .khabco-user-header-content .khabco-question-date {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #666;
    font-size: 13px;
}

.khabco-question-header .khabco-admin-header-content .khabco-question-date {
    display: flex;
    align-items: center;
    gap: 6px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
}

.khabco-question-header .khabco-user-header-content .khabco-question-date svg {
    width: 15px;
    height: 15px;
    opacity: 0.7;
    color: #666;
}

.khabco-question-header .khabco-admin-header-content .khabco-question-date svg {
    width: 15px;
    height: 15px;
    opacity: 0.7;
    color: rgba(255, 255, 255, 0.9);
}

/* ─────────────────────────────────────────────────────────
   بدنه پرسش — طراحی overlap مثل نظرات
   ───────────────────────────────────────────────────────── */

.khabco-question-body {
    background: #fff;
    padding: 50px 30px 0px 30px;
    border: 1px solid #d9d9d9;
    border-radius: 35px;
    position: relative;
    margin-top: -20px;
    z-index: 1;
}

.khabco-question-text {
    font-size: 14px;
    line-height: 2;
    color: #374151;
    margin-bottom: 1rem;
}

.khabco-question-text p {
    margin: 0;
}

.khabco-question-footer {
    display: flex;
    flex-direction: row-reverse;
    align-items: end;
    margin-top: 0;
    margin-bottom: 1rem;
    justify-content: space-between;
    padding-top: 18px;
}

.khabco-qa-answer-btn {
    background: transparent;
    border: none;
    color: #0f4f59;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 30px;
    padding: 0;
    font-family: inherit;
}

/* ─────────────────────────────────────────────────────────
   پاسخ‌ها
   ───────────────────────────────────────────────────────── */

.khabco-answer-list {
    margin-top: 18px;
    padding-right: 0;
}

.khabco-answer-item-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-top: 14px;
}

.khabco-answer-item-wrapper > svg {
    flex-shrink: 0;
    margin-top: 18px;
    width: 32px;
    height: 32px;
}

.khabco-answer-item-wrapper .khabco-question-box {
    flex: 1;
}

/* ─────────────────────────────────────────────────────────
   حالت بدون پرسش
   ───────────────────────────────────────────────────────── */

.khabco-qa-empty {
    background: #f9f9f9;
    border-radius: 10px;
    padding: 10px 30px;
    text-align: center;
    margin-top: 20px;
}

.khabco-qa-empty h4 {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 600;
    color: #111827;
}

.khabco-qa-empty p {
    margin: 0;
    color: #6b7280;
    font-size: 14px;
}

/* ─────────────────────────────────────────────────────────
   مودال
   ───────────────────────────────────────────────────────── */

.khabco-qa-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    text-align: center;
}

.khabco-qa-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(3px);
}

.khabco-qa-modal-content {
    position: relative;
    width: 470px;
    max-width: 90%;
    max-height: 90vh;
    overflow: hidden;
    margin: 40px auto;
    background: #fff;
    border-radius: 24px;
    padding: 15px 25px;
    z-index: 2;
    animation: qa-modalFade 0.3s ease;
    text-align: right;
    display: flex;
    flex-direction: column;
}

@keyframes qa-modalFade {
    from { opacity: 0; transform: translateY(25px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ─── هدر مودال — مثل نظرات (flex، بدون position absolute) ─── */

.khabco-qa-modal-header {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding-bottom: 13px;
    margin-bottom: 16px;
    border-bottom: 1px solid #d9d9d9;
}

.khabco-qa-modal-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #0f4f59;
    flex: 1;
    text-align: right;
}

.khabco-qa-modal-close {
    background: #f0f0f0;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #374151;
    line-height: 1;
    padding: 0;
    border-radius: 50%;
    transition: all .2s;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.khabco-qa-modal-close:hover {
    background: #fee2e2;
    color: #dc2626;
}

/* ─────────────────────────────────────────────────────────
   کارت محصول مودال
   ───────────────────────────────────────────────────────── */

.khabco-qa-product-info {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    margin-bottom: 25px;
    direction: rtl;
}

.khabco-qa-product-name {
    font-size: 13px;
    font-weight: 500;
    color: #111827;
    line-height: 1.8;
    flex: 1;
}

.khabco-qa-product-thumb {
    width: 64px;
    height: 64px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
}

.khabco-qa-product-thumb--placeholder {
    width: 64px;
    height: 64px;
    border-radius: 10px;
    background: #f0f0f0;
    flex-shrink: 0;
}

/* ─────────────────────────────────────────────────────────
   بدنه مودال (اسکرول)
   ───────────────────────────────────────────────────────── */

.khabco-qa-modal-body {
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    padding: 5px 10px;
}

.khabco-qa-modal-body::-webkit-scrollbar { width: 4px; }
.khabco-qa-modal-body::-webkit-scrollbar-track { background: #e2e2e2; border-radius: 10px; }
.khabco-qa-modal-body::-webkit-scrollbar-thumb { background: #0f4f59; border-radius: 10px; }

/* ─────────────────────────────────────────────────────────
   فرم
   ───────────────────────────────────────────────────────── */

.khabco-qa-form .khabco-qa-form-group {
    margin-bottom: 20px;
}

.khabco-qa-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.khabco-qa-form input:not([type="checkbox"]),
.khabco-qa-form textarea {
    border: 1px solid #d1d5db;
    border-radius: 14px;
    padding: 14px 16px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.25s ease;
    background: #fff;
    width: 100%;
    box-sizing: border-box;
}

.khabco-qa-form textarea {
    min-height: 120px;
    resize: vertical;
}

.khabco-qa-form input:focus,
.khabco-qa-form textarea:focus {
    outline: none;
    border-color: #0f4f59;
    box-shadow: 0 0 0 4px rgba(15, 79, 89, 0.08);
}

.khabco-qa-hint {
    font-size: 12px;
    color: #9ca3af;
    margin: 4px 0 0;
}

.khabco-qa-required { color: #dc2626; }

.khabco-qa-form label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

/* ─────────────────────────────────────────────────────────
   باکس افزودن سوال
   ───────────────────────────────────────────────────────── */

.khabco-qa-questions-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.khabco-qa-add-question-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px dashed #0f4f59;
    background: #f0f9f9;
    color: #0f4f59;
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    align-self: flex-start;
    font-family: inherit;
}

.khabco-qa-add-question-btn:hover {
    background: #0f4f59;
    color: #fff;
}

.khabco-qa-questions-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.khabco-qa-question-item {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 15px;
    position: relative;
}

.khabco-qa-question-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.khabco-qa-question-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #0f4f59;
    font-size: 15px;
}

.khabco-qa-question-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0f4f59;
    color: #fff;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
}

.khabco-qa-remove-question-btn {
    background: #fee2e2;
    color: #dc2626;
    border: none;
    border-radius: 8px;
    padding: 5px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.khabco-qa-remove-question-btn:hover {
    background: #dc2626;
    color: #fff;
}

.khabco-qa-question-item textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
    box-sizing: border-box;
}

.khabco-qa-question-item textarea:focus {
    outline: none;
    border-color: #0f4f59;
    box-shadow: 0 0 0 3px rgba(15, 79, 89, 0.1);
}

/* ─────────────────────────────────────────────────────────
   اکشن‌های فرم + ناشناس
   ───────────────────────────────────────────────────────── */

.khabco-qa-form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
}

.khabco-qa-anonymous-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #4b5563;
    cursor: pointer;
}

.khabco-qa-anonymous-check input {
    accent-color: #0f4f59;
    width: 16px;
    height: 16px;
}

.khabco-qa-checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
}

.khabco-qa-checkbox-wrapper input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #0f4f59;
}

.khabco-qa-checkbox-wrapper label {
    margin: 0;
    font-size: 13px;
    font-weight: 400;
    color: #6b7280;
    cursor: pointer;
}

/* ─────────────────────────────────────────────────────────
   دکمه ثبت
   ───────────────────────────────────────────────────────── */

.khabco-qa-modal .btn-submit {
    padding: 12px 35px;
    border: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #0f4f59;
    color: #fff;
    font-family: inherit;
}

.khabco-qa-modal .btn-submit:hover {
    background: #0a3840;
}

/* ─────────────────────────────────────────────────────────
   پیام‌های وضعیت
   ───────────────────────────────────────────────────────── */

.khabco-qa-message {
    padding: 14px 18px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.6;
}

.khabco-qa-message-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.khabco-qa-message-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.khabco-qa-message-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

/* ─────────────────────────────────────────────────────────
   لودینگ
   ───────────────────────────────────────────────────────── */

.khabco-qa-loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: qa-spin 0.6s linear infinite;
    margin-left: 8px;
}

@keyframes qa-spin {
    to { transform: rotate(360deg); }
}

body.modal-open {
    overflow: hidden !important;
}

.khabco-qa-icon {
    width: 100px;
    height: auto;
    animation: qa-float 3s ease-in-out infinite;
}

@keyframes qa-float {
    0%, 100% { transform: translateY(0px); }
    50%       { transform: translateY(-8px); }
}

@media print {
    .khabco-qa-submit-btn,
    .khabco-qa-answer-btn,
    .khabco-qa-modal { display: none !important; }
    .khabco-question-box { border: 1px solid #000; page-break-inside: avoid; }
}
