/* =========================================================
   Попапы определения города — city-popup.css
   ========================================================= */

/* Базовый контейнер (оба попапа) */
.city-popup {
    position: fixed;
    top: 74px;          /* чуть ниже шапки */
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    z-index: 9000;

    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.14), 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 20px 22px 18px;
    width: 300px;

    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
}

/* Якорим попап к левому краю кнопки карты */
@media (min-width: 769px) {
    .city-popup {
        left: auto;
        right: auto;
        /* JS выставит left динамически */
        transform: translateY(-8px);
    }
}

/* Видимое состояние */
.city-popup.is-visible {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
}

/* ── Попап 1: подтверждение ── */
.city-popup__question {
    margin: 0 0 16px;
    font-size: 15px;
    color: #1a1a1a;
    font-weight: 500;
    line-height: 1.4;
}

.city-popup__question span {
    color: #6C8DB4;
}

.city-popup__actions {
    display: flex;
    gap: 8px;
}

.city-popup__btn {
    flex: 1;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: background 0.15s ease, color 0.15s ease;
    white-space: nowrap;
}

.city-popup__btn--primary {
    background: linear-gradient(135deg, rgba(0, 79, 187, 0.4), rgba(1, 116, 198, 0.4), rgba(1, 152, 204, 0.4)), linear-gradient(0deg, #6C8DB4, #6C8DB4);
    color: #fff;
    transition: 0.3s;
}

.city-popup__btn--primary:hover {
    background: #6C8DB4;
}

.city-popup__btn--ghost {
    background: #f2f2f2;
    color: #444;
}

.city-popup__btn--ghost:hover {
    background: #e6e6e6;
}

/* ── Попап 2: выбор города ── */
.city-popup--select {
    width: 320px;
    padding: 20px 20px 16px;
}

.city-popup__title {
    margin: 0 0 14px;
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
}

/* Поле поиска */
.city-popup__search-wrap {
    position: relative;
    margin-bottom: 4px;
}

.city-popup__search {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 12px 9px 36px;
    border: 1.5px solid #6c8cb451;
    border-radius: 8px;
    font-size: 14px;
    color: #1a1a1a;
    outline: none;
    transition: border-color 0.15s ease;
    background: #fafafa url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23aaa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") no-repeat 10px center;
    background-size: 16px;
}

.city-popup__search:focus {
    border-color: #6C8DB4;
    background-color: #fff;
}

/* Список результатов поиска */
.city-popup__results {
    list-style: none;
    margin: 0 0 4px;
    padding: 0;
    max-height: 150px;
    overflow-y: auto;
}

.city-popup__results li button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 10px;
    background: none;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    color: #1a1a1a;
    cursor: pointer;
    transition: background 0.12s ease;
}

.city-popup__results li button:hover,
.city-popup__results li button:focus {
    background: #fff0ec;
    color: #6C8DB4;
    outline: none;
}

/* Популярные города */
.city-popup__popular {
    margin-top: 12px;
    border-top: 1px solid #f0f0f0;
    padding-top: 12px;
}

.city-popup__popular-label {
    margin: 0 0 8px;
    font-size: 12px;
    color: #999;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.city-popup__popular-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.city-popup__popular-btn {
    padding: 5px 11px;
    border-radius: 20px;
    border: 1.5px solid #e8e8e8;
    background: #fff;
    font-size: 13px;
    color: #333;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.city-popup__popular-btn:hover {
    border-color: #6C8DB4;
    color: #6C8DB4;
    background: #f2f5f8;
}

/* Скроллбар в результатах */
.city-popup__results::-webkit-scrollbar { width: 4px; }
.city-popup__results::-webkit-scrollbar-track { background: transparent; }
.city-popup__results::-webkit-scrollbar-thumb { background: #ddd; border-radius: 4px; }

/* Мобильная адаптация */
@media (max-width: 768px) {
    .city-popup,
    .city-popup--select {
        left: 16px !important;
        right: 16px !important;
        width: auto !important;
        transform: translateY(-8px);
    }

    .city-popup.is-visible {
        transform: translateY(0);
    }
}
