/* ReplicaMade.io layout hotfix v6
 * Consolidates category grid, toolbar and product-detail responsiveness.
 * Loaded after styles.css so it intentionally overrides the legacy float rules.
 */

/* --------------------------------------------------------------------------
   Two-column shell
   -------------------------------------------------------------------------- */
.col2-left-layout .main {
    display:flex !important;
    flex-flow:row nowrap !important;
    align-items:flex-start !important;
    gap:23px !important;
    overflow:visible !important;
}
.col2-left-layout .main:before,
.col2-left-layout .main:after {
    display:none !important;
    content:none !important;
}
.col2-left-layout .col-left.sidebar {
    order:1 !important;
    float:none !important;
    clear:none !important;
    flex:0 0 231px !important;
    width:231px !important;
    min-width:231px !important;
    max-width:231px !important;
    margin:0 !important;
    box-sizing:border-box !important;
}
.col2-left-layout .col-main {
    order:2 !important;
    float:none !important;
    clear:none !important;
    flex:1 1 0 !important;
    width:auto !important;
    min-width:0 !important;
    max-width:none !important;
    margin:0 !important;
    box-sizing:border-box !important;
}
.col2-left-layout .col-main .promotion-banner,
.col2-left-layout .col-main .category-description {
    width:100% !important;
    max-width:100% !important;
    box-sizing:border-box !important;
}
.col2-left-layout .col-main .promotion-banner img,
.col2-left-layout .col-main .category-description img {
    max-width:100% !important;
    height:auto !important;
}

@media only screen and (max-width:1040px) {
    .col2-left-layout .main { gap:14px !important; }
}

/* --------------------------------------------------------------------------
   Category toolbar
   Replace the old amount=float:left / limiter=float:right / pages=140px margins.
   -------------------------------------------------------------------------- */
.category-products .toolbar {
    width:100% !important;
    max-width:100% !important;
    box-sizing:border-box !important;
    overflow:visible !important;
}
.category-products .toolbar .pager {
    width:100% !important;
    max-width:100% !important;
    height:auto !important;
    min-height:47px !important;
    box-sizing:border-box !important;
    display:grid !important;
    grid-template-columns:minmax(155px,1fr) auto minmax(115px,1fr) !important;
    align-items:center !important;
    column-gap:10px !important;
    padding:10px 14px !important;
    line-height:19px !important;
    text-align:initial !important;
}
.category-products .toolbar .pager .amount {
    grid-column:1 !important;
    grid-row:1 !important;
    float:none !important;
    margin:0 !important;
    text-align:left !important;
    white-space:nowrap !important;
}
.category-products .toolbar .pager .pages {
    grid-column:2 !important;
    grid-row:1 !important;
    float:none !important;
    margin:0 !important;
    padding:0 !important;
    text-align:center !important;
    white-space:nowrap !important;
    justify-self:center !important;
}
.category-products .toolbar .pager .pages ol {
    display:inline-flex !important;
    align-items:center !important;
    gap:4px !important;
    margin:0 !important;
    padding:0 !important;
}
.category-products .toolbar .pager .pages li {
    display:inline-block !important;
    margin:0 !important;
}
.category-products .toolbar .pager .limiter {
    grid-column:3 !important;
    grid-row:1 !important;
    float:none !important;
    margin:0 !important;
    text-align:right !important;
    white-space:nowrap !important;
    justify-self:end !important;
}
.category-products .toolbar .pager .limiter select {
    width:auto !important;
    min-width:42px !important;
    max-width:60px !important;
}
.category-products .toolbar-bottom {
    width:100% !important;
    clear:both !important;
}

/* --------------------------------------------------------------------------
   Product listing grid
   list.phtml v6 emits ONE ul for all products. This prevents 3+1+3 wrapping.
   -------------------------------------------------------------------------- */
.category-products .products-grid.products-grid-responsive {
    display:grid !important;
    grid-template-columns:repeat(4,minmax(0,1fr)) !important;
    gap:10px !important;
    width:100% !important;
    max-width:100% !important;
    margin:0 !important;
    padding:8px 0 0 !important;
    box-sizing:border-box !important;
    overflow:visible !important;
}
.category-products .products-grid.products-grid-responsive:after {
    display:none !important;
    content:none !important;
}
.category-products .products-grid.products-grid-responsive > li.item {
    float:none !important;
    width:100% !important;
    min-width:0 !important;
    max-width:none !important;
    height:auto !important;
    min-height:345px !important;
    margin:0 !important;
    padding:0 0 8px !important;
    box-sizing:border-box !important;
}
.category-products .products-grid.products-grid-responsive .product-image {
    width:100% !important;
    height:243px !important;
    min-height:0 !important;
    display:flex !important;
    align-items:flex-start !important;
    justify-content:center !important;
    overflow:hidden !important;
}
.category-products .products-grid.products-grid-responsive .product-image > img:first-child {
    width:auto !important;
    max-width:100% !important;
    height:243px !important;
    object-fit:contain !important;
}
.category-products .products-grid.products-grid-responsive .actions {
    min-height:24px !important;
    overflow:hidden !important;
}

@media only screen and (max-width:920px) {
    .category-products .products-grid.products-grid-responsive {
        grid-template-columns:repeat(3,minmax(0,1fr)) !important;
    }
}
@media only screen and (max-width:820px) {
    .category-products .products-grid.products-grid-responsive {
        grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    }
    .category-products .toolbar .pager {
        grid-template-columns:1fr auto !important;
        row-gap:7px !important;
    }
    .category-products .toolbar .pager .amount {
        grid-column:1 !important;
        grid-row:1 !important;
    }
    .category-products .toolbar .pager .limiter {
        grid-column:2 !important;
        grid-row:1 !important;
    }
    .category-products .toolbar .pager .pages {
        grid-column:1 / -1 !important;
        grid-row:2 !important;
    }
}

/* --------------------------------------------------------------------------
   Product detail page
   The old page used fixed 285 + 415 floats and a 711px gallery.
   -------------------------------------------------------------------------- */
.product-view .product-essential,
.product-view .product-essential form {
    width:100% !important;
    max-width:100% !important;
    box-sizing:border-box !important;
}
.product-view .product-essential form {
    display:flex !important;
    flex-flow:row wrap !important;
    align-items:flex-start !important;
    gap:10px !important;
}
.product-view .product-essential form > .clearer {
    display:none !important;
}
.product-view .wrap-pic {
    order:1 !important;
    float:none !important;
    flex:0 0 285px !important;
    width:285px !important;
    max-width:40% !important;
    min-width:0 !important;
    box-sizing:border-box !important;
}
.product-view .product-shop {
    order:2 !important;
    float:none !important;
    flex:1 1 0 !important;
    width:auto !important;
    max-width:none !important;
    min-width:0 !important;
    box-sizing:border-box !important;
}
.product-view .product-shop .product-name {
    height:auto !important;
    min-height:36px !important;
    overflow:visible !important;
}
.product-view .product-shop .description .more {
    width:100% !important;
    max-width:100% !important;
    box-sizing:border-box !important;
}
.product-view .gal1 {
    order:3 !important;
    flex:0 0 100% !important;
    width:100% !important;
    max-width:100% !important;
    margin:0 0 10px !important;
    box-sizing:border-box !important;
    overflow:hidden !important;
}
.product-view .gal1 .cont {
    width:100% !important;
    max-width:100% !important;
    box-sizing:border-box !important;
}
.product-view .gal1 .cont ul {
    display:flex !important;
    flex-wrap:wrap !important;
    gap:10px !important;
    padding:10px !important;
    box-sizing:border-box !important;
}
.product-view .gal1 .cont li {
    float:none !important;
    margin:0 !important;
}
.product-view .rate-product {
    order:4 !important;
    flex:0 0 100% !important;
    width:100% !important;
    box-sizing:border-box !important;
}

@media only screen and (max-width:900px) {
    .product-view .product-essential form {
        flex-direction:column !important;
        gap:14px !important;
    }
    .product-view .wrap-pic,
    .product-view .product-shop {
        float:none !important;
        flex:0 0 auto !important;
        width:100% !important;
        max-width:100% !important;
        min-width:0 !important;
    }
    .product-view .wrap-pic {
        display:flex !important;
        flex-direction:column !important;
        align-items:center !important;
    }
    .product-view .product-img-box {
        max-width:100% !important;
    }
    .product-view .product-shop .description {
        height:auto !important;
        max-height:none !important;
        padding-left:0 !important;
        overflow:visible !important;
    }
    .product-view .product-shop .description .more {
        display:none !important;
    }
}

/* Phone: main category content first, sidebar after it. */
@media only screen and (max-width:640px) {
    .col2-left-layout .main {
        flex-direction:column !important;
        gap:14px !important;
    }
    .col2-left-layout .col-main {
        order:1 !important;
        width:100% !important;
        max-width:100% !important;
    }
    .col2-left-layout .col-left.sidebar {
        order:2 !important;
        flex:0 0 auto !important;
        width:100% !important;
        min-width:0 !important;
        max-width:100% !important;
    }
}

@media only screen and (max-width:430px) {
    .category-products .products-grid.products-grid-responsive {
        grid-template-columns:1fr !important;
    }
    .category-products .toolbar .pager {
        display:flex !important;
        flex-direction:column !important;
        align-items:stretch !important;
        gap:7px !important;
    }
    .category-products .toolbar .pager .amount,
    .category-products .toolbar .pager .pages,
    .category-products .toolbar .pager .limiter {
        width:100% !important;
        text-align:center !important;
        justify-self:center !important;
    }
}

/* Legacy decorative category tabs and product-question block also used fixed 709/710px widths. */
.category-products .categ-tabs {
    width:100% !important;
    max-width:709px !important;
    box-sizing:border-box !important;
    overflow:hidden !important;
}
.product-view .productquestions-container {
    width:100% !important;
    max-width:100% !important;
    box-sizing:border-box !important;
}
