/* إعدادات عامة */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Tajawal', sans-serif;
    background-color: #ffffff;
    color: #333;
}

/* حاوية القسم */
.categories-section {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

/* عنوان القسم */
.main-title {
    text-align: center;
    color: #d85d38; 
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 30px;
}

/* شبكة المنتجات (الشاشات الكبيرة) */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 4 أعمدة */
    gap: 20px;
}

/* كارت الفئة */
.category-card {
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    cursor: pointer;
}

/* حاوية الصورة */
.image-container {
    width: 100%;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 1 / 1; 
}

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

/* التكبير عند تمرير الماوس */
.category-card:hover .image-container img {
    transform: scale(1.05);
}

/* الطبقة الداكنة فوق الصورة */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.25);
    transition: background 0.3s ease;
}

.category-card:hover .overlay {
    background: rgba(0, 0, 0, 0.4);
}

/* عنوان الفئة (للشاشات الكبيرة - فوق الصورة) */
.category-title {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ffffff;
    font-size: 18px;
    font-weight: 600;
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.6); 
    z-index: 2;
    text-align: center;
    width: 90%;
    margin: 0;
}

/* --- التصميم المتجاوب (Responsive) --- */

/* للشاشات المتوسطة (التابلت) */
@media (max-width: 992px) {
    .categories-grid {
        grid-template-columns: repeat(3, 1fr); 
    }
}

/* للشاشات الصغيرة (الجوال - ليطابق طريقة العرض في صورتك) */
@media (max-width: 768px) {
    .categories-grid {
        grid-template-columns: repeat(2, 1fr); /* عمودين فقط */
        gap: 15px;
    }
    
    /* إخفاء الطبقة الداكنة لأن النص سيكون بالأسفل */
    .overlay {
        display: none; 
    }
    
    /* نقل النص ليكون أسفل الصورة */
    .category-title {
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        color: #555555;
        text-shadow: none;
        font-size: 15px;
        margin-top: 12px;
        font-weight: 500;
    }
}