/*
 * ============================================
 * PRODUCT CARD - SHOPIFY STYLE (RTL) - V3 (Larger Image)
 * تصميم نظيف مثل Shopify - من اليمين
 * ============================================
 */

/* === إعادة تعيين WooCommerce === */
.woocommerce ul.products,
ul.products {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 16px !important;
    padding: 16px !important;
    list-style: none !important;
    margin: 0 !important;
    background: #fff !important;
}/*
 * ============================================
 * PRODUCT CARD - SHOPIFY STYLE (RTL) - V3 (Larger Image)
 * تصميم نظيف مثل Shopify - من اليمين
 * ============================================
 */

/* === إعادة تعيين WooCommerce === */
.woocommerce ul.products,
ul.products {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 16px !important;
    padding: 16px !important;
    list-style: none !important;
    margin: 0 !important;
    background: #fff !important;
}

.woocommerce ul.products li.product {
    float: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
}

/* === البطاقة === */
.product-card-shopify {
    background: #fff;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* === wrapper الصورة === */
.product-image-wrapper {
    position: relative;
    width: 100%;
    padding-top: 100%; /* يحافظ على نسبة العرض إلى الارتفاع المربعة */
    overflow: hidden;
    background: #fff;
    margin-bottom: 12px;
}

.product-image-link {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-image-wrapper img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    object-position: center !important;
    padding: 0px !important; /* **تعديل مهم:** لجعل الصورة تملأ المساحة */
    transition: transform 0.3s ease;
}

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


/* === زر Quick Add === */
.quick-add-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 44px;
    height: 44px;
    background: #fff;
    border: 1.5px solid #e5e5e5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: all 0.2s ease;
    padding: 0;
}

.quick-add-btn:hover {
    background: #000;
    border-color: #000;
}

.quick-add-btn i {
    font-size: 18px;
    color: #000;
    transition: color 0.2s ease;
}

.quick-add-btn:hover i {
    color: #fff;
}

/* حالة التحميل */
.quick-add-btn.loading i {
    animation: spin 0.6s linear infinite;
}

/* حالة النجاح */
.quick-add-btn.added {
    background: #4caf50 !important;
    border-color: #4caf50 !important;
}

.quick-add-btn.added i {
    color: #fff !important;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mobile */
@media (max-width: 479px) {
    .quick-add-btn {
        width: 38px;
        height: 38px;
        bottom: 10px;
        right: 10px;
    }
    
    .quick-add-btn i {
        font-size: 16px;
    }
}


/* === العنوان === */
.product-title-shopify {
    margin: 0 0 6px 0;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    min-height: 38px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-title-shopify a {
    color: #000;
    text-decoration: none;
    transition: color 0.2s ease;
}

.product-title-shopify a:hover {
    color: #666;
}

/* === السعر === */
.product-price-shopify {
    font-size: 15px;
    font-weight: 400;
    color: #000;
    text-align: right; /* **مهم:** محاذاة لليمين حسب طلبك */
    direction: rtl;
}

.product-price-shopify .price {
    display: block;
    margin: 0;
}

.product-price-shopify .woocommerce-Price-amount {
    font-size: 15px;
    font-weight: 400;
    color: #000;
}

.product-price-shopify .woocommerce-Price-currencySymbol {
    margin-right: 2px;
}

/* === إخفاء عناصر WooCommerce الافتراضية === */
.woocommerce ul.products li.product .button,
.woocommerce ul.products li.product .add_to_cart_button {
    display: none !important;
}

.woocommerce ul.products li.product .star-rating,
.woocommerce ul.products li.product .onsale {
    display: none !important;
}

/* === Responsive === */

/* Mobile Small (320px - 479px) */
@media (max-width: 479px) {
    .woocommerce ul.products,
    ul.products {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
        padding: 12px !important;
    }
    
    .product-info-shopify {
        padding: 0 3px;
    }
    
    .product-title-shopify {
        font-size: 12px;
        min-height: 34px;
    }
    
    .product-price-shopify,
    .product-price-shopify .woocommerce-Price-amount {
        font-size: 13px;
    }
    
    .quick-add-btn {
        width: 36px;
        height: 36px;
        bottom: 10px;
        right: 10px;
    }
    
    .quick-add-btn i {
        font-size: 14px;
    }
}

/* Mobile (480px - 639px) */
@media (min-width: 480px) and (max-width: 639px) {
    .woocommerce ul.products,
    ul.products {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 14px !important;
        padding: 14px !important;
    }
    
    .product-info-shopify {
        padding: 0 4px;
    }
    
    .product-title-shopify {
        font-size: 13px;
    }
    
    .product-price-shopify,
    .product-price-shopify .woocommerce-Price-amount {
        font-size: 14px;
    }
}

/* Tablet (640px - 1023px) */
@media (min-width: 640px) and (max-width: 1023px) {
    .woocommerce ul.products,
    ul.products {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 18px !important;
        padding: 18px !important;
    }
    
    .product-info-shopify {
        padding: 0 6px;
    }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
    .woocommerce ul.products,
    ul.products {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 24px !important;
        padding: 24px !important;
    }
    
    .product-info-shopify {
        padding: 0 8px;
    }
}

/* Desktop Large (1440px+) */
@media (min-width: 1440px) {
    .woocommerce ul.products,
    ul.products {
        grid-template-columns: repeat(5, 1fr) !important;
        gap: 28px !important;
    }
    
    .product-info-shopify {
        padding: 0 10px;
    }
}


.woocommerce ul.products li.product {
    float: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
}

/* === البطاقة === */
.product-card-shopify {
    background: #fff;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* === wrapper الصورة === */
.product-image-wrapper {
    position: relative;
    width: 100%;
    padding-top: 100%; /* يحافظ على نسبة العرض إلى الارتفاع المربعة */
    overflow: hidden;
    background: #fff;
    margin-bottom: 12px;
}

.product-image-link {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-image-wrapper img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    object-position: center !important;
    padding: 0px; /* **تعديل مهم:** تم تقليل الحشو إلى 0 لجعل الصورة أكبر */
    transition: transform 0.3s ease;
}

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

/* === زر Quick Add === */
.quick-add-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
    opacity: 1;
    transform: translateY(0);
}

.quick-add-btn:hover {
    background: #000;
    border-color: #000;
}

.quick-add-btn i {
    font-size: 16px;
    color: #000;
    transition: color 0.2s ease;
}

.quick-add-btn:hover i {
    color: #fff;
}

.quick-add-btn.loading i {
    animation: spin 0.6s linear infinite;
}

.quick-add-btn.added {
    background: #4caf50;
    border-color: #4caf50;
}

.quick-add-btn.added i {
    color: #fff;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* === معلومات المنتج === */
.product-info-shopify {
    padding: 0 5px; /* **تعديل:** أضفت حشو أفقي بسيط للمعلومات لتجنب التصاقها بالحواف */
    text-align: right;
    direction: rtl;
}

/* === العنوان === */
.product-title-shopify {
    margin: 0 0 6px 0;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    min-height: 38px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-title-shopify a {
    color: #000;
    text-decoration: none;
    transition: color 0.2s ease;
}

.product-title-shopify a:hover {
    color: #666;
}

/* === السعر === */
.product-price-shopify {
    font-size: 15px;
    font-weight: 400;
    color: #000;
    text-align: right;
    direction: rtl;
}

.product-price-shopify .price {
    display: block;
    margin: 0;
}

.product-price-shopify .woocommerce-Price-amount {
    font-size: 15px;
    font-weight: 400;
    color: #000;
}

.product-price-shopify .woocommerce-Price-currencySymbol {
    margin-right: 2px;
}

/* === إخفاء عناصر WooCommerce الافتراضية === */
.woocommerce ul.products li.product .button,
.woocommerce ul.products li.product .add_to_cart_button {
    display: none !important;
}

.woocommerce ul.products li.product .star-rating,
.woocommerce ul.products li.product .onsale {
    display: none !important;
}

/* === Responsive (تم تحديث بعض قيم الحشو للصورة) === */

/* Mobile Small (320px - 479px) */
@media (max-width: 479px) {
    .woocommerce ul.products,
    ul.products {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
        padding: 12px !important;
    }
    
    /* **تعديل:** التأكد من تطبيق padding: 0 على الصورة في الجوالات */
    .product-image-wrapper img {
        padding: 0px !important; 
    }

    .product-info-shopify {
        padding: 0 3px; /* حشو أقل في الجوالات */
    }
    
    .product-title-shopify {
        font-size: 12px;
        min-height: 34px;
    }
    
    .product-price-shopify,
    .product-price-shopify .woocommerce-Price-amount {
        font-size: 13px;
    }
    
    .quick-add-btn {
        width: 36px;
        height: 36px;
        bottom: 10px;
        right: 10px;
    }
    
    .quick-add-btn i {
        font-size: 14px;
    }
}

/* Mobile (480px - 639px) */
@media (min-width: 480px) and (max-width: 639px) {
    .woocommerce ul.products,
    ul.products {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 14px !important;
        padding: 14px !important;
    }

    /* **تعديل:** التأكد من تطبيق padding: 0 على الصورة في الجوالات */
    .product-image-wrapper img {
        padding: 0px !important;
    }

    .product-info-shopify {
        padding: 0 4px; /* حشو أقل في الجوالات */
    }
    
    .product-title-shopify {
        font-size: 13px;
    }
    
    .product-price-shopify,
    .product-price-shopify .woocommerce-Price-amount {
        font-size: 14px;
    }
}

/* Tablet (640px - 1023px) */
@media (min-width: 640px) and (max-width: 1023px) {
    .woocommerce ul.products,
    ul.products {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 18px !important;
        padding: 18px !important;
    }

    /* **تعديل:** التأكد من تطبيق padding: 0 على الصورة في التابلت */
    .product-image-wrapper img {
        padding: 0px !important;
    }

    .product-info-shopify {
        padding: 0 6px;
    }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
    .woocommerce ul.products,
    ul.products {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 24px !important;
        padding: 24px !important;
    }

    /* **تعديل:** التأكد من تطبيق padding: 0 على الصورة في الديسكتوب */
    .product-image-wrapper img {
        padding: 0px !important;
    }

    .product-info-shopify {
        padding: 0 8px;
    }
}

/* Desktop Large (1440px+) */
@media (min-width: 1440px) {
    .woocommerce ul.products,
    ul.products {
        grid-template-columns: repeat(5, 1fr) !important;
        gap: 28px !important;
    }

    /* **تعديل:** التأكد من تطبيق padding: 0 على الصورة في الديسكتوب الكبير */
    .product-image-wrapper img {
        padding: 0px !important;
    }

    .product-info-shopify {
        padding: 0 10px;
    }
}
