/* =========================================
   1. المتغيرات والإعدادات العامة
   ========================================= */
:root {
    --gold-primary: #FFD700;       /* ذهبي أساسي */
    --gold-dim: #b8860b;           /* ذهبي داكن للإطارات */
    --mosque-color: #0f0518;       /* لون المساجد (كحلي ليلي) */
    --highlight-bg: #fff9c4;       /* لون تظليل الآية (أصفر كريمي) */
    --text-color: #1e293b;         /* لون النص */
    --glass-bg: rgba(20, 30, 48, 0.9); /* خلفية زجاجية داكنة */
    --glass-border: rgba(255, 215, 0, 0.3); /* حدود زجاجية ذهبية */
}

/* استيراد الخطوط (يجب أن تكون الروابط موجودة في HTML أيضاً) */
.font-kufi { font-family: 'Reem Kufi', sans-serif; }
.font-amiri { font-family: 'Amiri', serif; }

body {
margin: 0;
    padding: 0;
    overflow-x: hidden;
    min-height: 100vh;
    font-family: 'Amiri', serif;
    background-color: #000; /* لون احتياطي */
    padding-bottom: 150px; /* تم إضافة مسافة سفلية لتجنب تغطية الفوتر الثابت */
}

/* =========================================
   2. خلفية الغروب والنجوم والمساجد المتحركة
   ========================================= */

/* السماء المتدرجة (ليلي هادئ) */
.calm-sky {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to bottom, #020024 0%, #090979 40%, #5a1c70 80%, #b35d15 100%);
    z-index: -10;
}

/* الموجات الهادئة (Faith Waves) - خلفية متحركة للرقية */
.faith-waves {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: 
        radial-gradient(circle at 50% 100%, rgba(52, 211, 153, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 0% 0%, rgba(255, 215, 0, 0.1) 0%, transparent 30%);
    animation: waveMovement 30s linear infinite alternate;
    z-index: -8;
}

@keyframes waveMovement {
    from { background-position: 0% 0%, 100% 100%; }
    to { background-position: 100% 100%, 0% 0%; }
}


/* النجوم المتساقطة (Falling Stars) */
.stars-falling {
    position: fixed; top: 0; left: 0; width: 100%; height: 200%;
    background-image: 
        radial-gradient(2px 2px at 100px 50px, #fff, transparent),
        radial-gradient(1.5px 1.5px at 200px 150px, #fff, transparent),
        radial-gradient(2px 2px at 300px 50px, #fff, transparent),
        radial-gradient(2.5px 2.5px at 450px 250px, #fff, transparent),
        radial-gradient(1px 1px at 600px 100px, #fff, transparent),
        radial-gradient(2px 2px at 800px 300px, #fff, transparent);
    background-size: 500px 500px;
    opacity: 0.7;
    animation: fallDown 50s linear infinite;
    z-index: -9;
}
@keyframes fallDown {
    from { transform: translateY(0); }
    to { transform: translateY(-500px); }
}

/* الهلال */
.crescent-moon {
    position: fixed; top: 12%; left: 8%;
    width: 90px; height: 90px;
    border-radius: 50%;
    box-shadow: 12px 8px 0 0 #fffcd1; /* رسم الهلال بالظل */
    transform: rotate(-25deg);
    opacity: 0.9;
    z-index: -9;
    filter: drop-shadow(0 0 15px rgba(255, 252, 209, 0.5));
}

/* طبقة النوافذ المضيئة (خلف المساجد) */
.windows-layer {
    position: fixed; bottom: 0; left: 0;
    width: 200%; height: 260px;
    /* نقاط صفراء عشوائية تمثل النوافذ */
    background-image: 
        radial-gradient(2px 4px at 10% 60%, #ffeb3b, transparent),
        radial-gradient(2px 4px at 25% 50%, #ffeb3b, transparent),
        radial-gradient(2px 4px at 40% 70%, #ffeb3b, transparent),
        radial-gradient(2px 4px at 65% 55%, #ffeb3b, transparent),
        radial-gradient(2px 4px at 80% 40%, #ffeb3b, transparent);
    background-size: 400px 300px;
    opacity: 0.5;
    animation: slideMosques 80s linear infinite, glowWindows 3s infinite alternate;
    z-index: -6;
}
@keyframes glowWindows { from { opacity: 0.3; } to { opacity: 0.8; } }

/* المساجد الأنيقة (Vector Silhouette) */
.mosque-landscape {
    position: fixed; bottom: 0; left: 0;
    width: 200%; height: 280px;
    /* رسم SVG مدمج للمساجد */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 320' preserveAspectRatio='none'%3E%3Cpath fill='%230f0518' d='M0,320h1200V290c-20,0-40-10-50-30l-10-30c-5-15-20-15-25,0l-10,30c-10,20-30,30-50,30h-50v-90c0-40-30-70-70-70s-70,30-70,70v90h-20v-160l-10-20l-10,20v160h-40v-60c0-30-20-50-50-50s-50,20-50,50v60h-30v-110l-10-20l-10,20v110h-30v-40c0-20-15-35-35-35s-35,15-35,35v40h-100v-90c0-50-40-90-90-90s-90,40-90,90v90h-50v-190l-15-30l-15,30v190h-30v-70c0-30-25-50-50-50s-50,20-50,50v70H0z'/%3E%3C/svg%3E");
    background-repeat: repeat-x;
    background-size: 50% 100%;
    animation: slideMosques 80s linear infinite;
    z-index: -5;
    /* إطار ذهبي علوي عبر الظل */
    filter: drop-shadow(0 -2px 2px rgba(255, 215, 0, 0.5));
}
@keyframes slideMosques {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

/* =========================================
   3. شريط القراء (الصور الدائرية)
   ========================================= */
.reciters-container {
    display: flex;
    gap: 15px;
    padding: 10px 5px;
    overflow-x: auto; /* يسمح بالتمرير الأفقي في الموبايل */
    scrollbar-width: none; /* إخفاء شريط التمرير */
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    align-items: center;
}
.reciters-container::-webkit-scrollbar { display: none; }

.reciter-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.3s ease;
    min-width: 70px; /* عرض ثابت لضمان عدم الانكماش */
}

.reciter-item:hover {
    opacity: 1;
    transform: translateY(-3px);
}

.reciter-img-box {
    width: 60px; height: 60px;
    border-radius: 50%;
    border: 2px solid transparent;
    overflow: hidden;
    margin-bottom: 8px;
    background: #1e293b;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    transition: all 0.3s;
}

.reciter-img-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.reciter-name {
    font-size: 0.75rem;
    color: #cbd5e1;
    font-family: 'Reem Kufi', sans-serif;
    text-align: center;
    white-space: nowrap;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

/* حالة القارئ النشط */
.reciter-item.active {
    opacity: 1;
    transform: scale(1.05);
}
.reciter-item.active .reciter-img-box {
    border-color: var(--gold-primary);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}
.reciter-item.active .reciter-name {
    color: var(--gold-primary);
    font-weight: bold;
}

/* =========================================
   4. تنسيق ورقة المصحف والآيات
   ========================================= */
.quran-paper {
    background-color: #fffdf5; /* لون كريمي */
    border-radius: 12px;
    padding: 2.5rem;
    /* تأثير الورق */
    box-shadow: inset 0 0 40px rgba(0,0,0,0.05), 0 10px 30px rgba(0,0,0,0.3);
    border: 2px solid var(--gold-dim);
    outline: 4px double var(--gold-primary); /* إطار مزدوج */
    outline-offset: -10px;
    
    /* تنسيق النص */
    text-align: justify;
    text-align-last: center;
    line-height: 2.8; /* تباعد مريح للأسطر */
    direction: rtl;
    font-size: clamp(1.6rem, 4vw, 2.4rem); /* خط متجاوب كبير */
    color: #000;
    font-weight: 500;
}

/* الآية (Inline) */
.ayah-inline {
    display: inline; /* لجعل الآيات متصلة كفقرة واحدة */
    padding: 4px 2px;
    cursor: pointer;
    border-radius: 6px;
    transition: background-color 0.3s ease;
}

.ayah-inline:hover {
    background-color: rgba(212, 175, 55, 0.15);
}

/* التظليل عند القراءة */
.ayah-inline.active-playing {
    background-color: var(--highlight-bg);
    box-shadow: 0 0 0 5px var(--highlight-bg); /* تمديد التظليل قليلاً */
    color: #854d0e; /* لون بني للنص المقروء */
    border-radius: 4px;
}

/* رمز نهاية الآية */
.ayah-symbol {
    display: inline-flex; align-items: center; justify-content: center;
    width: 45px; height: 45px;
    /* رسمة زخرفية للرقم */
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='20' cy='20' r='18' fill='none' stroke='%23D4AF37' stroke-width='2'/%3E%3Cpath d='M20 2v36 M2 20h36' stroke='%23D4AF37' stroke-width='0.5' opacity='0.5'/%3E%3C/svg%3E");
    background-size: contain;
    font-family: 'Reem Kufi', sans-serif;
    font-size: 0.55em; font-weight: bold; color: #b45309;
    margin: 0 8px; vertical-align: middle; user-select: none;
}

/* =========================================
   5. المشغل العائم الإسلامي
   ========================================= */
.player-bar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(150%); /* مخفي افتراضياً */
    width: 90%; max-width: 500px;
    background: var(--glass-bg);
    border: 1px solid var(--gold-primary);
    border-radius: 50px;
    padding: 12px 25px;
    display: flex; justify-content: space-between; align-items: center;
    backdrop-filter: blur(15px);
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
    z-index: 1000;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.player-bar.active {
    transform: translateX(-50%) translateY(0); /* ظهور */
}

.player-info {
    flex: 1; text-align: right; padding-right: 15px;
}
.player-surah {
    color: var(--gold-primary); font-weight: bold;
    font-family: 'Reem Kufi', sans-serif; font-size: 1.1rem;
}
.player-reciter {
    color: #cbd5e1; font-size: 0.8rem; opacity: 0.9;
}

.player-controls { display: flex; gap: 15px; align-items: center; }

.ctrl-btn {
    background: none; border: none; color: #fff;
    cursor: pointer; font-size: 1.3rem;
    transition: 0.2s; width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
}
.ctrl-btn:hover { color: var(--gold-primary); }

.play-btn {
    background: var(--gold-primary); color: #0f172a;
    width: 55px; height: 55px; border-radius: 50%;
    font-size: 1.5rem;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.4);
}
.play-btn:hover { transform: scale(1.1); background: #fff; }

/* =========================================
   6. القوائم الجانبية والعلوية
   ========================================= */
.nav-glass {
    background: var(--glass-bg);
    border-bottom: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
}

.sidebar-styled {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    overflow: hidden;
}

/* تخصيص شريط التمرير (Scrollbar) */
.custom-scroll::-webkit-scrollbar { width: 6px; }
.custom-scroll::-webkit-scrollbar-track { background: #f1f1f1; }
.custom-scroll::-webkit-scrollbar-thumb { background: #064E3B; border-radius: 3px; }

/* ستايل قائمة الجوال */
.mobile-menu {
    background: var(--glass-bg);
    width: 100%;
    border-top: 1px solid var(--glass-border);
}
.mobile-menu li {
    width: 100%;
    text-align: center;
    padding: 5px 0;
}
.mobile-menu a {
    padding: 8px 0;
    width: 100%;
    display: block;
}

/* =========================================
   7. ستايل السيرة النبوية (Timeline)
   ========================================= */

/* الخط الرأسي الذهبي */
.timeline-container {
    position: relative;
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 0;
}

/* الخط المركزي */
.timeline-container::after {
    content: '';
    position: absolute;
    width: 4px;
    background: linear-gradient(to bottom, transparent, var(--gold-primary), transparent);
    top: 0; bottom: 0; left: 50%;
    margin-left: -2px;
    box-shadow: 0 0 15px var(--gold-glow);
}

/* بطاقة الحدث */
.timeline-item {
    padding: 10px 40px;
    position: relative;
    background-color: inherit;
    width: 50%;
    box-sizing: border-box;
}

/* اليسار واليمين */
.timeline-item.left { left: 0; }
.timeline-item.right { left: 50%; }

/* الدائرة المركزية (رمز الحدث) */
.timeline-item::after {
    content: '۞'; /* رمز إسلامي */
    font-family: 'Amiri', serif;
    position: absolute;
    width: 40px; height: 40px;
    right: -20px; top: 20px;
    background: #0f172a;
    border: 2px solid var(--gold-primary);
    border-radius: 50%;
    z-index: 1;
    color: var(--gold-primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 0 10px var(--gold-primary);
}

/* تصحيح مكان الدائرة لليمين */
.timeline-item.right::after { left: -20px; }

/* محتوى البطاقة (زجاجي داكن) */
.timeline-content {
    padding: 20px 30px;
    background: rgba(15, 23, 42, 0.85); /* زجاج داكن */
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 15px;
    position: relative;
    transition: all 0.3s ease;
}

.timeline-content:hover {
    transform: translateY(-5px);
    border-color: var(--gold-primary);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

/* المثلث الجانبي */
.timeline-item.left .timeline-content::before {
    content: " "; position: absolute; top: 22px; right: -10px;
    border-width: 10px 0 10px 10px; border-color: transparent transparent transparent rgba(255, 215, 0, 0.3);
}
.timeline-item.right .timeline-content::before {
    content: " "; position: absolute; top: 22px; left: -10px;
    border-width: 10px 10px 10px 0; border-color: transparent rgba(255, 215, 0, 0.3) transparent transparent;
}

/* إطار صور الذكاء الاصطناعي (AI Frame) */
.ai-media-frame {
    width: 100%;
    height: 200px;
    background-color: #000;
    border-radius: 10px;
    margin-bottom: 15px;
    position: relative;
    overflow: hidden;
    border: 1px solid #333;
    group: hover;
}

/* تأثير "جار التشغيل" للصور */
.ai-media-frame img {
    width: 100%; height: 100%; object-fit: cover;
    opacity: 0.8; transition: transform 0.5s;
}
.timeline-content:hover .ai-media-frame img {
    transform: scale(1.05); opacity: 0.5;
}

.ai-overlay {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    flex-direction: column;
    opacity: 0; transition: opacity 0.3s;
}
.timeline-content:hover .ai-overlay { opacity: 1; }

.play-icon-ai {
    font-size: 3rem; color: var(--gold-primary);
    text-shadow: 0 0 20px rgba(0,0,0,0.8);
    animation: pulse 2s infinite;
}

/* نصوص السيرة */
.event-year {
    color: var(--gold-primary);
    font-family: 'Reem Kufi', sans-serif;
    font-size: 0.9rem; margin-bottom: 5px;
    display: block;
}
.event-title {
    color: #fff; font-size: 1.5rem; font-weight: bold;
    margin-bottom: 10px; font-family: 'Reem Kufi', sans-serif;
}
.event-desc { color: #cbd5e1; line-height: 1.8; font-size: 1rem; }

/* التجاوب للموبايل (Mobile Responsive Timeline) */
@media screen and (max-width: 768px) {
    .timeline-container::after { left: 30px; }
    .timeline-item { width: 100%; padding-left: 70px; padding-right: 25px; }
    .timeline-item::after { left: 10px; right: auto; }
    .timeline-item.left::after, .timeline-item.right::after { left: 10px; }
    .timeline-item.right { left: 0%; }
    
    /* إلغاء المثلثات في الموبايل للتبسيط */
    .timeline-item.left .timeline-content::before, 
    .timeline-item.right .timeline-content::before { display: none; }
}

/* =========================================
   8. ويدجت مواقيت الصلاة (Prayer Times Widget)
   ========================================= */

/* الزر العائم (لفتح الويدجت) */
.prayer-fab {
    position: fixed;
    bottom: 40px;
    left: 40px; /* في RTL، نستخدم left */
    width: 60px; height: 60px;
    background: var(--gold-primary);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(255, 215, 0, 0.4);
    z-index: 1010;
    transition: transform 0.3s ease, background 0.3s ease;
}
.prayer-fab:hover {
    transform: scale(1.1) rotate(5deg);
    background: #fff;
    color: #0f172a;
}
.prayer-fab i {
    font-size: 1.8rem;
    color: #0f172a;
}

/* الويدجت الرئيسية (النافذة) */
.prayer-widget {
    position: fixed;
    bottom: 120px; /* لتجنب المشغل العائم */
    left: 40px;
    width: 350px;
    max-height: 80vh; /* لتكون متجاوبة */
    overflow: hidden;
    background: var(--glass-bg); /* خلفية زجاجية داكنة */
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    backdrop-filter: blur(20px);
    box-shadow: 0 10px 40px rgba(0,0,0,0.7);
    z-index: 1000;
    transform: scale(0.8) translateY(100%);
    opacity: 0;
    pointer-events: none;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
}
.prayer-widget.open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.prayer-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--glass-border);
    display: flex; justify-content: space-between; align-items: center;
    background-color: rgba(255, 215, 0, 0.1); /* تظليل خفيف للرأس */
}
.prayer-header h3 {
    color: var(--gold-primary);
    font-family: 'Reem Kufi', sans-serif;
    font-weight: bold;
    margin: 0;
}
.prayer-close-btn {
    background: none; border: none; color: #fff;
    cursor: pointer; font-size: 1.5rem;
    transition: color 0.2s;
}
.prayer-close-btn:hover { color: var(--gold-primary); }

.prayer-body {
    flex-grow: 1;
    overflow-y: auto; /* لإضافة شريط تمرير داخل الويدجت */
    padding: 15px;
}

.prayer-country-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
    color: #fff;
    font-family: 'Amiri', serif;
    transition: background-color 0.3s;
}
.prayer-country-item:hover {
    background-color: rgba(255, 215, 0, 0.05);
}
.prayer-country-item:last-child {
    border-bottom: none;
}

/* نمط صورة العلم */
.country-flag-img { 
    width: 30px; /* حجم معقول للعلم */
    height: 20px;
    border: 1px solid #fff;
    box-shadow: 0 0 5px rgba(0,0,0,0.3);
    object-fit: cover;
}

.country-info { display: flex; align-items: center; gap: 10px; }
.country-name { font-weight: bold; color: var(--gold-primary); }

.prayer-time-display {
    text-align: left;
    font-family: 'Reem Kufi', sans-serif; /* خط الأوقات */
    font-size: 1.2rem;
}
.next-prayer-highlight {
    color: #34d399; /* لون أخضر جميل */
    font-weight: bold;
    padding: 2px 5px;
    border-radius: 4px;
    background-color: rgba(52, 211, 153, 0.1); 
    animation: nextGlow 1.5s infinite alternate;
}
@keyframes nextGlow {
    from { text-shadow: 0 0 5px #34d399; }
    to { text-shadow: 0 0 10px #34d399, 0 0 20px #10b981; }
}

/* الأنماط الإضافية لصفحة الرقية الشرعية */
.glass-card {
    background: rgba(15, 23, 42, 0.85); /* نفس لون الزجاج الداكن */
    backdrop-filter: blur(10px);
    border: 1px solid rgba(52, 211, 153, 0.3); /* إطار أخضر */
    border-radius: 15px;
    color: #fff;
    position: relative;
}

/* حركات الأيقونات والعناصر */
.animate-pulse-fast {
    animation: pulse-fast 1s infinite alternate;
}
@keyframes pulse-fast {
    from { opacity: 0.7; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1.05); }
}

.animate-fade-in {
    animation: fadeIn 1s ease-out forwards;
}
.animate-fade-in-delay {
    animation: fadeIn 1.5s ease-out forwards;
    opacity: 0; /* يبدأ مخفيًا */
}
.animate-fade-in-delay-1 {
    animation: fadeIn 2s ease-out forwards;
    opacity: 0;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* التجاوب للموبايل (تم تحسين الويدجت) */
@media screen and (max-width: 400px) {
    .prayer-widget {
        width: 90%;
        left: 5%; 
        bottom: 100px;
    }
    .prayer-fab {
        left: 20px;
        bottom: 20px;
    }
}


/* =========================================
   9. أنماط صفحة الرقية الشرعية (إضافات جديدة)
   ========================================= */

/* حركة القرص الدوار */
.animate-spin-slow {
    animation: spin 8s linear infinite;
}
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* تنسيق تفاصيل النصوص (Accordion) */
details > summary {
    list-style: none;
}
details > summary::-webkit-details-marker {
    display: none;
}
details[open] summary {
    border-bottom: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.1);
}

/* خلفية الموجات الخاصة بالرقية */
.faith-waves {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: 
        radial-gradient(circle at 50% 100%, rgba(52, 211, 153, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 0% 0%, rgba(255, 215, 0, 0.1) 0%, transparent 30%);
    animation: waveMovement 30s linear infinite alternate;
    z-index: -8;
}

/* تحسينات القائمة الصوتية */
#playlistContainer::-webkit-scrollbar {
    width: 5px;
}
#playlistContainer::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.2);
}
#playlistContainer::-webkit-scrollbar-thumb {
    background: #4ade80; /* أخضر */
    border-radius: 10px;
}

/* تأثير التوهج للعنوان */
.drop-shadow-glow {
    filter: drop-shadow(0 0 10px rgba(74, 222, 128, 0.5));
}