/**
 * Enhanced Product Cards CSS
 * Professional styling for BCA Bois Connexes product display
 */

/* Reset and base styles */
.woocommerce ul.products {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)) !important;
    gap: 25px !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

.woocommerce ul.products li.product {
    background: white !important;
    border-radius: 16px !important;
    overflow: hidden !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    border: 1px solid rgba(0,0,0,0.06) !important;
    position: relative !important;
    margin: 0 !important;
    width: auto !important;
    display: flex !important;
    flex-direction: column !important;
    height: 500px !important;
    cursor: pointer !important;
}

.woocommerce ul.products li.product:hover {
    transform: translateY(-8px) !important;
    box-shadow: 0 12px 40px rgba(0,0,0,0.15) !important;
}

/* Product Image Container */
.product-image-wrapper {
    position: relative !important;
    height: 280px !important;
    overflow: hidden !important;
    background: #f8f9fa !important;
}

.woocommerce ul.products li.product img {
    width: 100% !important;
    height: 280px !important;
    object-fit: cover !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    margin: 0 !important;
    padding: 0 !important;
}

.woocommerce ul.products li.product:hover img {
    transform: scale(1.05) !important;
}

/* Description Overlay */
.description-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    color: white;
    padding: 20px 15px 15px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    font-size: 13px;
    line-height: 1.4;
}

.woocommerce ul.products li.product:hover .description-overlay {
    transform: translateY(0);
}

/* Product Badges */
.product-badges {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.sale-badge { 
    background: linear-gradient(45deg, #e74c3c, #c0392b); 
    color: white; 
}

.featured-badge { 
    background: linear-gradient(45deg, #f39c12, #e67e22); 
    color: white; 
}

.stock-badge { 
    background: linear-gradient(45deg, #27ae60, #229954); 
    color: white; 
}

.stock-badge.out { 
    background: linear-gradient(45deg, #e74c3c, #c0392b); 
}

/* Quick Actions */
.quick-actions {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 6;
}

.quick-actions .stock-badge {
    opacity: 1 !important;
    visibility: visible !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    padding: 0;
}

.quick-view-btn, .wishlist-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.95);
    color: #333;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    opacity: 0;
    transform: translateY(-10px);
}

.woocommerce ul.products li.product:hover .quick-view-btn,
.woocommerce ul.products li.product:hover .wishlist-btn {
    opacity: 1;
    transform: translateY(0);
}

.quick-view-btn:hover, .wishlist-btn:hover {
    background: #8B4513;
    color: white;
    transform: scale(1.1);
}

/* Product Info Section */
.product-info {
    padding: 20px !important;
    flex-grow: 1 !important;
    display: flex !important;
    flex-direction: column !important;
}

.product-category .category-name {
    color: #8B4513 !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.8px !important;
    margin-bottom: 8px !important;
    display: block !important;
}

.woocommerce ul.products li.product .woocommerce-loop-product__title {
    font-size: 16px !important;
    font-weight: 600 !important;
    color: #1a1a2e !important;
    margin: 0 0 10px 0 !important;
    line-height: 1.3 !important;
    height: 2.6em !important;
    overflow: hidden !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
}

.woocommerce ul.products li.product .woocommerce-loop-product__title:hover {
    color: #8B4513 !important;
}

.product-excerpt {
    color: #666 !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
    margin-bottom: 12px !important;
    height: 2.8em !important;
    overflow: hidden !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
}

/* Price Display */
.woocommerce ul.products li.product .price {
    font-size: 18px !important;
    font-weight: 700 !important;
    color: #8B4513 !important;
    margin: 0 0 6px 0 !important;
    display: block !important;
    visibility: visible !important;
}

.woocommerce ul.products li.product .price .amount {
    color: #8B4513 !important;
    font-weight: 700 !important;
}

.woocommerce ul.products li.product .price del {
    color: #e74c3c !important;
    font-size: 14px !important;
    margin-right: 8px !important;
}

.woocommerce ul.products li.product .price del .amount {
    color: #e74c3c !important;
}

.woocommerce ul.products li.product .price ins {
    color: #e74c3c !important;
    text-decoration: none !important;
    font-weight: 700 !important;
}

/* Single product page: ensure price colors match shop cards
   - struck-through (original) price should be red
   - current/active price should use the same gold/brown as the shop (#8B4513)
   These rules target the single product entry-summary to guarantee parity and
   use !important to override competing stylesheet rules. */
.woocommerce div.product .entry-summary .price del,
.woocommerce div.product .entry-summary .price del .woocommerce-Price-amount,
.woocommerce div.product .entry-summary .price del .amount {
    color: #e74c3c !important; /* red for original/struck price */
}
.woocommerce div.product .entry-summary .price ins,
.woocommerce div.product .entry-summary .price .woocommerce-Price-amount,
.woocommerce div.product .entry-summary .price .amount {
    color: #8B4513 !important; /* gold/brown matching shop cards */
    font-weight: 700 !important;
}
.product-price del,
.product-price del .woocommerce-Price-amount,
.product-price del .amount {
    color: #e74c3c !important; /* red for original/struck price */
}
.product-price ins,
.product-price .woocommerce-Price-amount,
.product-price .amount {
    color: #8B4513 !important; /* gold/brown matching shop cards */
    font-weight: 700 !important;
}

/* Stock Information */
.stock-info {
    margin-bottom: 12px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
}

.in-stock {
    color: #27ae60 !important;
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
}

.out-of-stock {
    color: #e74c3c !important;
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
}

/* Product Actions */
.product-actions {
    padding: 0 !important;
    margin-top: auto !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
}

/* Quantity Selector */
.quantity-selector {
    display: flex !important;
    align-items: center !important;
    border: 2px solid #e0e0e0 !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    background: white !important;
}

.qty-btn {
    width: 36px !important;
    height: 36px !important;
    border: none !important;
    background: #f8f9fa !important;
    cursor: pointer !important;
    font-weight: 700 !important;
    font-size: 16px !important;
    transition: all 0.3s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.qty-btn:hover {
    background: #8B4513 !important;
    color: white !important;
}

.qty-input {
    width: 50px !important;
    height: 36px !important;
    border: none !important;
    text-align: center !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    background: white !important;
    -webkit-appearance: none !important;
    -moz-appearance: textfield !important;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
}

.qty-input:focus {
    outline: none !important;
    background: #f8f9fa !important;
}

/* Add to Cart Button */
.add-to-cart-enhanced, .view-product-btn {
    background: linear-gradient(45deg, #8B4513, #A0522D) !important;
    color: white !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 12px 16px !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    text-decoration: none !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

.add-to-cart-enhanced:hover, .view-product-btn:hover {
    background: linear-gradient(45deg, #2fb5d2, #1a9bb8) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(47, 181, 210, 0.3) !important;
}

.add-to-cart-enhanced.loading {
    background: linear-gradient(45deg, #6c757d, #5a6268) !important;
    cursor: not-allowed !important;
}

.add-to-cart-enhanced.loading .btn-text { 
    display: none !important; 
}

.add-to-cart-enhanced.loading .btn-loading { 
    display: flex !important; 
    align-items: center !important;
    gap: 8px !important;
}

/* Loading Animation */
.spinning {
    animation: spin 1s linear infinite !important;
}

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

/* Product Modal Styles */
#product-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: white;
    border-radius: 20px;
    max-width: 900px;
    width: 95%;
    max-height: 95%;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 25px 80px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease;
}

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

.modal-close {
    position: absolute;
    top: 20px;
    right: 25px;
    font-size: 32px;
    cursor: pointer;
    z-index: 10;
    color: #333;
    font-weight: bold;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: #e74c3c;
    color: white;
    transform: scale(1.1);
}

/* Gallery Styles */
.image-gallery .main-image img {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    transition: transform 0.3s ease;
}

.image-gallery .main-image img:hover {
    transform: scale(1.02);
}

.thumbnails {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 15px;
}

.thumbnails img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.7;
}

.thumbnails img:hover {
    opacity: 1;
    transform: scale(1.05);
}

.thumbnails img.active {
    border: 2px solid #8B4513;
    opacity: 1;
}

/* Responsive Design */
@media (max-width: 768px) {
    .woocommerce ul.products {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
    
    .woocommerce ul.products li.product {
        height: 450px !important;
    }
    
    .product-image-wrapper {
        height: 250px !important;
    }
    
    .woocommerce ul.products li.product img {
        height: 250px !important;
    }
    
    .product-info {
        padding: 15px !important;
    }
    
    .modal-content {
        width: 98%;
        margin: 10px;
    }
    
    .modal-content > div {
        padding: 20px !important;
    }
    
    .modal-content > div > div {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
}

@media (max-width: 1024px) and (min-width: 769px) {
    .woocommerce ul.products {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Accessibility Improvements */
.add-to-cart-enhanced:focus,
.view-product-btn:focus,
.qty-btn:focus,
.quick-view-btn:focus,
.wishlist-btn:focus {
    outline: 2px solid #2fb5d2 !important;
    outline-offset: 2px !important;
}

/* Print Styles */
@media print {
    .quick-actions,
    .product-actions {
        display: none !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .woocommerce ul.products li.product {
        border: 2px solid #000 !important;
    }
    
    .badge {
        border: 1px solid #000 !important;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .woocommerce ul.products li.product,
    .woocommerce ul.products li.product img,
    .description-overlay,
    .quick-view-btn,
    .wishlist-btn,
    .add-to-cart-enhanced,
    .view-product-btn {
        transition: none !important;
        animation: none !important;
    }
}