/* ==========================================================================
   1. استيراد الخطوط المعتمدة للهوية الرقمية
   ========================================================================== */
@font-face {
    font-family: 'Cairo';
    src: url('../fonts/Cairo-Regular.ttf') format('truetype');
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: 'Questv1';
    src: url('../fonts/Questv1 Regular.ttf') format('truetype');
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: 'Sakkal Majalla';
    src: url('../fonts/Sakkal Majalla Regular.ttf') format('truetype');
    font-weight: 400;
    font-display: swap;
}

/* ==========================================================================
   2. متغيرات الهوية الرقمية
   ========================================================================== */
:root {
    --primary-blue: #3b71b9;         
    --accent-green: #49b5b0;         
    --black-fakhim: #0f172a;         
    --text-dim: #475569;             
    --white: #ffffff;
    --border-color: #e2e8f0;         
    --bg-dark-gradient: linear-gradient(135deg, #142847 0%, #0b1326 100%); 
    
    --font-main: 'Sakkal Majalla', 'Arial', sans-serif;
    --font-headers: 'Cairo', 'Helvetica', sans-serif;
    --font-accent: 'Questv1', sans-serif;
}

/* ==========================================================================
   3. تنسيق قسم البانر العلوي (digi-blog-banner)
   ========================================================================== */
.digi-blog-banner {
    direction: rtl !important;
    text-align: center !important;
    background: linear-gradient(to left, var(--black-fakhim), var(--primary-blue)) !important;
    padding: 90px 20px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.digi-blog-banner h1 {
    font-family: var(--font-headers) !important;
    font-size: 2.8rem;
    font-weight: 700;
    color: var(--white) !important;
    margin-bottom: 15px !important;
}

.digi-blog-banner p {
    font-family: var(--font-accent) !important;
    font-size: 1.3rem;
    color: var(--accent-green) !important;
    opacity: 0.95;
    margin: 0 !important;
}

/* ==========================================================================
   4. تهيئة الحاوية الكلية وتوزيع الهيكل الشبكي المطور (Layout)
   ========================================================================== */
main.blog-page-wrapper {
    direction: rtl !important;
    text-align: right !important;
    background-color: var(--white) !important; 
    color: var(--black-fakhim) !important;
    font-family: var(--font-main) !important;
    font-size: 1.4rem;
    padding: 60px 0;
    width: 100%;
    background-image: url('../images/bc-4.webp');
    background-size: cover;          
    background-position: center;     
    background-repeat: no-repeat;    
    background-attachment: fixed;
    position: relative;
}

.blog-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* توزيع المحتوى لليمين والشريط الجانبي لليسار */
.blog-main-layout {
    display: grid;
    grid-template-columns: 2.3fr 1fr;
    gap: 40px;
    align-items: start;
}

/* ==========================================================================
   5. تنسيق قسم الفلترة وشريط البحث الذكي (Filter Section)
   ========================================================================== */
.blog-filter-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: var(--white);
    padding: 24px;
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.02);
    border: 1px solid var(--border-color);
    margin-bottom: 40px;
}

.blog-search-box .search-form {
    display: flex;
    width: 100%;
    position: relative;
}

.blog-search-box .search-field {
    width: 100%;
    padding: 14px 20px;
    padding-left: 60px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    font-family: var(--font-headers);
    font-size: 0.95rem;
    background-color: #f8fafc;
    color: var(--black-fakhim);
    transition: all 0.3s ease;
}

.blog-search-box .search-field:focus {
    outline: none;
    border-color: var(--primary-blue);
    background-color: var(--white);
    box-shadow: 0 0 0 4px rgba(59, 113, 185, 0.08);
}

.blog-search-box .search-submit {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px 10px;
}

/* الأزرار العائمة للتصنيفات */
.blog-categories-tags {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.cat-tag-btn {
    font-family: var(--font-accent) !important;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-dim) !important;
    background: #f1f5f9;
    padding: 8px 18px;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.cat-tag-btn:hover, .cat-tag-btn.active {
    background: var(--primary-blue) !important;
    color: var(--white) !important;
    box-shadow: 0 4px 12px rgba(59, 113, 185, 0.15);
}

/* ==========================================================================
   6. العناوين وشبكة كروت المقالات
   ========================================================================== */
.blog-section-title {
    font-family: var(--font-headers) !important;
    font-weight: 700;
    font-size: 1.8rem;
    color: var(--primary-blue) !important;
    position: relative;
    padding-bottom: 12px;
    margin-bottom: 35px;
    display: inline-block;
}

.blog-section-title::after {
    content: "";
    position: absolute;
    bottom: 0;
    right: 0;
    width: 45px;
    height: 4px;
    background-color: var(--accent-green);
    border-radius: 10px;
}

.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.blog-card {
    background: var(--white) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 20px !important;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.03) !important; 
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.blog-card:hover {
    transform: translateY(-6px);
    border-color: var(--primary-blue) !important;
    box-shadow: 0 15px 35px rgba(59, 113, 185, 0.1) !important;
}

.blog-card-thumb {
    width: 100% !important;
    height: 220px !important; /* ارتفاع ثابت ومثالي لكروت الأرشيف */
    overflow: hidden !important;
    border-top-right-radius: 16px !important;
    border-top-left-radius: 16px !important;
    position: relative !important;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%) !important;
}

/* إجبار صورة الكرت على ملء المساحة بالكامل بدون فراغات زرقاء */
.blog-card-thumb img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important; /* ملء كامل الكرت بشكل احترافي */
    object-position: center !important;
    display: block !important;
}

/* تنسيق نص الـ Placeholder (Digicode Tech) عند عدم وجود صورة */
.blog-card-thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff !important;
    font-family: var(--font-headers) !important;
    font-size: 1.4rem !important;
    font-weight: 700;
}

.blog-card-content {
    padding: 24px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.blog-card-meta {
    font-family: var(--font-accent) !important;
    font-size: 0.85rem;
    color: var(--accent-green) !important;
    font-weight: 600;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.blog-card-meta a { color: var(--accent-green) !important; text-decoration: none; }

.blog-card-title {
    font-family: var(--font-headers) !important;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--black-fakhim) !important;
    line-height: 1.4;
    margin-bottom: 10px !important;
}

.blog-card-title a { color: var(--black-fakhim) !important; text-decoration: none; }
.blog-card-title a:hover { color: var(--primary-blue) !important; }

.blog-card-excerpt {
    font-family: var(--font-main) !important;
    font-size: 1.25rem;
    color: var(--text-dim) !important;
    line-height: 1.5;
    margin-bottom: 20px;
    flex-grow: 1;
}

.blog-card-btn {
    font-family: var(--font-accent) !important;
    color: var(--primary-blue) !important;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
}

/* ==========================================================================
   7. تنسيق شريط المقالات الأكثر تداولاً الجانبي (Sidebar & Trending Widget)
   ========================================================================== */
.blog-sidebar {
    position: sticky;
    top: 30px;
}

.sidebar-widget {
    background: var(--white);
    padding: 26px;
    border-radius: 22px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.02);
}

.widget-title {
    font-family: var(--font-headers) !important;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-blue);
    margin-bottom: 25px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f1f5f9;
}

.trending-posts-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.trending-item {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.trending-rank {
    font-family: var(--font-headers) !important;
    font-size: 1.6rem;
    font-weight: 800;
    color: rgba(73, 181, 176, 0.25); /* الرقم بلون الأخضر شفاف فخم جداً */
    line-height: 1;
}

.trending-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.trending-date {
    font-family: var(--font-accent) !important;
    font-size: 0.8rem;
    color: var(--text-dim);
}

.trending-title {
    font-family: var(--font-headers) !important;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.4;
    margin: 0 !important;
}

.trending-title a {
    color: var(--black-fakhim) !important;
    text-decoration: none;
    transition: color 0.2s ease;
}

.trending-title a:hover {
    color: var(--primary-blue) !important;
}

/* ==========================================================================
   8. الترقيم (Pagination)
   ========================================================================== */
.blog-pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 40px;
}

.blog-pagination .page-numbers {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-width: 40px;
    height: 40px;
    background: var(--white) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 10px;
    color: var(--black-fakhim) !important;
    text-decoration: none;
    font-family: var(--font-headers) !important;
    font-size: 0.9rem;
    font-weight: 600;
}

.blog-pagination .page-numbers.current, .blog-pagination .page-numbers:hover {
    background: var(--primary-blue) !important;
    color: var(--white) !important;
    border-color: var(--primary-blue) !important;
}

/* ==========================================================================
   9. الشاشات المتجاوبة الكاملة (Responsive Design)
   ========================================================================== */
@media (max-width: 992px) {
    /* تحويل الهيكل إلى عمود واحد للشاشات المتوسطة والصغيرة */
    .blog-main-layout {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    .blog-sidebar {
        position: static;
    }
}

@media (max-width: 576px) {
    .blog-filter-section {
        padding: 16px;
    }
    .blog-grid {
        grid-template-columns: 1fr !important;
    }
    .digi-blog-banner h1 { font-size: 2rem; }
}
/* تحسين استجابة أزرار التصنيفات الجديدة مع الانتقال الحركي السلس */
.blog-categories-tags {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 5px;
}

.cat-tag-btn {
    font-family: var(--font-accent) !important;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-dim) !important;
    background: #f1f5f9;
    padding: 10px 20px;
    border-radius: 14px;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.cat-tag-btn:hover, .cat-tag-btn.active {
    background: var(--primary-blue) !important;
    color: var(--white) !important;
    box-shadow: 0 6px 15px rgba(59, 113, 185, 0.18);
    transform: translateY(-2px);
}

/* دعم كلاس الانتقال الحركي للكروت عند الفلترة */
.blog-card {
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), 
                box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                border-color 0.4s ease,
                opacity 0.3s ease-in-out !important;
}

/* ==========================================================================
   11. تنسيقات صفحة المقال المفرد الخاصة (Single Post Styling)
   ========================================================================== */


/* 1️⃣ تحسين البانر العلوي والخلفية الداكنة */
.single-post-banner {
    background: linear-gradient(to left, var(--black-fakhim), var(--primary-blue)) !important;
    padding: 60px 0 !important;
    text-align: right;
    color: #ffffff !important; /* ضمان تحول النصوص للون الأبيض */
}

.single-post-banner h1 {
    font-family: var(--font-headers) !important;
    font-size: 2.8rem !important;
    line-height: 1.4 !important;
    color: #ffffff !important; /* لون العنوان أبيض ناصع */
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
    margin: 20px 0 !important;
    font-weight: 800;
}

/* بيانات المقال العلوية */
.single-meta-top {
    font-family: var(--font-accent);
    color: #38bdf8 !important; /* لون أزرق سماوي مضيء واضح جداً */
    font-size: 1rem;
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 10px;
}

.single-meta-top a {
    color: #38bdf8 !important;
    text-decoration: none;
    font-weight: 600;
}

.single-author-top {
    font-family: var(--font-main);
    color: #94a3b8 !important; /* رمادي فاتح متناسق */
    font-size: 1.1rem;
    margin-top: 15px;
}

/* 2️⃣ تحسين منطقة المحتوى الرئيسي (أسفل البانر) */
.single-page-wrapper {
    background-color: #f8fafc !important; /* خلفية الصفحة رمادي فاتح جداً مريح للعين */
    padding: 50px 0;
}

.single-post-content-area {
    background: #ffffff !important; /* حاوية المقال بيضاء تماماً لقراءة مثالية */
    padding: 50px;
    border-radius: 24px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.04) !important;
}

/* الصورة البارزة للمقال */

.single-post-featured-image {
    width: 100% !important;
    max-height: 500px; /* تحديد أقصى ارتفاع مسموح به للحفاظ على جمالية الصفحة */
    border-radius: 16px !important; /* حواف ناعمة متناسقة مع كرت المحتوى */
    overflow: hidden !important;
    margin-bottom: 35px !important;
    background-color: #0f172a; /* خلفية داكنة خفيفة تملأ الفراغات إذا كانت الصورة صغيرة */
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05) !important;
}

.single-post-featured-image img {
    width: 100% !important;
    height: auto !important; /* جعل الارتفاع مرن تلقائي لعدم تمطيط أبعاد الصورة */
    max-height: 500px !important;
    object-fit: contain !important; /* السحر هنا: يضمن ظهور أبعاد الصورة كاملة والنص داخلها بدون أي قص */
    object-position: center !important; /* تمركز الصورة في المنتصف تماماً */
    display: block !important;
}

/* 3️⃣ تحسين خطوط المحتوى الداخلي للمقال (Typography) */
.entry-content {
    font-family: var(--font-main) !important;
    font-size: 1.35rem !important; /* حجم ممتاز ومريح للقراءة الطويلة */
    line-height: 1.9 !important;
    color: #1e293b !important; /* لون النص أسود فخم/رمادي غامق جداً لتجنب إجهاد العين */
    text-align: justify;
}

.entry-content p {
    margin-bottom: 30px !important;
}

/* العناوين الجانبية داخل المقال */
.entry-content h2, .entry-content h3, .entry-content h4 {
    font-family: var(--font-headers) !important;
    color: #0f172a !important; /* تباين كامل للخطوط العريضة */
    font-weight: 700;
    margin: 45px 0 20px 0 !important;
}

.entry-content h2 { font-size: 1.9rem; border-right: 4px solid #1e3a8a; padding-right: 15px; }
.entry-content h3 { font-size: 1.6rem; }

/* 4️⃣ الشاشات المتجاوبة للهواتف (Responsive) */
@media (max-width: 768px) {
    .single-post-content-area {
        padding: 25px 20px;
        border-radius: 16px;
    }
    .single-post-banner h1 {
        font-size: 1.9rem !important;
    }
    .entry-content {
        font-size: 1.2rem !important;
        line-height: 1.8 !important;
    }
}
/* 🔥 كود الطوارئ لإجبار الألوان على التغير في صفحة single post */

body.single-post, 
.single-post-banner, 
.single-post-banner * {
    color: #ffffff !important; /* إجبار كل نصوص البانر العلوي على التحول للأبيض الناصع */
}

.single-post-banner .single-meta-top, 
.single-post-banner .single-meta-top * {
    color: #38bdf8 !important; /* إجبار التاريخ والتصنيفات العلوية على التحول للأزرق السماوي المضيء */
}

/* تحسين حاوية النص السفلي وإجبار الخلفية البيضاء */
main.single-page-wrapper, 
.single-page-wrapper {
    background-color: #f8fafc !important; /* خلفية الصفحة رمادي فاتح جداً */
    display: block !important;
}

.single-post-content-area, 
article.single-post-content-area {
    background: #ffffff !important; /* إجبار صندوق المقال على التحول للون الأبيض ناصع البياض */
    padding: 50px !important;
    color: #1e293b !important; /* إجبار نص المقال على التحول للون الرمادي الغامق جداً (المقروء) */
}

.entry-content p, 
.entry-content span, 
.entry-content div {
    color: #334155 !important; /* تأكيد اللون الداكن المريح للعين داخل الصندوق الأبيض */
    font-size: 1.35rem !important;
    line-height: 1.9 !important;
}

.entry-content h2, 
.entry-content h3 {
    color: #0f172a !important; /* عناوين المقال الداخلية بلون أسود فخم */
}
.single-post-banner h1 {
    font-size: 2.5rem !important; /* حجم خط مناسب لعناوين المقالات */
    line-height: 1.4 !important;
    max-width: 900px; /* لضمان عدم تمدد العنوان بشكل مشوه على الشاشات الواسعة */
    margin: 0 auto;
    padding: 0 15px;
}

.entry-content p, .entry-content ul, .entry-content li {
    margin-bottom: 20px !important;
    line-height: 1.9 !important;
}

/* 2️⃣ تنسيق منطقة التعليقات الكاملة (Comments Section) */
#comments, .comment-respond {
    margin-top: 50px !important;
    padding-top: 30px;
    border-top: 2px solid #f1f5f9; /* استبدال الخط الأسود الرفيع بخط ناعم */
    text-align: right !important;
    direction: rtl !important;
}

/* عنوان "اترك تعليقاً" */
.comment-reply-title {
    font-family: var(--font-headers) !important;
    font-size: 1.6rem !important;
    color: #0f172a !important;
    font-weight: 700;
    margin-bottom: 15px !important;
    display: block;
}

/* نص "مسجل دخول باسم..." */
.logged-in-as {
    font-size: 0.95rem !important;
    color: #64748b !important;
    margin-bottom: 20px !important;
}

/* تنسيق روابط تعديل الملف الشخصي وتسجيل الخروج */
.logged-in-as a {
    color: #1e3a8a !important; /* لون نيلي متناسق بدلاً من الأزرق التقليدي */
    text-decoration: none !important;
    font-weight: 600;
    border-bottom: 1px dashed #1e3a8a;
    padding-bottom: 2px;
    transition: color 0.3s ease;
}

.logged-in-as a:hover {
    color: #3b82f6 !important;
}

/* 3️⃣ تنسيق حقول الإدخال ومربع التعليق (Textarea & Inputs) */
.comment-form-comment {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 25px !important;
}

.comment-form-comment label {
    font-family: var(--font-headers);
    font-weight: 600;
    color: #334155;
    font-size: 1rem;
}

/* تصميم صندوق الكتابة الفخم */
.comment-form textarea, 
#comment {
    width: 100% !important;
    min-height: 150px;
    padding: 15px 20px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 12px !important;
    background-color: #f8fafc !important;
    font-family: var(--font-main) !important;
    font-size: 1.1rem !important;
    color: #1e293b !important;
    outline: none;
    resize: vertical;
    transition: all 0.3s ease !important;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

/* تأثير التفاعل عند الضغط على صندوق الكتابة */
.comment-form textarea:focus, 
#comment:focus {
    border-color: #1e3a8a !important;
    background-color: #ffffff !important;
    box-shadow: 0 0 0 4px rgba(30, 58, 138, 0.1) !important;
}

/* 4️⃣ تنسيق زر "إرسال التعليق" الاحترافي */
.form-submit {
    margin-bottom: 0 !important;
}

.comment-form input[type="submit"], 
#submit {
    background: linear-gradient(135deg, #1e3a8a 0%, #0f172a 100%) !important;
    color: #ffffff !important;
    font-family: var(--font-headers) !important;
    font-size: 1.1rem !important;
    font-weight: 600 !important;
    padding: 12px 35px !important;
    border: none !important;
    border-radius: 10px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.2) !important;
    display: inline-block;
}

/* تأثير تحويم الماوس فوق الزر */
.comment-form input[type="submit"]:hover, 
#submit:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(30, 58, 138, 0.3) !important;
    opacity: 0.95;
}