/* تنسيق الحاويات */
.category-container {
    width: 100%;
    padding: 20px;
    margin-bottom: 30px;
    background-color: #f4f4f4;
    border-radius: 8px;
}

    /* تنسيق اسم الفئة */
    .category-container h2 {
        font-size: 24px;
        color: #333;
        text-align: center;
        margin-bottom: 15px;
    }

/* تنسيق قائمة المنتجات */
.product-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    justify-items: stretch;
}

/* تنسيق المنتج */
.product-item {
    width: 100%;
    margin-bottom: 0;
    padding: 18px 16px;
    background: radial-gradient(circle at top left, #ffffff 0%, #f4f8ff 40%, #eef5ff 100%);
    border-radius: 18px;
    text-align: center;
    box-sizing: border-box; /* لضمان احتساب الحدود والحشو ضمن العرض */
    box-shadow: 0 14px 35px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease, translate 0.25s ease;
}

    .product-item img {
        width: 100%;
        height: 200px;
        object-fit: contain;
        border-radius: 5px;
        margin-bottom: 10px;
    }

    .product-item h3 {
        font-size: 18px;
        color: #0d47a1;
        margin-bottom: 10px;
    }

    .product-item p {
        font-size: 14px;
        color: #555;
        line-height: 1.5;
    }

.product-item::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(0, 159, 227, 0.12), rgba(227, 6, 19, 0.08));
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.product-item:hover {
    transform: translateY(-6px) scale(1.01);
    box-shadow: 0 22px 45px rgba(0, 0, 0, 0.14);
}

.product-item:hover::before {
    opacity: 1;
}

/* تحسين الاستجابة للشاشات الصغيرة */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden;
    }

    .category-container {
        padding: 15px;
    }

    .product-list {
        grid-template-columns: 1fr; /* كرت واحد في الصف على الشاشات الصغيرة */
    }

    .products-header {
        flex-direction: row;
        align-items: center;
        padding: 10px 10px;
        text-align: center;
    }

    .products-header .logo-container {
        margin-right: 0;
        margin-bottom: 0;
        width: auto;
    }

    .products-title {
        font-size: 22px;
        margin: 0;
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        white-space: nowrap;
    }
}

/* محاذاة اللوجو حسب اتجاه اللغة في الشاشات الصغيرة */
@media (max-width: 768px) {
    body[dir="ltr"] .products-header .logo-container {
        display: flex;
        justify-content: flex-start; /* يسار في الإنجليزي */
    }

    body[dir="rtl"] .products-header .logo-container {
        display: flex;
        justify-content: flex-end; /* يمين في العربي */
    }
}

/* تنسيق الرأس */
.products-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #0060a8; /* أغمق قليلاً من الهيدر العلوي */
    padding: 20px 0;
    color: white;
    position: relative;
}

/* حاوية الشعار */
.logo-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-right: 20px;
}

/* تنسيق الشعار */
.logo {
    width: 100px;
    height: auto;
}

/* تنسيق العنوان */
.products-title {
    font-size: 30px;
    text-align: center;
    margin: 0;
    flex-grow: 1; /* يجعل النص يأخذ المساحة المتاحة في المنتصف */
}

/* تنسيق الـ logo-container والنص معًا */
.products-header > .logo-container,
.products-header > .products-title {
    flex-shrink: 0;
}

.language-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 20px;
    font-size: 14px;
}

.language-toggle button {
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    font-size: 13px;
    background: transparent;
    color: #ffffff;
    cursor: pointer;
    min-width: 42px;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.language-toggle button.active {
    background: #ffffff;
    color: #009fe3;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.language-toggle button:not(.active):hover {
    background: rgba(255, 255, 255, 0.18);
}

@media (max-width: 768px) {
    .products-header {
        flex-wrap: wrap;
    }

    .language-toggle {
        margin: 8px 0 0 0;
        width: 100%;
        justify-content: center;
    }
}

.products-intro {
    text-align: center;
    margin: 20px auto;
    max-width: 800px;
    color: #333;
}

.intro-text {
    font-size: 16px;
    margin: 0 0 5px 0;
    display: none;
}

.intro-text.visible {
    display: block;
}

.intro-ar {
    direction: rtl;
    text-align: right;
}
