/* ------------------------------------------- */
/* --- تنسيقات صفحة جميع المنتجات --- */
/* ------------------------------------------- */

/* 1. الحاوية الرئيسية */
.page-wrapper {
    display: flex;
    gap: 30px;
    padding: 40px;
    max-width: 1400px;
    margin: 0 auto;
}

/* 2. الشريط الجانبي للفلترة */
.sidebar {
    flex: 0 0 280px;
    background-color: #fff;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    height: fit-content;
    border: 1px solid #eee;
}

.sidebar h4 {
    font-size: 22px;
    color: #4B3B2B;
    margin-top: 0;
    margin-bottom: 25px;
    border-bottom: 2px solid #F0C778;
    padding-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-group {
    margin-bottom: 20px;
}

.filter-label {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: #3d1e02;
    margin-bottom: 10px;
}

.filter-input, .filter-select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: 'Cairo', sans-serif;
    font-size: 15px;
    box-sizing: border-box;
}

.filter-input:focus, .filter-select:focus {
    outline: none;
    border-color: #A67C41;
    box-shadow: 0 0 0 2px rgba(166, 124, 65, 0.2);
}

.search-input-container {
    position: relative;
}

.search-input-container .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #aaa;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    cursor: pointer;
}

.radio-group input[type="radio"] {
    accent-color: #A67C41;
}

.price-range-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
}

.price-range-inputs span {
    color: #888;
}

/* 3. شبكة عرض المنتجات */
.products-grid-container {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 25px;
    align-content: flex-start;
}

/* 4. تصميم كرت المنتج الواحد */
.product-item-card {
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.07);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.product-item-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}

.product-item-image {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    border: 4px solid #F0C778;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.product-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-item-details {
    flex-grow: 1;
    margin-bottom: 15px;
}

.product-item-name {
    font-size: 18px;
    font-weight: 700;
    color: #3d1e02;
    margin: 0 0 8px 0;
}

.product-weight {
    font-size: 14px;
    font-weight: 500;
    color: #888;
}

.product-item-description {
    font-size: 14px;
    color: #777;
    margin: 0 0 12px 0;
    line-height: 1.5;
    height: 42px;
    overflow: hidden;
}

.product-item-price {
    font-size: 20px;
    font-weight: bold;
    color: #A67C41;
    margin: 0;
}

/* زر إضافة للسلة */
.add-to-cart-btn {
    width: 100%;
    padding: 10px;
    font-size: 16px;
    font-weight: 600;
    color: #A67C41;
    background-color: transparent;
    border: 2px solid #A67C41;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-sizing: border-box;
}

.add-to-cart-btn:hover {
    background-color: #A67C41;
    color: #fff;
}

.add-to-cart-btn i {
    font-size: 18px;
}

/* 5. تصميم متجاوب (Responsive) */
@media (max-width: 991px) {
    .page-wrapper {
        flex-direction: column;
        padding: 20px;
    }
    .sidebar {
        flex: 0 0 auto;
        width: 100%;
        box-sizing: border-box;
    }
}

/* --- تنسيقات إضافية وتصحيحية --- */
.products-main-content {
    flex: 1;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    color: #4B3B2B;
    margin-top: 0;
    margin-bottom: 25px;
    padding-bottom: 10px;
    border-bottom: 2px solid #F0C778;
}

.reset-btn {
    width: 100%;
    padding: 12px;
    margin-top: 10px;
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    color: #A67C41;
    background-color: transparent;
    border: 2px solid #A67C41;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.reset-btn:hover {
    background-color: #A67C41;
    color: #fff;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    font-size: 18px;
    color: #888;
    padding: 40px;
}

/* --- تنسيقات الشريط الجانبي لصفحة السلة --- */
.cart-sidebar {
    flex: 0 0 300px; /* عرض ثابت للشريط الجانبي */
    background-color: #fff;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    height: fit-content; /* يجعله يتمدد حسب المحتوى */
    border: 1px solid #eee;
}

.cart-sidebar h4 {
    font-size: 22px;
    color: #4B3B2B;
    margin-top: 0;
    margin-bottom: 25px;
    border-bottom: 2px solid #F0C778;
    padding-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 18px;
    margin-bottom: 20px;
}

.summary-item span {
    color: #3d1e02;
    font-weight: 600;
}

.summary-item strong {
    color: #A67C41;
}

.summary-total {
    border-top: 1px solid #eee;
    padding-top: 20px;
    margin-top: 20px;
}

.summary-total strong {
    font-size: 24px;
}

/* زر إتمام الشراء */
.checkout-btn {
    width: 100%;
    padding: 12px;
    font-size: 18px;
    font-weight: bold;
    color: #fff;
    background-color: #28a745; /* أخضر */
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.checkout-btn:hover {
    background-color: #218838;
}

/* زر حذف كل المنتجات */
.clear-cart-btn {
    width: 100%;
    padding: 10px;
    margin-top: 15px;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    color: #d9534f; /* أحمر */
    background-color: transparent;
    border: 2px solid #d9534f;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.clear-cart-btn:hover {
    background-color: #d9534f;
    color: #fff;
}

/* --- تنسيق ملاحظة رسوم التوصيل --- */
.delivery-note {
    margin-top: 25px;
    padding: 15px;
    background-color: #fff8e1; /* خلفية صفراء فاتحة */
    border: 1px solid #ffe082; /* إطار أصفر */
    border-radius: 8px;
    display: flex;
    align-items: flex-start; /* محاذاة للأعلى */
    gap: 10px;
    font-size: 14px;
    color: #5d4037; /* لون بني للنص */
    line-height: 1.6;
}

.delivery-note .fa-info-circle {
    font-size: 18px;
    color: #ff8f00; /* لون برتقالي للأيقونة */
    margin-top: 3px; /* لضبط المحاذاة العمودية */
}

/* 
   تصحيح لزر حذف جميع المنتجات لضمان عدم خروجه من الحاوية.
   إضافة box-sizing هو الحل.
*/
.clear-cart-btn {
    width: 100%;
    padding: 10px;
    margin-top: 15px;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    color: #d9534f;
    background-color: transparent;
    border: 2px solid #d9534f;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-sizing: border-box; /* هذا السطر يحل مشكلة خروج الزر */
}

.clear-cart-btn:hover {
    background-color: #d9534f;
    color: #fff;
}

/* --- تنسيقات نموذج إتمام الطلب في السلة --- */
.checkout-form .form-group {
    margin-bottom: 15px;
}

.checkout-form .form-label {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: #3d1e02;
    margin-bottom: 8px;
}

.checkout-form .form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: 'Cairo', sans-serif;
    font-size: 15px;
    box-sizing: border-box;
}

.checkout-form .form-control:focus {
    outline: none;
    border-color: #A67C41;
    box-shadow: 0 0 0 2px rgba(166, 124, 65, 0.2);
}

/* تنسيق خاص للرسالة المنبثقة */
.toast-notification {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #28a745;
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s, bottom 0.3s;
}

.toast-notification.show {
    opacity: 1;
    visibility: visible;
    bottom: 40px;
}

/* --- التحكم في إظهار وإخفاء الأشرطة الجانبية --- */

/* بشكل افتراضي، نموذج إتمام الطلب يكون مخفياً */
.checkout-sidebar {
    display: none;
}

/* كلاس لإخفاء أي عنصر */
.hidden {
    display: none !important;
}

@media (max-width: 991px) {
    .page-wrapper {
        flex-direction: column;
        padding: 15px;
    }

    .sidebar {
        width: 100%;
        margin-bottom: 15px;
        padding: 12px; /* صغر المساحة قليلاً */
        flex: none;
        border-radius: 12px;
    }

    /* صغر حجم خانة البحث */
    .search-input-container .filter-input {
        padding: 6px 8px;
        font-size: 13px;
    }

    .filter-select {
        font-size: 13px;
        padding: 6px 8px;
    }

    /* Radio buttons جنب بعض */
    .radio-group {
        flex-direction: row; /* بدل العمودي */
        gap: 10px;
    }

    .radio-group label {
        font-size: 13px;
        gap: 5px;
    }

    /* شبكة المنتجات صفين لكل صف */
    .products-grid-container {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .product-item-card {
        padding: 12px;
    }

    .product-item-image {
        width: 110px;
        height: 110px;
        margin-bottom: 8px;
    }

    .product-item-name {
        font-size: 15px;
    }

    .product-item-price {
        font-size: 17px;
    }

    .reset-btn {
        padding: 8px;
        font-size: 13px;
    }
}
