/**
 * YOOtheme WooCommerce Styles - Complete Version
 * Place this in your child theme folder as: yootheme-woocommerce.css
 */

/* CRITICAL: Hide duplicate WooCommerce elements */
.woocommerce ul.products li.product .price ~ .price,
.woocommerce ul.products li.product .woocommerce-loop-product__title ~ .woocommerce-loop-product__title,
.woocommerce ul.products li.product h2.woocommerce-loop-product__title ~ h2.woocommerce-loop-product__title {
    display: none !important;
}

/* Reset WooCommerce defaults */
.woocommerce ul.products::before,
.woocommerce ul.products::after {
    content: none !important;
}

.woocommerce ul.products {
    display: grid !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
    clear: both !important;
    align-items: stretch !important; /* Ensure all items stretch to same height */
}

.woocommerce ul.products li.product {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    float: none !important;
    list-style: none !important;
    position: relative;
    display: flex !important;
    flex-direction: column;
    height: 100% !important; /* Full height */
}

/* Product wrapper - full height flex container */
.yootheme-product-wrapper {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Product image */
.yootheme-product-image {
    overflow: hidden;
    background: #f8f8f8;
    position: relative;
    flex-shrink: 0; /* Prevent image from shrinking */
}

.yootheme-product-image a {
    display: block;
    text-decoration: none;
}

.yootheme-product-image img {
    width: 100% !important;
    height: auto !important;
    display: block;
    transition: transform 0.3s ease-in-out;
}

.yootheme-product-image:hover img {
    transform: scale(1.05);
}

/* Product content - flex container that grows */
.yootheme-product-content {
    flex-grow: 1; /* Take up available space */
    display: flex;
    flex-direction: column;
    padding: 20px !important;
}

.yootheme-product-content.uk-card-body {
    padding: 20px !important;
}

.yootheme-product-content.uk-card-small {
    padding: 15px !important;
}

.yootheme-product-content.uk-card-large {
    padding: 40px !important;
}

.yootheme-product-content.uk-padding-remove {
    padding: 0 0 20px 0 !important;
}

/* Top section - flexible height */
.yootheme-product-top {
    flex-grow: 1; /* Takes up available space pushing bottom section down */
}

/* Bottom section - aligned at bottom */
.yootheme-product-bottom {
    margin-top: auto; /* Pushes to bottom */
}

/* Card styling */
.woocommerce ul.products li.product.uk-card {
    overflow: hidden;
    transition: box-shadow 0.15s ease-in-out;
    height: 100% !important; /* Ensure card takes full height */
    display: flex !important;
    flex-direction: column !important;
}

.woocommerce ul.products li.product.uk-card-default {
    background-color: #fff;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

.woocommerce ul.products li.product.uk-card-primary {
    background-color: #1e87f0;
    color: #fff;
}

.woocommerce ul.products li.product.uk-card-secondary {
    background-color: #222;
    color: #fff;
}

.woocommerce ul.products li.product.uk-card:hover {
    box-shadow: 0 14px 25px rgba(0,0,0,0.16);
}

/* Product title */
.woocommerce ul.products li.product .woocommerce-loop-product__title {
    font-size: 1.25rem;
    line-height: 1.4;
    font-weight: 400;
    margin: 0 0 8px 0 !important; /* Reduced margin */
    word-wrap: break-word;
    overflow-wrap: break-word;
    -webkit-hyphens: auto;
    -moz-hyphens: auto;
    hyphens: auto;
    max-width: 100%;
}

.woocommerce ul.products li.product .woocommerce-loop-product__title a {
    color: inherit;
    text-decoration: none;
}

/* Mobile title size adjustment */
@media (max-width: 639px) {
    .woocommerce ul.products li.product .woocommerce-loop-product__title {
        font-size: 1.1rem !important;
    }
}

/* Primary/Secondary card text colors */
.woocommerce ul.products li.product.uk-card-primary .woocommerce-loop-product__title,
.woocommerce ul.products li.product.uk-card-secondary .woocommerce-loop-product__title,
.woocommerce ul.products li.product.uk-card-primary .price,
.woocommerce ul.products li.product.uk-card-secondary .price {
    color: #fff !important;
}

/* Rating */
.yootheme-product-rating {
    margin: 5px 0 !important; /* Reduced margin */
}

.woocommerce ul.products li.product .star-rating {
    font-size: 0.875em;
    margin: 0 !important;
    display: inline-block;
}

/* Price styling with typography support */
.yootheme-product-price {
    margin: 0 0 8px 0 !important; /* Reduced margin */
}

.yootheme-product-price .price {
    display: block;
    margin: 0 !important;
    line-height: 1.3; /* Tighter line height */
}

/* Price typography variations */
.yootheme-product-price h3.price-heading,
.yootheme-product-price h4.price-heading,
.yootheme-product-price h5.price-heading {
    margin: 0 !important;
    font-weight: 400;
}

.yootheme-product-price.uk-text-large .price {
    font-size: 1.25rem !important;
}

.woocommerce ul.products li.product .price del {
    opacity: 0.5;
    margin-right: 5px;
}

.woocommerce ul.products li.product .price ins {
    text-decoration: none;
    font-weight: 600;
}

/* Button container - NO TOP MARGIN/PADDING */
.yootheme-product-button {
    margin: 0 !important; /* No margins */
    padding: 0 !important;
}

/* Add to cart button */
.woocommerce ul.products li.product .button {
    display: inline-block;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    text-decoration: none !important;
    transition: 0.1s ease-in-out;
    transition-property: color, background-color, border-color;
    text-align: center;
    border: 1px solid transparent;
    margin: 0;
}

.woocommerce ul.products li.product .button.uk-button-primary {
    background-color: #1e87f0;
    color: #fff;
}

.woocommerce ul.products li.product .button.uk-button-primary:hover {
    background-color: #0f6ecd;
    color: #fff;
}

.woocommerce ul.products li.product .button.uk-button-small {
    padding: 0 15px;
    line-height: 28px;
}

/* Width 100% for centered buttons */
.woocommerce ul.products li.product .button.uk-width-1-1 {
    width: 100%;
    display: block;
}

/* Added to cart message */
.woocommerce ul.products li.product .added_to_cart {
    display: block;
    margin-top: 10px;
    color: #32d296;
    font-size: 0.875rem;
}

/* Sale badge */
.yootheme-product-image .uk-badge {
    position: absolute;
    z-index: 1;
}

.uk-badge.uk-label-danger {
    background: #f0506e;
    color: #fff;
    padding: 0 10px;
    line-height: 22px;
    font-size: 12px;
}

/* Badge positions */
.uk-position-top-left.uk-position-small {
    top: 10px;
    left: 10px;
}

.uk-position-top-right.uk-position-small {
    top: 10px;
    right: 10px;
}

.uk-position-bottom-left.uk-position-small {
    bottom: 10px;
    left: 10px;
}

.uk-position-bottom-right.uk-position-small {
    bottom: 10px;
    right: 10px;
}

/* Center alignment fixes */
.yootheme-product-content[style*="text-align: center"] .star-rating,
.yootheme-product-content[style*="text-align: center"] .button {
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Loading state */
.woocommerce ul.products li.product .button.loading {
    opacity: 0.5;
}

.woocommerce ul.products li.product .button.loading::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-left: 8px;
    border: 2px solid #fff;
    border-right-color: transparent;
    border-radius: 50%;
    animation: uk-spinner-rotate 1s linear infinite;
}

@keyframes uk-spinner-rotate {
    to { transform: rotate(360deg); }
}

/* Pagination */
.woocommerce nav.woocommerce-pagination {
    margin-top: 40px;
    text-align: center;
}

.woocommerce nav.woocommerce-pagination ul {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    margin: 0;
    padding: 0;
    list-style: none;
    border: none;
}

.woocommerce nav.woocommerce-pagination ul li {
    margin: 0 2px;
    border: none;
}

.woocommerce nav.woocommerce-pagination ul li a,
.woocommerce nav.woocommerce-pagination ul li span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    font-size: 0.875rem;
    text-decoration: none;
    background: #f8f8f8;
    color: #666;
    border: none;
    border-radius: 3px;
    transition: 0.1s ease-in-out;
}

.woocommerce nav.woocommerce-pagination ul li a:hover {
    background-color: #e5e5e5;
    color: #333;
}

.woocommerce nav.woocommerce-pagination ul li span.current {
    background-color: #1e87f0;
    color: #fff;
}

/* Result count and ordering */
.woocommerce-result-count {
    float: left;
    margin: 0 0 30px;
    color: #999;
    font-size: 0.875rem;
}

.woocommerce-ordering {
    float: right;
    margin: 0 0 30px;
}

.woocommerce-ordering select {
    padding: 0 30px 0 10px;
    height: 40px;
    background: #fff;
    border: 1px solid #e5e5e5;
    font-size: 0.875rem;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><polyline fill="none" stroke="%23666" stroke-width="1.1" points="4 6 8 10 12 6"></polyline></svg>');
    background-repeat: no-repeat;
    background-position: calc(100% - 10px) center;
    background-size: 16px;
}

/* Clear floats */
.woocommerce::before,
.woocommerce::after {
    content: "";
    display: table;
}

.woocommerce::after {
    clear: both;
}

/* Mobile responsive adjustments */
@media (max-width: 639px) {
    .woocommerce-result-count,
    .woocommerce-ordering {
        float: none;
        width: 100%;
        margin-bottom: 20px;
    }
    
    .woocommerce-ordering select {
        width: 100%;
    }
    
    /* Smaller padding on mobile */
    .yootheme-product-content.uk-card-body {
        padding: 15px !important;
    }
    
    .yootheme-product-content.uk-card-large {
        padding: 20px !important;
    }
}

/* Debug - ensure flexbox is working */
.yootheme-wc-product {
    display: flex !important;
    flex-direction: column !important;
}

.yootheme-wc-product > .yootheme-product-wrapper {
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
}

/* Ensure proper alignment of price and button at bottom */
@media (min-width: 640px) {
    /* Only on desktop/tablet where we have multiple columns */
    .yootheme-product-bottom {
        min-height: 60px; /* Ensures consistent height for price + button area */
    }
}