/* Login Screen Components */
.login-container { background: rgba(255, 255, 255, .15); backdrop-filter: blur(10px); border-radius: 20px; padding: 40px; width: 90%; max-width: 500px; }
.logo { font-size: 4rem; margin-bottom: 1rem; }
.app-title { font-size: 2.5rem; margin-bottom: 1rem; }
.app-subtitle { font-size: 1.2rem; margin-bottom: 2rem; }
.login-form { width: 100%; }
.form-group { margin-bottom: 1.5rem; position: relative; }
#login-screen input { width: 100%; padding: 15px 20px 15px 50px; border: none; border-radius: 50px; font-size: 1.1rem; background: rgba(255, 255, 255, .25); color: #fff; }
html[dir="rtl"] #login-screen input { padding: 15px 50px 15px 20px; }
#login-screen input::placeholder { color: rgba(255, 255, 255, .8); }
.form-icon { position: absolute; top: 50%; transform: translateY(-50%); font-size: 1.2rem; color: rgba(255, 255, 255, .8); }
html[dir="rtl"] .form-icon { right: 20px; left: auto; }
html[dir="ltr"] .form-icon { left: 20px; right: auto; }
.login-btn { background: #fff; color: var(--accent); border: none; padding: 15px; width: 100%; border-radius: 50px; font-size: 1.2rem; font-weight: bold; cursor: pointer; transition: .3s; }
.login-btn:hover { transform: translateY(-3px); }
.login-options { display: flex; justify-content: space-between; margin-top: 20px; gap: 10px; }
.login-option { flex: 1; padding: 12px; border-radius: 50px; background: rgba(255, 255, 255, .2); color: #fff; font-weight: 600; cursor: pointer; }
.login-option:hover { background: rgba(255, 255, 255, .3); }
.social-login { margin-top: 25px; }
.social-title { position: relative; margin-bottom: 20px; color: rgba(255, 255, 255, .9); }
.social-buttons { display: flex; justify-content: center; gap: 15px; }
.social-btn { width: 55px; height: 55px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; color: #fff; cursor: pointer; transition: .3s; }
.social-btn.google { background: #DB4437; }
.social-btn.facebook { background: #4267B2; }
.social-btn.phone { background: #25D366; }

/* Quran Screen */
.quran-verse { font-size: 2.5rem; font-weight: bold; font-family: 'Amiri', serif; text-align: center; }
.quran-surah { font-size: 1.2rem; margin-top: 10px; opacity: 0.8; }

/* Dashboard Components */
.dashboard-item { background: var(--card-background); border-radius: 15px; padding: 25px; text-align: center; box-shadow: var(--card-shadow); cursor: pointer; transition: .3s; }
.dashboard-item:hover { transform: translateY(-5px); }
.dashboard-icon { font-size: 2.5rem; margin-bottom: 15px; color: var(--primary); }
.dashboard-title { font-size: 1.1rem; font-weight: 600; }

/* Modal Components */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, .6); z-index: 1500; justify-content: center; align-items: center; padding: 20px; }
.modal-overlay.active { display: flex; }
#modal-content { 
    background: var(--card-background); 
    border-radius: 15px; 
    width: 95%; 
    max-width: 800px; 
    max-height: 90vh; 
    height: auto; 
    overflow: hidden; 
    animation: fadeIn .4s; 
    display: flex; 
    flex-direction: column; 
    color: var(--text-color); 
    transition: all 0.3s ease-in-out;
}
#modal-content.large { max-width: 95vw; }
#modal-content.modal-maximized {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    margin: 0 !important;
}
.modal-header { background: var(--primary); color: #fff; padding: 15px 25px; border-top-left-radius: 15px; border-top-right-radius: 15px; display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
.modal-maximized .modal-header { border-radius: 0; }
.modal-title { font-size: 1.5rem; }
.close-modal { background: transparent; border: none; color: #fff; font-size: 1.8rem; cursor: pointer; transition: 0.2s; }
.close-modal:hover { opacity: 0.8; transform: scale(1.1); }
.modal-body { padding: 25px; line-height: 1.7; flex-grow: 1; overflow-y: auto; }

/* Responsive adjustments */
@media (max-width: 768px) {
    #modal-content {
        width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        border-radius: 0 !important;
    }
    .modal-header { border-radius: 0 !important; }
}
@keyframes fadeIn { from { opacity: 0; transform: scale(0.95) } to { opacity: 1; transform: scale(1) } }

/* Form Components */
.contact-form { display: flex; flex-direction: column; gap: 15px; }
.contact-form label { font-weight: 600; color: var(--primary); }
.contact-form input, .contact-form select, .contact-form textarea { padding: 12px 15px; border: 1px solid var(--border-color); border-radius: 8px; font-size: 1rem; color: var(--text-color); background-color: var(--light); }
.contact-form input:focus, .contact-form select:focus, .contact-form textarea:focus { border-color: var(--secondary); outline: none; }
.contact-form textarea { height: auto; resize: vertical; }

/* Button Components */
.submit-btn { background: var(--primary); color: #fff; border: none; padding: 14px; border-radius: 8px; font-size: 1.1rem; font-weight: bold; cursor: pointer; }
.submit-btn:hover { background: var(--accent); }
.user-action-btn { padding: 10px 20px; border-radius: 50px; background: var(--secondary); color: #fff; font-weight: 600; cursor: pointer; border: none; }
.action-btn-group { display: flex; gap: 10px; margin-top: 15px; }
.action-btn { flex: 1; padding: 10px; border: none; border-radius: 8px; font-size: .9rem; font-weight: bold; cursor: pointer; }
.action-btn.download { background: #28a745; color: #fff; }
.action-btn.read { background: #17a2b8; color: #fff; }
.action-btn.print { background: #ffc107; color: #000; }

/* Tabs */
.plan-tabs { display: flex; gap: 10px; margin-bottom: 20px; }
.plan-tab { flex: 1; padding: 12px; border: none; background: var(--light); color: var(--dark); font-weight: 600; cursor: pointer; border-radius: 8px; border: 1px solid var(--border-color); }
.plan-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.plan-content { display: none; }
.plan-content.active { display: block; }

/* Search Components */
.search-box { flex: 1; position: relative; }
.search-input { width: 100%; padding: 12px 20px 12px 50px; border: 2px solid var(--secondary); border-radius: 50px; font-size: 1rem; outline: none; }
html[dir="rtl"] .search-input { padding: 12px 50px 12px 20px; }
.search-input:focus { box-shadow: 0 0 10px rgba(0, 180, 216, .3); }
.search-icon { position: absolute; top: 50%; transform: translateY(-50%); color: var(--primary); font-size: 1.2rem; }
html[dir="rtl"] .search-icon { right: 20px; left: auto; }
html[dir="ltr"] .search-icon { left: 20px; right: auto; }
.advanced-search-btn { background: var(--accent); color: #fff; border: none; padding: 0 25px; border-radius: 50px; font-weight: 600; cursor: pointer; transition: all .3s; display: flex; align-items: center; gap: 8px; min-width: 180px; justify-content: center; }
.advanced-search-btn:hover { background: #005f8c; transform: translateY(-2px); }
.search-result-item { padding: 15px; border-bottom: 1px solid #eee; }
.search-result-item:hover { background: #f9f9f9; }

/* ========================================================= */
/* ============ Notification Components (FINAL) ============ */
/* ========================================================= */

/* إصلاح الشريط العلوي لضمان عدم قص القائمة */
.header, .user-actions {
    overflow: visible !important;
}

/* 1. الجرس */
.notification-bell { 
    position: relative !important; 
    display: inline-block !important; 
    cursor: pointer; 
    color: var(--secondary); 
    font-size: 1.5rem; 
    margin-left: 15px;
    width: 30px; 
    height: 30px; 
    text-align: center;
    line-height: 30px;
    z-index: 1000;
}
html[dir="rtl"] .notification-bell { margin-left: 15px; margin-right: 0; }

.notification-badge { 
    position: absolute; 
    top: -5px; 
    right: -8px; 
    background: red; 
    color: white; 
    border-radius: 50%; 
    width: 18px; 
    height: 18px; 
    font-size: 0.75rem; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    font-weight: bold; 
    line-height: 1;
    z-index: 1001;
}

/* 2. القائمة المنبثقة: نستخدم ID selector لضمان القوة */
#notification-panel { 
    display: none; 
    
    /* الموقع */
    position: absolute !important;
    top: 45px !important; 
    
    /* في العربي (RTL) نجعلها تبدأ من اليسار بالنسبة للجرس */
    right: auto !important;
    left: 50% !important; 
    transform: translateX(-50%) !important; 
    
    width: 320px !important; 
    max-height: auto;
    
    /* === الحل النهائي للشفافية === */
    /* نستخدم background بدلاً من background-color للتأكد من تغطية أي تدرج لوني */
    background: #ffffff !important; 
    background-color: #ffffff !important; 
    opacity: 1 !important;
    
    /* حدود وظل قوي جداً لتبدو كنافذة عائمة */
    border: 2px solid #ccc !important; /* إطار رمادي واضح */
    border-radius: 8px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5) !important; 
    
    z-index: 999999 !important; /* تظهر فوق كل شيء */
}

/* تعديل الاتجاه في الوضع العربي */
html[dir="rtl"] #notification-panel {
    left: -15px !important; /* محاذاة لليسار قليلاً */
    transform: none !important;
}

/* السهم الصغير الأبيض فوق القائمة */
#notification-panel::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 20px; 
    border-width: 0 10px 10px 10px;
    border-style: solid;
    border-color: transparent transparent #ffffff transparent; /* مثلث أبيض صلب */
    z-index: 1000000;
}
html[dir="rtl"] #notification-panel::before {
    left: 20px; 
}

/* 3. عنوان القائمة (رأس القائمة) */
.notification-header { 
    padding: 12px 15px; 
    font-weight: bold; 
    border-bottom: 2px solid #ddd !important; /* خط فاصل سميك */
    background-color: #f5f5f5 !important; /* خلفية رمادية فاتحة جداً للعنوان */
    color: #000 !important; /* نص أسود */
    font-size: 1rem;
    text-align: center;
}

/* 4. عنصر الإشعار: عرض أفقي (flex row) */
.notification-item { 
    display: flex !important;
    flex-direction: row !important; /* أفقي: النص بجانب الوقت */
    justify-content: space-between;
    align-items: center;
    
    padding: 12px 15px; 
    border-bottom: 1px solid #ccc !important; /* خط فاصل واضح جداً */
    
    font-size: 0.9rem; 
    cursor: pointer; 
    
    background-color: #ffffff !important; /* خلفية بيضاء صلبة */
    color: #333 !important;
    
    min-height: 50px;
}
.notification-item:last-child { border-bottom: none !important; }
.notification-item:hover { background-color: #eeeeee !important; }

/* تمييز الإشعار الجديد */
.notification-item.unread {
    background-color: #e3f2fd !important; /* أزرق سماوي واضح */
    border-right: 5px solid var(--primary) !important; 
}
html[dir="ltr"] .notification-item.unread { 
    border-right: none !important;
    border-left: 5px solid var(--primary) !important; 
}

/* نص الإشعار */
.notification-item span {
    flex-grow: 1;
    font-weight: 600;
    color: #222;
    text-align: right;
    
    /* قص النص الطويل ليظهر بسطر واحد */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 190px; 
    margin-left: 10px;
}
html[dir="ltr"] .notification-item span { text-align: left; margin-left: 0; margin-right: 10px; }

/* وقت الإشعار */
.notification-item small { 
    color: #555; /* لون غامق قليلاً للقراءة */
    font-size: 0.75rem; 
    font-weight: normal;
    white-space: nowrap;
    flex-shrink: 0;
}

/* In-App Toast */
#in-app-notification-container { position: fixed; bottom: 20px; left: 20px; z-index: 9999; pointer-events: none; }
html[dir="rtl"] #in-app-notification-container { left: auto; right: 20px; }

.in-app-notification { 
    background: #fff; 
    color: #333; 
    padding: 15px 20px; 
    border-radius: 8px; 
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.25); 
    width: 320px; 
    cursor: pointer; 
    pointer-events: auto; 
    opacity: 0; 
    transform: translateY(20px); 
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); 
    margin-bottom: 10px; 
    border-right: 5px solid var(--primary);
    font-size: 0.95rem; 
}
html[dir="rtl"] .in-app-notification { border-right: 5px solid var(--primary); border-left: none; }
.in-app-notification.show { opacity: 1; transform: translateY(0); }
.in-app-notification strong { display: block; margin-bottom: 5px; font-size: 1rem; color: var(--primary); }

/* Other Components */
.language-switcher { position: relative; display: flex; align-items: center; color: white; }
.language-switcher i { font-size: 1.2rem; margin-right: 8px; }
.language-switcher select { background-color: transparent; color: white; border: none; font-size: 1rem; -webkit-appearance: none; -moz-appearance: none; appearance: none; cursor: pointer; }
.language-switcher select option { color: black; background-color: white; }
.language-switcher select:focus { outline: none; }
.profile-image-container { text-align: center; margin-bottom: 20px; }
.profile-image { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; border: 3px solid var(--primary); cursor: pointer; }
.profile-image-input { display: none; }
.form-section-divider { margin-top: 25px; padding-top: 15px; border-top: 1px solid #eee; }
.online-status { font-size: 0.9rem; padding: 5px 15px; border-radius: 20px; color: white; font-weight: 500; }
.online-status.online { background: #28a745; }
.online-status.offline { background: #dc3545; }
.toggle-switch { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; }
.switch { position: relative; display: inline-block; width: 50px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 24px; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked+.slider { background-color: var(--primary); }
input:checked+.slider:before { transform: translateX(26px); }

/* EXAM TEMPLATE PREVIEW FIX */
.template-preview-item .template-preview-item-full {
    width: 100%;
    flex-grow: 1;
    box-sizing: border-box;
    font-size: 10px;
    text-align: right;
    display: flex;
    flex-direction: column;
}
.template-preview-item-full b { display: block; }
.template-preview-item-full hr { margin: 2px 0; }