/* Кнопка выбора валюты */
.currency-selector__button {
    width: 100%;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #FFFFFF;
    border: 1px solid #E8E8E8;
    box-shadow: 0px 4px 80px rgba(0, 0, 0, 0.06);
    border-radius: 10px;
    cursor: pointer;
    transition: opacity 0.3s ease;
    font-family: 'Mazzard', sans-serif;
}

.currency-selector__button:hover {
    opacity: 0.7;
}

.currency-selector__img {
    width: 30px;
    height: 30px;
    margin-right: 8px;
}

.currency-selector__name {
    flex: 1;
    text-align: left;
    color: #12141D;
    font-weight: 500;
    font-size: 24px;
}

.currency-selector__change {
    color: #2B59FF;
    font-weight: 500;
    font-size: 16px;
}

/* Модальное окно */
.currency-modal {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    align-items: flex-start;
    justify-content: center;
    padding: 30px 20px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, background-color 0.3s ease, z-index 0s 0.3s;
    will-change: opacity;
    -webkit-overflow-scrolling: touch;
}

.currency-modal--active {
    z-index: 99999;
    opacity: 1;
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.5);
    transition: opacity 0.3s ease, background-color 0.3s ease, z-index 0s 0s;
}

.currency-modal.closing {
    opacity: 0;
    pointer-events: none;
    background: rgba(0, 0, 0, 0);
    transition: opacity 0.3s ease, background-color 0.3s ease, z-index 0s 0.3s;
}

.currency-modal__content {
    position: relative;
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    background: #FFFFFF;
    border-radius: 20px;
    padding: 30px;
    overflow-y: auto;
    z-index: 2;
    margin: auto;
    opacity: 0;
    transform: scale(0.9) translateY(-20px) translateZ(0);
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform, opacity;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
}

.currency-modal--active .currency-modal__content {
    opacity: 1;
    transform: scale(1) translateY(0) translateZ(0);
}

.currency-modal.closing .currency-modal__content {
    opacity: 0;
    transform: scale(0.9) translateY(-20px) translateZ(0);
}

.currency-modal__close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    font-size: 32px;
    color: #8C8D91;
    cursor: pointer;
    transition: color 0.3s ease;
    outline: none;
}

.currency-modal__close:hover {
    color: #2B59FF;
}

.currency-modal__close:focus {
    outline: none;
}

.currency-modal__title {
    margin: 0 0 20px 0;
    font-family: 'Mazzard', sans-serif;
    font-weight: 600;
    font-size: 24px;
    color: #12141D;
}

/* Строка с фильтрами и поиском */
.currency-modal__filter-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 15px;
}

/* Фильтры */
.currency-modal__filters {
    display: flex;
    gap: 8px;
    flex: 1;
}

.currency-filter {
    padding: 8px 16px;
    background: #F4F5FA;
    border: none;
    border-radius: 20px;
    font-weight: 600;
    font-size: 13px;
    color: #8C8D91;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
}

.currency-filter:hover {
    background: #EAEFFF;
    color: #2B59FF;
}

.currency-filter:focus {
    outline: none;
}

.currency-filter--active {
    background: #2B59FF;
    color: #FFFFFF;
    box-shadow: 0px 4px 16px rgba(43, 89, 255, 0.4);
}

/* Поиск валют */
.currency-search {
    position: relative;
    display: flex;
    align-items: center;
    width: 40px;
    height: 40px;
    background: #F4F5FA;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.currency-search:hover {
    background: #EAEFFF;
}

.currency-search.active {
    width: 250px;
    cursor: default;
    background: #FFFFFF;
    border: 2px solid #2B59FF;
    box-shadow: 0px 4px 16px rgba(43, 89, 255, 0.2);
}

.currency-search__icon {
    position: absolute;
    left: 11px;
    color: #8C8D91;
    flex-shrink: 0;
    pointer-events: none;
    transition: color 0.3s ease;
}

.currency-search.active .currency-search__icon {
    color: #2B59FF;
}

.currency-search__input {
    width: 100%;
    height: 100%;
    padding: 0 15px 0 38px;
    border: none;
    background: transparent;
    font-family: 'Mazzard', sans-serif;
    font-size: 14px;
    color: #12141D;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.currency-search.active .currency-search__input {
    opacity: 1;
    pointer-events: auto;
}

.currency-search__input:focus {
    outline: none;
}

.currency-search__input::placeholder {
    color: #8C8D91;
}

/* Секции */
.currency-section {
    margin-bottom: 30px;
}

.currency-section[data-section="bank"] {
    display: block;
}

.currency-section[data-section="crypto"] {
    display: block;
}

.currency-section.hidden {
    display: none;
}

.currency-section__title {
    margin: 0 0 15px 0;
    font-family: 'Mazzard', sans-serif;
    font-weight: 600;
    font-size: 13px;
    color: #8C8D91;
    letter-spacing: 1px;
}

/* Сетка карточек */
.currency-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

/* Карточка валюты */
.currency-card {
    position: relative;
    padding: 12px;
    background: #FFFFFF;
    border: 2px solid #E8E8E8;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.currency-card:hover {
    border-color: #2B59FF;
    box-shadow: 0px 4px 16px rgba(43, 89, 255, 0.2);
}

.currency-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.currency-card.selected {
    border-color: #2B59FF;
    background: #F8F9FF;
}

.currency-card__check {
    display: none;
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    background: #47D12B;
    border-radius: 50%;
}

.currency-card__check::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.currency-card.selected .currency-card__check {
    display: block;
}

.currency-card__icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.currency-card__name {
    font-weight: 500;
    font-size: 14px;
    color: #12141D;
}

/* Адаптивность */
@media (max-width: 768px) {
    .currency-modal__content {
        margin: 20px;
        padding: 25px 15px;
        max-height: 85vh;
        /* Упрощённая анимация для мобильных */
        transform: scale(0.95) translateY(-10px) translateZ(0);
    }

    .currency-modal--active .currency-modal__content {
        transform: scale(1) translateY(0) translateZ(0);
    }

    .currency-modal.closing .currency-modal__content {
        transform: scale(0.95) translateY(-10px) translateZ(0);
    }

    .currency-modal__title {
        font-size: 20px;
        margin-bottom: 15px;
    }

    .currency-modal__filter-row {
        flex-wrap: wrap;
        gap: 8px;
        transition: all 0.3s ease;
        position: relative;
    }

    .currency-modal__filter-row.search-active .currency-modal__filters {
        opacity: 0;
        pointer-events: none;
        transform: translateY(-20px);
    }

    .currency-modal__filters {
        flex: 1;
        min-width: 0;
        transition: all 0.3s ease;
    }

    .currency-filter {
        font-size: 12px;
        padding: 7px 12px;
    }

    .currency-search {
        flex-shrink: 0;
        transition: all 0.3s ease;
    }

    .currency-search.active {
        position: absolute;
        top: 0;
        left: 15px;
        right: 15px;
        width: auto;
        z-index: 10;
    }

    .currency-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .currency-card {
        padding: 8px;
        gap: 6px;
    }

    .currency-card__icon {
        width: 20px;
        height: 20px;
    }

    .currency-card__name {
        font-size: 12px;
    }

    .currency-selector__name {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .currency-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 5px;
    }

    .currency-card {
        padding: 6px;
        gap: 5px;
    }

    .currency-card__icon {
        width: 18px;
        height: 18px;
    }

    .currency-card__name {
        font-size: 11px;
    }

    .currency-modal__filters {
        flex-wrap: wrap;
    }

    .currency-modal__content {
        padding: 20px 12px;
    }

    .currency-search {
        width: 36px;
        height: 36px;
    }

    .currency-search__icon {
        left: 9px;
    }

    .currency-search.active {
        top: 0;
        left: 12px;
        right: 12px;
    }
}

/* Красивый современный scrollbar */
.currency-modal__content {
    scrollbar-width: thin;
    scrollbar-color: rgba(43, 89, 255, 0.5) transparent;
}

.currency-modal__content::-webkit-scrollbar {
    width: 6px;
}

.currency-modal__content::-webkit-scrollbar-track {
    background: transparent;
    margin: 10px 0;
}

.currency-modal__content::-webkit-scrollbar-thumb {
    background: rgba(43, 89, 255, 0.3);
    border-radius: 100px;
    transition: all 0.3s ease;
}

.currency-modal__content::-webkit-scrollbar-thumb:hover {
    background: rgba(43, 89, 255, 0.6);
}

.currency-modal__content::-webkit-scrollbar-thumb:active {
    background: rgba(43, 89, 255, 0.8);
}
