/* categories-section */

/* ====== قسم الفئات ====== */
.categories-section {
    /* padding: 10px 0; */
    background: #fff;
    position: relative;
}

.categories-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2px;
    position: relative;
}

.categories-container h2 {
    text-align: center;
    margin-bottom: 40px;
    font-size: 26px;
    font-weight: bold;
    color: #333;
    position: relative;
}

.categories-container h2::after {
    content: "";
    display: block;
    width: 60px;
    height: 3px;
    background: #007bff;
    margin: 10px auto 0;
    border-radius: 5px;
}

/* أزرار التمرير */
.scroll-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    border: 1px solid #ddd;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.scroll-btn:hover {
    background: #f8f9fa;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.scroll-btn.left {
    right: -20px;
}

.scroll-btn.right {
    left: -20px;
}

.scroll-btn i {
    font-size: 16px;
    color: #555;
}

/* الشبكة */
.subcategories-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(83px, 1fr));
    gap: 30px;
    justify-items: center;
}

/* العنصر */
.category-link {
    text-decoration: none;
    color: inherit;
    text-align: center;
    transition: transform 0.3s ease;
}

.category-link:hover {
    transform: translateY(-6px);
}

/* الدائرة */
.category-image {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    border: 0px solid #f8f9fa;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    position: relative;
    margin: 0 auto 12px;
    transition: all 0.3s ease;
}

.category-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.category-link:hover .category-image img {
    transform: scale(1.1);
}

/* التدرج عند hover */
.category-overlay {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.25);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.category-link:hover .category-overlay {
    opacity: 1;
}

/* اسم الفئة */
.category-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    line-height: 1.4;
    text-align: center;
    max-width: 110px;
    margin: 0 auto;
    word-break: break-word;
}

/* موبايل - تمرير أفقي */
@media (max-width: 768px) {
    
    .subcategories-wrapper {
        overflow-x: auto;
        padding-bottom: 10px;
        scrollbar-width: thin;
    }

    .subcategories-container {
        display: grid;
        grid-auto-flow: column;
        /* الامتداد يكون أفقي */
        grid-template-rows: repeat(3, auto);
        /* 3 صفوف */
        gap: 1px 2px;
        /* فراغ بين العناصر */
    }

    .category-link {
        width: 90px;
        /* حجم أصغر للفئة */
        flex: 0 0 auto;
    }

    .category-image {
        width: 80px;
        /* تصغير الصورة */
        height: 80px;
    }

    .category-name {
        font-size: 15px;
        max-width: 80px;
    }

    /* إخفاء الأسهم */
    .scroll-btn {
        display: none;
    }
}

/* الحاسوب - إظهار 3 صفوف فقط مع شريط تمرير */
@media (min-width: 769px) {
    .subcategories-wrapper {
        max-height: calc(3 * 170px);
        overflow-x: auto;
        /* كل صف تقريباً 170px (120px للصورة + margin + النص) */
        scrollbar-width: thin;
        padding-bottom: 15px;
        /* مساحة لشريط التمرير */
        scroll-behavior: smooth;
        /* تمرير سلس */
    }

    .subcategories-container {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        display: grid;
        grid-auto-flow: column;
        /* العناصر تمتد أفقياً */
        grid-template-rows: repeat(2, auto);
        /* صفين فقط */
        gap: 25px 35px;
        /* فراغ بين العناصر */
    }

    .category-link {
        width: 140px;
        /* حجم ثابت نسبي للصورة */
        flex: 0 0 auto;
    }

    /* تنسيق شريط التمرير */
    .subcategories-wrapper::-webkit-scrollbar {
        height: 10px;
    }

    .subcategories-wrapper::-webkit-scrollbar-thumb {
        background: #bbb;
        border-radius: 10px;
    }

    .subcategories-wrapper::-webkit-scrollbar-thumb:hover {
        background: #999;
    }
}

@media (max-width: 576px) {
        .category-name {
        font-size: 9px;
        max-width: 80px;
    }
}
