﻿:root {
    --color-surface: #ffffff;
    --color-surface-soft: #fdf8fe;
    --color-primary: #a957b5;
    --color-primary-dark: #783584;
    --color-primary-soft: #f5e6f8;
    --color-primary-muted: #d9a7e0;
    --color-text: #241a28;
    --color-muted: #746678;
    --color-border: #eadbed;
    --color-error: #b42318;
    --shadow: 0 24px 70px rgba(36, 26, 40, 0.14);
    --radius-large: 28px;
    --radius-medium: 24px;
    --radius-small: 16px;
    --calculator-primary: #a957b5;
    --calculator-primary-dark: #892e96;
    --calculator-primary-hover: #652596;
    --calculator-muted: #636363;
    --calculator-light-bg: #ece8ed;
    --calculator-accent: #d1aa67;
}

.calculator,
.calculator * {
    box-sizing: border-box;
}

    .calculator button,
    .calculator input {
        font: inherit;
    }

    .calculator button {
        cursor: pointer;
    }

body.calculator-modal-open {
    overflow: hidden;
}

/* Currency calculator wrapper */

.currency-calculator {
    width: 100%;
    max-width: 35rem;
    margin: 0 auto;
    display: flex;
    align-self: stretch;
}

/* Old currency header styles - kept for backward compatibility */

.currency-header {
    margin-bottom: 24px;
    text-align: center;
}

.currency-eyebrow {
    margin: 0 0 8px;
    color: var(--color-primary);
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-feature-settings: "case" on;
}

.currency-title {
    margin: 0;
    color: var(--color-text);
    font-size: clamp(28px, 5vw, 42px);
    line-height: 1.1;
    letter-spacing: -0.04em;
}

.currency-description {
    max-width: 560px;
    margin: 14px auto 0;
    color: var(--color-muted);
    font-size: 16px;
    line-height: 1.6;
}

/* Currency calculator heading */

.currency-calculator-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
    overflow-x: hidden;
    text-align: center;
}

.currency-calculator-title {
    margin: 0 0 0.625rem;
    color: var(--color-primary-dark);
    font-size: clamp(1.5rem, 2.6vw, 2.125rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.04em;
    text-transform: uppercase;
    font-feature-settings: "case" on;
}

.currency-calculator-subtitle {
    max-width: 28rem;
    margin: 0;
    color: var(--color-muted);
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    text-align: center;
    font-feature-settings: "case" on;
}

.currency-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    min-height: 30.5rem;
    height: 100%;
    padding: 28px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-large);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

/* Calculator navigation */

.calculator-navigation {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 6px;
    border: 1px solid var(--color-border);
    border-radius: 20px;
    background: linear-gradient( 135deg, rgba(169, 87, 181, 0.08), rgba(169, 87, 181, 0.02) ), var(--color-surface-soft);
}

.calculator-navigation-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 10px 12px;
    border: 0;
    border-radius: 15px;
    background: transparent;
    color: var(--color-muted);
    font-size: 14px;
    font-weight: 900;
    line-height: 1.2;
    text-transform: none;
    transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

    .calculator-navigation-button:hover {
        color: var(--color-primary-dark);
        background: rgba(255, 255, 255, 0.72);
        transform: translateY(-1px);
    }

    .calculator-navigation-button.is-active {
        color: #ffffff;
        background: linear-gradient( 135deg, var(--color-primary), var(--color-primary-dark) );
        box-shadow: 0 12px 26px rgba(120, 53, 132, 0.18);
    }

.calculator-navigation-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.76);
    color: var(--color-primary-dark);
    font-size: 11px;
    flex: 0 0 auto;
}

.calculator-navigation-button.is-active .calculator-navigation-icon {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
}

.calculator-navigation-text {
    white-space: nowrap;
}

/* Currency calculator form */

.currency-field {
    display: grid;
    gap: 10px;
}

.currency-label {
    color: var(--color-text);
    font-size: 15px;
    font-weight: 900;
    cursor: pointer;
}

.currency-input-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 132px;
    min-height: 64px;
    border: 1px solid var(--color-border);
    border-radius: 18px;
    background: var(--color-surface-soft);
    overflow: visible;
}

.currency-input {
    width: 100%;
    min-width: 0;
    padding: 0 18px;
    border: 0;
    border-radius: 18px 0 0 18px;
    background: transparent;
    color: var(--color-text);
    font-size: 24px;
    font-weight: 900;
    outline: none;
}

    .currency-input::placeholder {
        color: rgba(36, 26, 40, 0.35);
    }

.currency-select {
    position: relative;
    border-left: 1px solid var(--color-border);
}

.currency-select-button {
    width: 100%;
    height: 100%;
    min-height: 64px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 0 17px 17px 0;
    background: var(--color-primary);
    color: #ffffff;
    font-weight: 900;
    transition: background-color 0.2s ease, color 0.2s ease;
}

    .currency-select-button:hover {
        background: var(--color-primary-dark);
    }

.currency-select-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    line-height: 1;
    transition: transform 0.2s ease;
}

    .currency-select-arrow i {
        display: block;
    }

.currency-select.is-open .currency-select-arrow {
    transform: rotate(180deg);
}

.currency-select-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 30;
    width: 160px;
    max-height: 260px;
    overflow-y: auto;
    padding: 8px;
    border: 1px solid var(--color-border);
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 18px 40px rgba(36, 26, 40, 0.16);
    display: none;
}

.currency-select.is-open .currency-select-menu {
    display: grid;
    gap: 6px;
}

.currency-option {
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--color-text);
    font-weight: 800;
    text-align: left;
}

    .currency-option:hover,
    .currency-option.is-active {
        background: var(--color-primary-soft);
        color: var(--color-primary-dark);
    }

.currency-swap-wrap {
    display: flex;
    justify-content: center;
    margin: -4px 0;
}

.currency-swap-button {
    position: relative;
    z-index: 2;
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 4px solid #ffffff;
    border-radius: 999px;
    background: var(--color-primary);
    color: #ffffff;
    font-size: 18px;
    font-weight: 900;
    box-shadow: 0 12px 24px rgba(120, 53, 132, 0.2);
    transition: transform 0.2s ease, background-color 0.2s ease;
}

    .currency-swap-button:hover {
        background: var(--color-primary-dark);
        transform: rotate(180deg) scale(1.04);
    }

.currency-rate-card {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-block: auto;
    padding-top: 8px;
}

.currency-rate-item {
    padding: 14px;
    border: 1px solid var(--color-border);
    border-radius: 16px;
    background: var(--color-surface-soft);
}

    .currency-rate-item span {
        display: block;
        margin-bottom: 6px;
        color: var(--color-muted);
        font-size: 13px;
        font-weight: 800;
    }

    .currency-rate-item strong {
        color: var(--color-text);
        font-size: 18px;
        font-weight: 900;
    }

/* Shared calculator modal */

.calculator-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: grid;
    place-items: center;
    padding: 24px;
}

    .calculator-modal[hidden] {
        display: none !important;
    }

.calculator-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(36, 26, 40, 0.48);
    backdrop-filter: blur(8px);
}

.calculator-modal-dialog {
    position: relative;
    z-index: 1;
    width: min(1180px, 100%);
    max-height: calc(100vh - 48px);
    overflow: visible;
    border-radius: var(--radius-large);
}

.calculator-modal-close {
    position: absolute;
    top: 16px;
    right: 50px;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: 0;
    border: 0;
    border-radius: 999px;
    background: var(--color-primary-soft);
    color: var(--color-primary-dark);
    box-shadow: 0 12px 28px rgba(36, 26, 40, 0.16);
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

    .calculator-modal-close:hover {
        background: var(--color-primary);
        color: #ffffff;
        transform: scale(1.04);
    }

    .calculator-modal-close i {
        pointer-events: none;
    }

/* Shared modal scrollbar */

.pawn-calculator::-webkit-scrollbar,
.bond-calculator::-webkit-scrollbar {
    width: 10px;
}

.pawn-calculator::-webkit-scrollbar-track,
.bond-calculator::-webkit-scrollbar-track {
    margin: 18px 0;
    background: transparent;
}

.pawn-calculator::-webkit-scrollbar-thumb,
.bond-calculator::-webkit-scrollbar-thumb {
    border: 3px solid rgba(255, 255, 255, 0.96);
    border-radius: 999px;
    background-color: rgba(169, 87, 181, 0.34);
    background-clip: content-box;
}

    .pawn-calculator::-webkit-scrollbar-thumb:hover,
    .bond-calculator::-webkit-scrollbar-thumb:hover {
        background-color: rgba(169, 87, 181, 0.56);
    }

/* Responsive */

@media screen and (max-width: 900px) {
    .currency-calculator {
        width: 100%;
        max-width: 35rem;
    }
}

@media screen and (max-width: 640px) {
    .currency-calculator {
        max-width: 100%;
    }

    .currency-card {
        min-height: auto;
        padding: 20px;
        border-radius: 22px;
    }

    .currency-calculator-header {
        margin-bottom: 1rem;
    }

    .currency-calculator-title {
        font-size: clamp(1.375rem, 7vw, 1.75rem);
    }

    .currency-calculator-subtitle {
        font-size: 0.9375rem;
        padding-inline: 0.5rem;
    }

    .calculator-navigation {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .calculator-navigation-button {
        justify-content: flex-start;
        min-height: 44px;
        padding: 10px 12px;
    }

    .currency-input-row {
        grid-template-columns: minmax(0, 1fr) 110px;
    }

    .currency-input {
        font-size: 20px;
    }

    .currency-select-button {
        gap: 6px;
    }

    .currency-rate-card {
        grid-template-columns: 1fr;
        margin-top: 4px;
        padding-top: 0;
    }

    .calculator-modal {
        padding: 12px;
    }

    .calculator-modal-dialog {
        max-height: calc(100vh - 24px);
    }

    .calculator-modal-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        margin: 0;
    }
}
