/* ============================================
   Exchange Form — bitfm.io
   Merged amount+currency, popup, 30s timer
   ============================================ */

/* -------- Container -------- */
.bf-ex {
    position: relative;
    margin: 0 auto 20px;
}

.bf-ex-form {
    position: relative;
}

.bf-ex-main {
    border-radius: 30px;
    background: #f3f7fc;
    box-shadow: 0 4px 4px rgba(31, 33, 36, .01);
    padding: 30px;
    position: relative;
}

.bf-ex-error {
    text-align: center;
    color: #6b8199;
    padding: 40px 20px;
    font: 15px 'Nunito', sans-serif;
}

/* -------- Columns -------- */
.bf-ex-columns {
    display: flex;
    gap: 20px;
    justify-content: space-between;
    flex-wrap: wrap;
    position: relative;
}

.bf-ex-col {
    flex: 1 0 0%;
    min-width: 0;
}

.bf-ex-col-label {
    color: #000;
    font: 500 24px 'JetBrains Mono', sans-serif;
    margin: 0 0 10px;
}

/* -------- Swap -------- */
.bf-ex-swap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 8px;
    flex-shrink: 0;
}

.bf-ex-swap-btn {
    width: 40px;
    height: 40px;
    border: 1px solid #e4e8ee;
    border-radius: 8px;
    background: #fff;
    color: #6b8199;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .3s;
}

.bf-ex-swap-btn:hover {
    border-color: #148EFF;
    color: #148EFF;
}

.bf-ex-swap-btn.disabled,
.bf-ex-swap-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    border-color: #e4e8ee;
    color: #6b8199;
}

.bf-ex-swap-btn svg {
    width: 20px;
    height: 20px;
}

/* -------- Merged input group: [amount] | [currency btn] -------- */
.bf-ex-input-wrap {
    position: relative;
    margin: 0 0 6px;
    z-index: 40;
}

.bf-ex-input-wrap.dd-open {
    z-index: 100;
}

.bf-ex-input-group {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #e4e8ee;
    border-radius: 8px;
    height: 56px;
    box-sizing: border-box;
    transition: border-color .3s;
}

.bf-ex-input-group:focus-within {
    border-color: #148EFF;
}

.bf-ex-input-group.error {
    border-color: #e27c83;
}

input.bf-ex-amount {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    outline: none;
    color: #000;
    font: 600 20px 'Nunito', sans-serif;
    padding: 0 0 0 16px;
    height: 54px;
    -moz-appearance: textfield;
    appearance: textfield;
}

.bf-ex-amount::-webkit-outer-spin-button,
.bf-ex-amount::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.bf-ex-amount::placeholder {
    color: #b0b8c4;
    font-weight: 400;
}

/* Currency button (right side of input group) */
.bf-ex-cur-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 14px;
    height: 100%;
    cursor: pointer;
    flex-shrink: 0;
    border-left: 1px solid #e4e8ee;
    border-radius: 0 8px 8px 0;
    transition: background .2s;
    user-select: none;
}

.bf-ex-cur-btn:hover {
    background: #f3f7fc;
}

.bf-ex-cur-logo {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: contain;
    background: #f3f7fc;
    flex-shrink: 0;
}

.bf-ex-cur-name {
    font: 500 14px 'Nunito', sans-serif;
    color: #000;
    white-space: nowrap;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bf-ex-cur-arrow {
    color: #6b8199;
    flex-shrink: 0;
    transition: transform .2s;
}

.bf-ex-input-wrap.dd-open .bf-ex-cur-arrow {
    transform: rotate(180deg);
}

/* Commission input (simpler, no dropdown) */
.bf-ex-com-input-group {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #e4e8ee;
    border-radius: 8px;
    height: 48px;
    box-sizing: border-box;
    padding: 0 16px;
    transition: border-color .3s;
}

.bf-ex-com-input-group:focus-within {
    border-color: #148EFF;
}

.bf-ex-com-input-group.error {
    border-color: #e27c83;
}

.bf-ex-com-input-group .bf-ex-amount {
    padding: 0;
    font-size: 16px;
    font-weight: 500;
    height: 46px;
}

.bf-ex-cur-code {
    font: 13px 'Nunito', sans-serif;
    color: #6b8199;
    flex-shrink: 0;
    margin-left: 8px;
}

/* -------- Amount error -------- */
.bf-ex-amount-error {
    font: 12px 'Nunito', sans-serif;
    color: #e27c83;
    margin: 2px 0 0;
}

.bf-ex-amount-error:empty {
    display: none;
}

.bf-ex-amount-error .js_amount {
    cursor: pointer;
    text-decoration: underline dotted;
    transition: color .15s;
}

.bf-ex-amount-error .js_amount:hover {
    color: #148EFF;
}

/* -------- Min / Max -------- */
.bf-ex-minmax {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    padding: 0 0 6px;
    font: 12px 'Nunito', sans-serif;
    color: #6b8199;
}

.bf-ex-minmax:empty {
    display: none;
}

.bf-ex-minmax span > span {
    color: #000;
}

.bf-ex-minmax .js_amount {
    cursor: pointer;
    transition: color .15s;
}

.bf-ex-minmax .js_amount:hover {
    color: #148EFF;
}

/* -------- Commission -------- */
.bf-ex-com {
    margin-top: 4px;
}

.bf-ex-com-text {
    color: #6b8199;
    font: 13px/16px 'Nunito', sans-serif;
    margin: 0 0 6px;
}

/* -------- Dropdown panel -------- */
.bf-ex-dd {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 200;
    background: #fff;
    border: 1px solid #148EFF;
    border-radius: 0 0 8px 8px;
    max-height: 360px;
    overflow: hidden;
    flex-direction: column;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
    margin-top: -1px;
}

.bf-ex-input-wrap.dd-open .bf-ex-dd {
    display: flex;
}

.bf-ex-input-wrap.dd-open .bf-ex-input-group {
    border-color: #148EFF;
    border-radius: 8px 8px 0 0;
}

/* Search */
.bf-ex-dd-search {
    padding: 8px 10px;
    border-bottom: 1px solid #e4e8ee;
    flex-shrink: 0;
}

.bf-ex-dd-search-input {
    width: 100%;
    background: #fff;
    border: 1px solid #e4e8ee;
    border-radius: 4px;
    padding: 8px 12px;
    color: #000;
    font: 14px 'Nunito', sans-serif;
    outline: none;
    box-sizing: border-box;
    transition: border-color .3s;
    height: auto;
}

.bf-ex-dd-search-input:focus {
    border-color: #148EFF;
}

.bf-ex-dd-search-input::placeholder {
    color: #6b8199;
}

/* Filters */
.bf-ex-dd-filters {
    display: flex;
    gap: 5px;
    padding: 8px 10px;
    border-bottom: 1px solid #e4e8ee;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.bf-ex-dd-filter {
    padding: 4px 10px;
    background: #f3f7fc;
    border: 1px solid #e4e8ee;
    border-radius: 4px;
    color: #6b8199;
    font: 12px 'Nunito', sans-serif;
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
}

.bf-ex-dd-filter:hover {
    border-color: #148EFF;
    color: #000;
}

.bf-ex-dd-filter.active {
    background: #148EFF;
    border-color: #148EFF;
    color: #fff;
}

/* Currency list */
.bf-ex-dd-list {
    overflow-y: auto;
    flex: 1;
    padding: 4px 0;
    min-height: 0;
}

.bf-ex-dd-list::-webkit-scrollbar {
    width: 5px;
}

.bf-ex-dd-list::-webkit-scrollbar-track {
    background: #f3f7fc;
}

.bf-ex-dd-list::-webkit-scrollbar-thumb {
    background: #ccd5de;
    border-radius: 3px;
}

.bf-ex-dd-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 15px;
    cursor: pointer;
    transition: background .15s;
    user-select: none;
}

.bf-ex-dd-item:hover {
    background: #f3f7fc;
}

.bf-ex-dd-item.selected {
    background: #e8f4ff;
}

.bf-ex-dd-item.disabled {
    opacity: .35;
    pointer-events: none;
    display: none;
}

.bf-ex-dd-item.hidden {
    display: none;
}

.bf-ex-dd-item-logo {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: contain;
    background: #f3f7fc;
}

.bf-ex-dd-item-name {
    font: 14px 'Nunito', sans-serif;
    color: #000;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bf-ex-dd-item-code {
    font: 12px 'Nunito', sans-serif;
    color: #6b8199;
    margin-left: auto;
    flex-shrink: 0;
}

.bf-ex-dd-empty {
    padding: 20px 15px;
    text-align: center;
    color: #6b8199;
    font: 13px 'Nunito', sans-serif;
}

/* -------- Notice message (exchange description) -------- */
.bf-ex-notice {
    margin: 12px 0 0;
    padding: 12px 16px;
    background: #f3f7fc;
    border: 1px solid #e4e8ee;
    border-left: 3px solid #148EFF;
    border-radius: 0 8px 8px 0;
    font: 13px/1.5 'Nunito', sans-serif;
    color: #333;
}

.bf-ex-notice p {
    margin: 0 0 6px;
}

.bf-ex-notice p:last-child {
    margin-bottom: 0;
}

.bf-ex-notice a {
    color: #148EFF;
    text-decoration: none;
}

.bf-ex-notice a:hover {
    text-decoration: underline;
}

/* -------- Info rows (course, reserve, discount) -------- */
.bf-ex-info {
    margin-top: 12px;
    padding: 12px 0 0;
    border-top: 1px solid #e4e8ee;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bf-ex-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font: 13px 'Nunito', sans-serif;
    gap: 8px;
}

.bf-ex-course-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.bf-ex-info-label {
    color: #6b8199;
}

.bf-ex-info-value {
    color: #000;
    font-weight: 600;
}

.bf-ex-discount-row .bf-ex-info-value {
    color: #00E094;
}

/* -------- Timer -------- */
.bf-ex-timer {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font: 12px 'Nunito', sans-serif;
    color: #6b8199;
    background: #f3f7fc;
    border-radius: 4px;
    padding: 2px 8px;
    flex-shrink: 0;
}

.bf-ex-timer svg {
    width: 14px;
    height: 14px;
}

.bf-ex-timer-val {
    font-weight: 600;
    color: #148EFF;
    min-width: 16px;
    text-align: center;
}

/* -------- "Далее" button -------- */
.bf-ex-next-wrap {
    margin: 15px 0 5px;
    text-align: center;
}

.bf-ex-next-btn {
    display: inline-block;
    height: 50px;
    min-width: 220px;
    padding: 0 40px;
    background: #00E094;
    border: none;
    border-radius: 8px;
    color: #fff;
    font: 600 18px/50px 'Nunito', sans-serif;
    text-align: center;
    cursor: pointer;
    transition: all .4s;
}

.bf-ex-next-btn:hover {
    background: #1F2124;
}

.bf-ex-next-btn:disabled {
    background: #ccc;
    cursor: default;
}

/* -------- Popup / Modal -------- */
.bf-ex-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
}

.bf-ex-popup.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.bf-ex-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, .45);
}

.bf-ex-popup-content {
    position: relative;
    z-index: 1;
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .2);
    overflow: hidden;
}

.bf-ex-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e4e8ee;
    flex-shrink: 0;
}

.bf-ex-popup-title {
    font: 600 18px 'Nunito', sans-serif;
    color: #000;
}

.bf-ex-popup-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    font-size: 24px;
    color: #6b8199;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background .2s, color .2s;
}

.bf-ex-popup-close:hover {
    background: #f3f7fc;
    color: #000;
}

.bf-ex-popup-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.bf-ex-popup-fields {
    margin: 0 0 16px;
}

.bf-ex-popup-fields:empty {
    display: none;
}

.bf-ex-popup-captcha {
    margin: 0 0 16px;
}

.bf-ex-popup-captcha:empty {
    display: none;
}

.bf-ex-popup-check {
    padding: 0 0 16px;
}

.bf-ex-popup-check label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
    font: 13px 'Nunito', sans-serif;
    color: #6b8199;
    line-height: 1.4;
}

.bf-ex-popup-check label a {
    color: #148EFF;
    text-decoration: none;
}

.bf-ex-popup-check label a:hover {
    text-decoration: underline;
}

.bf-ex-popup-check input[type="checkbox"] {
    margin-top: 2px;
    flex-shrink: 0;
}

.bf-ex-popup-footer {
    padding: 16px 20px;
    border-top: 1px solid #e4e8ee;
    flex-shrink: 0;
}

input.bf-ex-submit {
    display: block;
    height: 50px;
    width: 100%;
    background: #00E094;
    border: none;
    border-radius: 8px;
    color: #fff;
    font: 600 18px/50px 'Nunito', sans-serif;
    text-align: center;
    cursor: pointer;
    transition: all .4s;
}

.bf-ex-submit:hover {
    background: #1F2124;
}

.bf-ex-submit:disabled {
    background: #ccc;
    cursor: default;
}

.bf-ex-popup-footer .ajax_post_bids_res {
    margin-top: 10px;
}

/* -------- Loading overlay -------- */
.bf-ex-loading {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #f3f7fc url(../images/ajax-big-loader.gif) no-repeat center center;
    opacity: .6;
    border-radius: 16px;
    z-index: 200;
}

.bf-ex-loading.active {
    display: block;
}

/* -------- Responsive -------- */
@media (max-width: 700px) {
    .bf-ex-main {
        padding: 25px;
    }

    .bf-ex-columns {
        flex-direction: column;
        gap: 0;
    }

    .bf-ex-swap {
        padding: 5px 0;
        align-self: center;
    }

    .bf-ex-swap-btn {
        transform: rotate(90deg);
    }

    .bf-ex-col {
        width: 100%;
    }

    .bf-ex-next-btn {
        width: 100%;
    }

    .bf-ex-popup-content {
        max-width: 100%;
        margin: 10px;
        border-radius: 12px;
    }

    .bf-ex-cur-name {
        max-width: 80px;
    }
}
