/* ========== Blog Hero ========== */
.blog-hero {
    background: linear-gradient(135deg, #1F334E 0%, #2a4a6d 100%);
    padding: 140px 20px 60px;
    text-align: center;
}

.blog-hero h1 {
    font-size: 42px;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 15px;
}

.blog-hero p {
    font-size: 18px;
    color: #94a3b8;
}

/* ========== Breadcrumb ========== */
.breadcrumb {
    margin-bottom: 30px;
}

.breadcrumb ol {
    display: flex;
    align-items: center;
    gap: 10px;
    list-style: none;
    padding: 0;
    margin: 0;
    flex-wrap: wrap;
}

.breadcrumb li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #94a3b8;
}

.breadcrumb li:not(:last-child)::after {
    content: '/';
    color: #64748b;
}

.breadcrumb a {
    color: #F2B100;
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumb a:hover {
    color: #ffffff;
}

/* ========== Blog Filters ========== */
.blog-filters {
    background: #ffffff;
    padding: 30px 20px;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 80px;
    z-index: 50;
}

.blog-filters .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.categories-tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.category-tab {
    background: #f1f5f9;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 14px;
    font-family: 'Zain', sans-serif;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
}

.category-tab:hover {
    background: #e2e8f0;
    color: #1F334E;
}

.category-tab.active {
    background: #1F334E;
    color: #ffffff;
}

.search-box {
    position: relative;
    width: 300px;
    max-width: 100%;
}

.search-box input {
    width: 100%;
    padding: 12px 45px 12px 20px;
    border: 1px solid #e5e7eb;
    border-radius: 25px;
    font-size: 14px;
    font-family: 'Zain', sans-serif;
    outline: none;
    transition: border-color 0.2s;
}

.search-box input:focus {
    border-color: #F2B100;
}

.search-box svg {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
}

/* ========== Blog Posts Grid ========== */
.blog-posts {
    padding: 60px 20px;
    background: #f8fafc;
    min-height: 60vh;
}

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

.post-card {
    background: #ffffff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s, box-shadow 0.3s;
    text-decoration: none;
    display: block;
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
}

.post-card-image {
    width: 100%;
    height: 220px;
    overflow: hidden;
}

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

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

.post-card-content {
    padding: 25px;
}

.post-card-category {
    display: inline-block;
    background: #e0e7ff;
    color: #4338ca;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 12px;
}

.post-card-title {
    font-size: 20px;
    font-weight: 700;
    color: #1F334E;
    margin-bottom: 12px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card-excerpt {
    font-size: 15px;
    color: #64748b;
    line-height: 1.7;
    margin-bottom: 20px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card-meta {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 13px;
    color: #94a3b8;
}

.post-card-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* ========== Loading & Empty States ========== */
.posts-loading,
.no-posts {
    text-align: center;
    padding: 60px 20px;
    color: #64748b;
}

.posts-loading .spinner,
.content-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: #F2B100;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
}

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

.no-posts h3 {
    font-size: 20px;
    color: #1F334E;
    margin: 20px 0 10px;
}

/* ========== Pagination ========== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 56px;
}

/* روابط الترقيم <a>/<span> — بنفس مظهر الأزرار القديمة */
.pagination button,
.pagination .page-num,
.pagination .page-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 45px;
    height: 45px;
    padding: 0 6px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    font-family: 'Zain', 'Tahoma', sans-serif;
    color: #64748b;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
}

.pagination button:hover,
.pagination a.page-num:hover,
.pagination a.page-arrow:hover {
    border-color: #F2B100;
    color: #F2B100;
}

.pagination button.active,
.pagination .page-num.active {
    background: #1F334E;
    border-color: #1F334E;
    color: #ffffff;
    cursor: default;
}

.pagination button:disabled,
.pagination .page-arrow.is-disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.pagination .page-arrow svg { display: block; }

.pagination .page-gap {
    display: inline-flex;
    align-items: flex-end;
    padding: 0 2px 8px;
    color: #94a3b8;
    font-weight: 700;
    user-select: none;
}

/* ========== Newsletter ========== */
.newsletter {
    background: linear-gradient(135deg, #F2B100 0%, #f59e0b 100%);
    padding: 80px 20px;
}

.newsletter-content {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.newsletter h2 {
    font-size: 32px;
    font-weight: 800;
    color: #1F334E;
    margin-bottom: 15px;
}

.newsletter p {
    font-size: 18px;
    color: #1F334E;
    opacity: 0.8;
    margin-bottom: 30px;
}

.newsletter-form {
    display: flex;
    gap: 10px;
    max-width: 450px;
    margin: 0 auto;
}

.newsletter-form input {
    flex: 1;
    padding: 15px 20px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-family: 'Zain', sans-serif;
    outline: none;
}

.newsletter-form button {
    background: #1F334E;
    color: #ffffff;
    border: none;
    padding: 15px 30px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    font-family: 'Zain', sans-serif;
    cursor: pointer;
    transition: background 0.2s;
}

.newsletter-form button:hover {
    background: #162436;
}

/* ========== Article Page ========== */
.blog-article {
    padding-top: 120px;
    padding-bottom: 60px;
}

.blog-article .container {
    max-width: 900px;
}

.article-header {
    text-align: center;
    margin-bottom: 40px;
}

.article-category {
    display: inline-block;
    background: #e0e7ff;
    color: #4338ca;
    padding: 8px 20px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 20px;
}

.article-title {
    font-size: 40px;
    font-weight: 800;
    color: #1F334E;
    line-height: 1.3;
    margin-bottom: 25px;
}

.article-meta {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    color: #64748b;
}

.meta-item svg {
    color: #94a3b8;
}

/* Featured Image */
.article-featured-image {
    margin-bottom: 40px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.article-featured-image img {
    width: 100%;
    height: auto;
    display: block;
}

/* Article Content */
.article-content {
    font-size: 18px;
    line-height: 1.9;
    color: #374151;
}

.article-content h2 {
    font-size: 28px;
    font-weight: 700;
    color: #1F334E;
    margin: 40px 0 20px;
}

.article-content h3 {
    font-size: 22px;
    font-weight: 700;
    color: #1F334E;
    margin: 30px 0 15px;
}

.article-content p {
    margin-bottom: 20px;
}

.article-content ul,
.article-content ol {
    margin: 20px 0;
    padding-right: 30px;
}

.article-content li {
    margin-bottom: 10px;
}

.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 30px 0;
}

.article-content blockquote {
    background: #f8fafc;
    border-right: 4px solid #F2B100;
    padding: 25px 30px;
    margin: 30px 0;
    border-radius: 0 12px 12px 0;
    font-style: italic;
    color: #64748b;
}

.article-content code {
    background: #f1f5f9;
    padding: 3px 8px;
    border-radius: 5px;
    font-family: monospace;
    font-size: 15px;
}

.article-content pre {
    background: #1F334E;
    color: #e2e8f0;
    padding: 25px;
    border-radius: 12px;
    overflow-x: auto;
    margin: 30px 0;
}

.article-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.article-content a {
    color: #F2B100;
    text-decoration: underline;
}

.article-content a:hover {
    color: #1F334E;
}

/* Share Buttons */
.article-share {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 30px 0;
    margin: 40px 0;
    border-top: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
}

.article-share span {
    font-size: 16px;
    font-weight: 600;
    color: #1F334E;
}

.share-buttons {
    display: flex;
    gap: 10px;
}

.share-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    transition: transform 0.2s, opacity 0.2s;
    border: none;
    cursor: pointer;
}

.share-btn:hover {
    transform: scale(1.1);
    opacity: 0.9;
}

.share-btn.twitter {
    background: #000000;
}

.share-btn.linkedin {
    background: #0077b5;
}

.share-btn.whatsapp {
    background: #25d366;
}

.share-btn.copy {
    background: #64748b;
}

/* Author Box */
.author-box {
    display: flex;
    gap: 20px;
    background: #f8fafc;
    padding: 30px;
    border-radius: 16px;
    margin: 40px 0;
}

.author-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
}

.author-info h4 {
    font-size: 20px;
    font-weight: 700;
    color: #1F334E;
    margin-bottom: 10px;
}

.author-info p {
    font-size: 15px;
    color: #64748b;
    line-height: 1.7;
}

/* Related Posts */
.related-posts {
    margin-top: 60px;
}

.related-posts h3 {
    font-size: 24px;
    font-weight: 700;
    color: #1F334E;
    margin-bottom: 30px;
}

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

.related-card {
    display: flex;
    gap: 15px;
    background: #ffffff;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    text-decoration: none;
    transition: transform 0.2s;
}

.related-card:hover {
    transform: translateY(-3px);
}

.related-card img {
    width: 100px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.related-card-content h4 {
    font-size: 15px;
    font-weight: 600;
    color: #1F334E;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.related-card-content span {
    font-size: 13px;
    color: #94a3b8;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .blog-hero {
        padding: 120px 20px 50px;
    }
    
    .blog-hero h1 {
        font-size: 32px;
    }
    
    .blog-filters .container {
        flex-direction: column;
    }
    
    .categories-tabs {
        justify-content: center;
    }
    
    .search-box {
        width: 100%;
    }
    
    .posts-grid {
        grid-template-columns: 1fr;
    }
    
    .article-title {
        font-size: 28px;
    }
    
    .article-content {
        font-size: 16px;
    }
    
    .article-meta {
        gap: 15px;
    }
    
    .author-box {
        flex-direction: column;
        text-align: center;
    }
    
    .author-avatar {
        margin: 0 auto;
    }
    
    .newsletter-form {
        flex-direction: column;
    }
    
    .related-grid {
        grid-template-columns: 1fr;
    }
}
/* ===== تحسينات المقال: جداول + صناديق خلاصة/FAQ (SSR) ===== */
.article-content table { width: 100%; border-collapse: collapse; margin: 26px 0; font-size: 16px; overflow: hidden; border-radius: 12px; box-shadow: 0 4px 20px rgba(31,51,78,.08); }
.article-content thead th { background: linear-gradient(135deg,#1F334E,#16273b); color: #fff; font-weight: 800; padding: 14px 16px; text-align: right; }
.article-content td { padding: 13px 16px; border-bottom: 1px solid #eef1f6; }
.article-content tbody tr:nth-child(even) { background: #f7f9fc; }
.article-content td:first-child { font-weight: 700; color: #1F334E; }
.tldr { background: #f2f6fc; border-inline-start: 5px solid #F2B100; border-radius: 12px; padding: 20px 24px; margin: 26px 0; }
.tldr h3 { margin: 0 0 8px; color: #1F334E; font-size: 20px; }
.tldr p, .tldr li { color: #33455f; }
.article-faq { margin-top: 40px; }
.article-faq .faq-q { background: #fff; border: 1px solid #e6ebf3; border-radius: 12px; padding: 18px 22px; margin-bottom: 14px; box-shadow: 0 3px 14px rgba(31,51,78,.05); }
.article-faq .faq-q h3 { margin: 0 0 8px; color: #1F334E; font-size: 19px; display: flex; gap: 10px; align-items: flex-start; }
.article-faq .faq-q h3::before { content: "؟"; color: #F2B100; font-weight: 900; }
.article-faq .faq-q p { margin: 0; color: #44566f; line-height: 1.8; }
.article-key { background: linear-gradient(135deg,#fff9e9,#fff); border: 1px solid #f6e6b8; border-radius: 12px; padding: 18px 22px; margin: 24px 0; font-weight: 700; color: #1F334E; }

/* ===== CTA أعمال في المدونة (بديل النشرة الوهمية) ===== */
.blog-cta { padding: 70px 20px; background: linear-gradient(135deg,#1F334E 0%,#16273b 100%); }
.blog-cta-box { max-width: 720px; margin: 0 auto; text-align: center; }
.blog-cta h2 { font-size: clamp(26px,4vw,38px); font-weight: 900; color: #fff; margin-bottom: 12px; }
.blog-cta p { font-size: clamp(16px,2vw,20px); color: rgba(255,255,255,.82); margin-bottom: 28px; line-height: 1.7; }
.blog-cta-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.blog-cta-btn { display: inline-flex; align-items: center; justify-content: center; padding: 15px 30px; border-radius: 12px; font-weight: 800; font-size: 16px; font-family: 'Zain', sans-serif; transition: transform .2s ease, box-shadow .2s ease; }
.blog-cta-btn.primary { background: linear-gradient(135deg,#F2B100,#ffcb3d); color: #1F334E; box-shadow: 0 10px 26px rgba(242,177,0,.35); }
.blog-cta-btn.wa { background: rgba(255,255,255,.08); color: #fff; border: 1px solid rgba(255,255,255,.28); }
.blog-cta-btn:hover { transform: translateY(-3px); }

/* ===== SSR blog listing — شبكة بطاقات احترافية ===== */
.blog-listing { padding: 50px 0 30px; background: var(--light-bg, #f5f7fa); }
/* auto-fill + minmax: يتجاوب تلقائياً، ويوسّط القليل من البطاقات بدل تركها معلّقة على الجانب */
.blog-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 360px)); gap: 28px; justify-content: center; }
.blog-card { background: #fff; border-radius: 18px; overflow: hidden; box-shadow: 0 8px 30px rgba(0,0,0,.07); transition: transform .3s ease, box-shadow .3s ease; display: flex; flex-direction: column; text-align: right; }
.blog-card:hover { transform: translateY(-8px); box-shadow: 0 22px 50px rgba(31,51,78,.15); }
.blog-card-image { height: 200px; overflow: hidden; }
.blog-card-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.blog-card-content { padding: 22px; display: flex; flex-direction: column; flex: 1; }
.blog-card-category { align-self: flex-start; background: rgba(242,177,0,.16); color: #b47d00; font-size: 13px; font-weight: 800; padding: 4px 12px; border-radius: 20px; margin-bottom: 12px; }
.blog-card h3 { font-size: 20px; font-weight: 800; color: #1F334E; margin: 0 0 10px; line-height: 1.4; }
.blog-card p { font-size: 15px; color: #5b6b82; line-height: 1.7; margin: 0 0 16px; flex: 1; }
.blog-card-meta { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: #8a97a9; font-weight: 700; border-top: 1px solid #eef1f6; padding-top: 12px; }
.related-posts-section { padding: 50px 0; background: var(--light-bg,#f5f7fa); }
.related-posts-section .related-posts { display: grid; grid-template-columns: repeat(3,1fr); gap: 24px; margin-top: 24px; }
@media (max-width: 900px) { .related-posts-section .related-posts { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .related-posts-section .related-posts { grid-template-columns: 1fr; } }

/* ===== إصلاح طفح الجدول على الجوال — يتمرّر داخل نفسه بدل دفع الصفحة ===== */
@media (max-width: 768px) {
  .article-content table { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
  .article-content { overflow-wrap: break-word; word-wrap: break-word; }
}

/* ===== مبدّل اللغة في رأس المدونة (SSR) ===== */
.nav-actions { display: flex; align-items: center; gap: 12px; }
.nav-menu .lang-switch {
  display: inline-flex; align-items: center; gap: 6px;
  border: 2px solid rgba(31,51,78,.18); color: #1F334E;
  padding: 5px 14px; border-radius: 999px; font-weight: 800; font-size: 14px;
  transition: all .25s ease; white-space: nowrap;
}
.nav-menu .lang-switch::after { display: none; }
.nav-menu .lang-switch:hover { border-color: #F2B100; background: #fffdf5; color: #b47d00; }
.lang-switch-mobile {
  display: none; align-items: center; justify-content: center;
  min-width: 40px; height: 34px; padding: 0 10px; border-radius: 999px;
  border: 2px solid rgba(31,51,78,.18); color: #1F334E; font-weight: 900; font-size: 14px;
}
.lang-switch-mobile:hover { border-color: #F2B100; color: #b47d00; }
@media (max-width: 992px) {
  .lang-switch-mobile { display: inline-flex; }
  .nav-menu .lang-switch { font-size: 20px; padding: 8px 22px; }
}

/* ===== دعم الإنجليزية LTR في المدونة ===== */
/* styles.css يفرض body{direction:rtl} فنعيد الاتجاه لـLTR على محتوى المدونة الإنجليزي
   حتى لا تنقلب علامات الترقيم المحايدة (?، /) لأول السطر */
[dir="ltr"] .blog-hero,
[dir="ltr"] .blog-listing,
[dir="ltr"] .blog-cta,
[dir="ltr"] .blog-article,
[dir="ltr"] .related-posts-section,
[dir="ltr"] .breadcrumb,
[dir="ltr"] .article-header,
[dir="ltr"] .article-title,
[dir="ltr"] .article-meta,
[dir="ltr"] .article-content,
[dir="ltr"] .blog-card { direction: ltr; }
[dir="ltr"] .blog-card { text-align: left; }
[dir="ltr"] .blog-card-category { align-self: flex-start; }
[dir="ltr"] .blog-card h3,
[dir="ltr"] .article-title,
[dir="ltr"] .article-content { text-align: left; }
[dir="ltr"] .article-content table { white-space: normal; }
