/* AFYC global search — строка + оверлей фильтров (этап 1) */

.afyc-gs {
    position: relative;
    width: 100%;
    max-width: 720px;
    margin: 0 auto 18px;
    text-align: left;
}

.afyc-hub__intro .afyc-gs {
    margin-top: 0;
    margin-bottom: 0;
}

.afyc-gs__form {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px;
    background: #fff;
    border: 2px solid #e9e3e3;
    border-radius: 14px;
    box-sizing: border-box;
}

.afyc-gs__form:focus-within {
    border-color: #e23737;
}

.afyc-gs__field {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    height: 40px;
    padding: 0 4px 0 8px;
    border-radius: 10px;
    background: transparent;
    border: 0;
    box-sizing: border-box;
}

.afyc-gs__field:focus-within {
    border-color: transparent;
    background: transparent;
}

.afyc-gs__brand {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
}

.afyc-gs__brand img {
    width: 22px;
    height: 22px;
    object-fit: contain;
    display: block;
    border-radius: 5px;
}

.afyc-gs__input {
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
    border: 0;
    background: transparent;
    font-size: 16px;
    line-height: 1.2;
    color: #353433;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

.afyc-gs__input::placeholder {
    color: #9a948f;
}

.afyc-gs__input::-webkit-search-decoration,
.afyc-gs__input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
}

.afyc-gs__clear,
.afyc-gs__filters {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #353433;
    cursor: pointer;
    padding: 0;
}
.afyc-gs__filters {
    width: 40px;
    height: 40px;
}
.afyc-gs__filters svg {
    width: 24px;
    height: 24px;
}

.afyc-gs__clear[hidden] {
    display: none !important;
}

.afyc-gs__clear:hover,
.afyc-gs__filters:hover {
    background: rgba(0, 0, 0, 0.06);
}

.afyc-gs__submit {
    flex: 0 0 auto;
    height: 40px;
    padding: 0 18px;
    border: 0;
    border-radius: 10px;
    background: #e23737;
    color: #fff;
    font-size: 15px;
    font-weight: 400;
    font-family: Inter-Medium, Inter, system-ui, sans-serif;
    cursor: pointer;
    white-space: nowrap;
}

.afyc-gs__submit:hover {
    background: #f93c3c;
}

.afyc-gs__suggest {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    z-index: 40;
    max-height: min(60vh, 360px);
    overflow: auto;
    background: #fff;
    border: 1px solid #e8e4df;
    border-radius: 14px;
    box-shadow: 0 10px 28px rgba(53, 52, 51, 0.12);
}

.afyc-gs__suggest[hidden] {
    display: none !important;
}

.afyc-gs__suggest-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 12px 4px;
}

.afyc-gs__chip {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 12px;
    border-radius: 16px;
    border: 0;
    background: #f0eeeb;
    color: #353433;
    font-size: 14px;
    cursor: pointer;
}

.afyc-gs__chip:hover {
    background: #e4e0db;
}

.afyc-gs__suggest-list {
    list-style: none;
    margin: 0;
    padding: 4px 0 8px;
}

.afyc-gs__suggest-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 14px;
    border: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
    color: #353433;
    font-size: 15px;
    line-height: 1.3;
    box-sizing: border-box;
}

.afyc-gs__suggest-item:hover,
.afyc-gs__suggest-item.is-active {
    background: #f7f5f2;
}

.afyc-gs__suggest-item .afyc-gs__suggest-q {
    flex: 1 1 auto;
    min-width: 0;
}

.afyc-gs__suggest-item .afyc-gs__suggest-q b {
    font-weight: 700;
}

.afyc-gs__suggest-meta {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    color: #8a847f;
}

.afyc-gs__suggest-ico {
    flex: 0 0 auto;
    color: #9a948f;
}

.afyc-gs__suggest-empty {
    padding: 14px;
    color: #8a847f;
    font-size: 14px;
}

/* Overlay */
.afyc-gs-overlay {
    position: fixed;
    inset: 0;
    /* выше FAB корзины/избранного (~10040); снизу щель под bottom-nav */
    z-index: 11000;
    background: rgba(20, 18, 16, 0.45);
    display: flex;
    align-items: stretch;
    justify-content: center;
}

.afyc-gs-overlay[hidden] {
    display: none !important;
}

.afyc-gs-overlay__panel {
    width: min(520px, 100%);
    margin: 0 auto;
    background: #fff;
    display: flex;
    flex-direction: column;
    max-height: 100%;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.18);
    overflow: hidden;
}

/* Адаптив: окно выше bottom-nav (56px + safe-area) */
@media (max-width: 767px) {
    .afyc-gs-overlay {
        bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    }
    .afyc-gs-overlay__panel {
        max-height: 100%;
        border-radius: 0;
    }
    .afyc-gs-overlay__foot {
        padding-bottom: 12px;
    }
}

@media (min-width: 768px) {
    .afyc-gs-overlay {
        align-items: center;
        padding: 24px 12px;
    }
    .afyc-gs-overlay__panel {
        max-height: min(92vh, 720px);
        border-radius: 16px;
    }
}

.afyc-gs-overlay__head {
    display: grid;
    grid-template-columns: 44px 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid #eeeae6;
    flex: 0 0 auto;
}

.afyc-gs-overlay__title {
    margin: 0;
    text-align: center;
    font-size: 17px;
    font-weight: 600;
    color: #353433;
}

.afyc-gs-overlay__close,
.afyc-gs-overlay__reset {
    border: 0;
    background: transparent;
    cursor: pointer;
    color: #353433;
    font-size: 14px;
    padding: 8px;
}

.afyc-gs-overlay__reset {
    color: #6b6562;
    font-weight: 500;
}

.afyc-gs-overlay__body {
    flex: 1 1 auto;
    overflow: auto;
    padding: 8px 16px 20px;
}

.afyc-gs-overlay__section {
    padding: 14px 0;
    border-bottom: 1px solid #f0eeeb;
}

.afyc-gs-overlay__section:last-child {
    border-bottom: 0;
}

.afyc-gs-overlay__label {
    margin: 0 0 10px;
    font-size: 15px;
    font-weight: 600;
    color: #353433;
    text-align: center;
}

.afyc-gs-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.afyc-gs-chip {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 14px;
    border-radius: 18px;
    border: 1px solid #e4e0db;
    background: #f7f5f2;
    color: #353433;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.afyc-gs-chip:hover {
    background: #efebe6;
}

.afyc-gs-chip.is-active,
.afyc-gs-chip[aria-pressed="true"] {
    border-color: #e23737;
    background: #fdecec;
    color: #c92f2f;
}

.afyc-gs-row {
    display: grid;
    gap: 10px 12px;
    align-items: end;
}

.afyc-gs-row--3 {
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.3fr) minmax(0, 0.9fr);
}

.afyc-gs-row--2 {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.afyc-gs-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.afyc-gs-field__caption {
    font-size: 16px;
    color: #8a847f;
    line-height: 1.2;
}

.afyc-gs-field select.js-afyc-gs-select {
    width: 100%;
    height: 40px;
    border: 1px solid #e4e0db;
    border-radius: 8px;
    padding: 0 10px;
    background: #fff;
    color: #353433;
    font-size: 14px;
}

.afyc-gs-overlay .select2-container {
    width: 100% !important;
}

.afyc-gs-overlay .select2-container .select2-selection--single {
    position: relative !important;
    height: 40px !important;
    border: 1px solid #e4e0db !important;
    border-radius: 8px !important;
    background: #fff !important;
}

/* Компактно: без стрелки select2, clear у правого края (~10px), текст до крестика. */
.afyc-gs-overlay .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 38px !important;
    padding-left: 8px !important;
    padding-right: 28px !important; /* место под × */
    color: #353433;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.afyc-gs-overlay .select2-container--default .select2-selection--single .select2-selection__arrow {
    display: none !important;
}

.afyc-gs-overlay .select2-container--default .select2-selection--single .select2-selection__clear {
    position: absolute !important;
    left: auto !important;
    right: 6px !important;
    top: 0 !important;
    float: none !important;
    margin: 0 !important;
    width: 18px;
    height: 38px !important;
    line-height: 38px !important;
    font-size: 15px;
    text-align: center;
}

/* Без clear (радиус) — отступ справа ~10px */
.afyc-gs-overlay select[data-allow-clear="0"] + .select2-container
    .select2-selection--single .select2-selection__rendered {
    padding-right: 10px !important;
}

.afyc-gs-overlay .select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #9a948f;
}

.afyc-gs-overlay .select2-dropdown {
    border-color: #e4e0db;
    border-radius: 8px;
    z-index: 11001;
}

/* FAB корзины/избранного не поверх фильтров */
body.afyc-gs-overlay-open .header-bottom .header-fav,
body.afyc-gs-overlay-open .header-bottom .header-cart,
body.afyc-gs-overlay-open .wm-cart-fab,
body.afyc-gs-overlay-open .wm-fav-fab,
body.afyc-gs-overlay-open [class*="cart-fab"],
body.afyc-gs-overlay-open [class*="fav-fab"] {
    visibility: hidden !important;
    pointer-events: none !important;
}

.afyc-gs-overlay .select2-search--dropdown .select2-search__field {
    border-radius: 6px;
    border-color: #e4e0db;
    padding: 6px 8px;
}

.afyc-gs-overlay__foot {
    flex: 0 0 auto;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #eeeae6;
    background: #fff;
    display: flex;
    justify-content: center;
}

.afyc-gs-overlay__apply {
    width: 60%;
    min-width: 140px;
    max-width: 400px;
    height: 48px;
    border: 0;
    border-radius: 12px;
    background: #e23737;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.afyc-gs-overlay__apply:hover {
    background: #c92f2f;
}

body.afyc-gs-overlay-open {
    overflow: hidden;
}

/* SERP */
.afyc-gs-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 12px 0 48px;
}

/* Крошки — как AP/oils (на случай перекрытия portal style.css) */
.afyc-gs-page .breadcrumb-wrap.afyc-gs-breadcrumb,
.afyc-gs-page .afyc-gs-breadcrumb {
    padding: 16px 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 2px;
}

.afyc-gs-page .afyc-gs-breadcrumb a,
.afyc-gs-page .afyc-gs-breadcrumb > .breadcrumb-list-item-current,
.afyc-gs-page .afyc-gs-breadcrumb > .breadcrumb-list-split {
    display: inline-flex;
    align-items: center;
    line-height: 1.2;
}

.afyc-gs-page .afyc-gs-breadcrumb a {
    text-decoration: none;
}

.afyc-gs-page .afyc-gs-breadcrumb a:hover .breadcrumb-list-item {
    text-decoration: underline;
}

.afyc-gs-page .afyc-gs-breadcrumb .breadcrumb-list-item {
    color: #e23737;
    font-size: 1.35rem;
    font-family: "Inter-Regular", Inter, system-ui, sans-serif;
    line-height: 1.2;
}

.afyc-gs-page .afyc-gs-breadcrumb .breadcrumb-list-item-current {
    color: #aaa6a1;
    font-size: 1.35rem;
    font-family: "Inter-Regular", Inter, system-ui, sans-serif;
    line-height: 1.2;
}

.afyc-gs-page .afyc-gs-breadcrumb .breadcrumb-list-split {
    color: #e23737;
    font-size: 1.2rem;
    padding: 0 4px;
    line-height: 1.2;
}

.afyc-gs-page__bar {
    margin: 0 0 16px;
}

.afyc-gs-page__meta {
    margin: 0 0 16px;
    font-size: 14px;
    line-height: 1.45;
    color: #6b6562;
}

.afyc-gs-page__meta strong {
    color: #353433;
}

.afyc-gs-page__meta-split,
.afyc-gs-page__meta-vehicle,
.afyc-gs-page__meta-note {
    color: #8a8480;
}

.afyc-gs-page__interest {
    margin: 28px 0 8px;
}
.afyc-gs-page__interest-title {
    margin: 0 0 14px;
    font-size: 20px;
    line-height: 1.3;
    font-family: Inter-SemiBold, Inter, system-ui, sans-serif;
    font-weight: 600;
    color: #1a1a1a;
}
.afyc-gs-page__feed {
    margin-top: 8px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: clip;
}

/* Как oils/AP: 2 в ряд на мобилке, 4 на desktop */
.afyc-gs-feed.ap-home-feed-grid,
.afyc-gs-feed {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    list-style: none;
    margin: 0 0 28px;
    padding: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    align-items: stretch;
}

@media (min-width: 900px) {
    .afyc-gs-feed.ap-home-feed-grid,
    .afyc-gs-feed {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 14px;
    }
}

.afyc-gs-feed > li,
.afyc-gs-feed__item {
    margin: 0;
    min-width: 0;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-self: stretch;
    box-sizing: border-box;
}

.afyc-gs-feed > li > .mp-ads-listing-card,
.afyc-gs-feed > li > .wm-card,
.afyc-gs-feed__item > .mp-ads-listing-card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    flex: 1 1 auto;
    height: 100%;
    box-sizing: border-box;
}

.afyc-gs-feed .mp-ads-listing-card.catalog__items {
    max-width: none;
    height: 100%;
}

.afyc-gs-page__empty,
.afyc-gs-page__stub {
    padding: 28px 16px;
    border: 1px dashed #ddd8d2;
    border-radius: 12px;
    background: #faf9f8;
    color: #6b6562;
    text-align: center;
    font-size: 15px;
    line-height: 1.45;
}

.afyc-gs-page__stub strong {
    color: #353433;
}

.afyc-gs-card-fallback {
    padding: 16px;
    border: 1px solid #ebe6e0;
    border-radius: 10px;
    background: #fff;
}

.afyc-gs-top100 {
    margin: 28px 0 8px;
}

.afyc-gs-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px 16px;
    margin: 28px 0 12px;
    flex-wrap: wrap;
}

.afyc-gs-pager__link {
    color: #e23737;
    font-weight: 600;
    text-decoration: none;
    font-size: 1.2rem;
}

.afyc-gs-pager__link:hover {
    text-decoration: underline;
}

.afyc-gs-pager__status {
    color: #6b6562;
    font-size: 1.2rem;
}

.afyc-gs-pager__nums {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.afyc-gs-pager__num {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid #e2ddd7;
    color: #353433;
    text-decoration: none;
    font-size: 14px;
    box-sizing: border-box;
}

.afyc-gs-pager__num:hover {
    border-color: #e23737;
    color: #e23737;
}

.afyc-gs-pager__num.is-current {
    background: #e23737;
    border-color: #e23737;
    color: #fff;
    font-weight: 600;
}

.afyc-gs-pager__ellipsis {
    color: #8a8480;
    padding: 0 2px;
}

@media (max-width: 560px) {
    .afyc-gs__form {
        flex-wrap: nowrap;
        gap: 6px;
    }
    .afyc-gs__submit {
        padding: 0 14px;
        font-size: 14px;
    }
    .afyc-gs__field {
        height: 44px;
        border-radius: 22px;
    }
    .afyc-gs__submit {
        height: 44px;
        border-radius: 22px;
    }
}

/*
 * Адаптив SERP: верх H1 ≈ 150px viewport.
 * container-page уже даёт padding-top: 72px (fixed header);
 * остаётся ~78px до текста H1 (ниже FAB избранного/корзины).
 */
@media (max-width: 1008px) {
    body.afyc-gs-page-body.td-parts-page .wrap.afyc-gs-page,
    body.afyc-gs-page-body.td-parts-page .td-wizard-wrap.afyc-gs-page {
        margin-top: 78px !important;
    }

    body.afyc-gs-page-body .td-wizard-shell.afyc-hub {
        padding-top: 0 !important;
    }

    body.afyc-gs-page-body .afyc-gs-page {
        padding-top: 0;
    }

    body.afyc-gs-page-body .afyc-gs-page .afyc-hub__intro,
    body.afyc-gs-page-body .afyc-gs-page .afyc-hub__h1 {
        padding-top: 0 !important;
        margin-top: 0;
    }

    body.afyc-gs-page-body .afyc-gs-page .afyc-hub__intro--pick {
        margin-bottom: 12px;
    }
}
