/* ========== صفحة الموضوع ========== */
.topic-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}
.topic-hero img {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}
.topic-title {
    font-size: 2rem;
    margin: 20px 0;
    color: #2c3e50;
}
.topic-content {
    line-height: 1.9;
    font-size: 1.2rem;
    color: #333;
    margin-bottom: 40px;
}

/* ⭐️ الروابط الزرقاء */
.topic-content a {
    color: #1565c0;
    text-decoration: underline;
    font-weight: 500;
}
.topic-content a:hover {
    color: #0d47a1;
    text-decoration: none;
}
/* روابط سريعة */
.other-topics {
    margin-top: 50px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}
.other-topics h2 {
    margin-bottom: 15px;
}
.topics-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.topic-link {
    background: #e3f2fd;
    color: #1565c0;
    padding: 8px 16px;
    border-radius: 20px;
    text-decoration: none;
    font-weight: 500;
}
.topic-link:hover {
    background: #bbdefb;
}

/* ========== تنسيق الأكورديون ========== */
.topic-content h3 {
    cursor: pointer;
    padding: 12px 15px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    margin: 20px 0 0 0;
    font-size: 1.3rem;
    color: #0f172a;
    position: relative;
    padding-right: 40px; /* مكان للسهم */
    user-select: none;
}

.topic-content h3::after {
    content: '\276F'; /* سهم */
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%) rotate(0deg);
    transition: transform 0.3s ease;
    font-size: 1.3rem;
    color: #475569;
}

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

/* حاوية المحتوى المخفية */
.accordion-section-content {
    display: none;
    padding: 10px 15px;
    border: 1px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    background: #fff;
    margin-bottom: 10px;
}

.accordion-section-content.open {
    display: block;
}
/* ========== تحسينات الصور في صفحة الموضوع ========== */
.topic-content img {
    display: block;
    max-width: 90%;            /* لا تأخذ العرض الكامل */
    height: auto;
    max-height: 500px;         /* حد أقصى للارتفاع */
    margin: 20px auto;         /* توسيط مع مسافة */
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    object-fit: contain;       /* إظهار كامل الصورة */
    background: #f8fafc;       /* خلفية لحين تحميل الصورة */
}

/* للجوال - صور أصغر */
@media (max-width: 600px) {
    .topic-content img {
        max-height: 300px;
        max-width: 100%;
        margin: 15px auto;
    }
}

/* ========== تحسينات صفحة الأرشيف ========== */
.topics-archive {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.topics-archive h1 {
    text-align: center;
    margin: 30px 0;
    font-size: 2rem;
    color: #1e293b;
}

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

.topic-card {
    border-radius: 16px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    background: #fff;
    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;
}

.topic-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.15);
}

.topic-card img {
    width: 100%;
    height: 200px;              /* ارتفاع ثابت */
    object-fit: cover;          /* تغطية المساحة بدون تشويه */
    display: block;
    background: #f1f5f9;        /* لون خلفية للصور الفارغة */
}

.topic-card h2 {
    margin: 16px 16px 8px;
    font-size: 1.2rem;
    color: #1e293b;
    line-height: 1.4;
}

.topic-card p {
    margin: 0 16px 20px;
    color: #64748b;
    font-size: 0.9rem;
    line-height: 1.6;
    flex-grow: 1;               /* يملأ المساحة المتبقية */
}

/* تحسينات للجوال */
@media (max-width: 600px) {
    .topics-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 15px;
    }
    
    .topic-card img {
        height: 140px;
    }
    
    .topic-card h2 {
        font-size: 1rem;
        margin: 12px 12px 6px;
    }
    
    .topic-card p {
        font-size: 0.8rem;
        margin: 0 12px 16px;
    }
}
/* ========== تنسيق صفوف الموضوعات (كل موضوع في صف) ========== */
.topics-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 30px;
}

.topic-row-card {
    display: flex;
    align-items: center;
    gap: 20px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    padding: 16px;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.topic-row-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

.topic-row-image {
    flex-shrink: 0;
    width: 120px;
    height: 90px;
    border-radius: 12px;
    overflow: hidden;
}

.topic-row-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.topic-row-info h2 {
    margin: 0 0 8px;
    font-size: 1.25rem;
    color: #1e293b;
}

.topic-row-info p {
    margin: 0;
    color: #475569;
    font-size: 0.95rem;
    line-height: 1.6;
}

/* للجوال */
@media (max-width: 600px) {
    .topic-row-card {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 12px;
    }

    .topic-row-image {
        width: 100%;
        height: 180px;
    }

    .topic-row-info h2 {
        font-size: 1.1rem;
    }
}
 .ayah {
    color: #2e7d32;
    font-weight: bold;
}