/**
 * Bricard Products Display Styles
 *
 * Mobile-first responsive product cards and grids
 *
 * @package GeneratePress Child
 * @since 1.0.0
 */

/* ============================================
   PRODUCTS SHOWCASE SECTION
   ============================================ */

.bricard-products-showcase {
    padding: 0;
    background: var(--color-bg-secondary, #f8f9fa);
}

/* Remove container padding - section padding handles spacing */
.bricard-products-showcase > .container {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Tablet */
@media (min-width: 768px) {
    .bricard-products-showcase {
        padding: 0;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .bricard-products-showcase {
        padding: 0;
    }
}

.bricard-products-showcase .section-header {
    text-align: center;
    margin-bottom: var(--space-12);
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 var(--space-4);
}

/* Tablet */
@media (min-width: 768px) {
    .bricard-products-showcase .section-header {
        margin-bottom: var(--space-16);
    }
}

.bricard-products-showcase .section-title {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
    color: var(--color-text-primary);
    margin-bottom: var(--space-4);
    padding: var(--space-3) 0;
    line-height: 1.2;
}

.bricard-products-showcase .section-subtitle {
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: var(--color-text-secondary);
    line-height: 1.6;
    margin-bottom: 0;
    padding: 0 var(--space-2);
}

/* ============================================
   PRODUCT GRID
   ============================================ */

.bricard-product-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-5); /* 20px on mobile */
    margin-bottom: var(--space-12);
    padding: 0 var(--space-4);
}

/* Tablet: 2 columns */
@media (min-width: 640px) {
    .bricard-product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-6); /* 24px */
        padding: 0 var(--space-6);
    }
}

/* Desktop: 3 columns for better card width */
@media (min-width: 1024px) {
    .bricard-product-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-8); /* 32-40px */
        padding: 0 var(--space-8);
    }
}

/* Extra large screens: 4 columns */
@media (min-width: 1440px) {
    .bricard-product-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: var(--space-8);
    }
}

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

.product-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Hover effects only on devices with hover capability (mouse/trackpad, not touch) */
@media (hover: hover) and (pointer: fine) {
    .product-card:hover {
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
        transform: translateY(-4px);
    }
}

/* Touch devices: Active state feedback instead of hover */
@media (hover: none) and (pointer: coarse) {
    .product-card:active {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        transform: scale(0.98);
    }
}

/* Product Image */
.product-image {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* CHANGED: Fill entire space for visual impact */
    object-position: center;
    transition: transform 0.3s ease;
}

/* Image zoom effect on hover - only for mouse/trackpad devices */
@media (hover: hover) and (pointer: fine) {
    .product-card:hover .product-image img {
        transform: scale(1.08);
    }
}

/* Product Content */
.product-content {
    padding: var(--space-5); /* Increased from 16px to 20px on mobile */
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    flex-grow: 1;
}

/* Tablet and up */
@media (min-width: 640px) {
    .product-content {
        padding: var(--space-6); /* 24px on tablet+ */
    }
}

/* Desktop: Enhanced spacing for better hierarchy */
@media (min-width: 1024px) {
    .product-content {
        padding: var(--space-8); /* 32-40px on desktop */
    }
}

.product-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-text-primary);
    line-height: 1.4; /* Improved readability: 1.3 → 1.4 */
    margin: 0;
    padding: var(--space-3) 0; /* Added padding top/bottom: 12px */
    min-height: 2.8em; /* Adjusted for new line-height */
}

/* Desktop: Larger product name */
@media (min-width: 1024px) {
    .product-name {
        font-size: 1.25rem;
    }
}

.product-category {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-2);
}

.product-description {
    font-size: 0.9375rem;
    color: var(--color-text-secondary);
    line-height: 1.5;
    margin-bottom: var(--space-3);
    flex-grow: 1;
}

/* Product Features List */
.product-features {
    list-style: none;
    padding: 0;
    margin: var(--space-3) 0;
}

.product-features li {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    padding-left: 1.25rem;
    position: relative;
    margin-bottom: var(--space-2);
    line-height: 1.4;
}

.product-features li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--color-success, #10b981);
    font-weight: 600;
}

/* Service Info Badges */
.product-service-info {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid #e5e7eb;
}

.service-badge {
    font-size: 0.75rem;
    color: white;
    background: #10b981;
    padding: var(--space-2) var(--space-3);
    border-radius: 6px;
    white-space: nowrap;
    font-weight: 500;
    line-height: 1.2;
    transition: all 0.2s ease;
}

/* Desktop: Larger, more prominent badges */
@media (min-width: 640px) {
    .service-badge {
        font-size: 0.8125rem;
        padding: var(--space-2) var(--space-3);
    }
}

@media (min-width: 1024px) {
    .service-badge {
        font-size: 0.875rem;
    }
}

/* Product CTA Button */
.product-cta {
    display: flex;
    width: 100%;
    padding: var(--space-4) var(--space-3);
    min-height: var(--touch-target-min); /* 44px minimum */
    background: var(--color-primary-600);
    color: white;
    text-align: center;
    text-decoration: none;
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: 0.9375rem;
    transition: all 0.2s ease;
    margin-top: auto;
    border: none;
    line-height: 1.4; /* Better for multi-line text */
    align-items: center;
    justify-content: center;
    white-space: normal; /* Allow text wrapping */
    word-break: break-word; /* Break long words if needed */
    hyphens: auto;
}

/* CTA hover effect - only on devices with hover capability */
@media (hover: hover) and (pointer: fine) {
    .product-cta:hover {
        background: var(--color-primary-700);
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
        color: white;
        text-decoration: none;
    }
}

/* Touch devices: Enhanced active state feedback */
@media (hover: none) and (pointer: coarse) {
    .product-cta:active {
        background: var(--color-primary-700);
        transform: scale(0.97);
    }
}

/* CTA active state for all devices (fallback) */
.product-cta:active {
    transform: translateY(0);
}

/* Tablet and up */
@media (min-width: 640px) {
    .product-cta {
        font-size: 0.875rem;
        padding: var(--space-3) var(--space-3);
    }
}

/* Desktop: Better spacing for 3-column layout */
@media (min-width: 1024px) {
    .product-cta {
        font-size: 0.9375rem;
        padding: var(--space-4) var(--space-4);
    }
}

/* ============================================
   PRODUCTS CTA SECTION
   ============================================ */

.products-cta {
    text-align: center;
    padding: var(--space-12);
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    margin-top: var(--space-12);
}

.products-cta .cta-text {
    font-size: 1.0625rem;
    color: var(--color-text-primary);
    margin-bottom: var(--space-6);
    line-height: 1.6;
}

.products-cta .cta-text strong {
    color: var(--color-primary);
    font-weight: 600;
    font-size: 1.125rem;
}

.products-cta .btn-large {
    padding: 1rem 2rem;
    font-size: 1.125rem;
    min-width: 280px;
}

/* ============================================
   MOBILE OPTIMIZATIONS
   ============================================ */

@media (max-width: 639px) {
    .product-card {
        max-width: 100%;
        /* Ensure card takes full width on small screens */
    }

    .product-name {
        font-size: 1.0625rem; /* Slightly larger for better mobile readability */
        min-height: auto;
    }

    .product-description {
        font-size: 0.9375rem;
    }

    .products-cta {
        padding: var(--space-6) var(--space-4);
        margin: 0 var(--space-4);
    }

    .products-cta .btn-large {
        width: 100%;
        min-width: 0;
        padding: var(--space-4);
        font-size: 1.125rem;
    }
}

/* ============================================
   LOADING STATE
   ============================================ */

.product-card.loading {
    opacity: 0.6;
    pointer-events: none;
}

.product-card.loading .product-image {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

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

/* ============================================
   SCHEMA MARKUP (HIDDEN)
   ============================================ */

.product-card script[type="application/ld+json"] {
    display: none;
}

/* ============================================
   NO PRODUCTS STATE
   ============================================ */

.bricard-product-grid:empty::after {
    content: "Aucun produit disponible pour le moment.";
    display: block;
    text-align: center;
    padding: var(--space-12);
    color: var(--color-text-secondary);
    font-size: 1rem;
    grid-column: 1 / -1;
}

/* ============================================
   CONTEXT-SPECIFIC VARIATIONS
   ============================================ */

/* Installation context - default styling (already defined above) */
.bricard-product-grid[data-context="installation"] {}

/* Multipoints context - emphasize security features */
.bricard-product-grid[data-context="multipoints"] .product-category {
    color: #10b981; /* Green for security */
}

/* Blindage context - emphasize strength */
.bricard-product-grid[data-context="blindage"] .product-cta {
    background: #dc2626; /* Red for reinforcement */
}

/* Hover effects for context-specific CTAs - only on hover-capable devices */
@media (hover: hover) and (pointer: fine) {
    .bricard-product-grid[data-context="blindage"] .product-cta:hover {
        background: #b91c1c;
    }

    .bricard-product-grid[data-context="depannage"] .product-cta:hover {
        background: #d97706;
    }
}

/* Emergency context - emphasize urgency */
.bricard-product-grid[data-context="depannage"] .product-cta {
    background: #f59e0b; /* Orange for emergency */
}
