/* استهداف القسم فقط */
.home-categories-section .tp-category-swiper {
  overflow: visible !important;
}

/* تحويل السلايدر إلى Grid مرن */
.home-categories-section .swiper-wrapper {
  display: grid !important;

  /* أهم تعديل: عرض مرن بدل 6 أعمدة ثابتة */
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));

  gap: 18px;
  justify-content: center;

  transform: none !important;
  transition: none !important;
}

/* إلغاء خصائص السلايد */
.home-categories-section .swiper-slide {
  width: 100% !important;
  flex: unset !important;
  margin: 0 !important;
  display: flex;
  justify-content: center;
}

/* إخفاء الأسهم */
.home-categories-section .swiper-button-next,
.home-categories-section .swiper-button-prev {
  display: none !important;
}

/* تصميم الكرت */
.home-categories-section .tp-product-category-item {
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  padding: 18px;
  background: #fff;
  text-align: center;
  height: 100%;
  width: 100%;
  max-width: 180px; /* يعطي شكل متوازن */
}

/* حاوية الصورة */
.home-categories-section .tp-product-category-thumb {
  width: 100%;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* حل مشكلة تمدد الصور نهائياً */
.home-categories-section .tp-product-category-thumb img {
  max-width: 100%;
  max-height: 100%;
  width: auto !important;
  height: auto !important;
  object-fit: contain;
  display: block;
}

/* العنوان */
.home-categories-section .tp-product-category-title {
  margin-top: 10px;
  font-size: 14px;
}

/* التابلت */
@media (max-width: 1024px) {
  .home-categories-section .swiper-wrapper {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }
}

/* الجوال */
@media (max-width: 768px) {
  .home-categories-section .swiper-wrapper {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    justify-content: center;
  }
}

/* جوالات صغيرة */
@media (max-width: 480px) {
  .home-categories-section .swiper-wrapper {
    grid-template-columns: repeat(2, 1fr);
    justify-content: center;
  }
}


.tp-product-category-item .tp-product-category-thumb img {
  object-fit: contain !important;
  border-radius: 10px !important;
  -webkit-border-radius: 10px !important;
  -moz-border-radius: 10px !important;
  width: 100% !important;
  height: 100% !important;
  padding: 4px;
}

@media (max-width: 768px) {

  html, body {
    overflow-x: hidden !important;
  }

  .tp-category-swiper.swiper {
    overflow: visible !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .tp-category-swiper .swiper-wrapper {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 10px !important;
    justify-content: center !important;
    align-items: start !important;
    transform: none !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .tp-category-swiper .swiper-slide {
    width: auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin: 0 !important;
    flex: unset !important;
  }

  /* الكارد الداخلي */
  .tp-category-swiper .swiper-slide a,
  .tp-category-swiper .swiper-slide .category-item,
  .tp-category-swiper .swiper-slide .box-category {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    width: 100% !important;
    max-width: 100% !important;
    text-align: center !important;
  }

  /* صندوق الصورة */
  .tp-category-swiper .swiper-slide .image,
  .tp-category-swiper .swiper-slide .img-box,
  .tp-category-swiper .swiper-slide .box-image,
  .tp-category-swiper .swiper-slide .cat-image,
  .tp-category-swiper .swiper-slide picture {
    width: 100% !important;
    aspect-ratio: 1 / 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
  }

  /* الصورة نفسها */
  .tp-category-swiper .swiper-slide img {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    object-position: center !important;
    display: block !important;
  }

  /* النص */
  .tp-category-swiper .swiper-slide .title,
  .tp-category-swiper .swiper-slide .name,
  .tp-category-swiper .swiper-slide h3,
  .tp-category-swiper .swiper-slide h4,
  .tp-category-swiper .swiper-slide span,
  .tp-category-swiper .swiper-slide p {
    text-align: center !important;
    word-break: break-word !important;
    margin-top: 8px !important;
  }

  /* إزالة كل آثار السلايدر */
  .tp-category-swiper .swiper-button-next,
  .tp-category-swiper .swiper-button-prev,
  .tp-category-swiper .swiper-pagination,
  .tp-category-swiper .swiper-scrollbar,
  .tp-category-swiper .swiper-scrollbar-drag,
  .tp-category-swiper .swiper-pagination-progressbar,
  .tp-category-swiper *[class*="scrollbar"],
  .tp-category-swiper *[class*="progress"] {
    display: none !important;
  }

  .tp-category-swiper,
  .tp-category-swiper::before,
  .tp-category-swiper::after {
    border: none !important;
    box-shadow: none !important;
  }
}