/* Products Grid - Bootstrap Enhanced */
.sp-products-grid {
    margin: 40px 0;
}

/* Override Bootstrap container if needed */
.sp-products-grid .container-fluid {
    padding: 0;
}

@media (max-width: 768px) {
    .sp-products-grid {
        margin: 20px 0;
    }
}

/* Product Card - Bootstrap Enhanced */
.sp-product-card {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid rgba(0,0,0,.125);
}

.sp-product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

/* Product Slider - Bootstrap Compatible */
.sp-product-slider {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    background: #f8f9fa;
}

.sp-product-slider .swiper-slide {
    display: flex;
    align-items: center;
    justify-content: center;
}

.sp-product-slider img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.sp-product-slider .swiper-button-next,
.sp-product-slider .swiper-button-prev {
    color: #ffffff;
    background: rgba(0, 0, 0, 0.5);
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.sp-product-slider .swiper-button-next::after,
.sp-product-slider .swiper-button-prev::after {
    font-size: 16px;
}

.sp-product-slider .swiper-pagination-bullet {
    background: #ffffff;
    opacity: 0.7;
}

.sp-product-slider .swiper-pagination-bullet-active {
    opacity: 1;
    background: #198754;
}

/* Product Content - Bootstrap Utility Classes Applied */
.sp-product-content {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.sp-product-title {
    line-height: 1.4;
}

.sp-product-description {
    line-height: 1.6;
    flex-grow: 1;
}

/* Product Features - Bootstrap Badge Enhancements */
.sp-feature-tag {
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.375rem 0.75rem;
    transition: all 0.2s ease;
}

.sp-feature-tag:hover {
    background-color: #e9ecef !important;
    transform: scale(1.05);
}

/* Product Footer - Bootstrap Utilities */
.sp-product-footer {
    margin-top: auto;
}

.sp-product-price {
    line-height: 1;
}

.sp-price-amount::before {
    /* left intentionally empty; currency is added via PHP */
    content: '';
}

/* WhatsApp Button - Bootstrap Button Enhanced */
.sp-whatsapp-btn {
    text-decoration: none;
    border-radius: 25px;
    transition: all 0.3s ease;
    direction: rtl;
    white-space: nowrap;
    border: none;
}

.sp-whatsapp-btn:hover {
    background-color: #128C7E !important;
    color: #ffffff !important;
    transform: scale(1.05);
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.2);
}

.sp-whatsapp-btn svg {
    flex-shrink: 0;
}

/* RTL Support - Bootstrap Compatible */
[dir="rtl"] .sp-products-grid,
[dir="rtl"] .sp-product-card,
[dir="rtl"] .sp-product-content {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .sp-product-footer {
    flex-direction: row-reverse;
}

[dir="rtl"] .sp-whatsapp-btn {
    direction: rtl;
}

/* Responsive Design - Bootstrap Breakpoints */
@media (max-width: 576px) {
    .sp-product-title {
        font-size: 1.125rem;
    }
    
    .sp-product-price {
        font-size: 1.25rem;
    }
    
    .sp-whatsapp-btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
    
    .sp-product-footer {
        flex-direction: column !important;
        gap: 0.75rem;
        align-items: stretch !important;
    }
    
    .sp-whatsapp-btn {
        justify-content: center;
        width: 100%;
    }
}

/* Accessibility - Bootstrap Focus States */
.sp-product-card:focus-within {
    outline: 2px solid #198754;
    outline-offset: 2px;
}

.sp-whatsapp-btn:focus {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
    box-shadow: 0 0 0 0.25rem rgba(25, 135, 84, 0.5);
}

/* Animation keyframes */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sp-product-card.animate-in {
    animation: fadeInUp 0.6s ease forwards;
}

/* WhatsApp Button */
.sp-whatsapp-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #25D366;
    color: #ffffff;
    text-decoration: none;
    border-radius: 25px;
    font-weight: 600;
    font-size: 14px;
    transition: background 0.3s ease, transform 0.2s ease;
    direction: rtl;
}

.sp-whatsapp-btn:hover {
    background: #128C7E;
    color: #ffffff;
    transform: scale(1.05);
}

.sp-whatsapp-btn svg {
    flex-shrink: 0;
}

/* RTL Support */
[dir="rtl"] .sp-products-grid,
[dir="rtl"] .sp-product-card,
[dir="rtl"] .sp-product-content {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .sp-product-features {
    justify-content: flex-start;
}

[dir="rtl"] .sp-product-footer {
    flex-direction: row-reverse;
}

/* Responsive Design */
@media (max-width: 480px) {
    .sp-product-title {
        font-size: 18px;
    }
    
    .sp-product-price {
        font-size: 20px;
    }
    
    .sp-whatsapp-btn {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .sp-product-footer {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .sp-whatsapp-btn {
        justify-content: center;
    }
}

/* Loading State */
.sp-products-grid.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Empty State */
.sp-products-grid:empty::after {
    content: 'لا توجد منتجات متاحة';
    display: block;
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 16px;
}

/* Accessibility */
.sp-product-card:focus-within {
    outline: 2px solid #25D366;
    outline-offset: 2px;
}

.sp-whatsapp-btn:focus {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}