/* ── Currency Trigger Button ── */
#monedaButton {
    cursor: pointer;
}

.moneda-trigger {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    padding: 7px 14px !important;
    border-radius: 10px !important;
    background-color: var(--white) !important;
    border: none;
    color: var(--gray-700) !important;
    font-size: 13px;
    font-weight: 600;
    transition: border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
    white-space: nowrap;
    height: auto !important;
}

.moneda-trigger:hover {
    background-color: rgba(0, 0, 0, 0.03) !important;
}

.moneda-trigger-symbol {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background-color: var(--brand-primary);
    color: var(--white);
    font-weight: 800;
    font-size: 13px;
    flex-shrink: 0;
    line-height: 1;
}

.moneda-trigger-label {
    font-weight: 600 !important;
    letter-spacing: 0.2px;
}

.moneda-trigger-arrow {
    font-size: 9px;
    opacity: 0.4;
    margin-left: 2px;
    transition: transform 200ms ease;
    width: auto !important;
}

.moneda-trigger:hover .moneda-trigger-arrow {
    opacity: 0.7;
    transform: translateY(1px);
}

/* ── Mobile Currency Bar (below header) ── */
.mobile-currency-bar {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background-color: var(--white);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    cursor: pointer;
    transition: background-color 150ms ease;
}

.mobile-currency-bar:active {
    background-color: rgba(0, 0, 0, 0.02);
}

.mobile-currency-bar .moneda-trigger-symbol {
    width: 28px;
    height: 28px;
    font-size: 12px;
}

.mobile-currency-label {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
}

.mobile-currency-arrow {
    font-size: 10px;
    color: var(--gray-700);
    opacity: 0.35;
}

@media (max-width: 900px) {
    .mobile-currency-bar {
        display: flex;
    }
}

/* Force centering — override global .modal.show { margin-top: 5vh } */
#currencyModal .modal-dialog {
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}

#currencyModal.modal.show .modal-dialog {
    margin-top: auto;
    margin-bottom: auto;
}

#currencyModal {
    overflow-y: hidden !important;
    padding-top: 0px !important;
}

#currencyModal .modal-dialog-centered {
    min-height: 100%;
    align-items: center;
}

/* Modal shell */
.currency-modal-content {
    border: none;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    background-color: var(--white);
}

/* Top bar */
.currency-modal-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px 8px;
}

.currency-modal-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--gray-700);
}

.currency-modal-close {
    background: none;
    border: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-700);
    opacity: 0.4;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background-color 150ms ease, opacity 150ms ease;
    padding: 0;
}

.currency-modal-close:hover {
    background-color: rgba(0, 0, 0, 0.06);
    opacity: 0.75;
}

/* Body */
.currency-modal-body {
    padding: 0;
    background-color: var(--white);
}

/* Card grid */
.currency-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ── Card: horizontal row layout ── */
.currency-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    border-radius: 14px;
    background-color: rgba(0, 0, 0, 0.018);
    border: 2px solid transparent;
    cursor: pointer;
    transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
    position: relative;
}

.currency-card:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

/* Symbol circle on the left */
.currency-symbol-badge {
    flex-shrink: 0;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.055);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--gray-700);
    transition: background-color 200ms ease, color 200ms ease, box-shadow 200ms ease;
}

/* Text block */
.currency-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.currency-code {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--gray-700);
    line-height: 1.3;
}

.currency-name {
    font-size: 0.85rem;
    color: var(--gray-700);
    opacity: 0.5;
    line-height: 1.3;
}

.currency-rate {
    display: block;
    font-size: 0.82rem;
    color: var(--gray-700);
    opacity: 0.45;
    margin-top: 3px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Radio circle on the right */
.currency-check {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0;
    transition: border-color 200ms ease, background-color 200ms ease, box-shadow 200ms ease;
}

/* ── Selected state (current session currency) ── */
.currency-card.selected .currency-check {
    border-color: var(--brand-primary);
    background-color: var(--brand-primary);
    font-size: 0.6rem;
    color: var(--white);
}

.currency-card.selected .currency-symbol-badge {
    opacity: 0.7;
}

/* ── Active state (user just picked this one) ── */
.currency-card.active {
    border-color: var(--brand-primary);
    background-color: rgba(0, 0, 0, 0.008);
}

.currency-card.active .currency-symbol-badge {
    background-color: var(--brand-primary);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    opacity: 1;
}

.currency-card.active .currency-code {
    color: var(--brand-primary);
}

.currency-card.active .currency-rate {
    color: var(--brand-primary);
    opacity: 0.7;
}

.currency-card.active .currency-check {
    border-color: var(--brand-primary);
    background-color: var(--brand-primary);
    font-size: 0.6rem;
    color: var(--white);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.04);
}

/* ── Footer with confirm button ── */
.currency-modal-footer {
    padding: 10px 28px 24px;
    background-color: var(--white);
}

.currency-confirm-btn {
    display: block;
    width: 100%;
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    background-color: var(--brand-primary);
    color: var(--white);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 180ms ease, transform 100ms ease;
    letter-spacing: 0.3px;
}

.currency-confirm-btn:hover:not(:disabled) {
    opacity: 0.9;
    transform: translateY(-1px);
}

.currency-confirm-btn:active:not(:disabled) {
    transform: translateY(0);
}

.currency-confirm-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.currency-confirm-btn.loading {
    pointer-events: none;
    opacity: 0.6;
}

/* Loading */
.currency-loading {
    text-align: center;
    padding: 32px 16px;
    color: var(--gray-700);
    opacity: 0.35;
    font-size: 1.3rem;
}

/* Responsive */
@media (max-width: 575.98px) {
    #currencyModal .modal-dialog {
        margin: 16px auto;
        max-width: calc(100vw - 32px);
    }

    .currency-modal-content {
        border-radius: 18px;
    }

    .currency-card {
        padding: 12px 14px;
        gap: 12px;
    }

    .currency-symbol-badge {
        width: 42px;
        height: 42px;
        font-size: 1.1rem;
    }

    .currency-confirm-btn {
        padding: 14px 20px;
    }
}
