/**
 * Petmex Shortcodes Styles
 */

/* ========================================
   All products
   ======================================== */
.products-all-page {
    margin-top: 40px !important;
    display: flex;
    gap: 32px;
}

@media (max-width: 991px) {
    .products-all-page {
        display: block;
    }
}

/* Left column wraps the filters and the optional under-filters banner */
.products-all-page .petmex-sidebar-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 280px;
    flex: 0 0 auto;
}

@media (max-width: 991px) {
    .products-all-page .petmex-sidebar-column {
        margin-bottom: 40px;
    }
}

.products-all-page .product-filters {
    padding: 24px 20px;
    border: 1px solid #DCDCDC;
    border-radius: 8px;
    height: min-content;
}

/* Banner shown directly under the filters column */
.products-all-page .petmex-filters-banner {
    width: 100%;
}

.products-all-page .petmex-filters-banner-img,
.products-all-page .petmex-filters-banner img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 8px;
}

.products-all-page .product-filters h3 {
    margin-bottom: 24px;
    font-size: 14px;
    font-weight: 700;
    line-height: 21px;
    color: #292929;
}

.products-all-page .product-filters .filter-section {
    margin-bottom: 32px;
}

.products-all-page .product-filters .filter-section h4 {
    font-size: 14px;
    font-weight: 500;
    line-height: 21px;
    color: #292929;
}

.products-all-page .product-filters .filter-section label {
    margin-bottom: 8px;
    display: flex;
    gap: 12px;
    justify-content: flex-start;
    font-size: 14px;
    font-weight: 400;
    line-height: 14px;
    color: #1E1E1E;
    align-items: center;
}

.products-all-page .product-filters .filter-section label:last-child {
    margin-bottom: 0;
}

.products-all-page .product-filters .filter-section label input {
    width: 16px;
    height: 16px;
}

/**
 * Gutenberg's core .wp-block-button__link sets `height: 100%`, which makes
 * the button stretch to the full height of its parent inside flex layouts
 * (filters column). Force it back to content height.
 */
.products-all-page .product-filters #apply-filters-all,
.products-all-page .product-filters #apply-filters,
.product-filters .wp-block-button__link {
    height: auto;
    align-self: flex-start;
}

.products-all-page .product-filters #apply-filters-all {
    font-size: 14px;
    font-weight: 500;
    line-height: 21px;
}

.products-all-page .products-section {
    width: 100%;
    min-width: 0;
}

/* Scroll target for AJAX pagination / filters (clear fixed header overlap) */
.products-all-page > .products-section,
#petmex-products-list {
    scroll-margin-top: 5rem;
}

/* Exactly 3 columns; grid block capped (~814px) and centered so it does not span the whole main column. */
.products-all-page .products-section .products-container {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 32px;
    width: min(100%, 914px);
    max-width: 100%;
    margin-inline: auto;
    box-sizing: border-box;
    align-items: start;
    justify-items: center;
}

.products-all-page .products-section .products-container > a,
.products-all-page .products-section .products-container > .petmex-grid-banner {
    width: 100%;
    max-width: 250px;
    box-sizing: border-box;
}

@media (max-width: 991px) {
    .products-all-page .products-section .products-container {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        width: min(100%, 408px);
    }

    .products-all-page .products-section .products-container > a,
    .products-all-page .products-section .products-container > .petmex-grid-banner {
        max-width: 200px;
    }
}

.products-all-page .products-section .products-container > h2 {
    grid-column: 1 / -1;
    margin: 0;
}

.products-all-page .products-section .products-container a {
    text-decoration: none;
}

/* In-grid banner: second slot in row (after first product), tile height aligned to cards */
.products-all-page .products-section .products-container .petmex-grid-banner {
    display: flex;
    flex-direction: column;
}

.products-all-page .products-section .products-container .petmex-grid-banner__media {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    max-height: 300px;
    overflow: hidden;
    border-radius: 4px;
}

.products-all-page .products-section .products-container .petmex-grid-banner__media .petmex-grid-banner-link {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    max-height: 100%;
    text-decoration: none;
    line-height: 0;
}

/* contain = full promo graphic visible (cover was cropping when the cell got very wide) */
.products-all-page .products-section .products-container .petmex-grid-banner__media img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
}

/* Roughly two lines of product title so the tile lines up with product cards */
.products-all-page .products-section .products-container .petmex-grid-banner__spacer {
    margin-top: 5px;
    min-height: 54px;
    flex-shrink: 0;
}

@media (max-width: 660px) {
    .products-all-page .products-section .products-container .petmex-grid-banner__media img {
        max-height: 200px;
        height: auto;
        width: auto;
        max-width: 100%;
        object-fit: contain;
    }
}

@media (max-width: 425px) {
    .products-all-page .products-section .products-container {
        width: 100%;
        max-width: 100%;
    }

    .products-all-page .products-section .products-container .petmex-grid-banner__media {
        min-height: 200px;
        max-height: 200px;
    }

    .products-all-page .products-section .products-container .petmex-grid-banner__media img {
        max-height: 168px;
        max-width: 168px;
        height: auto;
        width: auto;
        margin: 0 auto;
        object-fit: contain;
    }
}

/* In-grid promo: hidden on mobile (same breakpoint as stacked filters + 2-col grid). Sidebar filters banner stays visible. */
@media (max-width: 991px) {
    .products-all-page .products-section .products-container .petmex-grid-banner {
        display: none !important;
    }
}

.products-all-page .products-section .products-container a .product .product-image-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    max-height: 300px;
}

.products-all-page .products-section .products-container a .product .product-image-wrapper .new-product-badge {
    position: absolute;
    top: 0;
    left: 0;
    padding: 8px 16px;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    border-radius: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 2;
    box-shadow: none;
}

@media (max-width: 425px) {
    .products-all-page .products-section .products-container a .product .product-image-wrapper .new-product-badge,
    .products-all-page .products-section .products-container a .product .tag {
        padding: 4px 12px;
        font-size: 10px;
    }
}

.products-all-page .products-section .products-container a .product img {
    border-radius: 4px;
    max-width: 100%;
    height: auto;
}

.products-all-page .products-section .products-container a .product .tag {
    position: absolute;
    bottom: 0;
    left: 0;
    margin: 0;
    padding: 4px 12px;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.5px;
    z-index: 2;
}

.products-all-page .products-section .products-container a .product .product-name {
    margin-top: 5px;
    font-size: 18px;
    font-weight: 600;
    line-height: 27px;
    color: #292929;
    max-width: 100%;
}

@media (max-width: 660px) {
    .products-all-page .products-section .products-container a .product img {
        max-height: 200px;
    }
}

@media (max-width: 425px) {
    .products-all-page .products-section .products-container a .product img {
        max-height: 168px;
        max-width: 168px;
    }

    .products-all-page .products-section .products-container a .product .product-image-wrapper {
        min-height: 200px;
        max-height: 200px;
    }
}

.products-all-page .products-section.loading {
    opacity: 0.5;
    pointer-events: none;
    position: relative;
}

.products-all-page .products-section.loading:after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ========================================
   Error messages
   ======================================== */

.petmex-error {
    background-color: #ffebee;
    color: #c62828;
    padding: 15px 20px;
    border-radius: 4px;
    border-left: 4px solid #c62828;
    margin: 20px 0;
}

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

.products-pagination .page-numbers {
    display: inline-flex;
    list-style: none;
    padding: 0;
    margin: 0;
}

.products-pagination .page-numbers li {
    margin: 0 5px;
}

.products-pagination .page-numbers li a {
    display: block;
    padding: 8px 16px;
    border: 1px solid #ddd;
    text-decoration: none;
    color: #333;
}

.products-pagination .page-numbers li a:hover {
    background-color: #E0F1FC;
}

.products-pagination .page-numbers li span {
    display: block;
    padding: 8px 16px;
    border: 1px solid #ddd;
    text-decoration: none;
    color: #333;
}

.products-pagination .page-numbers li span.current {
    background-color: #1D71B8;
    color: #fff;
    border-color: #1D71B8;
}

.products-all-page .products-section .products-container p:not([class]) {
    display: none;
}

/* ========================================
   Product card
   ======================================== */
.single-product .wc-block-breadcrumbs {
    margin-top: 50px;
    margin-bottom: 50px;
}

.single-product .wp-block-post-title {
    font-weight: 600;
    font-size: 40px;
}

.single-product .wp-block-columns.wpbbe-3.wpbbe-3 {
    gap: 50px;
}

.single-product .wp-block-woocommerce-product-collection {
    margin-top: 50px;
    margin-bottom: 50px;
}

.single-product .wp-block-woocommerce-product-collection .wp-block-post-title a {
    font-size: 15px;
}

.single-product .product-additional-info {
    margin-top: 80px;
}

@media (max-width: 1199px) {
    .single-product .product-additional-info {
        margin-top: 64px;
    }
}

.single-product .product-additional-info .title {
    margin-bottom: 20px;
    font-weight: 600;
    font-size: 24px;
    line-height: 36px;
}

.single-product .product-additional-info .content {
    margin-bottom: 64px;
    font-weight: 400;
    font-size: 16px;
    line-height: 24px;
    color: #525252;
}

.single-product .petmex-find-store-btn {
    padding: 12px 38px !important;
    width: 100%;
    text-align: center;
    border-radius: 8px !important;
    background: #1D71B8 !important;
    font-weight: 500 !important;
    font-size: 16px !important;
}

@media (max-width: 425px) {
    .products-pagination .page-numbers {
        flex-wrap: wrap;
        row-gap: 10px;
    }
}
