/* ============================================================
   С-АГРОСЕРВИС
   CITY SELECTOR 2026
   ============================================================ */


/* ============================================================
   ОСНОВА
   ============================================================ */

.sa-city-selector {
    position: relative;

    min-width: 110px;
}


.sa-city-selector__label {
    margin-bottom: 1px;

    color: #8996a2;

    font-size: 10px;
    line-height: 1.2;
}


.sa-city-selector__button {
    padding: 2px 0;

    border: 0;

    display: flex;
    align-items: center;

    gap: 5px;

    background: transparent;

    color: var(--sa-blue);

    cursor: pointer;

    font-weight: 700;
}


.sa-city-selector__button > svg {
    width: 16px;
    height: 16px;

    flex: 0 0 auto;

    fill: var(--sa-blue);
}


.sa-city-selector__current {
    max-width: 130px;

    overflow: hidden;

    white-space: nowrap;
    text-overflow: ellipsis;
}


.sa-city-selector__arrow {
    width: 7px;
    height: 7px;

    margin: -3px 0 0 2px;

    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;

    transform: rotate(45deg);

    transition: transform .2s ease;
}


.sa-city-selector__button[aria-expanded="true"]
.sa-city-selector__arrow {
    margin-top: 4px;

    transform: rotate(225deg);
}


/* ============================================================
   СКРЫТЫЙ ИСТОЧНИК MODX
   ============================================================ */

.sa-city-source {
    display: none !important;
}


/* ============================================================
   ПАНЕЛЬ
   ============================================================ */

.sa-city-panel {
    position: absolute;

    left: -10px;
    top: calc(100% + 13px);

    z-index: 1500;

    width: 620px;
    max-width: calc(100vw - 30px);

    max-height: min(680px, calc(100vh - 150px));

    padding: 18px;

    overflow-y: auto;

    border: 1px solid #dfe5eb;
    border-radius: 14px;

    background: #fff;

    color: #17202b;

    box-shadow:
        0 22px 55px rgba(12, 29, 45, .20);

    text-align: left;
}


.sa-city-panel[hidden] {
    display: none !important;
}


/* ============================================================
   ЗАГОЛОВОК + ПОИСК
   ============================================================ */

.sa-city-panel__top {
    display: grid;

    grid-template-columns:
        minmax(170px, auto)
        minmax(240px, 1fr);

    align-items: center;

    gap: 18px;

    margin-bottom: 17px;
}


.sa-city-panel__top > strong {
    color: #17202b;

    font-size: 17px;
    line-height: 1.25;
}


.sa-city-search-wrap {
    position: relative;
}


.sa-city-search {
    width: 100%;
    height: 40px;

    padding:
        0
        40px
        0
        13px;

    border: 1px solid #d8e0e6;
    border-radius: 9px;

    outline: 0;

    background: #fff;

    color: #17202b;

    font-size: 13px;

    transition:
        border-color .2s ease,
        box-shadow .2s ease;
}


.sa-city-search::placeholder {
    color: #98a3ad;
}


.sa-city-search:focus {
    border-color: #087baa;

    box-shadow:
        0 0 0 3px rgba(8,123,170,.10);
}


.sa-city-search-wrap svg {
    position: absolute;

    right: 12px;
    top: 50%;

    width: 18px;
    height: 18px;

    transform: translateY(-50%);

    fill: #85929e;

    pointer-events: none;
}


/* ============================================================
   ПОДЗАГОЛОВКИ
   ============================================================ */

.sa-city-panel__subtitle {
    margin: 14px 0 8px;

    color: #536270;

    font-size: 11px;
    font-weight: 800;

    line-height: 1.3;

    letter-spacing: .04em;

    text-transform: uppercase;
}


/* ============================================================
   ПОПУЛЯРНЫЕ ГОРОДА
   ============================================================ */

.sa-city-popular {
    margin-bottom: 10px;
}


.sa-city-popular[hidden] {
    display: none !important;
}


.sa-city-popular__grid {
    display: flex;
    flex-wrap: wrap;

    gap: 7px;
}


.sa-city-popular__grid .sa-city-item {
    min-height: 36px;

    width: auto;

    padding: 7px 13px;

    border: 1px solid #dfe5eb;
    border-radius: 8px;

    display: inline-flex;
    align-items: center;

    background: #fff;

    color: #253340;

    font-size: 12px;
    font-weight: 650;

    white-space: nowrap;

    transition:
        color .2s ease,
        background .2s ease,
        border-color .2s ease;
}


.sa-city-popular__grid .sa-city-item:hover {
    border-color: #b7cbd8;

    background: #eaf5f9;

    color: #09658b;
}


/* ============================================================
   ГОРОДА СТРАНЫ
   ============================================================ */

.sa-city-country {
    margin-top: 7px;
}


.sa-city-country[hidden] {
    display: none !important;
}


.sa-city-grid {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    column-gap: 16px;
    row-gap: 1px;

    align-items: start;
}


/* ============================================================
   ГОРОД
   ============================================================ */

.sa-city-grid .sa-city-item {
    min-width: 0;
    min-height: 30px;

    padding: 6px 5px;

    border-radius: 6px;

    display: flex;
    align-items: flex-start;
    justify-content: flex-start;

    color: #1f2c38;

    font-size: 12px;
    font-weight: 500;

    line-height: 1.45;

    text-align: left;

    overflow-wrap: anywhere;

    transition:
        color .15s ease,
        background .15s ease;
}


.sa-city-grid .sa-city-item:hover {
    background: #f3f6f8;

    color: #087baa;
}


/* Именно это исправляет Нижний Новгород,
   Ростов-на-Дону, Санкт-Петербург и т.п. */

.sa-city-item {
    text-align: left !important;

    justify-content: flex-start !important;
}


/* ============================================================
   БЕЛАРУСЬ
   ============================================================ */

.sa-city-country--belarus {
    margin-top: 16px;

    padding-top: 15px;

    border-top: 1px solid #dfe5eb;
}


.sa-city-country--belarus
.sa-city-panel__subtitle {
    margin-top: 0;

    color: #394957;
}


/* ============================================================
   ПОИСК
   ============================================================ */

.sa-city-item.is-hidden {
    display: none !important;
}


.sa-city-empty {
    padding: 26px 10px;

    color: #768491;

    font-size: 13px;

    text-align: center;
}


.sa-city-empty[hidden] {
    display: none !important;
}


/* ============================================================
   SCROLLBAR
   ============================================================ */

.sa-city-panel {
    scrollbar-width: thin;

    scrollbar-color:
        #c5d0d8
        transparent;
}


.sa-city-panel::-webkit-scrollbar {
    width: 8px;
}


.sa-city-panel::-webkit-scrollbar-track {
    background: transparent;
}


.sa-city-panel::-webkit-scrollbar-thumb {
    border: 2px solid #fff;
    border-radius: 10px;

    background: #c5d0d8;
}


/* ============================================================
   ПЛАНШЕТ
   ============================================================ */

@media (max-width: 1100px) {

    .sa-city-selector {
        display: none;
    }

}


/* ============================================================
   МОБИЛЬНЫЙ ВАРИАНТ —
   если позже вернём выбор города в mobile menu
   ============================================================ */

@media (max-width: 700px) {

    .sa-city-panel {
        width: min(
            94vw,
            540px
        );

        left: 0;

        padding: 15px;

        max-height: 70vh;
    }


    .sa-city-panel__top {
        grid-template-columns: 1fr;

        gap: 10px;
    }


    .sa-city-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));

        column-gap: 10px;
    }

}