/* WooCommerce AJAX Products Styles - Comprehensive version */

.wc-ajax-products-container {
    margin: 20px 0;
}

/* Loading State - simplified like original b24products-ajax */
.wc-ajax-products-container.loading { 
    min-height: 47px; 
    text-align: center; 
}

.wc-ajax-products-container.loading:before { 
    content: "";
    display: block;
    width: 47px;
    height: 47px;
    margin: 24px auto;
    border: 3px solid rgb(0,0,0);
    border-radius: 50%;
    border-left-color: transparent;
    border-right-color: transparent;
    animation: wc-spin 1625ms infinite linear;
    -webkit-animation: wc-spin 1625ms infinite linear;
    -moz-animation: wc-spin 1625ms infinite linear;
}

@keyframes wc-spin {
    100% { transform: rotate(360deg); }
}

@-webkit-keyframes wc-spin {
    100% { -webkit-transform: rotate(360deg); }
}

@-moz-keyframes wc-spin {
    100% { -moz-transform: rotate(360deg); }
}

/* Product Grid */
.wc-ajax-products-grid {
    display: grid;
    gap: 20px;
    margin: 20px 0;
}

.wc-ajax-products-grid.columns-1 {
    grid-template-columns: 1fr;
}

.wc-ajax-products-grid.columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

.wc-ajax-products-grid.columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.wc-ajax-products-grid.columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

.wc-ajax-products-grid.columns-5 {
    grid-template-columns: repeat(5, 1fr);
}

.wc-ajax-products-grid.columns-6 {
    grid-template-columns: repeat(6, 1fr);
}

/* Product Items */
.wc-ajax-product-item {
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 15px;
    text-align: center;
    background: #fff;
    transition: box-shadow 0.3s ease;
}

.wc-ajax-product-item:hover {
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.wc-ajax-product-image {
    margin-bottom: 15px;
}

.wc-ajax-product-image img {
    max-width: 100%;
    height: auto;
    border-radius: 3px;
}

.wc-ajax-product-title {
    font-size: 16px;
    margin: 0 0 10px 0;
    line-height: 1.4;
}

.wc-ajax-product-title a {
    color: #333;
    text-decoration: none;
}

.wc-ajax-product-title a:hover {
    color: #0073aa;
}

.wc-ajax-product-price {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin-bottom: 15px;
}

.wc-ajax-product-actions .button {
    background: #0073aa;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 3px;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.3s ease;
}

.wc-ajax-product-actions .button:hover {
    background: #005a87;
    color: white;
}

.wc-ajax-product-actions .button.loading {
    opacity: 0.6;
    pointer-events: none;
}

.wc-ajax-product-actions .button.added {
    background: #46b450;
}

/* Pagination */
.wc-ajax-pagination {
    margin: 30px 0;
    text-align: center;
}

.pagination-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: inline-flex;
    gap: 5px;
}

.pagination-list li {
    margin: 0;
}

.pagination-list a,
.pagination-list .current,
.pagination-list .pagination-dots {
    display: block;
    padding: 8px 12px;
    text-decoration: none;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.pagination-list a:hover {
    background: #f5f5f5;
    color: #0073aa;
}

.pagination-list .current {
    background: #0073aa;
    color: white;
    border-color: #0073aa;
}

.pagination-list .pagination-dots {
    border: none;
    background: none;
}

/* Error Messages */
.wc-ajax-products-error {
    text-align: center;
    padding: 20px;
    color: #d63638;
    font-style: italic;
}

/* Map tease-product.twig structure to AJAX grid items */
.wc-ajax-products-grid article.product-wrap,
.mark2-show-products-ajax article.product-wrap,
.new-products article.product-wrap {
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #fff;
    transition: box-shadow 0.3s ease;
}
.wc-ajax-products-grid article.product-wrap:hover,
.mark2-show-products-ajax article.product-wrap:hover,
.new-products article.product-wrap:hover {
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.wc-ajax-products-grid article.product-wrap .effect-wrapper,
.mark2-show-products-ajax article.product-wrap .effect-wrapper,
.new-products article.product-wrap .effect-wrapper {
    padding: 15px;
    text-align: center;
}
.wc-ajax-products-grid article.product-wrap .product-image,
.mark2-show-products-ajax article.product-wrap .product-image,
.new-products article.product-wrap .product-image {
    margin-bottom: 15px;
    display: block;
}
.wc-ajax-products-grid article.product-wrap .product-image img,
.mark2-show-products-ajax article.product-wrap .product-image img,
.new-products article.product-wrap .product-image img {
    max-width: 100%;
    height: auto;
    border-radius: 3px;
}
.wc-ajax-products-grid article.product-wrap .product-title h3,
.mark2-show-products-ajax article.product-wrap .product-title h3,
.new-products article.product-wrap .product-title h3 {
    font-size: 16px;
    margin: 0 0 10px 0;
    line-height: 1.4;
}
.wc-ajax-products-grid article.product-wrap .product-title a,
.mark2-show-products-ajax article.product-wrap .product-title a,
.new-products article.product-wrap .product-title a {
    color: #333;
    text-decoration: none;
}
.wc-ajax-products-grid article.product-wrap .product-title a:hover,
.mark2-show-products-ajax article.product-wrap .product-title a:hover,
.new-products article.product-wrap .product-title a:hover {
    color: #0073aa;
}

/* Align article.product-wrap to theme template (mapped variables) */
.wc-ajax-products-grid article.product-wrap,
.mark2-show-products-ajax article.product-wrap,
.new-products article.product-wrap {
    position: relative;
    background: #fff; /* $color_white */
    color: #666; /* $color_secondgrey */
    padding: 20px 20px 40px;
    margin-bottom: 30px;
    margin-right: 20px;
    border-radius: 5% 5% 5% 5% / 5% 5% 5% 5%;
}

.wc-ajax-products-grid article.product-wrap a.product-image,
.mark2-show-products-ajax article.product-wrap a.product-image,
.new-products article.product-wrap a.product-image {
    display: block;
}

/* Title/Header styles */
.wc-ajax-products-grid article.product-wrap header.product-title,
.wc-ajax-products-grid article.product-wrap .product-title,
.mark2-show-products-ajax article.product-wrap header.product-title,
.mark2-show-products-ajax article.product-wrap .product-title,
.new-products article.product-wrap header.product-title,
.new-products article.product-wrap .product-title {
    background-color: #0073aa; /* $color_active */
    color: #fff; /* $color_white */
    margin-top: -3px;
}

.wc-ajax-products-grid article.product-wrap header.product-title a,
.wc-ajax-products-grid article.product-wrap .product-title a,
.mark2-show-products-ajax article.product-wrap header.product-title a,
.mark2-show-products-ajax article.product-wrap .product-title a,
.new-products article.product-wrap header.product-title a,
.new-products article.product-wrap .product-title a {
    display: block;
    text-decoration: none;
    padding: 8px;
    color: #fff; /* $color_white */
    font-size: 1.4rem;
}

/* Details rows (Flex version per template) */
.wc-ajax-products-grid article.product-wrap .product-details,
.mark2-show-products-ajax article.product-wrap .product-details,
.new-products article.product-wrap .product-details {
    margin-bottom: 0;
}

.wc-ajax-products-grid article.product-wrap .product-details .prod-detail,
.mark2-show-products-ajax article.product-wrap .product-details .prod-detail,
.new-products article.product-wrap .product-details .prod-detail {
    display: flex;
    flex-wrap: wrap; /* default: wrap */
}

@media (min-width: 900px) {
    .wc-ajax-products-grid article.product-wrap .product-details .prod-detail,
    .mark2-show-products-ajax article.product-wrap .product-details .prod-detail,
    .new-products article.product-wrap .product-details .prod-detail {
        flex-wrap: nowrap; /* larger screens: no wrap */
    }
}

.wc-ajax-products-grid article.product-wrap .product-details .prod-detail > div,
.mark2-show-products-ajax article.product-wrap .product-details .prod-detail > div,
.new-products article.product-wrap .product-details .prod-detail > div {
    width: 50%;
    font-size: 1rem;
    font-family: var(--special-font1, inherit); /* $special-font1 */
}

.wc-ajax-products-grid article.product-wrap .product-details .prod-detail > div:first-child,
.mark2-show-products-ajax article.product-wrap .product-details .prod-detail > div:first-child,
.new-products article.product-wrap .product-details .prod-detail > div:first-child {
    font-weight: bold;
    text-align: right;
    padding-right: 8px;
}

@media (min-width: 480px) { /* $mq-mobileminwidth */
    .wc-ajax-products-grid article.product-wrap .product-details .prod-detail > div:first-child,
    .mark2-show-products-ajax article.product-wrap .product-details .prod-detail > div:first-child,
    .new-products article.product-wrap .product-details .prod-detail > div:first-child {
        width: 100%;
        text-align: left;
        padding-left: 8px;
    }
}

@media (min-width: 900px) {
    .wc-ajax-products-grid article.product-wrap .product-details .prod-detail > div:first-child,
    .mark2-show-products-ajax article.product-wrap .product-details .prod-detail > div:first-child,
    .new-products article.product-wrap .product-details .prod-detail > div:first-child {
        width: 50%;
        text-align: right;
        padding-left: 0;
    }
}

.wc-ajax-products-grid article.product-wrap .product-details .prod-detail > div:last-child,
.mark2-show-products-ajax article.product-wrap .product-details .prod-detail > div:last-child,
.new-products article.product-wrap .product-details .prod-detail > div:last-child {
    padding-left: 8px;
}

@media (min-width: 480px) {
    .wc-ajax-products-grid article.product-wrap .product-details .prod-detail > div:last-child,
    .mark2-show-products-ajax article.product-wrap .product-details .prod-detail > div:last-child,
    .new-products article.product-wrap .product-details .prod-detail > div:last-child {
        width: 100%;
    }
}

@media (min-width: 900px) {
    .wc-ajax-products-grid article.product-wrap .product-details .prod-detail > div:last-child,
    .mark2-show-products-ajax article.product-wrap .product-details .prod-detail > div:last-child,
    .new-products article.product-wrap .product-details .prod-detail > div:last-child {
        width: 50%;
    }
}

.wc-ajax-products-grid article.product-wrap .product-details .prod-detail:nth-child(odd),
.mark2-show-products-ajax article.product-wrap .product-details .prod-detail:nth-child(odd),
.new-products article.product-wrap .product-details .prod-detail:nth-child(odd) {
    background-color: #eee;
}

/* Price & CTA per template */
.wc-ajax-products-grid article.product-wrap .price-bar,
.mark2-show-products-ajax article.product-wrap .price-bar,
.new-products article.product-wrap .price-bar {
    background-color: #333; /* $color_text_bold */
    padding: 4px;
    font-size: 0.8rem;
    text-align: center;
}

.wc-ajax-products-grid article.product-wrap .price-bar h3,
.mark2-show-products-ajax article.product-wrap .price-bar h3,
.new-products article.product-wrap .price-bar h3 {
    display: inline-block;
    color: #fff; /* $color_white */
    font-size: 1.5rem;
    margin-right: 4px;
}

.wc-ajax-products-grid article.product-wrap .price-bar a,
.mark2-show-products-ajax article.product-wrap .price-bar a,
.new-products article.product-wrap .price-bar a {
    color: inherit;
}

.wc-ajax-products-grid article.product-wrap a.detail-btn,
.mark2-show-products-ajax article.product-wrap a.detail-btn,
.new-products article.product-wrap a.detail-btn {
    position: absolute;
    left: 50%;
    bottom: -20px;
    margin-left: -20px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .wc-ajax-products-grid.columns-3,
    .wc-ajax-products-grid.columns-4,
    .wc-ajax-products-grid.columns-5,
    .wc-ajax-products-grid.columns-6 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .wc-ajax-products-grid {
        grid-template-columns: 1fr !important;
        gap: 15px;
    }
    
    .wc-ajax-product-item {
        padding: 10px;
    }
    
    .wc-ajax-products-grid article.product-wrap .product-details .prod-detail {
        grid-template-columns: 1fr;
    }
}
