/*
 * Epil: каталог студий /listings (виджет epil_catalog_explorer) — фильтр слева, карточки, карта справа.
 * Фильтр, звёзды, цена, значки, маркеры и балуны — из map-explorer.css (корень .epil-mapx.epil-catx), здесь раскладка и карточки.
 */
html body .epil-mapx.epil-catx {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr) minmax(340px, 34%);
    align-items: start;
    gap: 20px;
    height: auto;
    min-height: 0;
    padding: 24px;
    /* Фильтр и карта прилипают под закреплённой шапкой темы (90 px) с отступом 20 px */
    --catx-top: 110px;
}

.epil-catx [hidden] {
    display: none !important;
}

.epil-catx__bar {
    display: none;
}

/* ===== Фильтр: компактнее, прилипает сбоку ===== */
@media (min-width: 861px) {
    .epil-catx .epil-mapx__filters {
        position: sticky;
        top: var(--catx-top);
    }

    .epil-catx .epil-mapx__form {
        height: auto;
        max-height: calc(100vh - var(--catx-top) - 20px);
        padding: 16px 16px 0;
    }

    .epil-catx .epil-mapx__footer {
        margin: auto -16px 0;
        padding: 12px 16px;
    }
}

.epil-catx .epil-mapx__group {
    padding: 12px 0;
}

.epil-catx .epil-mapx__switch {
    padding: 4px 0;
}

.epil-catx .epil-mapx__chip.is-extra {
    display: none;
}

.epil-catx .is-expanded .epil-mapx__chip.is-extra {
    display: inline;
}

.epil-catx .epil-mapx__found {
    font-size: 13px;
}

/* ===== Список ===== */
.epil-catx__results {
    min-width: 0;
}

.epil-catx__toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.epil-catx__count {
    margin: 0;
    font-family: var(--epil-font-heading, inherit);
    font-size: 16px;
    font-weight: 700;
}

.epil-catx__sort {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--mx-muted);
    font-size: 13px;
}

html body .epil-catx__sort select {
    height: 38px;
    padding: 0 32px 0 12px;
    border: 1px solid var(--mx-line);
    border-radius: 10px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6' fill='none' stroke='%23374b5c' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 10px center / 14px;
    color: var(--mx-text);
    font-size: 13px;
    font-weight: 600;
    appearance: none;
    cursor: pointer;
}

.epil-catx__list {
    display: grid;
    gap: 14px;
}

/* ===== Карточка ===== */
.epil-catx-card {
    display: grid;
    grid-template-columns: 210px minmax(0, 1fr);
    gap: 16px;
    padding: 12px;
    border: 1.5px solid transparent;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .06);
    transition: box-shadow .15s ease, transform .15s ease, border-color .15s ease;
}

.epil-catx-card:hover,
.epil-catx-card.is-active {
    box-shadow: 0 14px 34px rgba(15, 23, 42, .12);
    transform: translateY(-2px);
}

.epil-catx-card.is-active {
    border-color: var(--mx-accent);
}

.epil-catx-card.is-premium {
    border-color: var(--mx-premium);
    background: linear-gradient(135deg, #fff 60%, var(--mx-premium-soft));
}

html body .epil-catx-card__img {
    position: relative;
    display: block;
    min-height: 168px;
    overflow: hidden;
    border-radius: 14px;
    background: var(--mx-soft);
}

.epil-catx-card__img img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .3s ease;
}

/* Студия без фото — первая буква названия на фирменном градиенте */
.epil-catx-card__noimg {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--mx-accent-soft), #ecd5f7);
    color: var(--mx-accent-dark);
    font-family: var(--epil-font-heading, inherit);
    font-size: 56px;
    font-weight: 800;
}

.epil-catx-card:hover .epil-catx-card__img img {
    transform: scale(1.04);
}

.epil-catx-card__badges {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.epil-catx-card__img .epil-marks {
    top: 10px;
    right: 10px;
}

.epil-catx-card.is-vip {
    border-color: #facc15;
    background: linear-gradient(135deg, #fff 60%, #fefce8);
}

.epil-catx-card__body {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
    padding: 4px 4px 2px 0;
}

.epil-catx-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

html body .epil-catx-card__name {
    margin: 0;
    font-family: var(--epil-font-heading, inherit);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
}

html body .epil-catx-card__name a {
    color: var(--mx-text);
    text-decoration: none;
}

html body .epil-catx-card__name a:hover {
    color: var(--mx-accent-dark);
}

.epil-catx-card__head .epil-mapx-price {
    flex: 0 0 auto;
    margin-top: 3px;
}

.epil-catx-card__norating {
    color: var(--mx-muted);
    font-size: 13px;
}

html body .epil-catx-card__address {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin: 0;
    color: var(--mx-muted);
    font-size: 13px;
    line-height: 1.4;
}

.epil-catx-card__address svg {
    flex: 0 0 auto;
    width: 15px;
    height: 15px;
    margin-top: 1px;
    color: var(--mx-accent-dark);
}

html body .epil-catx-card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.epil-catx-card__tags li {
    margin: 0;
    padding: 3px 9px;
    border-radius: 7px;
    background: var(--mx-soft);
    font-size: 12px;
    line-height: 1.4;
}

.epil-catx-card__tags li.is-more {
    color: var(--mx-muted);
    cursor: help;
}

.epil-catx-card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
    padding-top: 4px;
}

html body .epil-catx-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 38px;
    padding: 0 16px;
    border: 1.5px solid #d86eec;
    border-radius: 10px;
    background: #fff;
    color: #b44fc9;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    transition: background-color .15s ease, color .15s ease;
}

html body .epil-catx-btn:hover {
    background: #fbeefe;
    color: #b44fc9;
}

html body .epil-catx-btn--primary {
    background: #d86eec;
    color: #fff;
}

html body .epil-catx-btn--primary:hover {
    background: #c86ad9;
    color: #fff;
}

html body .epil-catx-btn--icon {
    width: 38px;
    padding: 0;
    border-color: var(--mx-line);
}

html body .epil-catx-btn--icon svg {
    width: 18px;
    height: 18px;
}

html body .epil-catx-btn--icon.is-telegram {
    color: #229ed9;
}

html body .epil-catx-btn--icon.is-whatsapp {
    color: #25d366;
}

html body .epil-catx-btn--icon:hover {
    border-color: currentColor;
    background: #fff;
}

/* ===== Пусто и «Показать ещё» ===== */
.epil-catx__empty {
    padding: 32px 20px;
    border-radius: 20px;
    background: #fff;
    text-align: center;
}

.epil-catx__empty p {
    margin: 0 0 12px;
    font-weight: 600;
}

html body .epil-catx__more {
    display: block;
    width: 100%;
    height: 46px;
    margin-top: 16px;
    border: 1.5px solid #d86eec;
    border-radius: 12px;
    background: #fff;
    color: #b44fc9;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

html body .epil-catx__more:hover {
    background: #fbeefe;
}

/* ===== Карта ===== */
/* Колонка тянется на всю высоту списка — иначе она равна высоте карты, и карте некуда «прилипать» */
.epil-catx__map-col {
    align-self: stretch;
    min-width: 0;
}

.epil-catx__map-sticky {
    position: sticky;
    top: var(--catx-top);
    height: calc(100vh - var(--catx-top) - 20px);
    min-height: 420px;
    overflow: hidden;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .06);
}

html body .epil-catx__map-close {
    display: none;
}

/* ===== Адаптив ===== */
@media (max-width: 1399px) {
    html body .epil-mapx.epil-catx {
        grid-template-columns: 260px minmax(0, 1fr) minmax(300px, 32%);
        gap: 16px;
        padding: 16px;
    }

    .epil-catx-card {
        grid-template-columns: 170px minmax(0, 1fr);
        gap: 14px;
    }

    html body .epil-catx-card__name {
        font-size: 16px;
    }
}

/* Карта прячется за кнопку «Карта» и открывается на весь экран */
@media (max-width: 1199px) {
    html body .epil-mapx.epil-catx {
        grid-template-columns: 260px minmax(0, 1fr);
    }

    .epil-catx__bar {
        display: flex;
        grid-column: 1 / -1;
        gap: 8px;
    }

    html body .epil-catx__map-toggle {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 10px 16px;
        border: 0;
        border-radius: 12px;
        background: #fff;
        box-shadow: 0 6px 16px rgba(15, 23, 42, .1);
        color: var(--mx-text);
        font-size: 14px;
        font-weight: 700;
        cursor: pointer;
    }

    .epil-catx__map-toggle svg {
        width: 18px;
        height: 18px;
        color: var(--mx-accent-dark);
    }

    .epil-catx__map-col {
        display: none;
    }

    .epil-catx.is-map-open .epil-catx__map-col {
        position: fixed;
        inset: 0;
        z-index: 100002;
        display: block;
        background: #fff;
    }

    .epil-catx.is-map-open .epil-catx__map-sticky {
        top: 0;
        height: 100%;
        border-radius: 0;
    }

    html body .epil-catx.is-map-open .epil-catx__map-close {
        position: absolute;
        top: 12px;
        right: 12px;
        z-index: 1000;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        border-radius: 50%;
        background: #fff;
        box-shadow: 0 6px 16px rgba(15, 23, 42, .2);
        font-size: 26px;
    }

    html.epil-catx-lock,
    html.epil-catx-lock body {
        overflow: hidden;
    }
}

@media (max-width: 860px) {
    html body .epil-mapx.epil-catx {
        display: flex;
        flex-direction: column;
        gap: 12px;
        padding: 12px;
    }

    .epil-catx__results {
        width: 100%;
    }
}

@media (max-width: 600px) {
    .epil-catx-card {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 10px;
    }

    html body .epil-catx-card__img {
        min-height: 0;
        aspect-ratio: 16 / 9;
    }

    .epil-catx__toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .epil-catx__sort select {
        flex: 1 1 auto;
    }
}
