:root { 
    --haraj-blue: #009688; 
    --haraj-green: #009688; 
    --haraj-red: #ff4d4d;
    --haraj-light: #fdfdfd;
}

body { 
    font-family: sans-serif; 
    margin: 0; 
    direction: rtl; 
    background: rgba(0, 150, 136, 0.03); 
    overflow-x: hidden; 
}

body.modal-open {
    overflow: hidden;
}

/* --- الهيدر والأقسام --- */
.main-header { 
    background: var(--haraj-blue); 
    padding: 10px 15px; 
    display: flex; 
    align-items: center; 
    position: sticky; 
    top: 0; 
    z-index: 1000; 
    height: 50px; 
}

.search-wrapper { 
    /* تغيير العرض من 300px إلى 180px لتقليص الطول */
    width: 200px; 
    flex: none;   
    background: white; 
    border-radius: 8px; 
    display: flex; 
    align-items: center; 
    padding: 5px 12px; 
    margin: 0 10px; 
}

.search-wrapper input { border: none; width: 100%; outline: none; }

.user-pill { 
    background: rgba(255,255,255,0.2); 
    padding: 5px 12px; 
    border-radius: 20px; 
    color: white; 
    display: flex; 
    gap: 8px; 
    font-size: 12px; 
}

.login-trigger { color: white; cursor: pointer; font-size: 13px; }

.categories-nav { 
    display: flex; 
    overflow-x: auto; 
    background: rgba(0, 150, 136, 0.03); 
    padding: 12px 5px; 
    gap: 10px; 
    border-bottom: 1px solid #eee; 
    scrollbar-width: none; 
}

.category-item { 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    min-width: 65px; 
    cursor: pointer; 
}

.category-item i { 
    font-size: 20px; 
    color: #777; 
    margin-bottom: 5px; 
    background: #f5f5f5; 
    width: 45px; 
    height: 45px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    border-radius: 50%; 
}

.category-item.active i { background: var(--haraj-blue); color: white; }
.category-item span { font-size: 11px; }

/* --- الكروت (Ads) --- */
/* --- التنسيق المشترك للكرت (جوال + كمبيوتر) --- */
.ad-card { 
    display: flex; 
    padding: 15px; 
    border-bottom: 1.5px solid #e0e0e0; 
    gap: 15px; 
    background: white; 
    cursor: pointer; 
    transition: all 0.2s ease;
    position: relative; /* ضروري لتوسيط الختم */
    align-items: center;
}

/* --- شكل السعر (الختم الدائري) - يعمل على جميع الشاشات --- */
/* --- شكل السعر (الختم الدائري) --- */
.ad-info p b {
    /* تم التعديل: إخفاء السعر الدائري افتراضياً (للجوال) */
    display: none; 
    
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background-color: #009688 !important;
    color: white !important;
    width: 50px;
    height: 50px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    border: 2px dashed rgba(255,255,255,0.3);
    z-index: 5;
    text-align: center;
}

/* --- إظهار السعر الدائري في الكمبيوتر فقط (أكبر من 992px) --- */
@media screen and (min-width: 992px) {
    .ad-card { padding: 20px 30px; }
    
    .ad-info p b {
        display: flex; /* إظهار العنصر في شاشات الكمبيوتر */
        width: 55px;
        height: 55px;
        font-size: 10px;
    }
    
    .ad-title { max-width: 40%; } /* منع تداخل النص مع الدائرة في الكمبيوتر */
}

/* --- حماية العنوان في الجوال ليعود بكامل عرضه --- */
@media screen and (max-width: 991px) {
    .ad-title { 
        max-width: 100%; /* استرجاع المساحة كاملة للعنوان في الجوال */
        line-height: 1.4;
    }
}
/* --- تعديل كروت الإعلانات لإصلاح مشكلة الجوال --- */

.ad-info { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    min-width: 0; /* ضروري جداً لتفعيل النقاط في Flexbox */
    overflow: hidden; 
}

.ad-title { 
    color: var(--haraj-blue); 
    font-size: 15px; 
    font-weight: bold; 
    margin: 0 0 5px 0;
    
    /* السماح بنزول النص لسطر جديد مع تحديد حد أقصى (سطرين) */
    display: -webkit-box;
    -webkit-line-clamp: 2; /* عدد الأسطر المسموح بها */
    -webkit-box-orient: vertical;  
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal; /* السماح بالالتفاف بدلاً من nowrap */
    width: 100%;
}

.ad-image { 
    flex-shrink: 0; /* يمنع الصورة من الصغر عند وجود نص طويل */
    width: 90px; 
    height: 90px; 
    background: #f9f9f9; 
    border-radius: 8px; 
    overflow: hidden; 
    margin-right: 10px;
}
.ad-price { color: #333; font-weight: bold; margin-bottom: 5px; }

.ad-actions {
    display: flex;
    gap: 15px;
    margin-top: auto;
    padding-top: 10px;
}

.btn-edit { color: var(--haraj-blue); cursor: pointer; font-size: 12px; font-weight: bold; }
.btn-delete { color: var(--haraj-red); cursor: pointer; font-size: 12px; font-weight: bold; }

.ad-image { 
    width: 90px; 
    height: 90px; 
    background: #f9f9f9; 
    border-radius: 8px; 
    overflow: hidden; 
}

.ad-image img { width: 100%; height: 100%; object-fit: cover; }

.ad-info .fa-user {
    margin-left: 2px;
    font-size: 10px;
}

/* تمييز صاحب الإعلان في التعليقات */
.owner-badge {
    background: var(--haraj-green);
    color: white;
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 5px;
    vertical-align: middle;
}

/* --- نظام النوافذ المحدث (Modals) --- */
.modal { 
    display: none; 
    position: fixed; 
    z-index: 2000; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: rgba(0,0,0,0.5); 
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

#loginModal .modal-content, 
#addPostModal .modal-content { 
    position: fixed;	
    background: white; 
    width: 90%; 
    max-width: 400px; 
    border-radius: 15px; 
    overflow: hidden; 
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
	top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%); /* هذا السطر يضمن التوسيط المطلق */
    margin: 0;
}

.full-screen-modal .modal-content { 
    width: 100%; 
    max-width: 100%; 
    height: 100vh; 
    border-radius: 0; 
    top: 0 !important; 
    left: 0 !important; 
    display: flex; 
    flex-direction: column; 
    backdrop-filter: none; 
}

.modal-header { 
    background: var(--haraj-blue); 
    color: white; 
    padding: 15px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center;
}

.modal-header span { font-weight: bold; }

.modal-body { 
    padding: 15px; 
    overflow-y: auto;
}

.modal-body::-webkit-scrollbar { width: 6px; }
.modal-body::-webkit-scrollbar-thumb { background-color: #ccc; border-radius: 10px; }

.full-screen-modal .modal-body { 
    flex: 1; 
    padding: 0; 
    display: block; /* تم التغيير من flex إلى block للسماح بالتمرير الطبيعي */
    background: #fff; 
    overflow-y: auto; /* التأكد من ظهور شريط التمرير عند الحاجة */
}

.view-content-wrapper { padding: 20px; flex: 1; }
.view-content-wrapper h2 { 
    color: var(--haraj-green); 
    font-size: 22px; 
    margin-bottom: 10px;
    
    /* حصر العنوان في سطر واحد حتى في صفحة التفاصيل */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}
.view-content-wrapper #view-meta { 
    font-size: 13px; 
    color: #888; 
    margin-bottom: 15px; 
    border-bottom: 1px solid #eee; 
    padding-bottom: 10px; 
    width: 100%;
    text-align: right; /* التأكد من محاذاة الميتا لليمين */ 
}

.view-image-wrapper img { 
    width: 100%; 
    display: block; 
    height: auto; /* لجعل الارتفاع يتناسب مع عرض الصورة تلقائياً */
    max-height: none; /* إلغاء التحديد السابق للارتفاع */
    object-fit: contain; 
    border-radius: 12px;
    background: #f8f8f8; 
}

/* --- الأزرار والقوائم --- */
.modal-body input, .modal-body select, .modal-body textarea { 
    width: 100%; 
    padding: 12px; 
    margin-bottom: 10px; 
    border: 1px solid #ddd; 
    border-radius: 6px; 
    box-sizing: border-box; 
}

.primary-btn { 
    background: var(--haraj-blue); 
    color: white; 
    border: none; 
    width: 100%; 
    padding: 12px; 
    border-radius: 6px; 
    font-weight: bold; 
    cursor: pointer; 
}

.whatsapp-btn { 
    background: #25D366; 
    color: white; 
    border: none; 
    width: 100%; 
    padding: 12px; 
    border-radius: 10px; 
    font-weight: bold; 
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
}

.bottom-tab-bar { 
    position: fixed; 
    bottom: -70px; /* إخفاء الشريط تحت الشاشة (ارتفاع الشريط تقريباً 60-70 بكسل) */
    width: 100%; 
    background: rgba(255, 255, 255, 0.95); /* إضافة شفافية بسيطة لمظهر عصري */
    display: flex; 
    justify-content: space-around; 
    padding: 10px 0; 
    border-top: 1px solid #eee; 
    z-index: 1000;
    backdrop-filter: blur(10px); /* تأثير زجاجي */
    transition: bottom 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* حركة انزلاق مرنة */
    box-shadow: 0 -5px 15px rgba(0,0,0,0.05);
}
body:hover .bottom-tab-bar,
.bottom-tab-bar:hover { 
    bottom: 0; 
}
.bottom-tab-bar .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 12px;
    color: #777;
    transition: all 0.3s ease;
    cursor: pointer;
    border-radius: 10px;
    padding: 5px 10px;
    position: relative;
}

.bottom-tab-bar .nav-item:hover {
    color: var(--haraj-blue);
    background: rgba(0, 115, 195, 0.05);
    transform: translateY(-3px);
}

.bottom-tab-bar .nav-item.active { color: var(--haraj-blue); font-weight: bold; }

.notify-badge {
    position: absolute;
    top: 5px;
    right: 15px;
    background: var(--haraj-red);
    color: white;
    font-size: 9px;
    padding: 2px 5px;
    border-radius: 50%;
    border: 2px solid white;
    display: none;
}

.floating-add-btn { 
    background: var(--haraj-blue); 
    color: white; 
    width: 55px; 
    height: 55px; 
    border-radius: 50%; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    position: absolute; /* تغيير من margin لـ absolute لضبط الحركة */
    top: -28px;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid white; 
    cursor: pointer; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: transform 0.2s, top 0.4s;
}

.floating-add-btn:hover { transform: translateX(-50%) scale(1.1); }

.upload-section { 
    border: 2px dashed #ccc; 
    padding: 20px; 
    text-align: center; 
    border-radius: 8px; 
    margin-bottom: 15px; 
    color: #888;
    cursor: pointer;
}

.close-btn { cursor: pointer; font-size: 18px; }

#notificationsBtn:hover i { animation: ring 0.5s ease; }

@keyframes ring {
    0% { transform: rotate(0); }
    25% { transform: rotate(15deg); }
    50% { transform: rotate(-15deg); }
    75% { transform: rotate(10deg); }
    100% { transform: rotate(0); }
}

.ad-info span { display: inline-flex; align-items: center; }
/* تحسينات إضافية لصفحة تفاصيل الإعلان */
.view-content-wrapper { 
    padding: 20px; 
    max-width: 800px; 
    margin: 0; /* تم التغيير لضمان الالتصاق باليمين */
    text-align: right; /* محاذاة النص لليمين */
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* ضمان اصطفاف العناصر مثل الأزرار لليمين */
    width: 100%;
}

#view-price { 
    color: var(--haraj-blue); 
    font-size: 22px; 
    font-weight: bold;
    margin: 10px 0; 
}

#view-desc {
    line-height: 1.8;
    font-size: 16px;
    color: #333;
    white-space: pre-wrap; 
    text-align: right; /* محاذاة وصف الإعلان لليمين */
    width: 100%;
}

.whatsapp-btn {
    transition: transform 0.2s, background-color 0.2s;
}

.whatsapp-btn:hover {
    background-color: #1ebe57;
    transform: translateY(-2px);
}
/* تنسيق قسم التعليقات ليكون بجهة اليمين */
.comments-section {
    width: 100%;
    text-align: right; /* محاذاة العنوان "التعليقات" لليمين */
    direction: rtl;    /* التأكد من اتجاه العناصر من اليمين لليسار */
}

#comments-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

#comments-list div {
    text-align: right; 
    direction: rtl;
    /* أضف السطرين التاليين */
    overflow-wrap: break-word; /* يضمن كسر الكلمات الطويلة جداً */
    word-break: break-all;     /* كسر الكلمة في أي حرف لتجنب التمدد الأفقي */
}

.add-comment-box {
    direction: rtl;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    width: 100%; /* جعله بنفس عرض الفقاعات فوقه */
    padding: 12px;
    border-radius: 12px;
    background: rgba(0, 115, 195, 0.08); 
    border: 1px solid rgba(0, 115, 195, 0.15);
    box-sizing: border-box; /* ليتطابق العرض تماماً مع الفقاعات */
    margin-top: 10px;
    margin-bottom: 30px;
}

/* تحسين مظهر اسم المعلق والوقت على اليمين */
#comments-list div strong {
    display: inline-block;
    margin-left: 5px; /* مسافة بسيطة بعد الاسم */
}
/* تنسيق نص التعليق لحصره في سطرين فقط مع إضافة نقاط ... */
#comments-list div p {
    font-size: 13px;
    margin: 0;
    /* حل مشكلة النصوص الطويلة التي تخرج عن الإطار */
    overflow-wrap: break-word;
    word-break: break-all; 
    
    /* تفعيل خاصية الحصر في سطرين */
    display: -webkit-box;
    -webkit-line-clamp: 2; /* عدد الأسطر المطلوبة */
    -webkit-box-orient: vertical;  
    overflow: hidden;
    text-overflow: ellipsis;
    
    /* تحسين المسافات */
    line-height: 1.5;
    max-height: 3em; /* يعادل سطرين بناءً على الـ line-height */
}
/* تحسين شكل حقل الكتابة ليتماشى مع الخلفية الزرقاء الشفافة */
#comment-input {
    background: rgba(255, 255, 255, 0.7); /* خلفية بيضاء شبه شفافة */
    border: 1px solid rgba(0, 115, 195, 0.1); /* إطار أزرق خفيف جدًا */
    border-radius: 8px; /* زوايا منحنية */
    padding: 10px; /* مسافة داخلية للكتابة */
    flex: 1; /* ليأخذ المساحة المتاحة */
    resize: none; /* منع المستخدم من تغيير الحجم يدوياً */
    min-height: 45px; /* الحد الأدنى للارتفاع */
    outline: none; /* إزالة الإطار الافتراضي عند النقر */
    transition: all 0.3s ease; /* نعومة في الانتقال عند التركيز */
    font-family: inherit; /* استخدام نفس خط الموقع */
}

/* تأثير عند الضغط داخل الصندوق للكتابة */
#comment-input:focus {
    background: #ffffff; /* يصبح أبيض ناصع عند الكتابة */
    border-color: var(--haraj-blue); /* يتغير الإطار للأزرق الأساسي */
    box-shadow: 0 0 8px rgba(0, 115, 195, 0.2); /* إضاءة زرقاء خفيفة حول الصندوق */
}
/* تنسيق فقاعة التعليق لتكون باللون الأزرق الشفاف */
.comment-bubble {
    background: rgba(0, 115, 195, 0.05); 
    padding: 12px;
    border-radius: 12px;
    margin-bottom: 12px;
    border: 1px solid rgba(0, 115, 195, 0.1);
    width: 100%; /* تأكيد أخذ العرض الكامل المتاح */
    box-sizing: border-box; /* لضمان عدم خروج البادينج عن العرض */
}

.comment-bubble:hover {
    background: rgba(0, 115, 195, 0.08); /* يغمق قليلاً عند تمرير الماوس */
    transform: translateX(-3px); /* حركة بسيطة لليمين عند التأشير */
}

/* تنسيق نص التعليق داخل الفقاعة (سطرين كحد أقصى) */
.comment-bubble p {
    font-size: 13px;
    margin: 0;
    color: #333;
    line-height: 1.5;
    overflow-wrap: break-word;
    word-break: break-all;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* حصر النص في سطرين */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* تنسيق أيقونة حذف التعليق */
.comment-bubble i.fa-trash-alt:hover {
    color: #d32f2f !important;
    transform: scale(1.2);
    transition: all 0.2s ease;
}
.btn-block-user {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid #ddd;
    transition: all 0.2s;
    background: white;
}

.btn-block-user.is-blocked {
    background: var(--haraj-red);
    color: white;
    border-color: var(--haraj-red);
}

.btn-block-user:hover {
    opacity: 0.8;
}
/* تحديد حجم مربع الكتابة في النافذة المنبثقة */
#ad-desc {
    min-height: 100px;
    max-height: 400px; /* تحديد ارتفاع أقصى يوازي 8 أسطر تقريباً */
    line-height: 1.5;
    resize: vertical; /* السماح بالتكبير الطولي فقط */
}

/* حصر عرض الوصف في صفحة تفاصيل الإعلان بـ 8 أسطر فقط */
#view-desc {
    line-height: 1.6;
    font-size: 16px;
    white-space: pre-wrap; 
    display: -webkit-box;
    -webkit-line-clamp: 30; /* التعديل هنا إلى 30 */
    -webkit-box-orient: vertical;  
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 50.6em; /* حسابياً: 30 أسطر × 1.6 ارتفاع السطر */ 
}
/* إضافة تأثير دوران للودر */
#upload-loader svg {
    transform: rotate(-90deg); /* لبدء الرسم من الأعلى */
}

#remove-img-btn:hover {
    background: red !important;
    transform: scale(1.1);
    transition: all 0.2s;
}

.upload-section {
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fcfcfc;
    border: 2px dashed #ddd;
    transition: border-color 0.3s;
}

.upload-section:hover {
    border-color: var(--haraj-blue);
}
/* تحسين شكل شريط السحب في النوافذ */
#loginModal .modal-header, 
#addPostModal .modal-header {
    cursor: move;
    user-select: none; /* منع تحديد النص أثناء السحب */
    position: relative;
}

/* إضافة خط صغير يوحي بالسحب (اختياري) */
#loginModal .modal-header::after, 
#addPostModal .modal-header::after {
    content: "";
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}
/* تحسين شكل شريط السحب في النوافذ */
#loginModal .modal-header, 
#addPostModal .modal-header {
    cursor: move;
    user-select: none; /* منع تحديد النص أثناء السحب */
    position: relative;
}

/* إضافة خط صغير يوحي بالسحب (اختياري) */
#loginModal .modal-header::after, 
#addPostModal .modal-header::after {
    content: "";
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}
/* تحديد أقصى ارتفاع للنافذة لضمان عدم خروجها عن الشاشة */
#addPostModal .modal-content {
    max-height: 90vh; /* تأخذ 90% من طول الشاشة كحد أقصى */
    display: flex;
    flex-direction: column;
}

/* جعل منطقة الحقول قابلة للتمرير مع بقاء الهيدر والزر ثابتين */
#addPostModal .modal-body {
    overflow-y: auto;
    flex: 1; /* تأخذ المساحة المتاحة وتترك مكاناً للزر */
    padding-bottom: 0; /* تقليل المسافة السفلية داخل الجسم */
}

/* تثبيت منطقة الزر في الأسفل بشكل أنيق */
#addPostModal .modal-body #submitBtn {
    position: sticky;
    bottom: 0;
    margin-top: 15px;
    margin-bottom: 15px;
    z-index: 10;
    box-shadow: 0 -5px 10px rgba(255,255,255,0.8); /* إضافة ظل بسيط لتمييزه عند التمرير */
}
/* تأثير عند تمرير الماوس على صور التفاصيل */
#view-image-container img {
    cursor: zoom-in;
    transition: transform 0.3s ease;
}

#view-image-container img:hover {
    transform: scale(1.02);
}

/* تنسيق عارض الصور */
#imageLightbox {
    display: none; 
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
/* منطقة غير مرئية في أسفل الشاشة لتسهيل التقاط حركة الماوس */
body::after {
    content: "";
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 30px; /* مساحة 30 بكسل في القاع تعمل كمستشعر للماوس */
    z-index: 999;
}
.chat-input-area input {
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 20px;
    outline: none;
}

.chat-input-area button {
    border-radius: 50%;
    width: 45px !important;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* تنسيق خاص لفقاعات الدردشة لتبدو احترافية */
/* تنسيق الفقاعة الافتراضي (للمستلم) */
.chat-bubble {
    max-width: 80%;
    padding: 12px 18px;
    border-radius: 18px;
    margin-bottom: 10px;
    font-size: 15px;
    line-height: 1.4;
    position: relative;
    word-wrap: break-word;
    /* إضافة ظل وحدود لجعلها بارزة */
    background: #ffffff !important; 
    color: #333 !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    border: 1px solid #e6e6e6;
}

/* حل مشكلة العرض في الجوال عند ظهور لوحة المفاتيح */
@media screen and (max-width: 768px) {
    #chatModal .modal-content {
        height: 100% !important;
        position: fixed;
        top: 0;
        left: 0;
    }
    
    #chatInput {
        font-size: 16px !important; /* يمنع الجوال من عمل Zoom تلقائي عند الكتابة */
    }
}
.chat-bubble i {
    font-size: 11px;
    margin-right: 2px;
}
/* --- تنسيق الرسائل المرسلة الشفافة --- */
.chat-bubble.my-message {
    background: transparent !important;
    border: 1px solid rgba(0, 115, 195, 0.3) !important;
    color: var(--haraj-blue) !important;
    box-shadow: none; /* إزالة الظل للرسائل الشفافة */
}

/* تعديل لون الوقت وعلامات الصح داخل الرسالة الشفافة */
.chat-bubble.my-message div span,
.chat-bubble.my-message div i {
    color: rgba(0, 115, 195, 0.6) !important; /* لون باهت للوقت والصح */
}

/* تأكيد لون الصح الأزرق عند القراءة */
.chat-bubble.my-message div i.fa-check-double {
    color: #4fc3f7 !important; /* يبقى اللون الأزرق الفاتح عند القراءة */
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.ad-card {
    animation: slideUp 0.5s ease-out forwards;
}
/* تنسيق حاوية المودال لضمان ملء الشاشة بشكل صحيح */
#chatModal .modal-content {
    display: flex;
    flex-direction: column;
    height: 100vh; /* ملء كامل ارتفاع الشاشة */
    overflow: hidden; /* منع التمرير في الحاوية الكبرى */
}

/* منطقة الرسائل - يجب أن تأخذ المساحة المتبقية وتسمح بالتمرير */
#chatMessagesContainer {
    flex: 1; /* التوسع لملء المساحة بين الهيدر وشريط الكتابة */
    overflow-y: auto; /* السماح بالتمرير داخل الرسائل فقط */
    display: flex;
    flex-direction: column;
    padding: 15px;
    background: #f0f2f5;
	max-height: calc(100vh - 150px);
    -webkit-overflow-scrolling: touch; /* تمرير ناعم على الهواتف */
}

/* شريط الكتابة - تثبيته في الأسفل تماماً */
.chat-input-area {
    flex-shrink: 0; /* منع الشريط من الانكماش */
    background: white;
    border-top: 1px solid #ddd;
    padding: 10px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom)); /* دعم هواتف آيفون الحديثة */
    z-index: 100;
}
#chatModal .modal-header {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    height: auto; /* للسماح بظهور الصورة والاسم بوضوح */
}

#userStatusInfo {
    display: block;
    margin-top: 2px;
}
/* تثبيت الهيدر في نافذة الشات */
/* تنسيق حاوية المودال الكبرى لملء الشاشة */
/* الحاوية الكبرى - نستخدم flex لترتيب العناصر عمودياً */
#chatModal .modal-content {
    display: flex !important;
    flex-direction: column !important;
    height: 100dvh !important; /* dvh تعني الارتفاع الفعلي الظاهر على الجوال */
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    background: #f0f2f5;
    border-radius: 0;
    overflow: hidden;
}

/* الهيدر الثابت في القمة */
#chatModal .modal-header {
    flex-shrink: 0;
    height: 65px; /* ارتفاع ثابت ومناسب */
    background: var(--haraj-blue);
    display: flex !important;
    align-items: center !important; /* توسيط العناصر عمودياً */
    justify-content: space-between !important;
    padding: 0 15px;
    z-index: 10;
}

/* منطقة الرسائل - تأخذ كل المساحة المتاحة وتسمح بالتمرير */
#chatMessagesContainer {
    flex: 1; /* التوسع لملء الفراغ بين الهيدر والكتابة */
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    -webkit-overflow-scrolling: touch;
}

/* شريط الكتابة السفلي - سيظهر دائماً فوق لوحة المفاتيح */
#chatModal .chat-input-area {
    flex-shrink: 0; /* يمنع الشريط من الاختفاء أو الانكماش */
    background: white;
    border-top: 1px solid #ddd;
    padding: 10px;
    /* دعم المسافات الآمنة في الآيفون */
    padding-bottom: calc(10px + env(safe-area-inset-bottom)); 
    display: flex;
    gap: 8px;
    align-items: center;
}

/* تعديل حقل الإدخال ليناسب الجوال */
#chatInput {
    margin-bottom: 0 !important;
    font-size: 16px !important; /* يمنع المتصفح من عمل زووم تلقائي مزعج */
}
#favAdBtn {
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

#favAdBtn:active {
    transform: scale(0.95);
}

#favIcon.fas {
    animation: heartBeat 0.3s ease-out;
}

@keyframes heartBeat {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}
#car-model-div select {
    border: 1px solid #ddd;
    padding: 12px;
    border-radius: 6px;
    background-color: #fff;
    font-family: inherit;
}
/* تنسيق السطر الذي يحتوي على الحقول المتعددة */
.input-group-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    width: 100%;
}

/* تصغير حجم خط القوائم المنسدلة لتتناسب مع المساحة */
.input-group-row select {
    padding: 8px 5px !important;
    font-size: 13px !important;
}

/* تنسيق خاص لمربع الموديل ليظهر بشكل أصغر وأنيق */
#car-model-div select {
    background-color: #f9f9f9;
    border: 1px dashed var(--haraj-blue);
    color: var(--haraj-blue);
    font-weight: bold;
}
/* إضافة مساحة في أسفل حاوية الإعلانات لضمان ظهور آخر إعلان فوق شريط التنقل */
#adsContainer {
    padding-bottom: 100px; /* هذه المساحة ستجعل الإعلان الأخير يرتفع للأعلى لتراه بوضوح */
}

/* في حال كنت تستخدم الجوال، نضمن أن المساحة كافية */
@media screen and (max-width: 768px) {
    #adsContainer {
        padding-bottom: 120px;
    }
}
@media screen and (max-height: 500px) {
    .modal-content {
        top: 10px !important;
        max-height: 95vh;
    }
    .upload-section {
        padding: 5px;
        min-height: 80px;
    }
}
.ad-info span[onclick*="shareAd"]:hover {
    color: var(--haraj-green) !important;
    text-decoration: underline;
}
/* إلغاء التظليل الرمادي الافتراضي في الموبايل */
.ad-card, .ad-card * {
    -webkit-tap-highlight-color: transparent;
}

/* إضافة تأثير بسيط لزر المشاركة عند لمسه ليشعر المستخدم بالاستجابة */
span[onclick*="shareAd"]:active {
    opacity: 0.5;
    transform: scale(0.95);
}
#chatBlockBtn {
	margin-right: auto;
	transform: translateY(-20px);
    white-space: nowrap;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
	font-size: 12px;
    padding: 5px 10px;
    display: flex;
    align-items: center;
    gap: 5px;
}

#chatBlockBtn:active {
    transform: scale(0.95);
    opacity: 0.8;
	margin-right: auto;
	transform: translateY(-20px);
    white-space: nowrap;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
	font-size: 12px;
    padding: 5px 10px;
    display: flex;
    align-items: center;
    gap: 5px;
}
/* تنسيق نجوم التقييم داخل النافذة المنبثقة */
.star-item {
    cursor: pointer !important;
    display: inline-block !important;
    font-size: 35px !important; /* تكبير الحجم لسهولة الضغط */
    transition: all 0.2s ease-in-out !important;
    color: #ccc; /* اللون الرمادي الافتراضي */
    margin: 0 5px !important;
    user-select: none !important;
}

/* التأثير عند تمرير الماوس */
.star-item:hover {
    transform: scale(1.3) !important;
    color: #f1c40f !important; /* يتحول للأصفر عند التأشير */
}

/* التأثير عند الضغط */
.star-item:active {
    transform: scale(0.9) !important;
}
/* خلفية النافذة المنبثقة باللون الأزرق الشفاف */
#reviewsListModal {
    background-color: rgba(0, 115, 195, 0.7); /* لون حراج الأزرق مع شفافية 70% */
    backdrop-filter: blur(5px); /* إضافة تأثير تغبيش للخلفية ليعطي مظهراً عصرياً */
}

/* تحسين شكل محتوى نافذة التقييمات */
#reviewsListModal .modal-content {
    border: none;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    background: #ffffff; /* جعل الصندوق الداخلي أبيض ليبرز النص */
}

/* تنسيق فقاعات التعليقات داخل النافذة */
.review-item {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
    border-right: 4px solid var(--haraj-blue);
}
#multi-preview-container div {
    flex: 0 0 70px; /* يمنع الصور من التمدد بشكل غريب */
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
/* كود مختصر لتحويل أزرار التبديل للون الأخضر */
#tab-login, #tab-register {
    transition: background-color 0.3s ease !important;
}

/* استهداف الزر المختار (الذي تم تغيير لونه برمجياً) وتحويله للأخضر */
.primary-btn#tab-login:not([style*="background: rgb(238, 238, 238)"]),
.primary-btn#tab-register:not([style*="background: rgb(238, 238, 238)"]),
.primary-btn#tab-login:not([style*="background: #eee"]),
.primary-btn#tab-register:not([style*="background: #eee"]) {
    background-color: var(--haraj-green) !important;
    color: white !important;
}

/* تنسيق رابط نسيت كلمة السر ليصبح متناسقاً مع اللون الأخضر */
#forgotPassTrigger {
    color: var(--haraj-green) !important;
}
.sub-categories-bar {
    display: flex;
    gap: 10px;
    padding: 10px 15px;
    background: #f9f9f9;
    overflow-x: auto;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
}

.sub-cat-item {
    padding: 5px 15px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    transition: 0.3s;
}

.sub-cat-item:hover, .sub-cat-item.active {
    background: var(--haraj-green);
    color: white;
    border-color: var(--haraj-green);
}
/* تنسيق عنوان الإعلان داخل الإشعارات */
.notification-ad-link {
    color: #009688 !important; /* لون أخضر فاتح */
    text-decoration: underline !important; /* وضع خط تحت النص */
    font-weight: bold;
    cursor: pointer;
}

.notification-ad-link:hover {
    color: #27ae60 !important; /* يغمق قليلاً عند تمرير الماوس */
}



