/**
 * Product Cards - 2025 Modern E-commerce Design
 * WinkelvanHugo - Conversion Optimized
 * 
 * CSS ARCHITECTUUR:
 * - Standalone component, geen WooCommerce dependencies
 * - Hover states via .product-card context selector
 * - Mobile-first breakpoint: 768px
 * - Geen !important
 * 
 * AFHANKELIJKHEDEN:
 * - style.css (CSS variabelen, base styles)
 */

/* ==========================================================================
   PRODUCT CARD BASE
   ========================================================================== */

.product-card,
.products .product,
.shop-products .product {
    position: relative;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    height: 100%;
}

.product-card:hover,
.products .product:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    transform: translateY(-4px);
}

/* ==========================================================================
   PRODUCT IMAGE - CRITICAL HOVER FIX
   ========================================================================== */

.product-card__image,
.product-card__image-wrapper {
    position: relative;
    display: block;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #f8f9fa;
}

.product-card__img-wrap {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Main image - always visible */
.product-card__img--main,
.product-card__img:first-child {
    position: relative;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 16px;
    transition: opacity 0.4s ease, transform 0.4s ease;
    z-index: 1;
}

/* Hover image - HIDDEN by default
 * Specificiteit verhoogd via .product-card context om !important te vermijden
 */
.product-card .product-card__img--hover,
.product-card .product-card__img-wrap > img:nth-child(2) {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    transform: scale(1.02);
    transition: opacity 0.4s ease, visibility 0.4s ease, transform 0.4s ease;
    z-index: 2;
}

/* On hover - show second image, hide first */
.product-card:hover .product-card__img--main,
.product-card:hover .product-card__img:first-child {
    opacity: 0;
}

.product-card:hover .product-card__img--hover,
.product-card:hover .product-card__img-wrap > img:nth-child(2) {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

/* ==========================================================================
   BADGES - Trust & Urgency
   ========================================================================== */

.product-card__badges {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.product-card__badge {
    display: inline-block;
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-radius: 6px;
}

/* Badges - WCAG AA compliant contrast (4.5:1 minimum) */
.product-card__badge--sale,
.onsale {
    background: #dc2626;
    color: #ffffff;
}

.product-card__badge--new {
    background: #15803d;
    color: #ffffff;
}

.product-card__badge--soldout {
    background: #374151;
    color: #ffffff;
}

/* Quick view button */
.product-card__quickview {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    transform: translateY(-8px);
    transition: all 0.3s ease;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.product-card:hover .product-card__quickview {
    opacity: 1;
    transform: translateY(0);
}

.product-card__quickview:hover {
    background: #FF5A4D;
    color: #fff;
}

/* ==========================================================================
   PRODUCT BODY - Content
   ========================================================================== */

.product-card__body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 16px;
    gap: 8px;
}

/* Rating */
.product-card__rating {
    display: flex;
    align-items: center;
    gap: 6px;
}

.product-card__stars {
    display: flex;
    gap: 1px;
}

.product-card__stars .star {
    font-size: 13px;
}

.product-card__stars .star--full {
    color: #FFB800;
}

.product-card__stars .star--half {
    color: #FFB800;
    opacity: 0.6;
}

.product-card__stars .star--empty {
    color: #ddd;
}

/* Reviews count - WCAG AA compliant contrast */
.product-card__reviews {
    font-size: 12px;
    color: #525252;
}

/* Title */
.product-card__title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card__title a {
    color: #1a1a2e;
    text-decoration: none;
}

.product-card__title a:hover {
    color: #FF5A4D;
}

/* Swatches/Variants indicator */
.product-card__swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 4px 0;
}

.product-card__swatch--color {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.1);
}

.product-card__swatch--text {
    padding: 2px 8px;
    font-size: 11px;
    background: #f0f0f0;
    border-radius: 4px;
    color: #555;
}

/* Variations hint - WCAG AA compliant contrast (darker orange) */
.product-card__variations-hint {
    font-size: 12px;
    color: #c2410c;
    font-weight: 600;
}

/* Price */
.product-card__price {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a2e;
    margin-top: auto;
}

/* Strikethrough price - WCAG AA compliant contrast */
.product-card__price del {
    font-size: 14px;
    color: #6b7280;
    font-weight: 400;
    margin-right: 6px;
}

.product-card__price ins {
    text-decoration: none;
    color: #e53935;
}

/* Shipping badge - WCAG AA compliant contrast (darker green) */
.product-card__shipping {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #15803d;
    font-weight: 600;
}

/* ==========================================================================
   PRODUCT FOOTER - CTA
   ========================================================================== */

.product-card__footer {
    padding: 0 16px 16px;
    margin-top: auto;
}

.product-card__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 18px;
    font-size: 14px;
    font-weight: 700;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    border: none;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Primary CTA - Add to Cart */
.product-card__btn--cart {
    background: linear-gradient(135deg, #FF5A4D 0%, #FF7B6E 100%);
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(255, 90, 77, 0.25);
}

.product-card__btn--cart:hover {
    background: linear-gradient(135deg, #e56d00 0%, #ff8a2e 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 90, 77, 0.35);
}

/* Secondary CTA - Select Options */
.product-card__btn--options,
.product-card__btn--select {
    background: #1a1a2e;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(26, 26, 46, 0.2);
}

.product-card__btn--options:hover,
.product-card__btn--select:hover {
    background: linear-gradient(135deg, #FF5A4D 0%, #FF7B6E 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 90, 77, 0.35);
}

/* Disabled state - WCAG AA compliant contrast */
.product-card__btn--disabled {
    background: #d1d5db;
    color: #4b5563;
    cursor: not-allowed;
    box-shadow: none;
}

.product-card__btn-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ==========================================================================
   WOOCOMMERCE DEFAULT OVERRIDES
   ========================================================================== */

.products .product .woocommerce-loop-product__link {
    display: block;
}

/* Hide WooCommerce default button */
.products .product .button.add_to_cart_button:not(.product-card__btn) {
    display: none;
}

/* Hide WooCommerce default elements we replace */
.products .product .woocommerce-loop-product__title:not(.product-card__title) {
    display: none;
}

.products .product .star-rating:not(.product-card__stars) {
    display: none;
}

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

@media (max-width: 768px) {
    .product-card__body {
        padding: 12px;
    }
    
    .product-card__title {
        font-size: 13px;
    }
    
    .product-card__price {
        font-size: 16px;
    }
    
    .product-card__footer {
        padding: 0 12px 12px;
    }
    
    .product-card__btn {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .product-card__quickview {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   LOADING STATE (AJAX)
   ========================================================================== */

.product-card__btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

.product-card__btn.loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Added to cart state */
.product-card__btn.added {
    background: #00c853;
}

.product-card__btn.added .product-card__btn-text::after {
    content: ' ✓';
}
