/* Модальное окно выбора города с анимацией вылета из dropdown */

/* Обертка модального окна */
.city-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: none;
    pointer-events: none;
}

.city-modal.active {
    display: block;
    pointer-events: auto;
}

/* Затемненный фон */
.city-modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
    transition: background-color 0.7s ease, backdrop-filter 0.7s ease;
    pointer-events: none;
}

.city-modal.active .city-modal__overlay {
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    pointer-events: auto;
}

/* Контейнер модального окна - НОРМАЛЬНЫЕ РАЗМЕРЫ! */
.city-modal__content {
    position: fixed;
    background: #ffffff;
    border-radius: 16px;
    padding: 32px;
    width: 480px;
    max-width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 10001;
    
    /* Начальная позиция - где dropdown */
    transform: scale(0.2);
    transition: transform 1.1s cubic-bezier(0.34, 1.56, 0.64, 1), left 1.1s ease, top 1.1s ease;
}

.city-modal.active .city-modal__content {
    /* Финальная позиция - центр экрана */
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(1);
}

/* Анимация закрытия */
.city-modal.closing .city-modal__content {
    /* Не переопределяем transform: его задаёт JS, чтобы точно попасть в центр dropdown */
    transition: transform 1.1s cubic-bezier(0.6, -0.28, 0.735, 0.045), left 1.1s ease, top 1.1s ease;
}

/* В режиме закрытия не скрываем внутренние элементы, чтобы не было "пустого" белого блока */
.city-modal.closing .city-modal__title,
.city-modal.closing .city-modal__body,
.city-modal.closing .city-modal__cities,
.city-modal.closing .city-modal__city-btn,
.city-modal.closing .city-modal__icon,
.city-modal.closing .city-modal__city-name {
    opacity: 1 !important;
    transform: none !important;
}

.city-modal.closing .city-modal__overlay {
    background-color: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
}

/* Заголовок */
.city-modal__header {
    text-align: center;
    margin-bottom: 24px;
    animation: slideDown 0.5s ease-out 0.3s both;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.city-modal__title {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
    line-height: 1.3;
}

/* Тело модального окна */
.city-modal__body {
    margin-top: 20px;
}

.city-modal__cities {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Кнопки городов с отложенной анимацией */
.city-modal__city-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 24px;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 18px;
    font-weight: 500;
    color: #333;
    width: 100%;
    opacity: 0;
    transform: translateX(-20px);
}

.city-modal.active .city-modal__city-btn:nth-child(1) {
    animation: slideInLeft 0.4s ease-out 0.5s both;
}

.city-modal.active .city-modal__city-btn:nth-child(2) {
    animation: slideInLeft 0.4s ease-out 0.6s both;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.city-modal__city-btn:hover {
    background: #fff;
    border-color: #3498db;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.2);
}

.city-modal__city-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(52, 152, 219, 0.2);
}

.city-modal__icon {
    width: 24px;
    height: 24px;
    color: #3498db;
    flex-shrink: 0;
}

.city-modal__city-name {
    font-size: 18px;
    font-weight: 500;
}

/* Адаптация для планшетов */
@media (max-width: 768px) {
    .city-modal__content {
        padding: 28px 24px;
        width: 420px;
        max-width: 90%;
    }

    .city-modal__title {
        font-size: 22px;
    }

    .city-modal__city-btn {
        padding: 14px 20px;
        font-size: 17px;
    }

    .city-modal__city-name {
        font-size: 17px;
    }

    .city-modal__icon {
        width: 22px;
        height: 22px;
    }
}

/* Адаптация для мобильных устройств */
@media (max-width: 480px) {
    .city-modal__content {
        padding: 24px 20px;
        width: 340px;
        max-width: 85%;
        border-radius: 12px;
    }

    .city-modal__title {
        font-size: 20px;
    }

    .city-modal__body {
        margin-top: 16px;
    }

    .city-modal__cities {
        gap: 10px;
    }

    .city-modal__city-btn {
        padding: 14px 16px;
        font-size: 16px;
        border-radius: 10px;
        gap: 10px;
    }

    .city-modal__city-name {
        font-size: 16px;
    }

    .city-modal__icon {
        width: 20px;
        height: 20px;
    }
}

/* Очень маленькие экраны */
@media (max-width: 360px) {
    .city-modal__content {
        padding: 20px 16px;
        width: 90%;
    }

    .city-modal__title {
        font-size: 18px;
    }

    .city-modal__city-btn {
        padding: 12px 14px;
        font-size: 15px;
    }

    .city-modal__city-name {
        font-size: 15px;
    }
}

/* Предотвращение прокрутки страницы при открытом модальном окне */
body.city-modal-open {
    overflow: hidden;
}

/* Подсветка dropdown при появлении модального окна */
.your_city.highlight,
#currentCityName.highlight,
.your_city_name.highlight {
    position: relative;
}

.your_city.highlight::after,
#currentCityName.highlight::after,
.your_city_name.highlight::after {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border: 2px solid #3498db;
    border-radius: 8px;
    animation: pulse 1.5s ease-in-out infinite;
    pointer-events: none;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
}


