/**
 * Jselect Popup - стили модального попапа выбора направления
 * Адаптивно для ПК и мобильных устройств
 */

/* Оверлей */
.jselect-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s;
    background: rgba(12, 33, 51, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.jselect-popup-overlay.jselect-popup--visible {
    opacity: 1;
    visibility: visible;
}

/* Модальное окно */
.jselect-popup {
    width: 100%;
    max-width: 420px;
    max-height: 85vh;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.2), 0 8px 16px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.97) translateY(8px);
    transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
}

.jselect-popup-overlay.jselect-popup--visible .jselect-popup {
    transform: scale(1) translateY(0);
}

/* Шапка с поиском */
.jselect-popup__header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid #e6e6e6;
    background: #f8f9fa;
    flex-shrink: 0;
}

.jselect-popup__search {
    flex: 1;
    padding: 12px 16px;
    font-size: 16px;
    line-height: 1.4;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    background: #fff;
    color: #0c2133;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.jselect-popup__search:focus {
    border-color: #0c73fe;
    box-shadow: 0 0 0 3px rgba(12, 115, 254, 0.15);
}

.jselect-popup__search::placeholder {
    color: #999;
}

.jselect-popup__close {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    line-height: 1;
    color: #666;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    transition: color 0.2s, background 0.2s, border-color 0.2s;
}

.jselect-popup__close:hover {
    color: #0c73fe;
    background: #f0f7ff;
    border-color: #0c73fe;
}

/* Список опций */
.jselect-popup__list {
    flex: 1;
    overflow: hidden;
    min-height: 200px;
}

.jselect-popup__list-inner {
    padding: 12px;
    max-height: 60vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.jselect-popup__list-inner::-webkit-scrollbar {
    width: 6px;
}

.jselect-popup__list-inner::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 3px;
}

.jselect-popup__list-inner::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.jselect-popup__list-inner::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* Элементы списка внутри попапа */
.jselect-popup__list-inner .select_js_ulli {
    padding: 12px 14px;
    margin-bottom: 4px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    overflow: visible !important; /* иконки не обрезаются */
}

.jselect-popup__list-inner .select_js_ulli:hover {
    background: #f0f7ff;
}

.jselect-popup__list-inner .select_js_ulli.active {
    background: #e8f0ff;
    color: #0c73fe;
}

.jselect-popup__list-inner .select_js_ulli_ins {
    display: flex !important;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
}

.jselect-popup__list-inner .select_js_ulli_ins .select_ico,
.jselect-popup__list-inner .select_ico,
.jselect-popup__list-inner .currency_logo {
    position: relative !important;
    top: auto !important;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    flex-shrink: 0 !important;
    background-size: contain !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
}

.jselect-popup__list-inner .select_js_ulli_ins .select_txt,
.jselect-popup__list-inner .select_txt {
    font-size: 15px;
    color: #000;
    margin-left: 0 !important;
    flex: 1;
    min-width: 0;
}

.jselect-popup__list-inner .select_js_ulli .select_js_abs {
    display: none !important;
}

.jselect-popup__list-inner .select_js_ulli_ins .select_js_abs {
    display: none !important;
}

/* Блокировка скролла body при открытом попапе */
body.jselect-popup-open {
    overflow: hidden;
}

/* ----- Мобильная адаптация ----- */
@media (max-width: 600px) {
    .jselect-popup-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .jselect-popup {
        max-width: 100%;
        max-height: 90vh;
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
    }

    .jselect-popup-overlay.jselect-popup--visible .jselect-popup {
        transform: translateY(0);
    }

    .jselect-popup__header {
        padding: 16px 20px;
    }

    .jselect-popup__search {
        padding: 14px 18px;
        font-size: 16px; /* предотвращает zoom на iOS при фокусе */
    }

    .jselect-popup__close {
        width: 48px;
        height: 48px;
        font-size: 32px;
    }

    .jselect-popup__list-inner {
        max-height: 65vh;
        padding: 12px 20px 24px;
        padding-bottom: max(24px, env(safe-area-inset-bottom));
    }

    .jselect-popup__list-inner .select_js_ulli {
        padding: 14px 16px;
    }

    .jselect-popup__list-inner .select_ico,
    .jselect-popup__list-inner .select_js_ulli_ins .select_ico {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
    }

    .jselect-popup__list-inner .select_txt {
        font-size: 16px;
    }
}

/* Тёмная тема */
body.-darkTheme .jselect-popup {
    background: #1a2a3a;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
}

body.-darkTheme .jselect-popup__header {
    background: #0f1c28;
    border-bottom-color: #2a3f52;
}

body.-darkTheme .jselect-popup__search {
    background: #1a2a3a;
    border-color: #2a3f52;
    color: #e8ecf0;
}

body.-darkTheme .jselect-popup__search::placeholder {
    color: #7a8a9a;
}

body.-darkTheme .jselect-popup__close {
    background: #1a2a3a;
    border-color: #2a3f52;
    color: #a0aeb8;
}

body.-darkTheme .jselect-popup__close:hover {
    color: #00aff0;
    background: #0f2434;
    border-color: #00aff0;
}

body.-darkTheme .jselect-popup__list-inner .select_js_ulli {
    color: #e8ecf0;
}

body.-darkTheme .jselect-popup__list-inner .select_js_ulli:hover {
    background: #243648;
}

body.-darkTheme .jselect-popup__list-inner .select_js_ulli.active {
    background: #1a3a52;
    color: #00aff0;
}
