/* --- CSS Переменные (будут заданы из PHP) --- */
:root {
    --ecs-primary-color: #E53935;   /* Основной цвет (ссылки, активные элементы) */
    --ecs-secondary-color: #424242; /* Второстепенный цвет (кнопки, фон) */
}

/* --- Контейнер шорткода --- */
.ecs-container {
    position: relative;
    display: inline-block;
}
.ecs-current-city {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: var(--ecs-primary-color);
    font-weight: 500;
    transition: color 0.2s ease;
}
.ecs-current-city:hover {
    color: #333;
}
.ecs-current-city svg {
    flex-shrink: 0;
}

/* --- Всплывающая подсказка (Popover) --- */
.ecs-popover {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 12px;
    width: 290px;
    max-width: 90vw;
    background: #1e1e1e;
    color: #fff;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 18px;
    z-index: 10000;
    box-shadow: 0 8px 25px rgba(0,0,0,0.5);
    text-align: left;
    box-sizing: border-box;
}
.ecs-popover.active {
    display: block;
}
.ecs-popover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 20px;
    border: 8px solid transparent;
    border-bottom-color: #1e1e1e;
}
.ecs-popover-text {
    font-size: 16px;
    margin: 0 0 15px 0;
    line-height: 1.4;
}
.ecs-popover-buttons {
    display: flex;
    gap: 10px;
}
.ecs-popover-btn {
    flex-grow: 1;
    border: none;
    padding: 10px 15px;
    font-size: 14px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}
.ecs-btn-confirm {
    background-color: var(--ecs-primary-color);
    color: #fff;
}
.ecs-btn-confirm:hover {
    opacity: 0.85;
}
.ecs-btn-decline {
    background-color: var(--ecs-secondary-color);
    color: #fff;
}
.ecs-btn-decline:hover {
    opacity: 0.85;
}
.ecs-popover-close {
    position: absolute;
    top: 5px;
    right: 8px;
    background: none;
    border: none;
    color: #888;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}
.ecs-popover-close:hover {
    color: #fff;
}

/* --- Модальное окно --- */
.ecs-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(18, 18, 18, 0.8);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 99998;
    display: flex; /* Изменено с none на flex для управления через opacity */
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden; /* Скрываем полностью, когда неактивно */
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.ecs-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}
.ecs-modal-content {
    position: relative;
    display: flex;
    flex-direction: column;
    background-color: #1e1e1e;
    color: #fff;
    padding: 25px 30px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 90%;
    max-width: 700px; /* Увеличили для комфорта */
    max-height: 80vh;
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}
.ecs-modal-overlay.active .ecs-modal-content {
    transform: scale(1);
}
.ecs-modal-content h2 {
    font-size: 24px;
    margin: 0 0 20px 0;
    color: #fff;
    text-align: center;
    flex-shrink: 0;
}
.ecs-modal-close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: #888;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    padding: 5px;
}
.ecs-modal-close-btn:hover {
    color: #fff;
}

/* --- Поиск --- */
.ecs-modal-search {
    margin-bottom: 20px;
    flex-shrink: 0;
}
#ecs-city-search-input {
    width: 100%;
    padding: 12px 15px;
    font-size: 16px;
    background-color: #333;
    border: 1px solid #555;
    border-radius: 6px;
    color: #fff;
    box-sizing: border-box;
}
#ecs-city-search-input:focus {
    outline: none;
    border-color: var(--ecs-primary-color);
}

/* --- Вкладки --- */
.ecs-modal-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid #444;
    padding-bottom: 15px;
    flex-shrink: 0;
}
.ecs-tab-btn {
    background: none;
    border: 2px solid transparent;
    color: #ccc;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    transition: all 0.2s ease;
}
.ecs-tab-btn:hover {
    background-color: #333;
    color: #fff;
}
.ecs-tab-btn.active {
    color: var(--ecs-primary-color);
    border-bottom: 2px solid var(--ecs-primary-color);
    background-color: transparent;
    border-radius: 0;
}

/* --- Список городов --- */
.ecs-city-list-wrapper {
    overflow-y: auto;
    padding-right: 10px; /* Отступ для скроллбара */
}
.ecs-city-list {
    list-style: none;
    padding: 0;
    margin: 0;
    column-count: 3; /* Отображаем в 3 колонки */
    column-gap: 25px;
}
.ecs-city-list li a {
    display: block;
    padding: 6px 0;
    color: #ddd;
    text-decoration: none;
    border-radius: 4px;
    transition: color 0.2s ease;
    font-size: 15px;
}
.ecs-city-list li a:hover {
    color: var(--ecs-primary-color);
}
.ecs-city-list .ecs-city-item.hidden {
    display: none; /* Для фильтрации поиска */
}
.ecs-city-list .ecs-no-results {
    color: #888;
    text-align: center;
    padding: 20px 0;
    display: none; /* Скрыт по умолчанию */
}

/* --- Адаптивность --- */
@media (max-width: 768px) {
    .ecs-modal-content {
        padding: 20px;
        max-height: 85vh;
    }
    .ecs-city-list {
        column-count: 2; /* 2 колонки на планшетах */
    }
}

@media (max-width: 480px) {
    .ecs-city-list {
        column-count: 1; /* 1 колонка на мобильных */
    }
    .ecs-modal-content {
        width: 95%;
        padding: 20px 15px;
    }
    .ecs-modal-content h2 {
        font-size: 20px;
    }
}