/* إعدادات عامة */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: #f9f9f9;
}

/* التنسيق الرئيسي للمنتجات */
main {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 10px; /* تقليل التباعد بين المنتجات */
    padding: 10px;
}

/* كل بطاقة منتج */
.product {
    position: relative;
    background-color: #fff;
    border: 1px solid #070303;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 8px;
    flex: 1 1 calc(23% - 10px); /* أربعة منتجات في السطر */
    max-width: calc(23% - 10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.3s ease;
}

.product:hover {
    transform: translateY(-5px);
}

/* صورة المنتج */
.product_img {
    width: 100%;
    text-align: center;
    margin-bottom: 8px;
}

.product_img img {
    max-width: 100%;
    height: 170px;
    object-fit: cover;
    border-radius: 10px;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.product_img:hover img {
    opacity: 0.7;
}

/* علامة المنتج غير متوفر */
.unvailable {
    position: absolute;
    top: 15px;
    left: 15px;
    background-color: rgba(255, 0, 0, 0.8);
    color: #fff;
    font-weight: bold;
    font-size: 16px;
    padding: 5px 10px;
    border-radius: 5px;
    transform: rotate(-25deg);
    z-index: 10;
}

/* القسم واسم المنتج والسعر والتفاصيل */
.product_section a,
.product_name a,
.product_price a,
.product_description a {
    display: block;
    text-align: center;
    text-decoration: none;
    font-weight: bold;
    color: black;
    margin: 5px 0;
    font-size: 14.5px;
}

.product_section {
    background-color: #cceeee;
    border: 2px solid #ccc;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    padding: 0px 20px;
    border-radius: 4px;
    width: fit-content;
    margin-bottom: 0px;
    align-self: flex-start;
}

.product_name {
    font-size: 16px;
    margin-bottom: 3px;
    color:black;
}

.product_price a {
    color: red;
    font-size: 18px;
}

.product_description a {
    color: black;
    font-size: 14px;
}

.product_description a i {
    margin-left: 5px;
  
}

/* أزرار التحكم بالكمية */
.qty_input {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 15px;
    gap: 8px;
    width: 100%;
}

.qty_count_mins,
.qty_count_add {
    background-color: #ccc;
    border: none;
    padding: 6px 12px;
    cursor: pointer;
    font-weight: bold;
    border-radius: 4px;
    user-select: none;
    transition: background-color 0.3s ease;
}

.qty_count_mins:hover,
.qty_count_add:hover {
    background-color: #999;
}

input[type="number"] {
    width: 80px;
    text-align: center;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 1px;
    padding: 4px;
    -moz-appearance: textfield; /* لإخفاء أزرار التغيير في Firefox */
}

input[type="number"]::-webkit-inner-spin-button, 
input[type="number"]::-webkit-outer-spin-button { 
    -webkit-appearance: none; 
    margin: 0; 
}

/* زر إضافة إلى السلة */
.addto_cart {
    width: 100%;
    padding: 10px 80px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.addto_cart:hover {
    background-color: #01244b;
}

/* استجابات الشاشات الكبيرة والمتوسطة */
@media (max-width: 1200px) {
    .product {
        flex: 1 1 calc(25% - 10px);
        max-width: calc(25% - 10px);
    }
}

@media (max-width: 992px) {
    .product {
        flex: 1 1 calc(33% - 10px);
        max-width: calc(33% - 10px);
    }
}

/* على الشاشات الصغيرة والهاتف: منتجين في السطر */
@media (max-width: 768px) {
    .product {
        flex: 1 1 calc(50% - 10px);
        max-width: calc(50% - 10px);
    }
}

/* على الشاشات الصغيرة جداً مثل الجوال: منتجين في السطر */
@media (max-width: 480px) {
    .product {
        flex: 1 1 calc(50% - 10px);
        max-width: calc(50% - 10px);
        padding: 8px;
    }

    .product_name {
        font-size: 1.1rem;
    }

    .addto_cart {
        font-size: 0.8rem;
        padding: 8px 0;
    }

    .qty_count_mins,
    .qty_count_add {
        padding: 5px 8px;
    }

    input[type="number"] {
        width: 40px;
        font-size: 14px;
    }
}

