/*
 * Product Card styles
 * Version: 1.0.0
 * Last Updated: 2026-07-15
 *
 * Extracted from the inline <style> block in components/product-card.blade.php (v6.28.0).
 * That block rendered once PER CARD - ~8 KB x ~87 cards = ~685 KB of duplicated CSS inside
 * the homepage HTML, which is what pinned mobile FCP at 8.0s. Kept as one external file so
 * it is sent once and cached across pages. Contents are byte-identical to the old block.
 */
    /* AliExpress-inspired Product Card v4.1.0 */
    :root {
        /* Darkened from #ff4747: white text on the old red was 3.36:1 and failed
           WCAG AA (4.5:1) - flagged by Lighthouse. #d92b2b gives 4.85:1. */
        --ali-red: #d92b2b;
        --ali-bg: #f2f2f2;
        --ali-blue: #667eea;
    }

    .product-card {
        background: white;
        border: 1px solid #e8e8e8;
        border-radius: 0.5rem;
        transition: all 0.3s ease;
        overflow: hidden;
        position: relative;
        display: flex;
        flex-direction: column;
        height: 100%;
        min-width: 0; /* Prevent grid cell overflow */
    }

    .product-card:hover {
        box-shadow: 0 8px 24px rgba(102, 126, 234, 0.15);
        transform: translateY(-2px);
        border-color: rgba(102, 126, 234, 0.3);
    }

    /* Platform border colors - full border using CSS custom properties for admin override */
    .product-card[data-platform="lazada"] {
        border: 2px solid var(--platform-lazada-color, #f57dbe);
    }

    .product-card[data-platform="aliexpress"] {
        border: 2px solid var(--platform-aliexpress-color, #000000);
    }

    .product-card[data-platform="shopee"] {
        border: 2px solid var(--platform-shopee-color, #ee4d2d);
    }

    .product-card-image {
        position: relative;
        width: 100%;
        height: 180px; /* Fixed height - scaled for 6 columns */
        background: #f5f5f5;
        overflow: hidden;
    }

    .product-card-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: transform 0.3s ease, opacity 0.3s ease;
        opacity: 0;
    }

    .product-card-image img.loaded {
        opacity: 1;
    }

    /* v2.44.3: Placeholder skeleton while image loads */
    .product-card-image::before {
        content: '';
        position: absolute;
        inset: 0;
        background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
        background-size: 200% 100%;
        animation: shimmer 1.5s infinite;
        z-index: 0;
    }

    .product-card-image img.loaded + .product-card-image::before,
    .product-card-image:has(img.loaded)::before {
        display: none;
    }

    @keyframes shimmer {
        0% { background-position: 200% 0; }
        100% { background-position: -200% 0; }
    }

    .product-card:hover .product-card-image img {
        transform: scale(1.08);
    }

    .product-discount-badge-inline {
        background: var(--ali-red);
        color: white;
        padding: 0.125rem 0.375rem;
        border-radius: 0.25rem;
        font-size: 0.75rem;
        font-weight: 700;
        white-space: nowrap;
        flex-shrink: 0;
        direction: ltr; /* Keep minus sign on left in RTL */
    }

    .product-platform-badge {
        position: absolute;
        top: 0.75rem;
        right: 0.75rem;
        z-index: 2;
    }

    .product-card-actions {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        display: flex;
        gap: 0.5rem;
        opacity: 0;
        transition: opacity 0.3s ease;
        z-index: 3;
    }

    .product-card:hover .product-card-actions {
        opacity: 1;
    }

    .product-action-btn {
        width: 40px;
        height: 40px;
        background: var(--white);
        border: none;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        box-shadow: var(--shadow-md);
        transition: all 0.2s ease;
        color: var(--gray-700);
        position: relative;
    }

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

    /* Compare button active state */
    .compare-btn[data-compared="true"] {
        background: #3b82f6;
        color: white;
    }

    .compare-btn[data-compared="true"]:hover {
        background: #2563eb;
    }

    /* v2.44.40: Mobile styles REMOVED from component - now controlled by page-level CSS
       (search.blade.php and home.blade.php) to avoid CSS specificity battles */

    .product-card-body {
        padding: 0.5rem;
        display: flex;
        flex-direction: column;
        gap: 0.375rem;
        flex: 1;
    }

    .product-title {
        font-size: 0.75rem;
        font-weight: 400;
        color: #191919;
        line-height: 1.3;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        margin: 0;
        min-height: 2.3em;
    }

    .product-brand-category {
        display: flex;
        align-items: center;
        gap: 0.375rem;
        font-size: 0.7rem;
        color: #6b6b6b;
        margin-bottom: 0;
    }

    .product-brand {
        font-weight: 600;
        color: #666;
    }

    .product-category-dot {
        color: #ccc;
    }

    .product-category {
        font-weight: 400;
        color: #6b6b6b;
    }

    .product-rating {
        display: flex;
        align-items: center;
        gap: 0.375rem;
        font-size: 0.75rem;
        color: #666;
    }

    .product-stars {
        color: #ff9f00;
        display: flex;
        gap: 0.125rem;
    }

    .product-reviews {
        /* #999 on white was 2.85:1 (WCAG AA needs 4.5:1). #6b6b6b = 5.33:1. */
        color: #6b6b6b;
    }

    .product-rating-original {
        color: #888;
        font-size: 0.7rem;
    }

    .product-rating-info {
        cursor: pointer;
        opacity: 0.6;
        transition: opacity 0.2s;
        display: inline-flex;
        align-items: center;
        vertical-align: middle;
        -webkit-tap-highlight-color: transparent;
    }

    .product-rating-info:hover {
        opacity: 1;
    }

    .product-rating-info svg {
        display: block;
        pointer-events: none;
    }

    .product-price-section {
        margin-top: auto;
    }

    .product-price {
        display: flex;
        align-items: baseline;
        gap: 0.375rem;
        flex-wrap: nowrap;
        overflow: hidden;
    }

    .product-current-price {
        font-size: 14px;
        font-weight: 700;
        color: #000;
        line-height: 1;
        flex-shrink: 0;
        white-space: nowrap;
    }

    .product-original-price {
        font-size: 0.75rem;
        /* #999 on white was 2.85:1 (WCAG AA needs 4.5:1). #6b6b6b = 5.33:1. */
        color: #6b6b6b;
        text-decoration: line-through;
        font-weight: 400;
        flex-shrink: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .product-meta {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding-top: 0.5rem;
        border-top: 1px solid #e8e8e8;
        font-size: 0.75rem;
        color: #6b6b6b;
    }

    .product-meta-left {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        flex-wrap: wrap;
        flex: 1;
    }

    .product-sales {
        display: flex;
        align-items: center;
        gap: 0.25rem;
        color: #666;
    }

    .product-free-shipping {
        display: flex;
        align-items: center;
        gap: 0.25rem;
        /* #00a854 on white was 3.12:1; #0b7a3e = 5.43:1 (WCAG AA). */
        color: #0b7a3e;
        font-weight: 600;
    }

    .product-shipping {
        display: flex;
        align-items: center;
        gap: 0.25rem;
        color: #6b6b6b;
    }

    .product-platform-badge-footer {
        display: flex;
        align-items: center;
        justify-content: flex-end;
    }

    .product-stock-badge {
        position: absolute;
        top: 0.75rem;
        left: 50%;
        transform: translateX(-50%);
        background: var(--gray-800);
        color: var(--white);
        padding: 0.375rem 0.75rem;
        border-radius: var(--radius);
        font-size: 0.75rem;
        font-weight: 600;
        opacity: 0.95;
    }
