/* ============================================
   PRODUCT CARD V2 ENHANCED - v5.0
   
   🎯 Features:
   ✅ Mobile-First Responsive
   ✅ RTL Support
   ✅ Accessibility (WCAG 2.2 AA)
   ✅ Performance Optimized
   ✅ Modern CSS (Grid, Flexbox, Custom Props)
   
   @author Senior Architect Team
   @date 2026-01-07
   @version 5.0.0
============================================ */

:root {
    --pc-v2-radius: 16px;
    --pc-v2-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    --pc-v2-shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.12);
    --pc-v2-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --pc-v2-primary: #4f46e5;
    --pc-v2-success: #10b981;
    --pc-v2-danger: #ef4444;
    --pc-v2-warning: #f59e0b;
}

/* ============================================
   PRODUCT CARD BASE
============================================ */
.product-card-v2 {
    position: relative;
    display: flex;
    flex-direction: column;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: var(--pc-v2-radius);
    overflow: hidden;
    transition: var(--pc-v2-transition);
    height: 100%;
}

.product-card-v2:hover {
    box-shadow: var(--pc-v2-shadow-hover);
    transform: translateY(-4px);
}

/* ============================================
   IMAGE WRAPPER
============================================ */
.image-wrapper-v2 {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #f9fafb;
}

.image-link-v2 {
    display: block;
    width: 100%;
    height: 100%;
}

.product-image-v2 {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.product-image-v2.lazy {
    filter: blur(5px);
    transition: filter 0.3s;
}

.product-image-v2.lazy.loaded {
    filter: blur(0);
}

/* ============================================
   BADGES SYSTEM
============================================ */
.badges-stack-v2 {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 3;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 140px;
}

.badge-primary-v2,
.badge-secondary-v2,
.badge-feature-v2 {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 8px;
    color: white;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    animation: fadeInDown 0.4s ease-out;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.badge-hot-v2 {
    background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
}

.badge-new-v2 {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.badge-limited-v2 {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.badge-bestseller-v2 {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.badge-featured-v2 {
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
}

.badge-top-rated-v2 {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
}

.badge-free-shipping-v2 {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.badges-secondary-v2,
.badges-features-v2 {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* ============================================
   ACTION BUTTONS
============================================ */
.action-buttons-floating-v2 {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 3;
    display: flex;
    flex-direction: column;
    gap: 8px;
    opacity: 0;
    transform: translateX(-10px);
    transition: var(--pc-v2-transition);
}

.product-card-v2:hover .action-buttons-floating-v2 {
    opacity: 1;
    transform: translateX(0);
}

.action-btn-v2 {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--pc-v2-transition);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.action-btn-v2:hover {
    background: var(--pc-v2-primary);
    color: white;
    transform: scale(1.1);
}

.wishlist-btn-v2.active {
    background: #fef2f2;
    color: #ef4444;
}

.wishlist-btn-v2.active:hover {
    background: #ef4444;
    color: white;
}

@media (max-width: 768px) {
    .action-buttons-floating-v2 {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ============================================
   PRODUCT INFO
============================================ */
.product-info-v2 {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    flex: 1;
}

/* TITLE */
.product-title-v2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    color: #111827;
}

.product-link-v2 {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}

.product-link-v2:hover {
    color: var(--pc-v2-primary);
}

/* SHORT DESCRIPTION */
.product-short-desc-v2 {
    margin: 0;
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.5;
}

/* CATEGORY */
.product-category-v2 {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: #f3f4f6;
    color: #6b7280;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 6px;
    text-decoration: none;
    align-self: flex-start;
    transition: var(--pc-v2-transition);
}

.product-category-v2:hover {
    background: #e5e7eb;
    color: var(--pc-v2-primary);
}

/* RATING & META */
.product-meta-row-v2 {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.product-rating-v2 {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
}

.stars-v2 {
    display: flex;
    gap: 2px;
    color: #fbbf24;
}

.rating-count-v2 {
    color: #6b7280;
}

.sales-counter-v2 {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: #6b7280;
}

/* ============================================
   PRICING
============================================ */
.price-section-v2 {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* CUSTOMER/GUEST PRICING */
.price-deal-v2 {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.price-current-v2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--pc-v2-primary);
}

.price-old-v2 {
    font-size: 1rem;
    color: #9ca3af;
    text-decoration: line-through;
}

.price-regular-v2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
}

.discount-badge-v2 {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    background: #fef2f2;
    color: #ef4444;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 6px;
}

.savings-info-v2 {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: #ecfdf5;
    color: #059669;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 6px;
}

/* MARKETER PRICING */
.marketer-pricing-v2 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 12px;
    color: white;
}

.price-row-v2 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 0.875rem;
}

.price-row-your-price {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    padding: 8px 10px;
    margin: 4px 0;
    font-weight: 600;
}

.price-row-profit {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 8px;
    margin-top: 4px;
    font-weight: 700;
}

.label-v2 {
    opacity: 0.95;
    font-size: 0.8125rem;
}

.value-v2 {
    font-weight: 600;
}

.profit-value {
    color: #34d399;
}

/* STOCK & SHIPPING */
.product-meta-bottom-v2 {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 8px 0;
    border-top: 1px solid #e5e7eb;
}

.stock-status-v2 {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    font-weight: 600;
}

.stock-status-v2.in-stock {
    color: #059669;
}

.stock-status-v2.out-stock {
    color: #dc2626;
}

.stock-status-v2 i {
    font-size: 0.5rem;
}

.shipping-info-v2 {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: #059669;
    font-weight: 600;
}

/* ============================================
   ATTRIBUTES
============================================ */
.attributes-preview-v2 {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.color-swatch-v2 {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 0 0 1px #e5e7eb, 0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: var(--pc-v2-transition);
}

.color-swatch-v2:hover {
    transform: scale(1.1);
}

.text-variant-v2 {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background: #f3f4f6;
    color: #374151;
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: 6px;
    transition: var(--pc-v2-transition);
}

.text-variant-v2:hover {
    background: #e5e7eb;
}

.more-variants-v2 {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    background: #e5e7eb;
    color: #6b7280;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 6px;
}

/* ============================================
   CTA BUTTONS
============================================ */
.product-actions-v2,
.product-actions-secondary-v2 {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

.btn-add-cart-v2,
.btn-buy-now-v2 {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border: none;
    border-radius: 10px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--pc-v2-transition);
}

.btn-primary-v2 {
    background: linear-gradient(135deg, var(--pc-v2-primary) 0%, #6366f1 100%);
    color: white;
}

.btn-primary-v2:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-primary-v2:disabled {
    background: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
}

.btn-success-v2 {
    background: linear-gradient(135deg, var(--pc-v2-success) 0%, #059669 100%);
    color: white;
}

.btn-success-v2:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* ============================================
   VARIANTS
============================================ */
.product-card-v2--compact {
    font-size: 0.875rem;
}

.product-card-v2--compact .product-info-v2 {
    padding: 12px;
    gap: 8px;
}

.product-card-v2--compact .product-title-v2 {
    font-size: 0.875rem;
}

.product-card-v2--compact .price-current-v2,
.product-card-v2--compact .price-regular-v2 {
    font-size: 1.25rem;
}

.product-card-v2--detailed .product-info-v2 {
    padding: 20px;
    gap: 16px;
}

.product-card-v2--detailed .product-title-v2 {
    font-size: 1.125rem;
}

/* ============================================
   ERROR STATE
============================================ */
.product-card-error {
    padding: 40px;
    text-align: center;
    background: #fef2f2;
    border: 2px dashed #ef4444;
    border-radius: var(--pc-v2-radius);
    color: #ef4444;
}

/* ============================================
   RESPONSIVE
============================================ */
@media (max-width: 768px) {
    .badges-stack-v2 {
        right: 8px;
        top: 8px;
        max-width: 100px;
    }
    
    .badge-primary-v2,
    .badge-secondary-v2,
    .badge-feature-v2 {
        font-size: 0.6875rem;
        padding: 4px 8px;
    }
    
    .action-btn-v2 {
        width: 36px;
        height: 36px;
    }
    
    .product-info-v2 {
        padding: 12px;
        gap: 10px;
    }
    
    .price-current-v2,
    .price-regular-v2 {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    .product-title-v2 {
        font-size: 0.875rem;
    }
    
    .price-current-v2,
    .price-regular-v2 {
        font-size: 1.125rem;
    }
    
    .btn-add-cart-v2,
    .btn-buy-now-v2 {
        font-size: 0.875rem;
        padding: 10px 12px;
    }
}

/* ============================================
   RTL SUPPORT
============================================ */
[dir="rtl"] .badges-stack-v2 {
    right: auto;
    left: 12px;
}

[dir="rtl"] .action-buttons-floating-v2 {
    left: auto;
    right: 12px;
    transform: translateX(10px);
}

[dir="rtl"] .product-card-v2:hover .action-buttons-floating-v2 {
    transform: translateX(0);
}

/* ============================================
   ACCESSIBILITY
============================================ */
.product-card-v2 *:focus-visible {
    outline: 2px solid var(--pc-v2-primary);
    outline-offset: 2px;
    border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
    .product-card-v2,
    .product-image-v2,
    .action-btn-v2,
    .btn-add-cart-v2,
    .btn-buy-now-v2 {
        transition: none;
        animation: none;
    }
    
    .product-card-v2:hover {
        transform: none;
    }
}

@media (prefers-contrast: high) {
    .product-card-v2 {
        border: 2px solid currentColor;
    }
    
    .action-btn-v2 {
        border: 2px solid currentColor;
    }
}