/**
 * CORRECTED Custom WooCommerce Product Archive Styling
 * Creates ONE unified card with image and details together
 * This matches the layout in your reference image
 */

/* ========================================
   Product Grid Layout
   ======================================== */

.woocommerce ul.products {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* Responsive Grid */
@media (max-width: 1024px) {
    .woocommerce ul.products {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .woocommerce ul.products {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .woocommerce ul.products {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

/* ========================================
   Product Item - Remove default styling
   ======================================== */

.woocommerce ul.products li.product,
.woocommerce ul.products li.custom-product-item {
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    position: relative;
    box-shadow: none !important;
    font-family: 'Montserrat', sans-serif;
}

/* ========================================
   UNIFIED CARD WRAPPER - This is the KEY
   ======================================== */

.product-inner-wrap,
#product-inner-wrap {
    display: flex;
    flex-direction: column;
    height: 100%;
    
    /* THIS CREATES THE VISIBLE CARD */
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
    
    /* Smooth transition for hover */
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Very subtle shadow - lighter and less spread */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* HOVER EFFECT - Entire card lifts */
.woocommerce ul.products li.product:hover .product-inner-wrap {
    transform: translateY(-5px);
    box-shadow: 0 6px 6px rgba(0, 0, 0, 0.1);
}

/* ========================================
   Product Image Section
   ======================================== */

.product-image-wrapper,
#product-image-wrapper {
    position: relative;
    overflow: hidden;
    
    /* Full white background for image area */
    background: #ffffff !important;
    
    /* No padding - image fills the area */
    padding: 0 !important;
    
    /* NO border, NO separate shadow, NO margin */
    border: none;
    box-shadow: none;
    margin: 0;
    border-radius: 0;
}

.product-image-wrapper img,
#product-image-wrapper img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

/* Main and Hover Image Setup */
.product-image-wrapper .product-main-image {
    position: relative;
    z-index: 1;
}

.product-image-wrapper .product-hover-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    z-index: 2;
    transition: opacity 0.4s ease;
}

/* Show hover image on hover */
.woocommerce ul.products li.product:hover .product-image-wrapper .product-hover-image {
    opacity: 1;
}

.woocommerce ul.products li.product:hover .product-image-wrapper .product-main-image {
    opacity: 0;
}

/* Color swatch selected image (overrides hover) */
.product-image-wrapper .product-main-image.swatch-active {
    opacity: 1 !important;
    z-index: 3;
}

.woocommerce ul.products li.product:hover .product-image-wrapper .product-main-image.swatch-active {
    opacity: 1 !important;
}

/* Image zoom on hover - disabled when swatch active */
.woocommerce ul.products li.product:hover .product-image-wrapper img:not(.swatch-active) {
    transform: scale(1.03);
}

.product-image-link,
#product-image-link {
    display: block;
    position: relative;
}

/* Wishlist Icon (if you have wishlist plugin) */
.product-wishlist-icon,
#product-wishlist-icon {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 10;
    background: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

/* ========================================
   Product Details Section
   ======================================== */

.product-details-wrapper,
#product-details-wrapper {
    padding: 20px 24px 24px 24px;
    background: #fff;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    
    /* NO border, NO separate shadow, NO margin */
    border: none;
    box-shadow: none;
    margin: 0;
    border-radius: 0;
}

/* Product Category/Tag */
.product-category,
#product-category {
    margin-bottom: 8px;
}

.product-category .category-label,
#product-category .category-label,
.product-category #category-label,
#product-category #category-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #999;
    font-weight: 500;
}

/* Product Title */
.woocommerce ul.products li.product .woocommerce-loop-product__title,
.woocommerce ul.products li.product h2 {
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
    margin: 0 0 10px 0;
    color: #333;
    min-height: 42px;
}

.woocommerce ul.products li.product .woocommerce-loop-product__title a,
.woocommerce ul.products li.product h2 a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
}

.woocommerce ul.products li.product .woocommerce-loop-product__title a:hover,
.woocommerce ul.products li.product h2 a:hover {
    color:  #333;
}

/* ========================================
   Product Price
   ======================================== */

.product-price-wrapper,
#product-price-wrapper {
    margin-bottom: 12px;
}

.woocommerce ul.products li.product .price {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.woocommerce ul.products li.product .price del {
    opacity: 0.5;
    font-weight: 400;
    margin-right: 6px;
    font-size: 14px;
}

.woocommerce ul.products li.product .price ins {
    text-decoration: none;
    color: #e74c3c;
}

/* ========================================
   Color Variations/Swatches
   ======================================== */

.product-variations,
#product-variations {
    margin-bottom: 16px;
}

.product-color-swatches,
#product-color-swatches {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.product-color-swatches .color-swatch,
#product-color-swatches .color-swatch,
.product-color-swatches #color-swatch,
#product-color-swatches #color-swatch {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #e0e0e0;
    cursor: pointer;
    transition: all 0.25s ease;
    display: inline-block;
    position: relative;
}

.product-color-swatches .color-swatch:hover {
    border-color: #333;
    transform: scale(1.15);
}

/* Active/Selected swatch */
.product-color-swatches .color-swatch.active {
    border-color: #333;
    transform: scale(1.1);
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #333;
}

/* Predefined colors */
.product-color-swatches .color-swatch[title*="Black"],
.product-color-swatches .color-swatch[title*="black"] {
    background-color: #000 !important;
}

.product-color-swatches .color-swatch[title*="Blue"],
.product-color-swatches .color-swatch[title*="blue"] {
    background-color: #4a90e2 !important;
}

.product-color-swatches .color-swatch[title*="Navy"],
.product-color-swatches .color-swatch[title*="navy"] {
    background-color: #2c3e7a !important;
}

.product-color-swatches .color-swatch[title*="Green"],
.product-color-swatches .color-swatch[title*="green"] {
    background-color: #7c9d8e !important;
}

.product-color-swatches .color-swatch[title*="Coral"],
.product-color-swatches .color-swatch[title*="coral"],
.product-color-swatches .color-swatch[title*="Pink"],
.product-color-swatches .color-swatch[title*="pink"],
.product-color-swatches .color-swatch[title*="Peach"],
.product-color-swatches .color-swatch[title*="peach"] {
    background-color: #ff9b9b !important;
}

.product-color-swatches .color-swatch[title*="Grey"],
.product-color-swatches .color-swatch[title*="gray"],
.product-color-swatches .color-swatch[title*="Gray"] {
    background-color: #b0b0b0 !important;
}

.product-color-swatches .color-swatch[title*="Light Blue"],
.product-color-swatches .color-swatch[title*="light-blue"],
.product-color-swatches .color-swatch[title*="Sky Blue"],
.product-color-swatches .color-swatch[title*="sky-blue"] {
    background-color: #a8d5f7 !important;
}

/* ========================================
   Add to Cart Button
   ======================================== */

.product-button-wrapper,
#product-button-wrapper {
    margin-top: auto;
}

.woocommerce ul.products li.product .button,
.woocommerce ul.products li.product .add_to_cart_button,
.woocommerce ul.products li.product .product_type_variable {
    width: 100%;
    text-align: center;
    background: #FFE1E2;
    color: #666;
    border: 1px solid #FFE1E2;
    padding: 11px 20px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 500;
    border-radius: 4px;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    cursor: pointer;
}

.woocommerce ul.products li.product .button:hover,
.woocommerce ul.products li.product .add_to_cart_button:hover,
.woocommerce ul.products li.product .product_type_variable:hover {
    background: #333;
    color: #fff;
    border-color: #333;
}

.woocommerce ul.products li.product .added_to_cart {
    display: none;
}

/* ========================================
   Sale Badge
   ======================================== */

.woocommerce span.onsale {
    position: absolute;
    top: 20px;
    left: 20px;
    background: #e74c3c;
    color: #fff;
    padding: 6px 14px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    z-index: 10;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
}

/* ========================================
   Remove ALL default WooCommerce/Astra styles
   ======================================== */

.woocommerce ul.products li.product a img {
    margin: 0 !important;
    box-shadow: none !important;
}

.woocommerce ul.products li.product .star-rating {
    margin: 0 0 8px 0;
}

/* Remove any wrapper styles from Astra */
.woocommerce ul.products li.product .astra-shop-thumbnail-wrap {
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
}

/* ========================================
   CRITICAL: Ensure no separation between sections
   ======================================== */

.product-inner-wrap > * {
    margin-top: 0 !important;
    border: none !important;
}

.product-inner-wrap > *:first-child {
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
}

.product-inner-wrap > *:last-child {
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
}

/* ========================================
   Optional: Out of Stock Badge
   ======================================== */

.woocommerce ul.products li.product.outofstock .product-inner-wrap::after {
    content: 'Out of Stock';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 10px 20px;
    border-radius: 4px;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    font-weight: 600;
    z-index: 100;
}

.woocommerce ul.products li.product.outofstock .product-inner-wrap {
    opacity: 0.6;
}

/* ========================================
   Loading State
   ======================================== */

.woocommerce ul.products li.product.loading {
    opacity: 0.5;
    pointer-events: none;
}

/* ========================================
   Responsive Adjustments
   ======================================== */

@media (max-width: 768px) {
    .product-image-wrapper {
        padding: 20px 15px 15px 15px;
    }
    
    .product-details-wrapper {
        padding: 15px 18px 18px 18px;
    }
    
    .woocommerce ul.products li.product .woocommerce-loop-product__title,
    .woocommerce ul.products li.product h2 {
        font-size: 13px;
        min-height: 38px;
    }
}

/* ========================================
   Fix for Theme Conflicts
   ======================================== */

/* Override any Astra specific styles */
.ast-woocommerce-container .woocommerce ul.products li.product {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
}

/* Ensure proper alignment */
.woocommerce ul.products li.product {
    text-align: left;
    vertical-align: top;
}