/**
 * Mad Storefront - Основні стилі
 *
 * @package Mad_Storefront
 * @version 4.0
 */

/* ==========================================================================
   WRAPPER & HEADER
   ========================================================================== */

.mb-storefront-wrapper {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 1px 2vw 20px;
    box-sizing: border-box;
    background: #000;
}

.mb-storefront-title {
    font-size: 20px;
    text-transform: uppercase;
    letter-spacing: .16em;
    font-weight: 800;
    line-height: 0.6;
    color: #fff;
}

.mb-storefront-subtitle {
    font-size: 20px;
    opacity: 1.1;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: #ddd;
}

/* ==========================================================================
   BRAND CAROUSEL
   ========================================================================== */

.mb-brand-strip {
    position: relative;
    max-width: 1600px;
    margin: 6px auto 10px;
    padding: 6px 40px;
}

.mb-brand-viewport {
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
}

.mb-brand-viewport::-webkit-scrollbar {
    display: none;
}

.mb-brand-track {
    display: inline-flex;
    gap: 8px;
    min-width: 100%;
}

.mb-brand-tile {
    flex: 0 0 auto;
    width: 82px;
    height: 82px;
    border-radius: 14px;
    background: #111;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .35);
    overflow: hidden;
    position: relative;
    transition: transform .16s, box-shadow .16s, filter .16s, opacity .16s;
}

.mb-brand-tile::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, .18);
    pointer-events: none;
}

.mb-brand-tile.inactive {
    filter: grayscale(1);
    opacity: .45;
}

.mb-brand-tile.active {
    filter: grayscale(0);
    opacity: 1;
    box-shadow: 0 10px 26px rgba(0, 0, 0, .55);
}

.mb-brand-tile:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 10px 26px rgba(0, 0, 0, .55);
    opacity: 1;
}

.mb-brand-image-wrap {
    width: 74px;
    height: 74px;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.mb-brand-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.mb-brand-initial {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: #fff;
    color: #000;
    font-size: 18px;
    font-weight: 700;
    text-transform: uppercase;
}

.mb-brand-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: none;
    background: rgba(0, 0, 0, .9);
    color: #fff;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 4px 10px rgba(0, 0, 0, .4);
    transition: background .16s, transform .16s;
}

.mb-brand-arrow-left {
    left: 4px;
}

.mb-brand-arrow-right {
    right: 4px;
}

.mb-brand-arrow:hover {
    background: #fff;
    color: #000;
    transform: translateY(-50%) scale(1.05);
}

/* ==========================================================================
   LAYOUT
   ========================================================================== */

.mb-storefront-layout {
    max-width: 1600px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(220px, 1.3fr) minmax(0, 4.8fr) minmax(220px, 1.3fr);
    gap: 16px;
    align-items: flex-start;
    zoom: 1.1;
}

.mb-storefront-leftbar,
.mb-storefront-right {
    position: sticky;
    top: 60px;
    align-self: flex-start;
    background: #000;
    padding: 4px 2px;
}

.mb-storefront-main {
    min-width: 0;
    background: radial-gradient(circle at top, #fff, #f1f1f4 55%, #e8e8ee 100%);
    border-radius: 16px;
    padding: 9px 10px 12px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .35);
}

/* ==========================================================================
   SIDEBAR BLOCKS
   ========================================================================== */

.mb-sidebar-block {
    border-radius: 14px;
    background: rgba(255, 255, 255, .92);
    padding: 10px 10px 9px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .14);
    margin-bottom: 10px;
}

.mb-sidebar-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .14em;
    opacity: .75;
    margin-bottom: 4px;
}

.mb-cat-desc,
.mb-greeting-text {
    font-size: 11px;
    line-height: 1.4;
    color: #222;
}

.mb-greeting-text strong {
    font-weight: 700;
}

.mb-greeting-text em {
    font-style: normal;
    opacity: .8;
}

/* ==========================================================================
   RELATED CATEGORIES
   ========================================================================== */

.mb-related-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.mb-related-cat-link {
    font-size: 11px;
    padding: 3px 9px;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, .16);
    background: #fff;
    text-decoration: none;
    color: #222;
    transition: all .15s;
}

.mb-related-cat-link:hover {
    border-color: #000;
    background: #000;
    color: #fff;
    transform: translateY(-1px);
}

/* ==========================================================================
   BESTSELLERS
   ========================================================================== */

.mb-bestseller-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mb-bestseller-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    cursor: pointer;
    border-radius: 10px;
    padding: 3px 4px;
    transition: background .15s, transform .15s;
}

.mb-bestseller-item:hover {
    background: rgba(0, 0, 0, .04);
    transform: translateY(-1px);
}

.mb-bestseller-thumb {
    flex: 0 0 42px;
    height: 42px;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
}

.mb-bestseller-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.mb-bestseller-meta {
    flex: 1 1 auto;
    min-width: 0;
}

.mb-bestseller-title {
    font-size: 11px;
    line-height: 1.3;
    margin-bottom: 2px;
}

.mb-bestseller-title a {
    color: #111;
    text-decoration: none;
}

.mb-bestseller-title a:hover {
    text-decoration: underline;
}

.mb-bestseller-price {
    font-size: 11px;
    opacity: .8;
}

/* ==========================================================================
   VIDEO BLOCK
   ========================================================================== */

.mb-cat-video video,
.mb-cat-video img {
    width: 100%;
    height: auto;
    border-radius: 10px;
    display: block;
    background: #000;
    object-fit: contain;
}

/* ==========================================================================
   FILTERS & CLASSIFIERS
   ========================================================================== */

.mb-classifier-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(0, 0, 0, .08);
}

.mb-classifier-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: #666;
    white-space: nowrap;
    min-width: 90px;
}

.mb-classifier-select {
    font-size: 13px;
    padding: 7px 32px 7px 14px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, .15);
    background: #fff;
    min-width: 200px;
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, #666 50%), linear-gradient(135deg, #666 50%, transparent 50%);
    background-position: calc(100% - 14px) 50%, calc(100% - 10px) 50%;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}

.mb-classifier-select:hover {
    border-color: rgba(0, 0, 0, .3);
}

.mb-classifier-select:focus {
    outline: none;
    border-color: #000;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, .08);
}

.mb-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
    align-items: center;
}

.mb-filters-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: #666;
    margin-right: 4px;
    min-width: 50px;
}

.mb-filter-link {
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, .1);
    background: #fff;
    text-decoration: none;
    color: #333;
    transition: all .15s;
    font-weight: 500;
}

.mb-filter-link:hover {
    border-color: rgba(0, 0, 0, .25);
    background: #f8f8f8;
    transform: translateY(-1px);
}

.mb-filter-link.active {
    border-color: #000;
    background: #000;
    color: #fff;
    box-shadow: 0 3px 10px rgba(0, 0, 0, .25);
}

/* ==========================================================================
   TOPBAR & ORDERING
   ========================================================================== */

.mb-storefront-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    padding: 8px 0;
    flex-wrap: wrap;
}

.mb-show-oos-toggle {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #444;
    cursor: pointer;
}

.mb-show-oos-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #000;
    cursor: pointer;
}

.mb-ordering {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mb-ordering-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: #666;
}

.mb-ordering select {
    font-size: 13px;
    padding: 7px 32px 7px 14px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, .15);
    background: #fff;
    min-width: 180px;
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, #666 50%), linear-gradient(135deg, #666 50%, transparent 50%);
    background-position: calc(100% - 14px) 50%, calc(100% - 10px) 50%;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}

.mb-ordering select:hover {
    border-color: rgba(0, 0, 0, .3);
}

.mb-ordering select:focus {
    outline: none;
    border-color: #000;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, .08);
}

/* ==========================================================================
   PRODUCT GRID
   ========================================================================== */

.mb-storefront-wrapper .woocommerce ul.products {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 14px 12px;
}

.mb-storefront-wrapper .woocommerce ul.products::before,
.mb-storefront-wrapper .woocommerce ul.products::after {
    content: none !important;
    display: none !important;
}

.mb-storefront-wrapper .woocommerce ul.products li.product:empty {
    display: none !important;
}

.mb-storefront-wrapper .woocommerce ul.products li.product {
    margin: 0 !important;
    padding: 6px 6px 7px;
    float: none !important;
    width: auto !important;
    box-sizing: border-box;
    transition: transform .16s, box-shadow .16s;
    background: rgba(255, 255, 255, .95);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .06);
    position: relative;
}

.mb-storefront-wrapper .woocommerce ul.products li.product:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
}

.mb-storefront-wrapper .woocommerce ul.products li.product a img {
    transition: transform .18s, filter .18s;
    filter: grayscale(.06) contrast(1.02);
    margin-bottom: 4px !important;
}

.mb-storefront-wrapper .woocommerce ul.products li.product:hover a img {
    transform: translateY(-1px) scale(1.02);
    filter: grayscale(0) drop-shadow(0 0 14px rgba(255, 255, 255, .5));
}

/* Product Title */
.mb-storefront-wrapper .woocommerce ul.products li.product .woocommerce-loop-product__title,
.mb-storefront-wrapper .woocommerce ul.products li.product .woocommerce-loop-product__title a {
    font-size: 13px;
    line-height: 1.25;
    margin: 2px 2px 1px;
    text-transform: none;
    letter-spacing: .02em;
    min-height: auto;
    color: #111 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Sale Badge */
.mb-storefront-wrapper .woocommerce span.onsale {
    position: absolute;
    top: 8px;
    right: 8px;
    min-width: 52px;
    height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    background: #000;
    color: #fff;
    font-size: 10px;
    line-height: 24px;
    text-transform: uppercase;
    letter-spacing: .08em;
    box-shadow: 0 4px 10px rgba(0, 0, 0, .4);
    z-index: 40;
}

/* Price */
.mb-storefront-wrapper .woocommerce ul.products li.product .price {
    position: absolute;
    left: 12px;
    bottom: 54px;
    margin: 0;
    padding: 5px 11px;
    font-size: 12px;
    line-height: 1.1;
    background: rgba(0, 0, 0, .9);
    color: #fff;
    border-radius: 999px;
    z-index: 26;
    pointer-events: none;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .7);
}

.mb-storefront-wrapper .woocommerce ul.products li.product .price ins {
    text-decoration: none;
}

.mb-storefront-wrapper .woocommerce ul.products li.product .price del {
    opacity: .7;
    margin-right: 4px;
}

/* Add to Cart Button */
.mb-storefront-wrapper .woocommerce ul.products li.product .button,
.mb-storefront-wrapper .woocommerce ul.products li.product .add_to_cart_button {
    margin-top: 4px;
    padding: 5px 14px;
    font-size: 11px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: .08em;
    background: #000;
    color: #fff;
    border: none;
    transition: background .18s, transform .18s, box-shadow .18s;
    display: inline-block;
}

.mb-storefront-wrapper .woocommerce ul.products li.product .button:hover,
.mb-storefront-wrapper .woocommerce ul.products li.product .add_to_cart_button:hover {
    background: #fff;
    color: #000;
    box-shadow: 0 4px 10px rgba(0, 0, 0, .45);
    transform: translateY(-1px);
}

.mb-storefront-wrapper .woocommerce ul.products li.product .add_to_cart_button,
.mb-storefront-wrapper .woocommerce ul.products li.product .button {
    position: relative;
    left: 50%;
    transform: translateX(-50%);
}

.mb-storefront-wrapper .woocommerce ul.products li.product:hover .add_to_cart_button,
.mb-storefront-wrapper .woocommerce ul.products li.product:hover .button {
    transform: translateX(-50%) translateY(-1px);
}

/* ==========================================================================
   THUMBNAIL OVERLAY (Tags & Excerpt)
   ========================================================================== */

.mb-thumb-overlay {
    position: absolute;
    left: 8px;
    right: 8px;
    top: 8px;
    bottom: 64px;
    background: radial-gradient(circle at center, rgba(0, 0, 0, .95), rgba(0, 0, 0, .7));
    opacity: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 6px 6px;
    gap: 4px;
    border-radius: 8px;
    transition: opacity .16s;
    pointer-events: none;
    z-index: 25;
}

.mb-thumb-tags-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
}

.mb-thumb-tag {
    font-size: 9px;
    line-height: 1.2;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .35);
    text-transform: uppercase;
    letter-spacing: .08em;
    white-space: nowrap;
}

.mb-thumb-excerpt {
    font-size: 10px;
    line-height: 1.25;
    color: #e0e0e0;
    text-align: center;
    max-height: 42px;
    overflow: hidden;
    padding: 0 2px;
}

.mb-thumb-meta-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    margin-top: 2px;
}

.mb-thumb-meta {
    font-size: 9px;
    line-height: 1.2;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(100, 200, 255, .2);
    color: #b0e0ff;
    border: 1px solid rgba(100, 200, 255, .4);
    white-space: nowrap;
}

.mb-storefront-wrapper .woocommerce ul.products li.product a:hover .mb-thumb-overlay,
.mb-storefront-wrapper .woocommerce ul.products li.product:hover .mb-thumb-overlay {
    opacity: 1;
}

/* ==========================================================================
   PAGINATION
   ========================================================================== */

.mb-pagination {
    margin-top: 10px;
    text-align: center;
}

.mb-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 3px;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, .16);
    background: #fff;
    font-size: 11px;
    text-decoration: none;
    transition: all .15s;
}

.mb-pagination .page-numbers.current,
.mb-pagination .page-numbers:hover {
    border-color: #000;
    background: #000;
    color: #fff;
}

.mb-pagination .page-numbers.prev,
.mb-pagination .page-numbers.next {
    width: auto;
    padding: 0 8px;
}

/* ==========================================================================
   CART BLOCK
   ========================================================================== */

.mb-cart-summary {
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 4px;
}

.mb-cart-items {
    list-style: none;
    margin: 0 0 6px;
    padding: 0;
    max-height: 180px;
    overflow-y: auto;
    font-size: 11px;
}

.mb-cart-items li {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 3px;
}

.mb-cart-item-name {
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mb-cart-item-qty {
    flex: 0 0 auto;
    opacity: .8;
}

.mb-cart-more {
    font-style: italic;
    opacity: .8;
}

.mb-cart-total {
    font-size: 11px;
    margin-bottom: 4px;
}

.mb-cart-link .button {
    font-size: 11px;
    padding: 5px 14px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: .08em;
    background: #000;
    color: #fff;
    border: none;
    display: inline-block;
    transition: background .18s, transform .18s, box-shadow .18s;
}

.mb-cart-link .button:hover {
    background: #fff;
    color: #000;
    box-shadow: 0 4px 10px rgba(0, 0, 0, .45);
    transform: translateY(-1px);
}

.mb-cart-empty {
    font-size: 11px;
    line-height: 1.4;
    opacity: .85;
}

/* ==========================================================================
   OUT OF STOCK STYLES
   ========================================================================== */

.mb-storefront-wrapper .woocommerce ul.products li.product.outofstock {
    opacity: 0.65;
}

.mb-storefront-wrapper .woocommerce ul.products li.product.outofstock img {
    filter: grayscale(100%) !important;
}

.mb-storefront-wrapper .woocommerce ul.products li.product.outofstock::after {
    content: "Закінчився";
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #000;
    color: #fff;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    z-index: 50;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    white-space: nowrap;
}

.mb-storefront-wrapper .woocommerce ul.products li.product.outofstock:hover {
    transform: none;
    box-shadow: none;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 1100px) {
    .mb-storefront-layout {
        grid-template-columns: minmax(0, 1.4fr) minmax(0, 2.6fr);
        grid-template-areas: "leftbar main" "rightbar rightbar";
    }

    .mb-storefront-leftbar {
        grid-area: leftbar;
    }

    .mb-storefront-main {
        grid-area: main;
    }

    .mb-storefront-right {
        grid-area: rightbar;
        position: static;
    }
}

@media (max-width: 768px) {
    .mb-storefront-layout {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: "leftbar" "main" "rightbar";
    }

    .mb-storefront-wrapper {
        padding: 12px 10px 16px;
    }

    .mb-storefront-leftbar,
    .mb-storefront-right {
        position: static;
    }

    .mb-brand-tile {
        width: 56px;
        height: 56px;
    }

    .mb-brand-image-wrap {
        width: 48px;
        height: 48px;
    }

    .mb-support-qr {
        display: none;
    }
}