/* ===============================================
   MODERN E-COMMERCE PRODUCT CARDS
   =============================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css');

:root {
    --primary-color: #ed5233;
    --primary-hover: #d1452c;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    --background: #ffffff;
    --border: #e5e7eb;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --spacing-xs: 0.5rem;
    --spacing-sm: 0.75rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --border-radius: 0.75rem;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Product Grid Container */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-lg);
    padding: var(--spacing-md) 0;
}

/* Product Card Wrapper */
.product-card-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Main Product Card */
.product-card {
    background: var(--background);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid var(--border);
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-color);
}

/* Product Badge */
.product-card__badge {
    position: absolute;
    top: var(--spacing-sm);
    left: var(--spacing-sm);
    z-index: 10;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.product-card__badge--discount {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

.product-card__badge--sale {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
}

.product-card__badge--featured {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
    box-shadow: 0 2px 4px rgba(139, 92, 246, 0.3);
}

.product-card__badge--new {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
}

/* Product Image Container */
.product-card__image {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    background-color: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

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

/* Product Content */
.product-card__content {
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0.25rem;
}

/* Product Title */
.product-card__title {
    margin: 0 0 0.125rem 0;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

.product-card__title a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

.product-card__title a:hover {
    color: var(--primary-color);
}

/* Product Category */
.product-card__category {
    margin: 0 0 0.125rem 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Stock Status */
.product-card__stock {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
    color: var(--success);
    font-weight: 500;
    margin: 0 0 0.125rem 0;
}

.product-card__stock i {
    font-size: 0.75rem;
}

/* Price Container */
.product-card__price {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.25rem 0;
}

.product-card__price-sale {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.product-card__price-old {
    font-size: 0.9rem;
    color: var(--text-light);
    text-decoration: line-through;
    font-weight: 500;
}

/* Call to Action Button */
.product-card__cta {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.6rem 0.75rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.product-card__cta:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(237, 82, 51, 0.3);
    color: white;
    text-decoration: none;
}

.product-card__cta:active {
    transform: translateY(0);
}

/* Product Actions Container (for multiple buttons) */
.product-card__actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
}

.product-card__actions .product-card__cta {
    flex: 1;
}

/* Remove Button (for wishlist) */
.product-card__remove {
    background: #fff;
    border: 2px solid #dc3545;
    color: #dc3545;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.product-card__remove:hover {
    background-color: #dc3545;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

/* ===============================================
   RESPONSIVE DESIGN
   =============================================== */

/* Large Desktop (1400px+) - 5 products per row */
@media (min-width: 1400px) {
    .product-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: var(--spacing-md);
    }
}

/* Medium Desktop (1200-1399px) - 4 products per row */
@media (min-width: 1200px) and (max-width: 1399px) {
    .product-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: var(--spacing-lg);
    }
}

/* Large Tablets (992-1199px) - 3 products per row */
@media (min-width: 992px) and (max-width: 1199px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--spacing-lg);
    }
}

/* Tablets (768-991px) - 2 products per row */
@media (min-width: 768px) and (max-width: 991px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-lg);
    }
    
    .product-card__content {
        padding: var(--spacing-md);
    }
}

/* Mobile (576-767px) - 2 products per row */
@media (min-width: 576px) and (max-width: 767px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-sm);
    }
    
    /* Optimize image aspect ratio for mobile */
    .product-card__image {
        aspect-ratio: 0.9;
        min-height: 140px;
        max-height: 180px;
    }
    
    .product-card__content {
        padding: 0.4rem;
        gap: 0.15rem;
    }
    
    .product-card__title {
        font-size: 0.75rem;
        line-height: 1.2;
        margin: 0 0 0.1rem 0;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .product-card__category {
        font-size: 0.7rem;
        margin: 0 0 0.1rem 0;
    }
    
    .product-card__stock {
        font-size: 0.7rem;
        margin: 0 0 0.1rem 0;
    }
    
    .product-card__price {
        margin: 0.15rem 0;
    }
    
    .product-card__price-sale {
        font-size: 0.9rem;
    }
    
    .product-card__price-old {
        font-size: 0.7rem;
    }
    
    .product-card__cta {
        padding: 0.45rem 0.6rem;
        font-size: 0.7rem;
        margin-top: 0.15rem;
    }
}

/* Mobile Portrait (<576px) - 2 products per row */
@media (max-width: 575px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-xs);
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }
    
    /* Optimize image aspect ratio for mobile */
    .product-card__image {
        aspect-ratio: 0.85;
        min-height: 120px;
        max-height: 160px;
    }
    
    .product-card__content {
        padding: 0.3rem;
        gap: 0.1rem;
    }
    
    .product-card__title {
        font-size: 0.7rem;
        line-height: 1.15;
        margin: 0 0 0.08rem 0;
    }
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    .product-card__category {
        font-size: 0.65rem;
        margin: 0 0 0.08rem 0;
    }
    
    .product-card__stock {
        font-size: 0.65rem;
        margin: 0 0 0.08rem 0;
    }
    
    .product-card__price {
        margin: 0.1rem 0;
        gap: 0.2rem;
    }
    
    .product-card__price-sale {
        font-size: 0.8rem;
    }
    
    .product-card__price-old {
        font-size: 0.65rem;
    }
    
    .product-card__cta {
        padding: 0.3rem 0.4rem;
        font-size: 0.65rem;
        margin-top: 0.1rem;
    }
    
    .product-card__badge {
        padding: 0.125rem 0.25rem;
        font-size: 0.6rem;
        top: 0.25rem;
        left: 0.25rem;
    }
}

/* Extra Small Mobile (320px-479px) - Ultra compact view */
@media (max-width: 479px) {
    .product-grid {
        gap: 0.25rem;
        padding: 0.25rem 0;
    }
    
    .product-card__image {
        aspect-ratio: 0.8;
        min-height: 100px;
        max-height: 130px;
    }
    
    .product-card__content {
        padding: 0.2rem;
        gap: 0.05rem;
    }
    
    .product-card__title {
        font-size: 0.65rem;
        line-height: 1.1;
        margin: 0 0 0.05rem 0;
    }
    
    .product-card__category {
        font-size: 0.6rem;
        margin: 0 0 0.05rem 0;
    }
    
    .product-card__stock {
        font-size: 0.6rem;
        margin: 0 0 0.05rem 0;
    }
    
    .product-card__price {
        margin: 0.08rem 0;
        gap: 0.15rem;
    }
    
    .product-card__price-sale {
        font-size: 0.75rem;
    }
    
    .product-card__price-old {
        font-size: 0.6rem;
    }
    
    .product-card__cta {
        padding: 0.2rem 0.3rem;
        font-size: 0.6rem;
        margin-top: 0.08rem;
    }
    
    .product-card__badge {
        padding: 0.1rem 0.2rem;
        font-size: 0.55rem;
        top: 0.2rem;
        left: 0.2rem;
    }
}

/* ===============================================
   PERFORMANCE OPTIMIZATIONS
   =============================================== */

/* Optimize product cards for better performance */
.product-card {
    contain: layout style paint;
    will-change: auto;
}

/* Optimize image loading */
img[data-src] {
    opacity: 0;
    transition: opacity 0.3s ease;
}

img.lazyloaded {
    opacity: 1;
}

/* Prevent layout shifts during loading */
.product-card__image {
    aspect-ratio: 1;
    background-color: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-card__image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
}

/* Optimize hover animations */
.product-card:hover {
    transform: translateY(-4px) translateZ(0);
}

/* Reduce paint operations */
.product-card__badge {
    contain: layout style paint;
}

/* Best Offer badge styling */
.product-badge_item.best-offer {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
    border: none;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
    font-weight: 600;
    letter-spacing: 0.5px;
    animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 4px 16px rgba(255, 107, 107, 0.5);
        transform: scale(1.05);
    }
}

/* Shop page specific styles */
.wrapper-shop.tf-grid-layout.tf-col-3.product-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

@media (max-width: 1200px) {
    .wrapper-shop.tf-grid-layout.tf-col-3.product-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .wrapper-shop.tf-grid-layout.tf-col-3.product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

@media (max-width: 576px) {
    .wrapper-shop.tf-grid-layout.tf-col-3.product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
}

/* Wishlist specific grid styling */
.wrapper-wishlist.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .wrapper-wishlist.product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

@media (max-width: 576px) {
    .wrapper-wishlist.product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
}

/* Related Products Grid Responsive */
.related-products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

@media (max-width: 1200px) {
    .related-products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.25rem;
    }
}

@media (max-width: 768px) {
    .related-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

@media (max-width: 576px) {
    .related-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
}
