/* ============================================================
   UCM Marketplace — ucm-marketplace.css
   ТОЛЬКО: sticky nav, заголовки секций, таймер.
   Карточки товаров НЕ трогаем — используется CSS темы.
   ============================================================ */

/* ── Sticky nav ── */
.ucm-mp-nav {
    position: sticky;
    top: 0;
    z-index: 199;
    background: #1B2034;
    border-bottom: 1px solid rgba(118, 128, 165, 0.2);
    box-shadow: none;
    transition: box-shadow 0.2s;
    margin-bottom: 0;
}

.ucm-mp-nav.is-stuck {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.ucm-mp-nav__inner {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 16px;
    height: 50px;
    max-width: 1400px;
    margin: 0 auto;
}

/* Pills scroll */
.ucm-mp-nav__pills {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 6px 0;
}

.ucm-mp-nav__pills::-webkit-scrollbar {
    display: none;
}

/* Arrow buttons */
.ucm-mp-nav__arrow {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(118, 128, 165, 0.1);
    border: 1px solid rgba(118, 128, 165, 0.2);
    border-radius: 6px;
    color: #7680A5;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.15s;
    padding: 0;
}

.ucm-mp-nav__arrow:hover {
    background: rgba(216, 64, 170, 0.12);
    color: #D840AA;
    border-color: rgba(216, 64, 170, 0.3);
}

/* Pills */
.ucm-mp-pill {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 13px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: #7680A5;
    background: transparent;
    border: 1px solid rgba(118, 128, 165, 0.2);
    text-decoration: none !important;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.15s;
}

.ucm-mp-pill:hover {
    color: #ffffff;
    border-color: rgba(216, 64, 170, 0.4);
    background: rgba(216, 64, 170, 0.08);
    text-decoration: none !important;
}

.ucm-mp-pill.ucm-mp-pill--active {
    color: #ffffff !important;
    background: #D840AA !important;
    border-color: #D840AA !important;
}

.ucm-mp-pill__cnt {
    font-size: 11px;
    font-weight: 400;
    opacity: 0.65;
}

/* ── Sections ── */
.ucm-mp-sections {
    margin: 0 auto;
}

.ucm-mp-section {
    padding: 0 0 8px;
}

.ucm-mp-section + .ucm-mp-section {
    border-top: 1px solid var(--UM_bg-light, #424A68);
    margin-top: 24px;
    padding-top: 24px;
}

/* Section header */
.ucm-mp-section__head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.ucm-mp-section__title {
    color: var(--UM_white, #FFF) !important;
    /* UM_H3 */
    font-family: Roboto, sans-serif !important;
    font-size: 20px !important;
    font-style: normal !important;
    font-weight: 700 !important;
    line-height: normal !important;
    margin: 0 !important;
    display: flex;
    align-items: center;
    gap: 8px;
    border: none !important;
    padding: 0 !important;
}

.ucm-mp-section__cnt {
    color: var(--UM_bg-light-2, #7680A5);
    /* UM_Paragraph */
    font-family: Roboto, sans-serif;
    font-size: 14px;
    font-style: normal;
    font-weight: 400;
    line-height: normal;
}

/* ── Timer (Figma 1232:19781) ── */
.ucm-mp-timer {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px;
    background: var(--UM_bg-light, #424A68);
    border: 0;
    border-radius: 2px;
    white-space: nowrap;
}

.ucm-mp-timer__icon {
    flex-shrink: 0;
    display: block;
    width: 16px;
    height: 16px;
    overflow: visible;
}

.ucm-mp-timer__label {
    /* UM_Paragraph */
    font-family: Roboto, sans-serif;
    font-size: 14px;
    font-style: normal;
    font-weight: 400;
    line-height: normal;
    color: var(--UM_grey, #CFD1D5);
}

.ucm-mp-timer__val {
    /* UM_Paragraph bold */
    font-family: Roboto, sans-serif;
    font-size: 14px;
    font-style: normal;
    font-weight: 700;
    line-height: normal;
    color: var(--UM_grey, #CFD1D5);
    font-variant-numeric: tabular-nums;
}

/* ============================================================
   Filter bar (products_with_filter, style1) — Swiper tabs,
   arrows, "All categories" button + popup, sections toggle.
   ============================================================ */

.ucm-hidden { display: none !important; }

/* ── Filter bar layout ── */
.mt-food-pro-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 auto 16px;
    max-width: none !important;
}

/* Order: tabs (swiper) first, arrows on the right, then All categories */
.ucm-fltr-swiper { order: 0; }
.ucm-fltr-prev   { order: 1; }
.ucm-fltr-next   { order: 2; }
.ucm-allcats     { order: 3; }

/* Swiper track takes the remaining space */
.ucm-fltr-swiper {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    margin: 0 !important;
}

.ucm-fltr-swiper .swiper-wrapper {
    align-items: center;
    margin: 0 !important;
}

.ucm-fltr-swiper .swiper-slide {
    width: auto;
    flex-shrink: 0;
}

/* Search in homepage heading row (moved from filter swiper via JS) */
.mt-heading-wi-btn.ucm-heading-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.mt-heading-wi-btn.ucm-heading-row .mt-heading {
    margin: 0;
    flex: 1 1 auto;
    min-width: 0;
}

.mt-heading-wi-btn.ucm-heading-row .mt-search-form {
    position: static !important;
    top: auto !important;
    right: auto !important;
    flex-shrink: 0;
}

.mt-heading-wi-btn.ucm-heading-row .mt-search-form input {
    min-width: 280px;
    height: 40px;
    background: var(--UM_bg-dark, #1B2034);
    color: var(--UM_bg-light-2, #7680A5);
    border: 1px solid var(--UM_bg-light, #7680A5);
    border-radius: 0;
}

.mt-heading-wi-btn.ucm-heading-row .mt-search-form input::placeholder {
    color: var(--UM_bg-light-2, #7680A5);
}

/* ── Filter tab links (override theme's boxed style) ── */
.mt-food-pro-filter .mt-pro-filter a {
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    height: auto !important;
    line-height: normal !important;
    padding: 0 0 4px !important;
    color: var(--UM_white, #FFF) !important;
    /* UM_BTN_M */
    font-family: Roboto, sans-serif !important;
    font-size: 16px !important;
    font-style: normal !important;
    font-weight: 500 !important;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
}

.mt-food-pro-filter .mt-pro-filter a:hover {
    color: var(--UM_link, #708AED) !important;
}

.mt-food-pro-filter .mt-pro-filter.mt-filter-active a {
    color: var(--UM_bg-light-2, #7680A5) !important;
    border-bottom: 1px solid var(--UM_bg-light-2, #7680A5) !important;
    /* theme style.css also adds text-decoration:underline — kill it to avoid double line */
    text-decoration: none !important;
}

/* ── Scroll arrows ── */
.ucm-fltr-arrow {
    flex-shrink: 0;
    display: flex;
    width: 40px;
    height: 40px;
    justify-content: center;
    align-items: center;
    gap: 10px;
    aspect-ratio: 1 / 1;
    background: transparent;
    border: 1px solid var(--UM_bg-light, #424A68);
    border-radius: 4px;
    color: var(--UM_bg-light-2, #424A68);
    font-size:26px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.15s;
    padding: 0;
}

.ucm-fltr-arrow:hover {
    color: var(--UM_link, #708AED);
    border-color: var(--UM_link, #708AED);
}

/* Disabled (edge) state — same frame as normal, dimmed */
.ucm-fltr-arrow.swiper-button-disabled {
    opacity: 0.45;
    cursor: default;
    color: var(--UM_bg-light-2, #7680A5);
    border-color: var(--UM_bg-light, #424A68);
}

.ucm-fltr-arrow.ucm-arrow-hidden { display: none; }

/* ── All categories button + popup ── */
.ucm-allcats {
    position: relative;
    flex-shrink: 0;
}

.ucm-allcats-btn {
    display: flex;
    height: 40px;
    padding: 0 12px;
    justify-content: center;
    align-items: center;
    gap: 10px;
    border-radius: 2px;
    border: 1px solid var(--UM_link, #708AED);
    background: transparent;
    color: var(--UM_link, #708AED);
    text-align: center;
    /* UM_BTN L */
    font-family: Roboto, sans-serif;
    font-size: 16px;
    font-style: normal;
    font-weight: 700;
    line-height: normal;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}

.ucm-allcats-btn:hover,
.ucm-allcats-btn[aria-expanded="true"] {
    background: rgba(112, 138, 237, 0.12);
    border-color: var(--UM_link, #708AED);
}

.ucm-allcats-btn svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

/* Popup shell — Figma 1150:21625.
   Nested under .mt-food-pro-filter, so theme pill styles
   (.mt-food-pro-filter ul li { inline-block }, white pill a, …)
   MUST be fully overridden here with high specificity. */
.mt-food-pro-filter .ucm-allcats-popup,
.ucm-allcats-popup {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 210;
    width: 780px;
    max-width: min(780px, 96vw);
    padding: 14px !important;
    margin: 0 !important;
    background: var(--UM_bg, #22273A) !important;
    border: 1px solid var(--UM_bg-light, #424A68) !important;
    border-radius: 6px !important;
    box-shadow: none !important;
    display: none;
    word-break: normal;
    white-space: nowrap;
    box-sizing: border-box;
    text-align: left !important;
    line-height: normal !important;
}

.mt-food-pro-filter .ucm-allcats-popup *,
.mt-food-pro-filter .ucm-allcats-popup *::before,
.mt-food-pro-filter .ucm-allcats-popup *::after,
.ucm-allcats-popup *,
.ucm-allcats-popup *::before,
.ucm-allcats-popup *::after {
    box-sizing: border-box;
}

.mt-food-pro-filter .ucm-allcats-popup.is-open,
.ucm-allcats-popup.is-open {
    display: block !important;
}

.mt-food-pro-filter .ucm-allcats-popup__grid,
.ucm-allcats-popup__grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    grid-template-rows: repeat(2, auto) !important;
    gap: 12px !important;
    align-items: start !important;
    width: 100%;
    margin: 0 !important;
    padding: 0 !important;
}

/* Column card */
.mt-food-pro-filter .ucm-allcats-col,
.ucm-allcats-col {
    min-width: 0;
    width: 100%;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    align-self: start;
    background: var(--UM_bg-dark, #1B2034) !important;
    border-radius: 4px !important;
    overflow: hidden;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    float: none !important;
}

/* Header — UM_BTN L / count UM_BTN_M */
.mt-food-pro-filter .ucm-allcats-col__title,
.ucm-allcats-col__title {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 8px 12px !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 2px !important;
    background: transparent !important;
    color: var(--UM_bg-light-2, #7680A5) !important;
    font-family: Roboto, sans-serif !important;
    font-size: 18px !important;
    font-style: normal !important;
    font-weight: 700 !important;
    line-height: normal !important;
    letter-spacing: 0 !important;
    text-decoration: none !important;
    text-align: left !important;
    white-space: nowrap !important;
    transition: color 0.15s;
}

.mt-food-pro-filter .ucm-allcats-col__title:hover,
.ucm-allcats-col__title:hover {
    color: var(--UM_link, #708AED) !important;
    background: transparent !important;
    border-color: transparent !important;
}

.mt-food-pro-filter .ucm-allcats-col__title > span:first-child,
.ucm-allcats-col__title > span:first-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mt-food-pro-filter .ucm-allcats-col__title .ucm-allcats-cnt,
.ucm-allcats-col__title .ucm-allcats-cnt {
    color: var(--UM_bg-light, #424A68) !important;
    font-family: Roboto, sans-serif !important;
    font-size: 0.85em !important;
    font-style: normal !important;
    font-weight: 500 !important;
    line-height: normal !important;
    letter-spacing: 0 !important;
    text-align: right !important;
    opacity: 1 !important;
    background: none !important;
    border: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Kill theme .mt-food-pro-filter ul / li / a pill styles */
.mt-food-pro-filter .ucm-allcats-list,
.ucm-allcats-list {
    list-style: none !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    flex-wrap: nowrap !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 0 0.25rem 0 !important;
    text-align: left !important;
    gap: 0 !important;
}

.mt-food-pro-filter .ucm-allcats-list > li,
.ucm-allcats-list > li {
    display: block !important;
    float: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
}

/* Subcategory — UM_BTN_S / count UM_Additional */
.mt-food-pro-filter .ucm-allcats-list a,
.ucm-allcats-list a {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 4px 12px 4px 24px !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: var(--UM_white, #FFF) !important;
    font-family: Roboto, sans-serif !important;
    font-size: 13px !important;
    font-style: normal !important;
    font-weight: 500 !important;
    line-height: normal !important;
    letter-spacing: 0 !important;
    text-decoration: none !important;
    text-align: left !important;
    white-space: nowrap !important;
    box-shadow: none !important;
    transition: color 0.15s;
}

.mt-food-pro-filter .ucm-allcats-list a > span:first-child,
.ucm-allcats-list a > span:first-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mt-food-pro-filter .ucm-allcats-list a:hover,
.ucm-allcats-list a:hover {
    color: var(--UM_link, #708AED) !important;
    background: transparent !important;
    border-color: transparent !important;
}

.mt-food-pro-filter .ucm-allcats-list a.is-active,
.mt-food-pro-filter .ucm-allcats-list a:active,
.ucm-allcats-list a.is-active,
.ucm-allcats-list a:active {
    color: var(--UM_link, #708AED) !important;
    background: transparent !important;
}

.mt-food-pro-filter .ucm-allcats-list a .ucm-allcats-cnt,
.ucm-allcats-list a .ucm-allcats-cnt {
    color: var(--UM_bg-light-2, #7680A5) !important;
    font-family: Roboto, sans-serif !important;
    font-size: 12px !important;
    font-style: normal !important;
    font-weight: 400 !important;
    line-height: normal !important;
    letter-spacing: 0 !important;
    text-align: right !important;
    opacity: 1 !important;
    background: none !important;
    border: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    height: auto !important;
    line-height: normal !important;
}

.mt-food-pro-filter .ucm-allcats-list a.is-active .ucm-allcats-cnt,
.mt-food-pro-filter .ucm-allcats-list a:active .ucm-allcats-cnt,
.ucm-allcats-list a.is-active .ucm-allcats-cnt,
.ucm-allcats-list a:active .ucm-allcats-cnt {
    font-weight: 700 !important;
}

.mt-food-pro-filter .ucm-allcats-cnt,
.ucm-allcats-cnt {
    flex-shrink: 0 !important;
}

/* ── Sections vs AJAX flat-grid toggle ──
   Default = grouped sections; .ucm-mode-flat = AJAX flat grid.
   Higher specificity + !important beats theme's
   `.woocommerce-active .mt-products-filter-wrapper{display:block!important}` */
.woocommerce-active .mt-pro-filter-wrap .mt-products-filter-wrapper,
.mt-pro-filter-wrap .mt-products-filter-wrapper { display: none !important; }
.mt-pro-filter-wrap .mt-pro-filter-pagination { display: none !important; }

.woocommerce-active .mt-pro-filter-wrap.ucm-mode-flat .mt-products-filter-wrapper,
.mt-pro-filter-wrap.ucm-mode-flat .mt-products-filter-wrapper { display: block !important; }
.mt-pro-filter-wrap.ucm-mode-flat .mt-pro-filter-pagination { display: block !important; }
.mt-pro-filter-wrap.ucm-mode-flat .ucm-mp-sections { display: none !important; }

/* ── Section product grid ── */
.ucm-mp-section .products {
    display: grid;
    grid-gap: 30px;
    width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
}
.ucm-mp-section .products.columns-6 { grid-template-columns: repeat(6, 1fr); }
.ucm-mp-section .products.columns-5 { grid-template-columns: repeat(5, 1fr); }
.ucm-mp-section .products.columns-4 { grid-template-columns: repeat(4, 1fr); }
.ucm-mp-section .products.columns-3 { grid-template-columns: repeat(3, 1fr); }

/* ── Mobile ── */
@media (max-width: 1199px) {
    .ucm-mp-section .products.columns-6,
    .ucm-mp-section .products.columns-5 { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 991px) {
    .ucm-mp-section .products.columns-6,
    .ucm-mp-section .products.columns-5,
    .ucm-mp-section .products.columns-4 { grid-template-columns: repeat(3, 1fr); }
    .mt-food-pro-filter .ucm-allcats-popup,
    .ucm-allcats-popup { width: 560px; max-width: min(560px, 96vw); }
    .mt-food-pro-filter .ucm-allcats-popup__grid,
    .ucm-allcats-popup__grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}

@media (max-width: 767px) {
    .ucm-mp-section .products.columns-6,
    .ucm-mp-section .products.columns-5,
    .ucm-mp-section .products.columns-4,
    .ucm-mp-section .products.columns-3 { grid-template-columns: repeat(2, 1fr); }

    .mt-heading-wi-btn.ucm-heading-row {
        flex-direction: column;
        align-items: stretch;
    }

    .mt-heading-wi-btn.ucm-heading-row .mt-search-form input {
        min-width: 0;
        width: 100%;
    }
}

@media (max-width: 600px) {
    .ucm-mp-nav__inner {
        padding: 0 10px;
    }

    .ucm-mp-pill {
        font-size: 12px;
        padding: 4px 10px;
    }

    .ucm-mp-section__title {
        font-size: 18px !important;
    }

    /* All categories — desktop/tablet only */
    .ucm-allcats { display: none !important; }
}
