/* css/post-style.css - Talal Awad Theme (Fixed Mobile & Sidebar) */

/* تعريف المتغيرات المحلية بناءً على Global */
:root {
    --primary: var(--brand-orange, #f57c00);
    --primary-dark: #e65100;
    --bg-card: var(--bg-card, #ffffff);
    --bg-alt: var(--bg-secondary, #f9f9f9);
    --text-main: var(--text-primary, #1a1a1a);
    --text-sec: var(--text-secondary, #666666);
    --text-gray: #888;
    --border: var(--border-color, #eee);
    --shadow: 0 5px 20px rgba(0,0,0,0.05);
}

/* Layout - الحاوية الرئيسية */
.main-layout-flex {
    display: flex;
    gap: 40px;
    padding: 60px 20px;
    align-items: flex-start;
    max-width: 1400px;
    margin: 0 auto;
}

/* Article Area */
.post-article-area {
    flex: 2; /* تأخذ مساحة أكبر */
    background: var(--bg-card);
    padding: 50px;
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    min-width: 0; /* مهم جداً لمنع تمدد المحتوى خارج الشاشة في الموبايل */
}

/* Header & Meta */
.post-article-header { text-align: right; }

.post-badge-chip {
    background: rgba(245, 124, 0, 0.1);
    color: var(--primary);
    padding: 6px 20px;
    border-radius: 50px;
    font-weight: 800;
    font-size: 0.9rem;
    display: inline-block;
    margin-bottom: 20px;
}

.article-title {
    font-size: clamp(1.8rem, 4vw, 3rem); /* خط متجاوب */
    font-weight: 900;
    color: var(--text-main);
    margin-bottom: 25px;
    line-height: 1.4;
}

.article-meta-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    padding-bottom: 25px;
    margin-bottom: 35px;
    flex-wrap: wrap; /* يسمح للعناصر بالنزول لسطر جديد في الموبايل */
    gap: 15px;
}

.meta-author { display: flex; align-items: center; gap: 12px; }
.meta-author img { width: 45px; height: 45px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); }
.meta-author span { color: var(--text-main); font-size: 1rem; }
.meta-author strong { color: var(--primary); }

.meta-data { display: flex; gap: 20px; color: var(--text-gray); font-size: 0.9rem; font-weight: 600; flex-wrap: wrap; }
.meta-data i { color: var(--primary); }

/* Featured Image */
.article-featured-img { margin-bottom: 40px; border-radius: 12px; overflow: hidden; }
.article-featured-img img { width: 100%; height: auto; display: block; }

/* Table of Contents (TOC) */
.article-toc {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-right: 4px solid var(--primary);
    padding: 25px;
    margin: 30px 0;
    border-radius: 12px;
}

.toc-title { font-weight: 800; font-size: 1.2rem; margin-bottom: 15px; color: var(--text-main); display: flex; align-items: center; gap: 10px; }
.toc-title i { color: var(--primary); }
.toc-list { list-style: none; padding: 0; margin: 0; }
.toc-list li { margin-bottom: 10px; }
.toc-list a { color: var(--text-sec); text-decoration: none; font-weight: 600; transition: 0.3s; display: block; }
.toc-list a:hover { color: var(--primary); transform: translateX(-5px); }
.toc-list li.sub-item { margin-right: 20px; font-size: 0.9rem; border-right: 2px solid var(--border); padding-right: 10px; }

/* Main Content Typography */
.article-main-text { font-size: 1.2rem; line-height: 2; color: var(--text-main); }
.article-main-text h2 { font-size: 1.8rem; color: var(--text-main); margin: 45px 0 20px; font-weight: 800; }
.article-main-text h3 { font-size: 1.5rem; color: var(--text-main); margin: 35px 0 15px; font-weight: 700; }
.article-main-text p { margin-bottom: 25px; }
.article-main-text strong { color: var(--primary); }
.article-main-text img { max-width: 100%; height: auto; border-radius: 8px; margin: 20px 0; }
.article-main-text blockquote {
    background: var(--bg-alt); border-right: 5px solid var(--primary);
    padding: 25px; margin: 35px 0; font-style: italic; color: var(--text-sec); font-size: 1.1rem;
}

/* Footer Box */
.article-footer-box { margin-top: 50px; padding-top: 30px; border-top: 1px solid var(--border); }
.tags-container, .share-container { display: flex; align-items: center; gap: 15px; margin-bottom: 20px; flex-wrap: wrap; }
.box-label { font-weight: 800; color: var(--text-main); }

.tags-list a {
    background: var(--bg-alt); padding: 6px 18px; border-radius: 50px;
    font-size: 0.85rem; color: var(--text-sec); border: 1px solid var(--border); transition: 0.3s;
}
.tags-list a:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

.share-icons-row a {
    width: 45px; height: 45px; background: var(--bg-alt); border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--text-main); margin-left: 10px; border: 1px solid var(--border); transition: 0.3s; font-size: 1.1rem;
}
.share-icons-row a:hover { background: var(--primary); color: #fff; border-color: var(--primary); transform: translateY(-3px); }

/* --- Sidebar (السايدبار) --- */
.article-sidebar { flex: 1; max-width: 380px; position: sticky; top: 100px; }

/* 🔥 إصلاح الصورة فوق الاسم (Author Box Fix) 🔥 */
.side-widget {
    background: var(--bg-card); 
    padding: 35px; 
    border-radius: 16px;
    border: 1px solid var(--border); 
    margin-bottom: 30px; 
    text-align: center;
    box-shadow: var(--shadow);
    
    /* جعل العناصر عمودية ومحاذاتها في المنتصف */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.author-box img {
    width: 120px; 
    height: 120px; 
    border-radius: 50%; 
    margin: 0 auto 15px auto; /* توسيط تلقائي ومسافة من الأسفل */
    border: 4px solid var(--primary); 
    padding: 4px; 
    background: #fff; 
    object-fit: cover;
    display: block; /* لضمان عدم تأثرها بالـ inline */
}

.author-box h4 { 
    font-size: 1.4rem; 
    margin-bottom: 10px; 
    font-weight: 800; 
    color: var(--text-main); 
    width: 100%;
}

.author-box p { color: var(--text-sec); font-size: 0.95rem; margin-bottom: 20px; line-height: 1.6; }
.author-socials a { color: var(--text-gray); margin: 0 10px; font-size: 1.3rem; transition: 0.3s; }
.author-socials a:hover { color: var(--primary); }

.newsletter-widget input {
    width: 100%; padding: 14px; margin-bottom: 10px; border: 1px solid var(--border);
    border-radius: 8px; background: var(--bg-alt); outline: none; color: var(--text-main);
}
.newsletter-widget button {
    width: 100%; padding: 14px; background: var(--primary); color: #fff;
    border: none; border-radius: 8px; cursor: pointer; font-weight: bold; transition: 0.3s;
}
.newsletter-widget button:hover { background: var(--primary-dark); }

/* CTA Box */
.article-cta-box {
    background: linear-gradient(135deg, var(--primary) 0%, #e65100 100%);
    border-radius: 20px; padding: 40px; text-align: center; margin-top: 50px;
    color: #fff; box-shadow: 0 15px 35px rgba(245, 124, 0, 0.3);
}
.article-cta-box h3 { color: #fff !important; margin-bottom: 10px; font-size: 1.8rem; font-weight: 900; }
.article-cta-box p { color: rgba(255, 255, 255, 0.95) !important; margin-bottom: 25px; font-size: 1.1rem; }
.cta-btns { display: flex; justify-content: center; gap: 15px; flex-wrap: wrap; }

.btn-cta-primary {
    background: #fff; color: var(--primary) !important; padding: 12px 30px;
    border-radius: 50px; font-weight: 800; text-decoration: none; transition: 0.3s;
    display: inline-flex; align-items: center; gap: 8px;
}
.btn-cta-outline {
    background: transparent; border: 2px solid #fff; color: #fff !important;
    padding: 10px 30px; border-radius: 50px; font-weight: 800; text-decoration: none; transition: 0.3s;
}
.btn-cta-primary:hover { transform: translateY(-3px); box-shadow: 0 10px 20px rgba(0,0,0,0.2); }
.btn-cta-outline:hover { background: #fff; color: var(--primary) !important; }

/* 🔥 Mobile Responsive Fixes (إصلاحات الموبايل) 🔥 */
@media (max-width: 992px) {
    .main-layout-flex {
        flex-direction: column; /* يجعل السايدبار تحت المقال */
        padding: 40px 15px; /* تقليل الهوامش */
    }

    .article-sidebar {
        width: 100%; /* السايدبار يأخذ عرض كامل */
        max-width: 100%;
        position: static; /* إزالة التثبيت في الموبايل */
        order: 2; /* يظهر بعد المقال */
    }

    .post-article-area {
        padding: 30px 20px; /* تقليل الحواف الداخلية */
        width: 100%;
        order: 1;
    }

    .article-title { font-size: 1.8rem; }
    
    .article-meta-info {
        flex-direction: column; /* المعلومات تحت بعض */
        align-items: flex-start;
        gap: 15px;
    }
    
    .meta-data { width: 100%; justify-content: space-between; }
    
    .cta-btns { flex-direction: column; width: 100%; }
    .btn-cta-primary, .btn-cta-outline { width: 100%; justify-content: center; }
}