.templates{
    margin: 0;
    padding: 0;
}
.templates > div .template-image-wrapper,
.templates > li .template-image-wrapper{
    position: relative;
    margin-bottom: 1rem;
}
.templates > div .template-image-wrapper .template-image,
.templates > li .template-image-wrapper .template-image{
    position: relative;
    padding-top: 150%;
    display: block;
}
.templates > div > a,
.templates > li > a{
    position: relative;
    padding-top: 150%;
    display: block;
    margin-bottom: 1rem;
}
.templates > div .template-image-wrapper .template-image img,
.templates > li .template-image-wrapper .template-image img,
.templates > div > a img,
.templates > li > a img{
    position: absolute;
    height: auto;
    left: 0%;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

/* Two-button hover overlay */
.template-hover-buttons{
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: rgba(0,0,0,0.45);
    opacity: 0;
    transition: opacity 0.25s ease;
    z-index: 2;
    border-radius: 4px;
}
.template-image-wrapper:hover .template-hover-buttons{
    opacity: 1;
}
.hover-btn{
    display: inline-block;
    padding: 0.65rem 1.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-decoration: none;
    text-align: center;
    border-radius: 4px;
    min-width: 200px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
}
.hover-btn:hover{
    transform: scale(1.04);
    text-decoration: none;
}
.hover-btn--view{
    background: var(--primary);
    color: #fff;
    border: 2px solid var(--primary);
    border-radius: 50px;
}
.hover-btn--view:hover{
    color: #fff;
    box-shadow: 0 4px 12px rgba(221,157,76,0.4);
    border-radius: 50px;
}
.hover-btn--edit{
    background: #DD9D4C;
    color: #fff;
    border: 2px solid #DD9D4C;
    border-radius: 50px;
}
.hover-btn--edit:hover{
    color: #fff;
    box-shadow: 0 4px 12px rgba(221,157,76,0.4);
    border-radius: 50px;
    background: #DD9D4C;
}

.templates .creat-btn{
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    opacity: 0;
}

.templates .color-palette{
    padding: 0;
    margin: 0;
    padding-top: 1rem;
    padding-left: .1rem;
}
.templates .color-palette li{
    list-style-type: none;
    margin-right: .2rem;
    border: 0.063rem solid #ced5d9;
    width: 1.813rem;
    height: 1.813rem;
    border-radius: 50%;
    cursor: pointer;
    display: inline-block;
}
.templates .color-palette li.active{
    box-shadow: 0 0 0 0.125rem var(--primary)
}
.padding-large{
    padding-bottom: 6rem;
}

.mbm-shop-loop-intro{
    max-width: 1348px;
    padding: 0 15px;
    margin: 0 auto 2rem;
    box-sizing: border-box;
}
.mbm-shop-loop-intro::after{
    content: "";
    display: block;
    clear: both;
}
.mbm-shop-loop-intro .woocommerce-result-count,
.woocommerce .mbm-shop-loop-intro .woocommerce-result-count,
.woocommerce-page .mbm-shop-loop-intro .woocommerce-result-count{
    float: none !important;
    margin: 0 !important;
    text-align: left !important;
    width: 100%;
}
.mbm-shop-loop-intro .woocommerce-notices-wrapper{
    margin-bottom: 1rem;
}

.woocommerce .woocommerce-ordering,
.woocommerce-page .woocommerce-ordering{
    display: none;
}

/* Constrain the WooCommerce shop product grid + pagination to header container width */
.woocommerce ul.products,
.woocommerce-page ul.products,
.woocommerce nav.woocommerce-pagination,
.woocommerce-page nav.woocommerce-pagination{
    max-width: 1348px;
    padding-left: 15px;
    padding-right: 15px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
    width: 100%;
}
.woocommerce .woocommerce-result-count{
    padding-left: 15px;
    padding-right: 15px;
}

/* Responsive flex grid – outer edges flush with container (no extra padding on ul).
   gap provides spacing between cards only, so first/last cards align with header logo. */
.woocommerce ul.products,
.woocommerce-page ul.products {
    display: flex !important;
    flex-wrap: wrap !important;
    list-style: none !important;
    gap: 1.5rem !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

/* Override WC column classes at all breakpoints */
.woocommerce ul.products li.product,
.woocommerce-page ul.products li.product {
    box-sizing: border-box !important;
    padding: 0 0 1rem !important;
    float: none !important;
    margin: 0 !important;
    /* default (<480px): 1 per row */
    width: 100% !important;
}

@media (min-width: 480px) {
    .woocommerce ul.products li.product,
    .woocommerce-page ul.products li.product {
        /* 2 per row: (100% - 1 gap) / 2 */
        width: calc(50% - 0.75rem) !important;
    }
}

@media (min-width: 768px) {
    .woocommerce ul.products li.product,
    .woocommerce-page ul.products li.product {
        /* 3 per row: (100% - 2 gaps) / 3 */
        width: calc(33.3333% - 1rem) !important;
    }
}

@media (min-width: 1200px) {
    .woocommerce ul.products li.product,
    .woocommerce-page ul.products li.product {
        /* 4 per row: (100% - 3 gaps) / 4 */
        width: calc(25% - 1.125rem) !important;
    }
}
    width: 100%;
}

/* Hide product titles on shop / archive pages (titles still visible on single product) */
.woocommerce ul.products li.product .woocommerce-loop-product__title,
.woocommerce-page ul.products li.product .woocommerce-loop-product__title,
ul.products li.product .woocommerce-loop-product__title,
.woocommerce ul.products li.product h2,
.woocommerce-page ul.products li.product h2,
ul.products li.product h2.woocommerce-loop-product__title{
    display: none !important;
}

/* Kill WooCommerce's clearfix that breaks the flex grid (used to clear floated cards). */
.woocommerce ul.products li.product.first,
.woocommerce-page ul.products li.product.first,
.woocommerce ul.products li.product.last,
.woocommerce-page ul.products li.product.last{
    clear: none !important;
}
.woocommerce ul.products::before,
.woocommerce ul.products::after,
.woocommerce-page ul.products::before,
.woocommerce-page ul.products::after{
    display: none !important;
    content: none !important;
}

@media only screen and (min-width: 768px) {
	a:not([href]),
	a[href] {
		-webkit-transition: none !important;
		transition: none !important;
	}
    .templates{
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        margin: 0 -1rem;
        max-width: 80%;
        margin: 0 auto;
    }
    .templates > div,
    .templates > li{
        list-style-type: none;
        width: 50%;
        padding: 0 1rem;
        position: relative;
        margin-bottom: 3rem;
    }
    .templates > div .template-image-wrapper,
    .templates > li .template-image-wrapper{
        margin-bottom: 0rem;
    }
    .templates > div .template-image-wrapper .template-image,
    .templates > li .template-image-wrapper .template-image{
        margin-bottom: 0;
    }
    .templates > div > a,
    .templates > li > a{
        position: relative;
        margin-bottom: 2rem;
    }
    .templates > div .template-image-wrapper:hover img,
    .templates > li .template-image-wrapper:hover img{
        box-shadow: 0 .5rem 1rem rgba(0,0,0,.15)!important;
        transform: translateY(calc(-50% - 10px));
    }
    .templates > div .template-image-wrapper,
    .templates > li .template-image-wrapper{
        transform: none !important;
    }
    .templates > div > a:hover img,
    .templates > li > a:hover img{
        box-shadow: 0 .5rem 1rem rgba(0,0,0,.15)!important;
        transform: translateY(calc(-50% - 10px));
    } 
    .templates > div > a,
    .templates > li > a{
        transform: none !important;
    }   
    .templates > div > a:hover .creat-btn,
    .templates > li > a:hover .creat-btn{
        opacity: 1;
    }
    .templates > div a.creat-btn-mobile,
    .templates > li a.creat-btn-mobile{
        display: none;
    }
}
@media only screen and (min-width: 991px) {
    .templates > div,
    .templates > li{
        width: 33%;
    }
}


/* Slider */
@media only screen and (max-width: 768px) {
    .mbm-shop-loop-intro{
        max-width: 100%;
        margin-bottom: 1.5rem;
    }
    .creat-btn-desktop{
        display: none;
    }
    .templates > div a.creat-btn-mobile,
    .templates > li a.creat-btn-mobile{
       padding-top: 0;
       
    }
    .creat-btn-mobile{
        text-decoration: none;
        transition-property:none;
    }
    a.creat-btn-mobile .creat-btn{
            position: relative;
            opacity: 1;
            display: block;
            font-size: 12px;
            height: auto;
            transform: none !important;
            top: 0;
            left: 0;
    }
    .template-slider{
        position: relative;
        overflow: hidden;
        margin: 0 auto;
    }
    
    .template-slider .templates{
        white-space: nowrap;
    }
    .template-slider .templates > div,
    .template-slider .templates > li{
        display: inline-block;
        white-space: normal;
        vertical-align: top;
        height: 100%;
        width: 100%;
        margin-right: -0.344rem;

    }
    
    .slider-wrapper .prevNext {
        position: absolute;
        z-index: 1;
        top: 35%;
        width: 100%;
        height: 0;
        cursor: pointer;
    }
    
    .slider-wrapper .prevNext > div+div {
        visibility: hidden; 
    }
    
    .slider-wrapper .prevNext span {
        background-color: var(--primary);
        position: absolute;
        width: 2rem;
        height:2rem;
        transform: translateY(-50%);
        left: -15px;
    }
    .slider-wrapper .prevNext span::before{
        position: absolute;
        content: '';
        width: 0.5rem;
        height: 0.5rem;
        border-top: 0.13rem solid #fff;
        border-left: 0.13rem solid #fff;
        top: 50%;
        transform: translateY(-50%) rotate(-45deg);
        left: .6rem;
    }
    .slider-wrapper .prevNext span::after{
        position: absolute;
        content: "";
        display: block;
        width: 1rem;
        height: 0.13rem;
        background-color: #fff;
        left: 0.5rem;
        top: 50%;
        transform: translateY(-50%);
    }
    .slider-wrapper .prevNext span+span {
        left: auto;
        right: -15px;
        transform: translateY(-50%) scaleX(-1);
    }

    .slider-wrapper{
        position: relative;
    }

    .templates .color-palette li{
        width: 1.5rem;
        height: 1.5rem;
    }

    .templates > div .text-align-center h2,
    .templates > li .text-align-center h2{
        white-space: nowrap;
        text-overflow: ellipsis;
        overflow: hidden;
    }
}
