/* إصلاحات عرض المنتجات على الشاشات الصغيرة */

/* تعديل عرض بطاقات المنتجات على الشاشات الصغيرة */
@media (max-width: 480px) {
  .category-products {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }
  
  .product {
    padding: 8px !important;
    margin-bottom: 10px !important;
    height: auto !important;
    width: 100% !important;
    max-width: none !important;
  }
  
  .product img {
    max-width: 100% !important;
    height: auto !important;
    max-height: 130px !important;
    object-fit: contain !important;
  }
  
  .product .card-body {
    padding: 8px 5px !important;
  }
  
  .product h5 {
    font-size: 0.9rem !important;
    margin: 5px 0 !important;
    height: 40px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
  }
  
  .product p {
    font-size: 0.8rem !important;
    margin: 5px 0 !important;
  }
  
  .product button {
    padding: 6px 10px !important;
    font-size: 0.8rem !important;
    margin-top: 5px !important;
    width: 100% !important;
  }
  
  .brand-logo img {
    max-width: 40px !important;
  }
}

/* إعدادات خاصة للشاشات الصغيرة جداً مثل الآيفون */
@media (max-width: 375px) {
  .category-products {
    grid-template-columns: repeat(1, 1fr) !important;
  }
  
  .product {
    margin: 0 auto 15px auto !important;
    max-width: 90% !important;
  }
}

/* تحسينات قائمة التصنيفات الجانبية على الموبايل */

/* زر فتح القائمة */
.open-navigation {
  display: none;
  position: fixed;
  top: 85px;
  right: 15px;
  z-index: 1100;
  background: #ffffff;
  color: #333333;
  border: 1px solid #e0e0e0;
  padding: 10px 15px;
  border-radius: 50px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  font-weight: bold;
  transition: all 0.3s ease;
  align-items: center;
  font-size: 0.9rem;
}

.open-navigation i {
  font-size: 1.1rem;
  color: #333333;
}

.open-navigation:hover {
  background: #f5f5f5;
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

/* إظهار زر القائمة فقط على الشاشات الصغيرة */
@media (max-width: 768px) {
  .open-navigation {
    display: flex;
  }
}

/* القائمة الجانبية */
.mobile-navigation {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  width: 85%;
  max-width: 350px;
  height: 100%;
  background: #ffffff;
  z-index: 1200;
  box-shadow: -5px 0 25px rgba(0, 0, 0, 0.15);
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* عندما تكون القائمة مفتوحة */
.mobile-navigation.open {
  transform: translateX(0);
  display: block;
}

/* رأس القائمة */
.mobile-nav-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  background: #ffffff;
  color: #333333;
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid #e0e0e0;
}

.mobile-nav-header span {
  font-size: 1.2rem;
  font-weight: bold;
  color: #333333;
}

/* زر إغلاق القائمة */
.close-navigation {
  background: transparent;
  color: #333333;
  border: none;
  font-size: 1.8rem;
  cursor: pointer;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.8;
  transition: opacity 0.3s;
}

.close-navigation:hover {
  opacity: 1;
}

/* صندوق البحث داخل القائمة الجانبية */
.mobile-nav-search {
  padding: 12px 15px;
  background: #f5f5f5;
  border-bottom: 1px solid #e0e0e0;
}

.search-input-container {
  position: relative;
  display: flex;
  width: 100%;
}

.mobile-nav-search input {
  width: 100%;
  padding: 10px 15px 10px 45px;
  border: 1px solid #ddd;
  border-radius: 30px;
  font-size: 0.95rem;
  color: #333;
  background: #fff;
}

.mobile-nav-search button {
  position: absolute;
  left: 5px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: #0062cc;
  font-size: 1.1rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* تنسيقات قائمة التصنيفات الرئيسية */
.main-categories {
  padding: 0;
  margin: 0;
  list-style: none;
}

/* رابط الصفحة الرئيسية */
.home-link {
  display: flex;
  align-items: center;
  padding: 15px;
  color: #333;
  text-decoration: none;
  font-weight: bold;
  border-bottom: 1px solid #eee;
  transition: all 0.3s ease;
}

.home-link i {
  margin-left: 10px;
  color: #0062cc;
  font-size: 1.3rem;
}

.home-link:hover {
  background: #f5f5f5;
  color: #0062cc;
}

/* عناصر التصنيفات الرئيسية */
.main-category {
  margin-bottom: 1px;
  border-bottom: 1px solid #eee;
}

/* رأس التصنيف الرئيسي */
.category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  cursor: pointer;
  transition: background 0.3s ease;
}

.category-header:hover {
  background: #f5f5f5;
}

/* عنوان التصنيف */
.category-title1 {
  font-weight: bold;
  color: #333;
  font-size: 1.05rem;
  margin: 0;
  border: none;
  background: transparent;
  padding: 0;
  display: block;
  width: auto;
}

/* أيقونة التوسيع/الطي */
.category-toggle {
  color: #0062cc;
  font-size: 0.9rem;
  transition: transform 0.3s ease;
}

/* عند توسيع القائمة */
.main-category.expanded .category-toggle {
  transform: rotate(180deg);
}

/* قائمة التصنيفات الفرعية */
.sub-categories {
  display: none;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
  padding: 0 0 0 15px;
  margin: 0;
  background: #f9f9f9;
}

/* عند توسيع قائمة التصنيفات الفرعية */
.main-category.expanded .sub-categories {
  display: block;
  max-height: 1000px;
}

/* عناصر التصنيفات الفرعية */
.sub-categories li {
  margin: 0;
  padding: 0;
}

/* روابط التصنيفات الفرعية */
.subcategory-link {
  display: flex;
  align-items: center;
  padding: 12px 15px;
  color: #555;
  text-decoration: none;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  border-bottom: 1px solid #eeeeee;
}

.subcategory-link i {
  margin-left: 10px;
  color: #0062cc;
  font-size: 0.9rem;
}

.subcategory-link:hover {
  background: #f0f0f0;
  color: #0062cc;
}

/* تأثير تغطية الشاشة عند فتح القائمة */
.menu-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1190;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.menu-backdrop.active {
  display: block;
  opacity: 1;
}

/* تعديل للشاشات الصغيرة جدًا */
@media (max-width: 375px) {
  .open-navigation {
    font-size: 0.8rem;
    padding: 8px 12px;
  }
  
  .mobile-navigation {
    width: 90%;
  }
  
  .category-title1 {
    font-size: 1rem;
  }
  
  .subcategory-link {
    font-size: 0.9rem;
    padding: 10px 12px;
  }
}
