/* ============================================================
   assets/css/dialogue.css
   صفحة الحوار + قائمة الحوارات
   ------------------------------------------------------------
   ما هو مشترك (لا نكرره):
     - .topic-page, .topic-content, .topic-title  → topic.css
     - .accordion-section-content                 → topic.css
     - .quran-verse, .hadith                      → refinements.css
     - .font-size-controls, .font-size-btn        → topic.css
     - .topics-archive, .topics-grid              → topic.css
   ------------------------------------------------------------
   الأقسام:
     PART 1 — صفحة حوار واحد (dialogue.php)
       • حاوية الحوار
       • عنوان الحوار
       • رأس المتحاورين
       • أزرار التحكم بحجم الخط
       • محتوى الحوار (تكامل مع topic.css)
       • الآيات والأحاديث
       • الأكورديون
     PART 2 — قائمة الحوارات (dialogues.php)
     PART 3 — الاستجابة للجوال
     PART 4 — RTL / LTR
     PART 5 — الطباعة
   ============================================================ */

/* ============================================================
   PART 1 — صفحة حوار واحد (dialogue.php)
   ============================================================ */

/* ---------- حاوية الحوار (توسيع topic-page) ---------- */
.dialogue-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 0 40px;
    direction: rtl;
}

/* ---------- صورة الحوار (Hero) ---------- */
.dialogue-page .topic-hero img {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: 0;
    display: block;
}

/* ---------- عنوان الحوار ---------- */
.dialogue-page .topic-title {
    font-size: 2.5rem;
    margin: 25px 20px;
    color: var(--primary-dark);
    font-weight: 800;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.05);
    position: relative;
    padding-bottom: 10px;
    line-height: 1.35;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.dialogue-page .topic-title::after {
    content: '';
    display: block;
    width: 100px;
    height: 4px;
    background: var(--primary);
    margin-top: 10px;
    border-radius: 2px;
}

/* ---------- رأس المتحاورين ---------- */
.dialogue-participants-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 20px 25px;
    padding: 15px 20px;
    background: #f0f7ff;
    border-radius: 12px;
    border-inline-end: 5px solid var(--primary);
    font-size: 1.3rem;
    color: var(--text-main);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    line-height: 1.6;
}

.dialogue-participants-header i {
    font-size: 1.8rem;
    color: var(--primary);
    flex-shrink: 0;
}

.dialogue-participants-header .participants-label {
    font-weight: 800;
    color: var(--primary);
    font-size: 1.4rem;
}

/* ---------- محتوى الحوار (توسيع topic-content) ---------- */
.dialogue-page .topic-content {
    padding: 0 20px 30px;
    font-size: 1.3rem;
    line-height: 2;
    color: var(--text-main);
    text-align: justify;
    text-justify: inter-word;
    -webkit-hyphens: auto;
    hyphens: auto;
    word-wrap: break-word;
    overflow-wrap: break-word;
    text-align-last: right;
}

/* العناوين — لا تُضبط */
.dialogue-page .topic-content h3,
.dialogue-page .topic-content h4,
.dialogue-page .topic-content h5 {
    text-align: right;
    text-align-last: right;
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-inline-end: 35px;
    transition: background 0.2s;
}

/* السهم — استخدام inset-inline-start لدعم RTL/LTR */
.dialogue-page .topic-content h3::after,
.dialogue-page .topic-content h4::after,
.dialogue-page .topic-content h5::after {
    content: '\276F';
    position: absolute;
    inset-inline-start: 15px;
    top: 50%;
    transform: translateY(-50%) rotate(0deg);
    transition: transform 0.3s ease;
    font-size: 1.2rem;
    color: var(--primary-dark);
}

.dialogue-page .topic-content h3.open::after,
.dialogue-page .topic-content h4.open::after,
.dialogue-page .topic-content h5.open::after {
    transform: translateY(-50%) rotate(90deg);
}

/* الفقرات */
.dialogue-page .topic-content p,
.dialogue-page .topic-content div {
    text-align: justify;
    text-justify: inter-word;
    text-align-last: right;
}

/* الآيات القرآنية */
.dialogue-page .topic-content .quran-verse {
    display: inline;
    color: #2c7a5a;
    font-family: 'Amiri', 'Traditional Arabic', 'Noto Naskh Arabic', serif;
    font-size: inherit;
    line-height: inherit;
    white-space: normal;
}

.dialogue-page .topic-content .quran-verse::before {
    content: "﴿";
    font-size: 1.2em;
    color: #2c7a5a;
}

.dialogue-page .topic-content .quran-verse::after {
    content: "﴾";
    font-size: 1.2em;
    color: #2c7a5a;
}

/* الأحاديث */
.dialogue-page .topic-content .hadith {
    display: inline;
    background: #f0f7ff;
    padding: 2px 6px;
    border-radius: 4px;
    color: #0a3a5a;
    font-family: 'Amiri', 'Traditional Arabic', 'Noto Naskh Arabic', serif;
    font-size: inherit;
    line-height: inherit;
    font-style: normal;
    white-space: normal;
}

/* الصور */
.dialogue-page .topic-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 15px auto;
    border-radius: 12px;
}

/* ---------- أكورديون — المستوى الأول (h3) ---------- */
.dialogue-page .topic-content h3.accordion-heading {
    background: #f0f4ff;
    border-inline-end: 5px solid var(--primary);
    padding: 12px 18px;
    margin: 25px 0 10px;
    border-radius: 8px;
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--text-main);
}

.dialogue-page .topic-content h4.accordion-subheading {
    background: #f8fafc;
    border-inline-end: 4px solid #4f46e5;
    padding: 10px 15px;
    margin: 15px 0 5px;
    border-radius: 6px;
    font-size: 1.3rem;
    font-weight: 700;
    color: #1f2937;
    border: 1px solid #d1d5db;
    border-inline-end-width: 4px;
}

.dialogue-page .topic-content h5.accordion-sub-subheading {
    background: #f1f5f9;
    border-inline-end: 3px solid #7c3aed;
    padding: 10px 15px;
    margin: 10px 0 5px;
    border-radius: 6px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    border: 1px solid #d4d4d8;
    border-inline-end-width: 3px;
}

/* ---------- روابط حوارات أخرى ---------- */
.dialogue-page .other-topics {
    margin: 30px 20px;
    padding: 20px;
    background: var(--offwhite);
    border-radius: 16px;
    border: 1px solid var(--border-light);
}

.dialogue-page .other-topics h2 {
    font-size: 1.6rem;
    color: var(--primary-dark);
    margin-bottom: 15px;
    font-weight: 800;
}

.dialogue-page .topics-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.dialogue-page .topic-link {
    background: var(--primary-soft);
    color: var(--primary);
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
    transition: var(--transition-fast);
    border: 1px solid transparent;
}

.dialogue-page .topic-link:hover,
.dialogue-page .topic-link:focus-visible {
    background: var(--primary-light);
    color: var(--white);
    transform: translateY(-2px);
    outline: none;
    box-shadow: var(--shadow-sm);
}

/* ============================================================
   PART 2 — قائمة الحوارات (dialogues.php)
   ============================================================ */

.dialogues-archive {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-size: 1.1rem;
}

.dialogues-archive h1.page-heading {
    text-align: center;
    margin: 30px 0;
    font-size: 2.4rem;
    color: var(--text-main);
    font-weight: 800;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.05);
    position: relative;
    display: inline-block;
    width: 100%;
}

.dialogues-archive h1.page-heading::after {
    content: '';
    display: block;
    width: 80px;
    height: 4px;
    background: var(--primary);
    margin: 10px auto 0;
    border-radius: 2px;
}

/* ---------- شبكة بطاقات الحوار ---------- */
.dialogues-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
}

.dialogue-card {
    border-radius: 16px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    background: var(--white);
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.dialogue-card:hover,
.dialogue-card:focus-visible {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
    outline: none;
}

.dialogue-card-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: #f1f5f9;
}

.dialogue-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.dialogue-card:hover .dialogue-card-image img {
    transform: scale(1.05);
}

.dialogue-card-body {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.dialogue-card-body h2 {
    margin: 0 0 12px;
    font-size: 1.5rem;
    color: var(--text-main);
    line-height: 1.4;
    font-weight: 700;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.dialogue-participants {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: #f0f7ff;
    border-radius: 8px;
    color: var(--primary);
    font-size: 1.05rem;
    font-weight: 600;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.dialogue-participants i {
    font-size: 1.2rem;
    color: var(--primary);
    flex-shrink: 0;
}

.dialogue-excerpt {
    margin: 0;
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.6;
    flex-grow: 1;
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* ---------- حالة فارغة ---------- */
.dialogues-archive .text-center {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* ============================================================
   PART 3 — الاستجابة للجوال
   ============================================================ */

@media (max-width: 768px) {
    /* ---------- صفحة حوار واحد ---------- */
    .dialogue-page .topic-title {
        font-size: 2rem;
        margin: 15px 10px;
        padding-bottom: 8px;
    }

    .dialogue-page .topic-title::after {
        width: 70px;
        height: 3px;
    }

    .dialogue-participants-header {
        margin: 0 10px 15px;
        padding: 10px 15px;
        font-size: 1.1rem;
        gap: 8px;
    }

    .dialogue-participants-header i {
        font-size: 1.4rem;
    }

    .dialogue-participants-header .participants-label {
        font-size: 1.2rem;
    }

    .dialogue-page .topic-content {
        padding: 0 10px 20px;
        font-size: 1.15rem;
        line-height: 1.9;
        word-spacing: -0.5px;
    }

    /* الأكورديون يأخذ العرض الكامل */
    .dialogue-page .accordion-section-content,
    .dialogue-page .accordion-sub-content,
    .dialogue-page .accordion-sub-sub-content {
        padding: 10px;
        margin: 0;
        border-radius: 0;
        width: 100%;
        border-inline-start: none;
        border-inline-end: none;
    }

    .dialogue-page .topic-content h3.accordion-heading {
        font-size: 1.4rem;
        padding: 12px 15px;
        margin: 15px 0 5px;
    }

    .dialogue-page .topic-content h4.accordion-subheading {
        font-size: 1.3rem;
        padding: 10px 12px;
        margin: 12px 0 4px;
    }

    .dialogue-page .topic-content h5.accordion-sub-subheading {
        font-size: 1.2rem;
        padding: 10px 12px;
        margin: 10px 0 4px;
    }

    .dialogue-page .other-topics {
        margin: 20px 10px;
        padding: 15px;
    }

    .dialogue-page .other-topics h2 {
        font-size: 1.3rem;
    }

    /* ---------- قائمة الحوارات ---------- */
    .dialogues-archive {
        padding: 12px;
    }

    .dialogues-archive h1.page-heading {
        font-size: 1.8rem;
        margin: 20px 0;
    }

    .dialogues-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 15px;
    }

    .dialogue-card-image {
        height: 160px;
    }

    .dialogue-card-body {
        padding: 15px;
    }

    .dialogue-card-body h2 {
        font-size: 1.3rem;
    }

    .dialogue-participants {
        font-size: 0.95rem;
        padding: 6px 10px;
    }
}

@media (max-width: 480px) {
    .dialogue-page .topic-title {
        font-size: 1.6rem;
    }

    .dialogue-page .topic-content {
        font-size: 1.1rem;
    }

    .dialogue-participants-header {
        font-size: 1rem;
        padding: 8px 12px;
    }

    .dialogue-participants-header .participants-label {
        font-size: 1.05rem;
    }

    .dialogues-grid {
        grid-template-columns: 1fr;
    }

    .dialogue-card-image {
        height: 180px;
    }
}

/* ============================================================
   PART 4 — RTL / LTR
   ============================================================ */
body[dir="ltr"] .dialogue-page .topic-title,
body[dir="ltr"] .dialogue-participants-header,
body[dir="ltr"] .dialogue-page .topic-content h3,
body[dir="ltr"] .dialogue-page .topic-content h4,
body[dir="ltr"] .dialogue-page .topic-content h5 {
    text-align: left;
}

body[dir="ltr"] .dialogue-page .topic-title::after {
    margin-inline-start: 0;
    margin-inline-end: auto;
}

/* إصلاح احتياطي للأكورديون (مستقل عن الطباعة) */
.dialogue-page .topic-content .accordion-section-content,
.dialogue-page .topic-content .accordion-sub-content,
.dialogue-page .topic-content .accordion-sub-sub-content {
    box-sizing: border-box;
    width: 100%;
}
.dialogue-page .topic-content h3.accordion-heading,
.dialogue-page .topic-content h4.accordion-subheading,
.dialogue-page .topic-content h5.accordion-sub-subheading {
    cursor: pointer;
}
.dialogue-page .topic-content h3.accordion-heading:focus-visible,
.dialogue-page .topic-content h4.accordion-subheading:focus-visible,
.dialogue-page .topic-content h5.accordion-sub-subheading:focus-visible {
    outline: 2px solid var(--primary, #2563eb);
    outline-offset: 3px;
}
