/*
 * Custom Frontend Stylesheet
 * styles for product cards, etc.
 */

/*
 * =============================================
 *   شاشة التحميل (Preloader)
 * =============================================
 */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #ffffff;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.75s ease, visibility 0.75s ease;
}

/*
 * =============================================
 *   تخصيص شعار التحميل (Lottie)
 * =============================================
 */
.preloader-lottie {
    width: 250px; /* حجم مناسب للشاشات الكبيرة */
    height: auto;
    /* تطبيق فلتر لتحويل الألوان إلى الأسود */
    filter: grayscale(1) brightness(0);
}

@media (max-width: 768px) {
    .preloader-lottie {
        width: 180px; /* حجم أصغر للشاشات المتوسطة والصغيرة */
    }
}

/* --- إعدادات عامة وخطوط --- */
body {
    font-family: 'Cairo', sans-serif; /* تأكد من استيراد الخط في header.php */
    background-color: #f8f9fa;
}

/* --- حاوية شبكة المنتجات --- */
.product-grid {
    display: grid;
    /* التغيير هنا: استخدم auto-fill بدلاً من auto-fit */
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

/* فرض عرض بطاقتين في السطر على شاشات الهواتف */
@media (max-width: 576px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
/* --- تصميم بطاقة المنتج --- */
.product-card {
    background-color: #ffffff;
    border-radius: 32px;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.3s ease;
    /* min-height: 300px; */ /* لم يعد ضرورياً مع height: 100% */
    height: 100%; /* يجعل كل البطاقات في نفس الصف بنفس الارتفاع */ 
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

.product-content-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 0.5rem;
}

.product-brand {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
    padding: 0.25rem 0.75rem;
    border-radius: 16px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #374151;
    z-index: 2;
}

.product-link-wrapper {
    display: flex;
    flex: 1;
    flex-direction: column;
    text-decoration: none;
}

/* رابط الصورة لجعله كتلة قابلة للنقر */
.product-image-link {
    display: block;
}
/* --- صورة المنتج --- */
.product-card .product-image-container {
    position: relative;
    width: 100%;
    height: 180px; /* ارتفاع ثابت للصورة */
    overflow: hidden;
}

.product-card .product-image {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    object-fit: contain; /* يضمن ظهور المنتج بالكامل مع الحفاظ على نسبة العرض إلى الارتفاع */
    mix-blend-mode: multiply; /* لمزج الخلفية الرمادية مع خلفية البطاقة */
    transition: transform 0.4s ease;
}

.product-card:hover .product-image {
    transform: scale(1.05);
}

.product-card .product-title {
    font-size: 0.9rem;
    color: #111827;
    margin: 0.5rem 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --- قسم السعر --- */
.product-price-container {
    display: flex;
    align-items: flex-start;
    gap: 0.25rem;
    margin-top: auto; /* يدفع السعر إلى أسفل حاوية المحتوى */
}

.price-icon-wrapper {
    background-color: #22c55e; /* green-500 */
    border-radius: 9999px;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.price-icon-wrapper i {
    color: white;
    font-size: 10px;
    width: 10px;
    height: 10px;
}

.product-card .price-wrapper {
    display: flex;
    align-items: baseline;
    gap: 0.2rem;
    font-size: 1rem;
    font-weight: 700;
}

.product-card .product-price {
    color: #111827;
}

.product-card .product-price.sale {
    color: #ef4444; /* red-500 */
}

.product-card .original-price {
    font-size: 0.8rem;
    color: #6b7280;
    text-decoration: line-through;
    font-weight: 500;
}

.product-card .currency {
    font-weight: 400;
    font-size: 0.9rem;
}

/* --- زر الإضافة للسلة السفلي --- */
.add-to-cart-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    height: 48px;
    padding: 0.75rem 0;
    border: none;
    border-top: 1px solid #f3f4f6; /* gray-100 */
    background-color: transparent;
    color: #d20a11; /* primary color */
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    border-bottom-left-radius: 32px;
    border-bottom-right-radius: 32px;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.add-to-cart-footer i {
    color: #d20a11;
    transition: color 0.2s ease-in-out;
}

.add-to-cart-footer:hover {
    background-color: #d20a11;
    color: white;
}

.add-to-cart-footer:hover i {
    color: white;
}

.add-to-cart-footer:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/*
 * =============================================
 *   إصلاح مشكلة bootstrap.rtl.min.css
 * =============================================
 * هذه القاعدة تقوم بتصحيح السلوك الخاطئ للكلاس .text-end
 * وتجبره على محاذاة النص لليمين كما هو متوقع في RTL.
 */
[dir="rtl"] .text-end {
    text-align: right !important;
}

/*
 * =============================================
 *   تعديل موضع مؤشرات السلايدر
 * =============================================
 * هذا الكود يضع المؤشرات داخل السلايدر في الأسفل.
 */
#mainSlider .carousel-indicators {
    position: absolute;
    bottom: 20px; /* يمكنك تعديل هذه القيمة لضبط المسافة من الأسفل */
}

/*
 * =============================================
 *   تحديد ارتفاع السلايدر ليتناسق مع اللافتات
 * =============================================
 */
@media (min-width: 992px) { /* تطبيق النمط على الشاشات الكبيرة (lg) وأكبر */
    #mainSlider,
    #mainSlider .carousel-inner,
    #mainSlider .carousel-item {
        height: 400px; /* يمكنك تعديل هذا الارتفاع ليناسب تصميمك */
        max-height: 450px;
    }
}

/*
 * =============================================
 *   توسيط محتوى السلايدر عمودياً
 * =============================================
 */
@media (min-width: 768px) { /* تطبيق النمط على الشاشات المتوسطة وأكبر */
    .slide-content-wrapper .col-md-7 {
        display: flex;
        flex-direction: column;
        justify-content: center;
        height: 100%;
    }
}

/*
 * =============================================
 *   إصلاح مشكلة ظهور لون فوق خلفية السلايدر
 * =============================================
 * هذا الكود يجعل خلفية أعمدة المحتوى شفافة.
 */
.slide-content-wrapper,
.slide-content-wrapper .row,
.slide-content-wrapper .col-md-7,
.slide-content-wrapper .col-md-5 {
    background-color: transparent !important;
}

/*
 * =============================================
 *   تطبيق تصميم محصور للسلايدر والبطاقات
 * =============================================
 * هذا الكود يطبق الإعدادات المطلوبة على حاوية السلايدر.
 */
.hero-section-container {
    max-width: 1400px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}