/* =========================================
   1. تنسيقات القائمة العلوية (Navbar)
   ========================================= */

/* الحاوية الرئيسية */
.chefaa-nav-container {
    background: #fff;
    border-bottom: 1px solid #e1e1e1;
    direction: rtl;
    font-family: 'Cairo', sans-serif; /* تأكد من أن الخط مدعوم في موقعك */
    width: 100%;
    position: relative;
    z-index: 10;
}

/* القائمة الأفقية (UL) */
ul.chefaa-nav-ul {
    display: flex;
    flex-wrap: wrap;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    justify-content: flex-start;
    align-items: center;
}

/* عناصر القائمة الرئيسية (LI) */
ul.chefaa-nav-ul > li {
    position: relative; /* ضروري جداً عشان القائمة المنسدلة تظهر تحته */
    margin: 0;
    list-style: none;
}

/* روابط الأقسام الرئيسية */
ul.chefaa-nav-ul > li > a {
    display: block;
    padding: 15px 20px;
    color: #333;
    text-decoration: none;
    font-weight: 700;
    font-size: 15px;
    transition: color 0.3s ease;
    white-space: nowrap; /* يمنع نزول النص لسطرين */
}

/* الخط الأخضر المتحرك */
ul.chefaa-nav-ul > li > a:after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 0%;
    height: 3px;
    background: #26a69a; /* لون شفاء */
    transition: width 0.3s ease;
}

ul.chefaa-nav-ul > li:hover > a:after {
    width: 100%;
}

ul.chefaa-nav-ul > li:hover > a {
    color: #26a69a;
}

/* -----------------------------------------
   إصلاح مشكلة القائمة المنسدلة (الدروب داون)
   ----------------------------------------- */
.sub-menu-content {
    display: none;       /* إخفاء القائمة افتراضياً */
    opacity: 0;          /* شفافية 0 لضمان الإخفاء */
    visibility: hidden;  /* إخفاء عن المتصفح */
    
    position: absolute;  /* تموضع حر بالنسبة للقسم */
    top: 100%;           /* تظهر أسفل القسم مباشرة */
    right: 0;            /* محاذاة لليمين */
    
    background: #fff;
    min-width: 220px;    /* عرض القائمة */
    box-shadow: 0 5px 20px rgba(0,0,0,0.15); /* ظل لتمييزها */
    border-top: 3px solid #26a69a;
    z-index: 9999;       /* فوق كل العناصر */
    padding: 10px 0;
    border-radius: 0 0 8px 8px;
    text-align: right;
    transition: all 0.3s ease;
}

/* عند الوقوف (Hover) على القسم، تظهر القائمة */
ul.chefaa-nav-ul > li:hover .sub-menu-content {
    display: block;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* تنسيق عناصر القائمة المنسدلة */
.sub-menu-content ul {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.sub-menu-content li {
    border-bottom: 1px solid #f9f9f9;
    padding: 0;
}

.sub-menu-content li:last-child {
    border: none;
}

.sub-menu-content a {
    padding: 10px 15px;
    display: block;
    color: #555;
    font-size: 14px;
    font-weight: normal;
    text-decoration: none;
    transition: all 0.2s;
}

.sub-menu-content a:hover {
    color: #26a69a;
    background-color: #fcfcfc;
    padding-right: 20px; /* حركة بسيطة لليسار */
}


/* =========================================
   2. إصلاح مشكلة الصور الكبيرة (Grid Widget)
   ========================================= */

.chefaa-grid-wrapper {
    display: grid;
    /* أعمدة متجاوبة: كل عمود لا يقل عن 110 بكسل */
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 15px;
    direction: rtl;
    padding: 20px 0;
    font-family: 'Cairo', sans-serif;
}

.chefaa-grid-item {
    text-align: center;
}

.chefaa-grid-link {
    text-decoration: none;
    display: block;
    color: inherit;
}

/* [هام] إجبار الصورة والحاوية على حجم أيقونة صغير */
.chefaa-img-box {
    width: 90px !important;    /* عرض ثابت بقوة */
    height: 90px !important;   /* ارتفاع ثابت بقوة */
    margin: 0 auto 10px auto;  /* توسيط المربع */
    background-color: #f8f9fa; /* لون خلفية رمادي فاتح */
    border-radius: 15px;       /* حواف دائرية */
    
    display: flex;             /* لتوسيط الصورة داخل المربع */
    align-items: center;
    justify-content: center;
    
    border: 1px solid transparent;
    transition: all 0.3s ease;
    overflow: hidden;          /* قص أي زيادات */
}

/* تنسيق الصورة داخل المربع */
.chefaa-img-box img {
    width: 60px !important;    /* عرض الصورة داخل المربع */
    height: 60px !important;   /* ارتفاع الصورة */
    object-fit: contain;       /* الحفاظ على أبعاد الصورة دون مط */
    max-width: 100%;
    border-radius: 0;          /* إلغاء حواف الصورة نفسها */
    margin: 0 !important;
    padding: 0 !important;
}

/* تأثير الهوفر على المربع */
.chefaa-grid-link:hover .chefaa-img-box {
    border-color: #26a69a;
    background-color: #fff;
    box-shadow: 0 5px 15px rgba(38, 166, 154, 0.2);
    transform: translateY(-3px);
}

.chefaa-grid-title {
    font-size: 14px;
    font-weight: 700;
    color: #333;
    margin: 0;
    line-height: 1.4;
}

.chefaa-grid-link:hover .chefaa-grid-title {
    color: #26a69a;
}