/* YooAI — товарные табы. Стили только внутри .yooai-ft */
.yooai-ft {
    --yooai-ft-card: 240px;
    --yooai-ft-gap: 16px;
    --yooai-ft-pad-top: 20px;
    --yooai-ft-pad-bottom: 20px;
    --yooai-ft-pad-left: 12px;
    --yooai-ft-pad-right: 12px;
    --yooai-ft-nav-idle: #9bb4e8;
    --yooai-ft-nav-active: #3b82f6;
    /* Акцент вкладок: тема может переопределить --links / --yooai-ft-accent */
    --yooai-ft-accent: var(--links, #3498db);
    --yooai-ft-line: rgba(15, 23, 42, 0.12);
    --yooai-ft-pill-border: #d8dee8;
    --yooai-ft-pill-text: #071d37;
    margin: 8px 0 36px;
    min-width: 0;
    max-width: 100%;
    color: inherit;
    font-family: inherit;
    box-sizing: border-box;
    overflow-anchor: none;
}

.yooai-ft *,
.yooai-ft *::before,
.yooai-ft *::after {
    box-sizing: border-box;
}

.yooai-ft__title {
    margin: 0 0 14px;
    font-size: 28px;
    line-height: 1.2;
    font-weight: 700;
}

.yooai-ft__bar {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    margin: 0 0 18px;
}

.yooai-ft--tabs-pills .yooai-ft__bar {
    align-items: center;
}

.yooai-ft--tabs-pills .yooai-ft__navs {
    margin-bottom: 0;
}

.yooai-ft__tabs {
    display: flex;
    flex: 1 1 auto;
    flex-wrap: nowrap;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.yooai-ft__tabs::-webkit-scrollbar {
    display: none;
}

.yooai-ft__tab {
    appearance: none;
    position: relative;
    margin: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.12s linear, border-color 0.12s linear, background-color 0.12s linear;
}

.yooai-ft__tab:focus-visible {
    outline: 2px solid var(--yooai-ft-accent);
    outline-offset: 2px;
}

/*
 * Стиль 1: полоска снизу.
 * Серая линия — inset box-shadow (не border): overflow-x не обрезает цветную ::after,
 * и она ложится прямо на серую, а не висит над ней.
 */
.yooai-ft--tabs-line .yooai-ft__tabs {
    gap: 32px;
    border-bottom: 0;
    box-shadow: inset 0 -1px 0 var(--yooai-ft-line);
}

.yooai-ft--tabs-line .yooai-ft__tab {
    padding: 4px 0 12px;
    color: inherit;
    font-size: 18px;
    font-weight: 600;
}

.yooai-ft--tabs-line .yooai-ft__tab::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: transparent;
    transition: background-color 0.12s linear;
}

.yooai-ft--tabs-line .yooai-ft__tab:hover,
.yooai-ft--tabs-line .yooai-ft__tab.is-active {
    color: var(--yooai-ft-accent);
}

.yooai-ft--tabs-line .yooai-ft__tab:hover::after,
.yooai-ft--tabs-line .yooai-ft__tab.is-active::after {
    background: var(--yooai-ft-accent);
}

/* Стиль 2: кнопки как подкатегории, шрифт и отступы чуть больше */
.yooai-ft--tabs-pills .yooai-ft__tabs {
    flex-wrap: wrap;
    gap: 10px;
    overflow: visible;
    border-bottom: 0;
}

.yooai-ft--tabs-pills .yooai-ft__tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 18px;
    border: 1px solid var(--yooai-ft-pill-border);
    border-radius: 8px;
    background: #fff;
    color: var(--yooai-ft-pill-text);
    font-size: 16px;
    font-weight: 400;
    line-height: 1.2;
}

.yooai-ft--tabs-pills .yooai-ft__tab:hover {
    border-color: var(--yooai-ft-accent);
    color: var(--yooai-ft-accent);
}

.yooai-ft--tabs-pills .yooai-ft__tab.is-active {
    border-color: var(--yooai-ft-accent);
    color: var(--yooai-ft-accent);
    background: color-mix(in srgb, var(--yooai-ft-accent) 8%, #fff);
}

@supports not (background: color-mix(in srgb, #000 8%, #fff)) {
    .yooai-ft--tabs-pills .yooai-ft__tab.is-active {
        background: #f3f8fc;
    }
}

.yooai-ft__tab[hidden],
.yooai-ft__navs[hidden],
.yooai-ft__more-wrap[hidden] {
    display: none !important;
}

.yooai-ft__navs {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    /* Ширина всегда занята — не схлопываем при disabled */
    min-width: calc(44px + 8px + 44px);
}

.yooai-ft__navs.is-idle {
    opacity: 0.45;
}

.yooai-ft__nav {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: var(--yooai-ft-nav-idle);
    color: #fff;
    cursor: pointer;
    transition: background 0.18s ease, opacity 0.18s ease, transform 0.18s ease;
}

.yooai-ft__nav:hover:not(:disabled) {
    transform: translateY(-1px);
}

.yooai-ft__nav:disabled {
    opacity: 0.55;
    cursor: default;
}

.yooai-ft__nav:not(:disabled) {
    background: var(--yooai-ft-nav-active);
}

.yooai-ft__nav:focus-visible {
    outline: 2px solid var(--yooai-ft-nav-active);
    outline-offset: 2px;
}

.yooai-ft__panel {
    display: none;
    overflow-anchor: none;
}

.yooai-ft__panel.is-active {
    display: block;
}

.yooai-ft__panel.is-loading {
    opacity: 0.55;
}

.yooai-ft__panel,
.yooai-ft__viewport,
.yooai-ft__track {
    min-width: 0;
    max-width: 100%;
}

.yooai-ft__viewport {
    position: relative;
    width: 100%;
    /* Место под тени/рамки карточек (значения из админки) */
    padding: var(--yooai-ft-pad-top) var(--yooai-ft-pad-right) var(--yooai-ft-pad-bottom) var(--yooai-ft-pad-left);
    margin-left: calc(-1 * var(--yooai-ft-pad-left));
    margin-right: calc(-1 * var(--yooai-ft-pad-right));
    box-sizing: border-box;
}

/* Сетка: колонка не шире карточки в категории */
.yooai-ft--more .yooai-ft__track {
    width: 100%;
    overflow: visible;
}

.yooai-ft .category-grid,
.yooai-ft .yooai-ft__grid {
    justify-content: start;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--yooai-ft-card)), var(--yooai-ft-card)));
    gap: var(--yooai-ft-gap);
}

.yooai-ft__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--yooai-ft-gap);
}

@media (min-width: 768px) {
    .yooai-ft__grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1200px) {
    .yooai-ft__grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* Карусель: один ряд. Без scroll-snap / mask / smooth до is-ready —
   на старте compositor-scroll давал NO_LCP; smooth только после load.
   Вертикальные отступы не меняются вместе с is-ready — иначе блок растёт после load и даёт CLS. */
.yooai-ft--carousel .yooai-ft__viewport {
    overflow: hidden;
    padding-top: 0;
    padding-bottom: var(--yooai-ft-pad-bottom);
}

/* Как .category-grid: без vertical clip — drop-shadow карточки рисуется снаружи */
.yooai-ft--carousel.is-ready .yooai-ft__viewport {
    overflow: visible;
}

.yooai-ft--carousel.is-ready .yooai-ft__panel.is-active {
    overflow: visible;
}

/*
 * Moonshop: на ≥992px .product-card__adds absolute при hover;
 * на мобиле раскрытие по клику «Доступные варианты» увеличивает высоту карточки.
 * overflow трека/viewport режет оба случая — класс снимает clip (см. JS).
 */
.yooai-ft--carousel .yooai-ft__viewport.is-card-hover {
    overflow: visible;
    z-index: 30;
}

.yooai-ft--carousel .yooai-ft__viewport.is-card-hover .yooai-ft__track {
    overflow: visible;
}

.yooai-ft--carousel .yooai-ft__track,
.yooai-ft--carousel .yooai-ft__track.category-grid,
.yooai-ft--carousel .yooai-ft__track.yooai-ft__grid {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: var(--yooai-ft-card);
    grid-template-columns: none;
    justify-content: start;
    gap: var(--yooai-ft-gap);
    width: 100%;
    padding-top: var(--yooai-ft-pad-top);
    padding-bottom: var(--yooai-ft-pad-bottom);
    overflow-x: hidden;
    overflow-y: hidden;
    scroll-behavior: auto;
    scroll-snap-type: none;
    scrollbar-width: none;
    -ms-overflow-style: none;
    overscroll-behavior-x: contain;
}

.yooai-ft--carousel.is-ready .yooai-ft__track,
.yooai-ft--carousel.is-ready .yooai-ft__track.category-grid,
.yooai-ft--carousel.is-ready .yooai-ft__track.yooai-ft__grid {
    overflow-x: auto;
    /* Иначе filter: drop-shadow на .product-card обрезается (в категории overflow: initial) */
    overflow-y: visible;
    scroll-behavior: smooth;
}

.yooai-ft--carousel .yooai-ft__track::-webkit-scrollbar {
    display: none;
}

.yooai-ft .category-grid > .product-card,
.yooai-ft .yooai-ft__grid > .product-card,
.yooai-ft .product-layout {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.yooai-ft--carousel .category-grid > .product-card,
.yooai-ft--carousel .yooai-ft__grid > .product-card,
.yooai-ft--carousel .product-layout {
    width: var(--yooai-ft-card);
    max-width: var(--yooai-ft-card);
}

.yooai-ft .product-layout {
    width: auto;
    float: none;
    padding: 0;
    margin: 0;
}

.yooai-ft .product-thumb {
    margin-bottom: 0;
}

.yooai-ft__more-wrap {
    display: flex;
    justify-content: center;
    margin-top: 18px;
}

.yooai-ft__more {
    appearance: none;
    min-width: 180px;
    padding: 11px 22px;
    border: 1px solid rgba(15, 23, 42, 0.18);
    border-radius: 999px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.yooai-ft__more:hover {
    background: rgba(15, 23, 42, 0.04);
}

.yooai-ft__empty {
    margin: 12px 0 0;
    opacity: 0.7;
}

@media (max-width: 767px) {
    .yooai-ft__title {
        font-size: 22px;
    }

    .yooai-ft--tabs-line .yooai-ft__tab {
        font-size: 16px;
    }

    .yooai-ft--tabs-line .yooai-ft__tabs {
        gap: 22px;
    }

    .yooai-ft__bar {
        flex-wrap: wrap;
        align-items: center;
    }

    .yooai-ft__navs {
        margin-left: auto;
        margin-bottom: 0;
        min-width: calc(40px + 8px + 40px);
    }

    .yooai-ft__nav {
        width: 40px;
        height: 32px;
    }
}
