/* ==========================================================================
   Premium 3D Shop Archive & Grid Styles
   ========================================================================== */

/* Remove Astra Default Top Spacing */
.archive.woocommerce #content,
.post-type-archive-product #content,
.archive.woocommerce .site-main,
.archive.woocommerce .ast-container,
.archive.woocommerce #primary {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

/* 1. RESPONSIVE GRID ARCHITECTURE */
.custom-shop-header {
    text-align: center;
    padding: 2rem 1rem 1rem; /* Reduced padding */
    margin-bottom: 1rem; /* Reduced margin */
}

.custom-shop-title {
    color: var(--color-primary-green, #045c2f);
    font-weight: 900;
    font-size: 3rem;
    margin-bottom: 0.5rem; /* Tighter gap */
    letter-spacing: -1px;
}

/* Hide default breadcrumbs outside our custom header */
.woocommerce-breadcrumb { display: none !important; }
.custom-shop-header .woocommerce-breadcrumb {
    display: flex !important;
    justify-content: center;
    margin: 0;
    color: var(--color-text-light, #4a4a4a);
    font-size: 1rem;
    font-weight: 500;
}
.custom-shop-header .woocommerce-breadcrumb a {
    color: var(--color-primary-green, #045c2f);
    text-decoration: none;
    font-weight: 600;
}

/* Override default WooCommerce UL to CSS Grid */
ul.products {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
    max-width: var(--container-max-width, 1200px);
    margin: 0 auto 5rem !important;
    padding: 0 20px !important;
}

ul.products::before,
ul.products::after {
    display: none !important; /* Remove legacy float clearfix */
}

@media (min-width: 768px) {
    ul.products {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 2rem !important;
    }
}

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

/* ==========================================================================
   2. PREMIUM 3D PRODUCT CARD
   ========================================================================== */
li.premium-3d-product-card {
    display: flex !important;
    flex-direction: column !important;
    background: #ffffff !important;
    border-radius: 16px !important;
    padding: 1.5rem !important;
    border: 1px solid rgba(0,0,0,0.05) !important;
    box-shadow: 0 8px 24px rgba(0,0,0,0.04) !important;
    transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) !important;
    width: 100% !important; /* Override astra widths */
    margin: 0 !important; /* Override woo margins */
    box-sizing: border-box;
}

li.premium-3d-product-card:hover {
    transform: translateY(-12px) !important;
    box-shadow: 0 24px 48px rgba(4,92,47,0.12) !important; /* Primary green shadow */
}

/* Make the link wrapper take up remaining space */
li.premium-3d-product-card > a {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    text-decoration: none !important;
    outline: none;
}

/* ==========================================================================
   3. CARD INNER ELEMENTS
   ========================================================================== */
.product-card-image-wrapper {
    height: 200px;
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    margin-bottom: 1rem;
    background-color: #ffffff; /* Fallback for transparency */
}

@media (min-width: 1024px) {
    .product-card-image-wrapper {
        height: 250px;
    }
}

.product-card-image-wrapper img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important; /* Ensure product isn't cropped */
    transition: transform 0.4s ease !important;
    margin: 0 !important;
}

li.premium-3d-product-card:hover .product-card-image-wrapper img {
    transform: scale(1.05) !important;
}

/* Sale Badge */
.product-card-image-wrapper .onsale {
    position: absolute;
    top: 10px !important;
    left: 10px !important;
    right: auto !important;
    margin: 0 !important;
    background: var(--color-secondary-yellow, #f7b731) !important;
    color: var(--color-text-dark, #1a1a1a) !important;
    padding: 4px 12px !important;
    border-radius: 20px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    min-height: 0 !important;
    min-width: 0 !important;
    z-index: 10;
    box-shadow: 0 4px 10px rgba(247, 183, 49, 0.4);
}

.product-card-info-wrapper {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

/* Title */
.product-card-info-wrapper .woocommerce-loop-product__title {
    font-weight: 700 !important;
    color: var(--color-text-dark, #1a1a1a) !important;
    font-size: 1.1rem !important;
    margin: 1rem 0 0.5rem !important;
    padding: 0 !important;
    /* Truncate to 2 lines max so grid stays aligned */
    display: -webkit-box !important;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4 !important;
}

/* Price */
.product-card-info-wrapper .price {
    font-weight: 600 !important;
    margin-bottom: 1.5rem !important;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.product-card-info-wrapper .price ins {
    text-decoration: none;
    color: var(--color-primary-green, #045c2f) !important;
    font-size: 1.25rem !important;
    background: transparent !important;
    font-weight: 800 !important;
}

.product-card-info-wrapper .price del {
    color: #999999 !important;
    font-size: 0.95rem !important;
}

/* ==========================================================================
   4. "ADD TO CART" BUTTON (Premium Redesign)
   ========================================================================== */
li.premium-3d-product-card .add_to_cart_button,
li.premium-3d-product-card .product_type_variable {
    margin-top: auto !important; /* Forces button to the absolute bottom of the card */
    width: 100% !important;
    text-align: center !important;
    background: var(--color-primary-green, #045c2f) !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    font-size: 1rem !important;
    padding: 12px 0 !important;
    border-radius: 8px !important;
    transition: all 0.3s ease !important;
    border: none !important;
    display: block !important;
    line-height: 1.5 !important;
}

li.premium-3d-product-card .add_to_cart_button:hover,
li.premium-3d-product-card .product_type_variable:hover {
    background: #034523 !important; /* Darker green hover */
    transform: translateY(-2px) !important;
    box-shadow: 0 5px 15px rgba(4,92,47,0.3) !important;
    color: #ffffff !important;
}

li.premium-3d-product-card .add_to_cart_button:active {
    transform: scale(0.98) !important;
}

/* Astra specific overrides */
.ast-woo-shop-product-description {
    display: none !important;
}

/* Fix spacing around sorting and result count */
.woocommerce-result-count,
.woocommerce-ordering {
    margin-top: 0 !important;
    margin-bottom: 1.5rem !important;
}
