/* ============================================================
   km-overrides.css — точечные доработки поверх темы plitka
   (shop.kerama-marazzi.ru) под нужды kmshop:
   текстовый логотип, наш умный фильтр, корзина, модалки.
   Подключается ПОСЛЕДНИМ.
   ============================================================ */

:root {
    --km-red: #e30613;
}

/* ---------- Текстовый логотип (вместо их растрового logo.svg) ---------- */
.km-logo {
    display: inline-block;
    text-decoration: none;
    line-height: 1;
}
.km-logo:hover { text-decoration: none; }
.km-logo__brand {
    display: block;
    font-family: 'Bebas Neue', 'Inter', sans-serif;
    font-size: 44px;
    letter-spacing: 0.04em;
    color: #293132;
    white-space: nowrap;
}
.km-logo__brand em {
    font-style: normal;
    color: var(--km-red);
}
.km-logo__sub {
    display: block;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #5E5F64;
    margin-top: 2px;
}
/* Логотип в футере (тёмный фон) */
.footer .km-logo__brand { color: #fff; }
.footer .km-logo__sub { color: rgba(255, 255, 255, 0.6); }

@media (max-width: 991.98px) {
    .km-logo__brand { font-size: 30px; }
    .km-logo__sub { font-size: 9px; }
}

/* ---------- Счётчик корзины в шапке ---------- */
.cart .cart-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    margin-left: 4px;
    border-radius: 9px;
    background: var(--km-red);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
}

/* ---------- Live-поиск (выпадающие подсказки) ---------- */
.header-search { position: relative; }
.title-search-result {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    display: none;
    background: #fff;
    border: 1px solid #EEEEEE;
    border-radius: 4px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    max-height: 420px;
    overflow-y: auto;
}
.title-search-result.is-open { display: block; }
.title-search-result__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    color: #293132;
    border-bottom: 1px solid #F0F1F5;
}
.title-search-result__item:hover { background: #F0F1F5; text-decoration: none; color: #293132; }
.title-search-result__img { width: 40px; height: 40px; object-fit: contain; flex-shrink: 0; }
.title-search-result__name { font-size: 13px; }
.title-search-result__name mark { background: none; color: var(--km-red); padding: 0; }
.title-search-result__meta { display: flex; gap: 8px; font-size: 12px; color: #5E5F64; }
.title-search-result__price { color: var(--km-red); font-weight: 600; }
.title-search-result__empty { padding: 12px; font-size: 13px; color: #5E5F64; }
.title-search-result__all {
    display: block;
    padding: 10px 12px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--km-red);
}
.title-search-result__all:hover { color: var(--km-red); }

/* ---------- Наш умный фильтр в стилистике list-group ---------- */
.filter-block .filter-block__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 15px;
    background: none;
    border: none;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #293132;
    cursor: pointer;
    text-align: left;
}
.filter-block .filter-block__head:hover { color: var(--km-red); }
.filter-block__toggle-icon { width: 14px; height: 14px; flex-shrink: 0; }
.filter-block__toggle-icon-vert { transition: opacity 0.2s; }
.filter-block.is-open .filter-block__toggle-icon-vert { opacity: 0; }
.filter-block__body { padding: 0 15px 10px; }
.filter-block__subtitle { display: block; font-size: 12px; font-weight: 400; color: #5E5F64; }

.filter-search { position: relative; margin-bottom: 8px; }
.filter-search__icon {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    color: #979aa0;
}
.filter-search__input {
    width: 100%;
    padding: 6px 8px 6px 28px;
    border: 1px solid #EEEEEE;
    border-radius: 4px;
    font-size: 13px;
}
.filter-block__quick-actions { display: flex; gap: 12px; margin-bottom: 6px; }
.filter-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    background: none;
    border: none;
    font-size: 12px;
    cursor: pointer;
}
.filter-link-btn svg { width: 12px; height: 12px; }
.filter-link-btn--success { color: #2e9e5b; }
.filter-link-btn--danger { color: var(--km-red); }

.filter-options { list-style: none; margin: 0; padding: 0; }
.filter-options li { margin: 0; }
.filter-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    margin: 0;
    font-size: 13px;
    color: #293132;
    cursor: pointer;
}
.filter-option__input { display: none; }
.filter-option__box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    border: 1px solid #c4c9d1;
    border-radius: 3px;
    color: #fff;
    background: #fff;
}
.filter-option__box svg { width: 10px; height: 10px; opacity: 0; }
.filter-option__input:checked + .filter-option__box { background: var(--km-red); border-color: var(--km-red); }
.filter-option__input:checked + .filter-option__box svg { opacity: 1; }
.filter-option__label { flex: 1; }
.filter-option__flag { width: 16px; height: auto; margin-right: 4px; vertical-align: middle; }
.filter-option__count { color: #979aa0; font-size: 12px; }
.filter-option--disabled { opacity: 0.45; pointer-events: none; }
.filter-more {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 0;
    background: none;
    border: none;
    text-align: left;
    font-size: 12px;
    color: var(--km-red);
    cursor: pointer;
}

/* Цена: двойной range-слайдер */
.range-slider__bubbles { display: flex; justify-content: space-between; margin-bottom: 6px; }
.range-slider__bubble { font-size: 12px; color: #5E5F64; }
.range-slider__track { position: relative; height: 18px; }
.range-slider__track::before {
    content: "";
    position: absolute;
    left: 0; right: 0;
    top: 8px;
    height: 3px;
    background: #EEEEEE;
    border-radius: 2px;
}
.range-slider__progress {
    position: absolute;
    top: 8px;
    height: 3px;
    background: var(--km-red);
    border-radius: 2px;
}
.range-slider__input {
    position: absolute;
    left: 0;
    width: 100%;
    top: 0;
    height: 18px;
    margin: 0;
    -webkit-appearance: none;
    appearance: none;
    background: none;
    pointer-events: none;
}
.range-slider__input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--km-red);
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    pointer-events: auto;
    cursor: pointer;
}
.range-slider__input::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--km-red);
    border: 2px solid #fff;
    pointer-events: auto;
    cursor: pointer;
}
.range-slider__limits { display: flex; justify-content: space-between; font-size: 11px; color: #979aa0; }

/* Чипы активных фильтров */
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border: 1px solid #EEEEEE;
    border-radius: 20px;
    background: #fff;
    font-size: 12px;
    color: #293132;
    cursor: pointer;
}
.filter-chip:hover { border-color: var(--km-red); color: var(--km-red); }
.filter-chip__remove { width: 10px; height: 10px; }
.filter-block__actions { display: flex; justify-content: space-between; align-items: center; }

/* Кнопка «Показать» в фильтре */
.btn-km {
    display: inline-block;
    padding: 8px 18px;
    border: none;
    border-radius: 4px;
    background: var(--km-red);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
}
.btn-km:hover { background: #b20510; color: #fff; text-decoration: none; }

/* Мобильная шторка фильтров */
.catalog-page__filter-toggle { margin-bottom: 15px; }
@media (max-width: 991.98px) {
    .filter-menu-mobile-anchor { display: block; }
    aside.sidebar-content .filter-drawer {
        position: fixed;
        inset: 0;
        z-index: 1050;
        background: #fff;
        overflow-y: auto;
        padding: 15px;
        transform: translateX(-100%);
        transition: transform 0.25s;
    }
    aside.sidebar-content .filter-drawer.is-open { transform: translateX(0); }
    .filter-drawer__topbar {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 15px;
        font-weight: 700;
    }
    body.filters-open { overflow: hidden; }
}
@media (min-width: 992px) {
    .filter-drawer__topbar { display: none; }
    .catalog-page__filter-toggle { display: none; }
}

/* ---------- Карточка товара: бейдж скидки ---------- */
.collections-product { position: relative; }
.product-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
    padding: 3px 8px;
    border-radius: 3px;
    background: var(--km-red);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}
.collections-product .price .old {
    color: #979aa0;
    font-size: 13px;
    text-decoration: line-through;
}

/* ---------- Корзина (наша разметка, стилистика plitka) ---------- */
.cart-card {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid #EEEEEE;
}
.cart-card__media { width: 90px; flex-shrink: 0; text-align: center; }
.cart-card__media img { max-width: 100%; max-height: 110px; object-fit: contain; }
.cart-card__info { flex: 1 1 220px; }
.cart-card__title {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #293132;
    margin-bottom: 4px;
}
.cart-card__title:hover { color: var(--km-red); text-decoration: none; }
.cart-card__meta { font-size: 12px; color: #5E5F64; margin-bottom: 4px; }
.cart-card__meta a { color: #00B4D8; }
.cart-card__sku { font-size: 12px; color: #979aa0; margin: 0; }
.cart-card__sku span { color: #5E5F64; }
.cart-card__price { text-align: right; }
.cart-card__price-now { display: block; font-size: 16px; font-weight: 700; color: #293132; }
.cart-card__price-old { font-size: 12px; color: #979aa0; text-decoration: line-through; }
.cart-card__price-unit { font-size: 12px; color: #5E5F64; }
.cart-card__actions { display: flex; gap: 6px; }
.cart-card__action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid #EEEEEE;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
}
.cart-card__action:hover { border-color: var(--km-red); }
.cart-card__action svg { width: 16px; height: 16px; }

.qty { display: inline-flex; align-items: stretch; border: 1px solid #EEEEEE; border-radius: 4px; overflow: hidden; }
.qty__btn {
    width: 32px;
    border: none;
    background: #F0F1F5;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.qty__btn svg { width: 12px; height: 12px; }
.qty__btn:hover { background: var(--km-red); color: #fff; }
.qty__input {
    width: 52px;
    border: none;
    text-align: center;
    font-size: 14px;
    padding: 6px 4px;
    -moz-appearance: textfield;
}
.qty__input::-webkit-outer-spin-button,
.qty__input::-webkit-inner-spin-button { -webkit-appearance: none; }

.cart-summary {
    background: #F0F1F5;
    border-radius: 6px;
    padding: 20px;
}
.cart-summary__list { margin: 0 0 15px; }
.cart-summary__row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 14px;
    color: #293132;
}
.cart-summary__row dt { font-weight: 400; }
.cart-summary__row dd { margin: 0; font-weight: 600; }
.cart-summary__row--total {
    border-top: 1px solid #ddd;
    margin-top: 8px;
    padding-top: 12px;
    font-size: 18px;
}
.cart-summary__row--total dd { color: var(--km-red); }
.cart-summary__cta { width: 100%; }

/* Панели оформления заказа */
.cart-panel {
    background: #fff;
    border: 1px solid #EEEEEE;
    border-radius: 6px;
    margin-bottom: 20px;
}
.cart-panel__inner { padding: 20px; }
.cart-panel__title { font-size: 18px; font-weight: 700; margin-bottom: 5px; }
.cart-panel__lead { font-size: 13px; color: #5E5F64; }
.cart-form__row { margin-bottom: 15px; }
.cart-form__row--2col { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
@media (max-width: 767.98px) { .cart-form__row--2col { grid-template-columns: 1fr; } }
.form-field { display: block; margin: 0; }
.form-field__label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: #293132; }
.form-field__hint { display: flex; gap: 6px; align-items: center; font-size: 12px; color: #979aa0; margin-top: 4px; }
.form-field__hint .ic { width: 14px; height: 14px; }
.cart-form__consents { display: flex; flex-direction: column; gap: 8px; }

.checkbox { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; cursor: pointer; margin: 0; }
.checkbox__input { display: none; }
.checkbox__box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    border: 1px solid #c4c9d1;
    border-radius: 3px;
    color: #fff;
    background: #fff;
    margin-top: 1px;
}
.checkbox__box svg { width: 11px; height: 11px; opacity: 0; }
.checkbox__input:checked + .checkbox__box { background: var(--km-red); border-color: var(--km-red); }
.checkbox__input:checked + .checkbox__box svg { opacity: 1; }
.checkbox__label a { color: #00B4D8; }

/* Табы доставки */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 15px; }
.tabs__btn {
    padding: 8px 16px;
    border: 1px solid #EEEEEE;
    border-radius: 4px;
    background: #fff;
    font-size: 13px;
    color: #293132;
    cursor: pointer;
    text-decoration: none;
}
.tabs__btn:hover { border-color: var(--km-red); color: var(--km-red); text-decoration: none; }
.tabs__btn.is-active {
    background: var(--km-red);
    border-color: var(--km-red);
    color: #fff;
}

/* Переключатели (toggle) доставки/оплаты */
.toggle-list { list-style: none; margin: 0; padding: 0; }
.toggle-item { padding: 10px 0; border-bottom: 1px solid #F0F1F5; }
.toggle-item:last-child { border-bottom: none; }
.toggle { display: flex; gap: 12px; cursor: pointer; margin: 0; }
.toggle__input { display: none; }
.toggle__track {
    position: relative;
    width: 38px;
    height: 20px;
    flex-shrink: 0;
    border-radius: 10px;
    background: #c4c9d1;
    transition: background 0.2s;
    margin-top: 2px;
}
.toggle__thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    transition: left 0.2s;
}
.toggle__input:checked + .toggle__track { background: var(--km-red); }
.toggle__input:checked + .toggle__track .toggle__thumb { left: 20px; }
.toggle.is-disabled { opacity: 0.5; pointer-events: none; }
.toggle__title { display: block; font-size: 14px; font-weight: 600; color: #293132; }
.toggle__desc { display: block; font-size: 12px; color: #5E5F64; }

.order-form-status {
    padding: 10px 14px;
    border-radius: 4px;
    font-size: 13px;
    margin: 10px 0;
}
.order-form-status[data-state="error"] { background: #ffefee; color: var(--km-red); }
.order-form-status[data-state="loading"] { background: #F0F1F5; color: #293132; }

/* Промокод */
.cart-promo { display: flex; gap: 8px; }
.cart-promo__input { flex: 1; }
.cart-summary__promo-label { font-size: 13px; color: #5E5F64; }

/* ---------- Модалки (наши .modal из /api/form, /api/formviz) ---------- */
.modal { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; }
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.5); }
.modal__panel {
    position: relative;
    background: #fff;
    border-radius: 8px;
    padding: 30px;
    max-width: 460px;
    width: calc(100% - 30px);
    max-height: calc(100vh - 60px);
    overflow-y: auto;
}
.modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    cursor: pointer;
}
.modal__close svg { width: 16px; height: 16px; }
.modal__title { font-size: 20px; font-weight: 700; margin-bottom: 10px; }
.modal__submit { width: 100%; }
body.modal-open { overflow: hidden; }
.order-result__text { font-size: 14px; color: #5E5F64; }

/* ---------- 404 ---------- */
.error-page { text-align: center; padding: 40px 0; }
.error-page__title { font-size: 28px; font-weight: 700; margin-bottom: 10px; }
.error-page__subtitle { color: #5E5F64; margin-bottom: 25px; }

/* ---------- Текстовые страницы ---------- */
.text-page { padding-bottom: 40px; }
.text-page h1, .text-page h2 { font-weight: 700; }
.text-page p, .text-page li { font-size: 14px; color: #293132; }

/* ---------- Чипы размеров/цветов в карточке коллекции ---------- */
.size-chip {
    display: inline-block;
    padding: 2px 8px;
    margin: 2px;
    border: 1px solid #EEEEEE;
    border-radius: 3px;
    font-size: 11px;
    color: #5E5F64;
}
.color-chip {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin: 2px;
    border-radius: 3px;
    border: 1px solid #ddd;
}

/* ---------- Миниатюры галереи (product/collection) ---------- */
.product-gallery-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.product-gallery-thumb {
    width: 64px;
    height: 64px;
    padding: 2px;
    border: 1px solid #EEEEEE;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
}
.product-gallery-thumb img { width: 100%; height: 100%; object-fit: contain; }
.product-gallery-thumb.is-active { border-color: var(--km-red); }

/* ---------- Код товара: копирование ---------- */
.js-copy-code { cursor: pointer; border-bottom: 1px dashed #979aa0; }
.js-copy-code.is-copied { color: #2e9e5b; border-bottom-color: #2e9e5b; }

/* ---------- Инфо-страницы (наследие старой вёрстки) ---------- */
.content-page__head { margin-bottom: 20px; }
.content-page__title, .contacts-page__title {
    font-size: 26px;
    font-weight: 700;
    color: #293132;
}
.content-page__section { margin-bottom: 25px; }
.contacts-page__head { margin-bottom: 20px; }

.accordion { list-style: none; margin: 0; padding: 0; }
.accordion__item { border-bottom: 1px solid #EEEEEE; }
.accordion__details summary::-webkit-details-marker { display: none; }
.accordion__summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    padding: 14px 0;
    cursor: pointer;
    font-weight: 600;
    color: #293132;
    list-style: none;
}
.accordion__summary:hover { color: var(--km-red); }
.accordion__icon {
    position: relative;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}
.accordion__icon::before,
.accordion__icon::after {
    content: "";
    position: absolute;
    background: var(--km-red);
    top: 7px;
    left: 0;
    width: 16px;
    height: 2px;
}
.accordion__icon::after { transform: rotate(90deg); transition: transform 0.2s; }
.accordion__details[open] .accordion__icon::after { transform: rotate(0); }
.accordion__content { padding: 0 0 16px; color: #5E5F64; font-size: 14px; }

/* Контакты */
.contacts-side__list { list-style: none; margin: 0 0 20px; padding: 0; }
.contact-item { display: flex; gap: 12px; margin-bottom: 16px; }
.contact-item__icon { width: 22px; flex-shrink: 0; color: #00B4D8; }
.contact-item__icon svg { width: 22px; height: 22px; }
.contact-item__title { font-size: 15px; font-weight: 700; margin-bottom: 2px; }
.contact-item__text { font-size: 14px; color: #293132; margin: 0; }
.contact-item__text a { color: #00B4D8; }
.contact-item__link { font-size: 13px; color: #00B4D8; background: none; border: none; padding: 0; cursor: pointer; }
.requisites { margin: 0; }
.requisites__row { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0; font-size: 13px; }
.requisites__row dt { color: #979aa0; }
.requisites__row dd { margin: 0; color: #293132; }
.contacts-side__action { margin: 15px 0; }
.route-block { margin-bottom: 20px; }
.route-block__head { font-weight: 700; color: #293132; }
.route-block__list { color: #5E5F64; font-size: 14px; }
.contacts-main__title { font-size: 18px; font-weight: 700; margin-bottom: 12px; }
.contacts-page__grid { display: block; }

/* Инфо-страницы: типовые заголовки/таблицы */
.text-page h1 { font-size: 26px; }
.text-page h2 { font-size: 20px; margin-top: 20px; }
.text-page h3 { font-size: 17px; margin-top: 16px; }
.text-page table { width: 100%; margin-bottom: 15px; border-collapse: collapse; }
.text-page td, .text-page th { padding: 8px 10px; border: 1px solid #EEEEEE; font-size: 13px; }
.text-page img { max-width: 100%; height: auto; }
.fw-semi-bold { font-weight: 600; }

/* Умный fit изображений карточек (вытянутые пропорции) */
.img-wrap--contain img { object-fit: contain !important; }
