/* إعدادات عامة */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Cairo', sans-serif;
    background: linear-gradient(135deg, #e0f2f7 0%, #c2e9fb 100%); /* ألوان فاتحة وأنيقة */
    min-height: 100vh;
    color: #333;
    direction: rtl;
    text-align: right;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 10px;
}

/* هوية القناة */
.channel-identity {
    background: linear-gradient(135deg, #4a90e2, #50e3c2); /* أزرق مخضر */
    color: white;
    padding: 15px 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    margin-bottom: 5px;
}

.identity-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.channel-name {
    font-size: 2rem;
    color: white; /* أبيض */
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.profile-pic-container {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-pic {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid white;
    object-fit: cover;
    object-position: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

/* شريط الإعلان */
.advertisement-bar {
    padding: 14px; /* <-- هذا هو السطر الذي يجب تعديله */
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 5px;
    position: relative;
    overflow: hidden;
    display: flex; /* استخدام فليكس بوكس للمحاذاة الأفقية */
    align-items: center;
    justify-content: flex-end; /* دفع العناصر إلى اليمين في RTL */
}

.ad-highlight {
    background-color: #dc3545; /* أحمر */
    color: white; /* تم تصحيح اللون إلى الأبيض */
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 1.1rem; /* تم تصحيح حجم الخط ليكون منطقيًا */
    font-weight: bold;
    text-align: center;
    animation: blink 1.5s infinite;
    display: inline-block; /* لجعل المربع يتناسب مع المحتوى */
}
/* تم إزالة السطور الخاطئة هنا */

/* البطاقات العامة */
.section-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 10px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.section-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    background: rgba(255, 255, 255, 1);
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #000000;
    margin-bottom: 10px;
    text-align: center;
}

.section-description {
    color: #7f8c8d;
    text-align: center;
    font-size: 1rem;
}

/* بطاقة المنشورات */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.post-card {
    background: linear-gradient(135deg, #2DABF9 0%, #2DABF9 100%); /* أزرق جديد */
    color: white;
    border-radius: 12px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.post-card:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.all-posts-card {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%); /* أزرق */
}

.post-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.4;
}

.post-date {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 8px;
}

.post-summary {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.9rem;
    opacity: 0.9;
    line-height: 1.4;
}

/* النوافذ المنبثقة */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
}

.modal-content {
    background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%); /* رمادي داكن */
    margin: 5% auto;
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 800px;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
    max-height: 80vh;
    overflow-y: auto;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.close-button {
    color: white;
    float: left;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    top: 15px;
    left: 25px;
    transition: color 0.3s ease;
}

.close-button:hover {
    color: #ffeb3b;
}

.modal-title {
    color: white;
    text-align: center;
    margin-bottom: 30px;
    font-size: 2rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

/* شبكة قنوات التليجرام */
.telegram-channels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.channel-item {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.channel-item:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    background: rgba(255, 255, 255, 1);
}

.channel-icon {
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1abc9c, #16a085); /* أخضر مائي */
    border-radius: 50%;
    color: white;
    flex-shrink: 0;
}

.channel-name {
    font-size: 1rem;
    font-weight: 600;
    color: #000000 !important; /* <-- أضفنا !important لفرض اللون الأسود */
    flex: 1;
}

/* شبكة العناصر المنبثقة */
.modal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.modal-item {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.modal-item:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    background: rgba(255, 255, 255, 1);
}

.modal-item-icon {
    font-size: 2rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f39c12, #e67e22); /* برتقالي */
    border-radius: 50%;
    color: white;
    flex-shrink: 0;
}

.modal-item-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: #000000;
    flex: 1;
}

/* الفوتر */
.footer {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    padding: 20px 0;
    text-align: center;
    margin-top: 10px;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 15px;
    color: #3498db;
}

.social-links {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    justify-items: center;
    gap: 15px;
    margin-bottom: 15px;
    max-width: 300px;
    margin: 0 auto 15px auto;
}

.social-link {
    color: white;
    text-decoration: none;
    font-size: 1.5rem;
    padding: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
}

.social-link:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.copyright {
    font-size: 0.9rem;
    opacity: 0.8;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 15px;
}

/* الأزرار العائمة */
.back-to-top, .back-to-home {
    position: fixed;
    bottom: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 999;
    opacity: 0.7;
    visibility: visible;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    background: rgba(52, 152, 219, 0.7); /* أزرق شفاف 70% */
}

.back-to-top {
    right: 20px;
}

.back-to-home {
    right: 80px;
}

.back-to-top.show, .back-to-home.show {
    opacity: 0.7;
    visibility: visible;
}

.back-to-top:hover, .back-to-home:hover {
    transform: translateY(-3px) scale(1.1);
    opacity: 1;
}

/* التجاوب مع الشاشات الصغيرة */
@media (max-width: 768px) {
    .channel-name {
        font-size: 1.5rem;
    }
    
    .profile-pic-container {
        width: 50px;
        height: 50px;
    }
    
    .posts-grid {
        grid-template-columns: 1fr;
    }
    
    .telegram-channels-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 20px;
    }
    
    .modal-grid {
        grid-template-columns: 1fr;
    }
    
    .social-links {
        flex-direction: column;
        align-items: center;
    }
    
    .identity-content {
        padding: 0 15px;
    }
    
    .main-content {
        padding: 0 5px;
    }
}

@media (max-width: 480px) {
    .section-card {
        padding: 10px;
        margin-bottom: 6px;
        border-radius: 10px;
    }
    
    .section-title {
        font-size: 1.1rem;
    }
    .posts-list-title, .posts-list-description {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* أنماط البطاقات الجديدة لصفحة المنشور الفردي */
.card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 10px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
}

.post-header-card {
    text-align: center;
}

.post-image-card {
    display: flex;
    justify-content: center;
    align-items: center;
}

.post-image-responsive {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
}

.post-content-card {
    /* يمكن إضافة أنماط إضافية هنا إذا لزم الأمر */
}

.download-links {
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.download-link, .telegram-link {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.download-link:hover, .telegram-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.post-navigation-footer {
    margin-top: 20px;
    padding: 10px 0;
    border-top: 1px solid #eee;
}

.post-navigation {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.nav-link {
    background: #f0f0f0;
    padding: 8px 15px;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
}

.nav-link:hover {
    background: #e0e0e0;
    transform: translateY(-1px);
}

.nav-link i {
    font-size: 1rem;
}

.prev-post {
    margin-right: auto; /* يدفع الزر إلى اليمين */
}

.next-post {
    margin-left: auto; /* يدفع الزر إلى اليسار */
}

@media (max-width: 768px) {
    .card {
        padding: 15px;
    }
    .download-link, .telegram-link {
        width: 100%;
        justify-content: center;
    }
    .post-navigation {
        flex-direction: column;
        align-items: center;
    }
    .nav-link {
        width: 100%;
        justify-content: center;
    }
}

/* أنماط الشريط الإعلاني */
.ad-banner {
    background-color: #f0f0f0; /* لون خلفية فاتح للشريط */
    padding: 12px 20px;
    margin-top: 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: flex-end; /* محاذاة المحتوى إلى اليمين */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    overflow: hidden; /* لإخفاء أي محتوى يتجاوز الشريط */
}

.ad-label {
    background-color: #ff4d4d; /* أحمر */
    color: black;
    padding: 5px 10px;
    border-radius: 4px;
    font-weight: bold;
    margin-right: 6px; /* مسافة بين كلمة إعلان والنص */
    animation: blink 1s infinite; /* تأثير الوميض */
}

.ad-text {
    flex-grow: 1; /* لجعل النص الإعلاني يملأ المساحة المتبقية */
    text-align: right; /* محاذاة النص إلى اليمين */
    white-space: nowrap; /* منع التفاف النص */
    overflow: hidden; /* إخفاء النص الزائد */
    text-overflow: ellipsis; /* إضافة علامة الحذف للنص الزائد */
}

@keyframes blink {
    0% { opacity: 1; }
    50% { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes blink {
    0%, 50% {
        opacity: 1;
    }
    51%, 100% {
        opacity: 0.3;
    }
}

/* أنماط شريط الإعلان في نهاية كل منشور */
.ad-banner {
    background-color: #ffeb3b; /* خلفية صفراء افتراضية */
    color: #000000; /* لون نص افتراضي */
    padding: 15px 20px;
    text-align: center;
    font-weight: 600;
    font-size: 1.1rem; /* نفس حجم خط كلمة إعلان فw شريط الرئيسي */
    margin-top: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: flex-end; /* دفع العناصر إلى اليمين في RTL */
}

.ad-label {
    background-color: #dc3545; /* أحمر */
    color: black;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 1.1rem; /* نفس حجم خط كلمة إعلان في الشريط الرئيسي */
    font-weight: bold;
    text-align: center;
    animation: blink 1.5s infinite;
    margin-left: 5; /* إزالة الهامش الأيسر */
}

.ad-text {
    font-size: 0.9rem; /* أصغر من حجم خط كلمة إعلان */
}

#advertisement-text {
    font-size: 0.9em; /* حجم خط أصغر من ad-highlight */
    margin-left: 3ch; /* 3 مسافات حرف من المربع */
    flex-grow: 1; /* يأخذ المساحة المتبقية */
    text-align: right; /* محاذاة النص إلى اليمين */
}

/* التعديلات للشاشات الصغيرة جداً */
@media (max-width: 320px) {
    .advertisement-bar {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: flex-end; /* دفع العناصر إلى اليمين في RTL */
        padding: 0;
    }

.ad-highlight {
    background-color: #dc3545; /* أعدنا الخلفية الحمراء */
    color: white;              /* تأكدنا من أن لون النص أبيض */
    border: none;              /* أزلنا الإطار */
    border-radius: 4px;        /* أعدنا الحواف الدائرية */
    padding: 4px 8px;          /* أعدنا الحشو الأصلي */
    font-size: 0.9rem;         /* حافظنا على حجم الخط المناسب للشاشة الصغيرة */
    animation: blink 1.5s infinite; /* أعدنا وميض الخلفية الأصلي */
    margin-right: 0;
}

    #advertisement-text {
        font-size: 0.8rem !important;
        margin-left: 2ch; /* مسافة 2ch بين المربع والنص */
        flex-grow: 1;
    }
}

@keyframes blink-border {
    0%, 50% { border-color: #dc3545; }
    51%, 100% { border-color: transparent; }
}

/* أنماط المحتوى الإعلاني */
#advertisement-text {
    font-size: 0.9rem; /* حجم خط أصغر من كلمة إعلان */
} /* تم إضافة القوس المفقود هنا */

/* تأثير الوميض */
@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

/* أنماط Statcounter مع أيقونة العين */
.statcounter-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 10px;
    flex-direction: column;
}

.statcounter-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 8px 12px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.eye-icon {
    font-size: 18px;
    color: #3498db;
    margin-bottom: 4px;
}

.statcounter-container img {
    display: none; /* إخفاء الصورة الأصلية */
}

.custom-counter {
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    text-align: center;
}

/* إخفاء العداد الأصلي وإظهار التصميم المخصص */
.statcounter {
    display: none !important;
}

/* =================================================
 *  الحل النهائي للون الشريط الإعلاني العلوي
 *  (يقرأ اللون من متغير CSS)
 * =================================================
*/
.header-contact ul li a.advertisement-text {
    color: var(--ad-text-color, #FFFFFF) !important;
}

/* =================================================================
 *  فرض اللون الأسود على نصوص قائمة قنوات التليجرام المنبثقة
 * =================================================================
*/

/*
   نستهدف أي رابط (a) موجود داخل عنصر يحمل الكلاس (channel-item).
   هذا أكثر تحديدًا من استهداف .channel-name فقط.
   نستخدم !important لضمان تجاوز أي قواعد أخرى.
*/
.channel-item a,
.channel-item .channel-name {
    color: #000000 !important; /* فرض اللون الأسود */
    text-decoration: none !important; /* إزالة أي خط تحت الرابط (اختياري) */
}

