/**
 * Стили для кастомного попапа выбора токенов
 */

/* Overlay (фон попапа) */
.currency-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(4px);
    overflow: hidden;
    -webkit-overflow-scrolling: touch;
    touch-action: none;
}

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

/* Контейнер попапа */
.currency-popup-container {
    background: #fff;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.currency-popup-overlay.active .currency-popup-container {
    transform: scale(1);
}

/* Заголовок попапа */
.currency-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.currency-popup-title {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    color: #000;
    font-family: "OpenRunde", sans-serif;
}

.currency-popup-close {
    background: transparent;
    border: none;
    color: #000;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
    border-radius: 50%;
}

.currency-popup-close:hover {
    color: #e53935;
    background: rgba(229, 57, 53, 0.1);
}

/* Поиск */
.currency-popup-search {
    padding: 15px 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.currency-popup-search-input {
    width: 100%;
    padding: 12px 20px;
    background: #1e2130;
    border: 1px solid #353b51;
    border-radius: 10px;
    color: #fff;
    font-size: 16px;
    font-family: "OpenRunde", sans-serif;
    outline: none;
    transition: border-color 0.3s ease;
}

.currency-popup-search-input:focus {
    border-color: #e53935;
}

.currency-popup-search-input::placeholder {
    color: #6b8199;
}

/* Контент попапа */
.currency-popup-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.currency-popup-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 0;
    max-height: calc(80vh - 180px);
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    will-change: scroll-position;
}

/* Стилизация скроллбара */
.currency-popup-list::-webkit-scrollbar {
    width: 6px;
}

.currency-popup-list::-webkit-scrollbar-track {
    background: #1e2130;
}

.currency-popup-list::-webkit-scrollbar-thumb {
    background: #353b51;
    border-radius: 3px;
}

.currency-popup-list::-webkit-scrollbar-thumb:hover {
    background: #4a5568;
}

/* Элемент списка */
.currency-popup-item {
    display: flex;
    align-items: center;
    padding: 15px 25px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    position: relative;
}

.currency-popup-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.currency-popup-item.active {
    background: rgba(229, 57, 53, 0.15);
}

.currency-popup-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #e53935;
}

.currency-popup-item.keyboard-active {
    background: rgba(229, 57, 53, 0.2);
}

/* Иконка валюты */
.currency-popup-item-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    flex-shrink: 0;
    margin-right: 15px;
}

/* Текст валюты */
.currency-popup-item-text {
    flex: 1;
    color: #000;
    font-size: 16px;
    font-weight: 500;
    font-family: "OpenRunde", sans-serif;
}

.currency-popup-item.active .currency-popup-item-text {
    color: #2f2828;
    font-weight: 600;
}

/* Блокировка скролла body при открытом попапе */
body.currency-popup-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* Для iOS - дополнительная блокировка скролла */
@supports (-webkit-touch-callout: none) {
    body.currency-popup-open {
        position: fixed;
        overflow: hidden;
        -webkit-overflow-scrolling: touch;
    }
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .currency-popup-container {
        width: 95%;
        max-height: 90vh;
        border-radius: 15px;
        height: auto;
    }
    
    .currency-popup-header {
        padding: 15px 20px;
        flex-shrink: 0;
    }
    
    .currency-popup-title {
        font-size: 18px;
    }
    
    .currency-popup-search {
        padding: 12px 20px;
        flex-shrink: 0;
    }
    
    .currency-popup-content {
        min-height: 0;
        flex: 1 1 auto;
        overflow: hidden;
    }
    
    .currency-popup-list {
        max-height: calc(90vh - 140px);
        min-height: 200px;
        height: auto;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
        overflow-y: scroll;
        overflow-x: hidden;
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
    
    .currency-popup-item {
        padding: 12px 20px;
        -webkit-tap-highlight-color: rgba(229, 57, 53, 0.2);
        touch-action: manipulation;
    }
    
    .currency-popup-item-icon {
        width: 35px;
        height: 35px;
        margin-right: 12px;
    }
    
    .currency-popup-item-text {
        font-size: 15px;
    }
}

/* Анимация появления элементов */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.currency-popup-item {
    animation: fadeInUp 0.3s ease forwards;
}

.currency-popup-item:nth-child(1) { animation-delay: 0.01s; }
.currency-popup-item:nth-child(2) { animation-delay: 0.02s; }
.currency-popup-item:nth-child(3) { animation-delay: 0.03s; }
.currency-popup-item:nth-child(4) { animation-delay: 0.04s; }
.currency-popup-item:nth-child(5) { animation-delay: 0.05s; }
.currency-popup-item:nth-child(n+6) { animation-delay: 0.06s; }

