/* Scoped FX Savings Calculator — safe to load on clients page */

.fx-savings-calculator {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #043145 0%, #043145 100%);
    padding: 48px 20px 64px;
    box-sizing: border-box;
    width: 100%;
}

.fx-savings-calculator *,
.fx-savings-calculator *::before,
.fx-savings-calculator *::after {
    box-sizing: border-box;
}

.fx-savings-calculator .fx-calc-title {
    text-align: center;
    margin: 0 0 40px;
    font-size: 32px;
    font-weight: 700;
    color: #ffffff;
}

.fx-savings-calculator .fx-calc-inner {
    max-width: 900px;
    margin: 0 auto;
}

.fx-savings-calculator .badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(87, 140, 200, 0.15);
    color: #578cc8;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    margin-bottom: 24px;
}

.fx-savings-calculator .badge::before {
    content: "📊";
}

.fx-savings-calculator .fx-calc-heading {
    color: #ffffff;
    font-size: 42px;
    font-weight: 700;
    margin: 0 0 12px;
    text-align: center;
}

.fx-savings-calculator .subtitle {
    color: #b8d4f0;
    font-size: 16px;
    text-align: center;
    margin: 0 0 40px;
}

.fx-savings-calculator .calculator-card {
    background: rgba(10, 74, 97, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(87, 140, 200, 0.1);
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 24px;
}

.fx-savings-calculator .form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.fx-savings-calculator .form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fx-savings-calculator label {
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
}

.fx-savings-calculator input,
.fx-savings-calculator select {
    background: rgba(4, 49, 69, 0.8);
    border: 1px solid #1a5570;
    color: #ffffff;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.2s;
    width: 100%;
}

.fx-savings-calculator input:focus,
.fx-savings-calculator select:focus {
    outline: none;
    border-color: #578cc8;
    background: rgba(10, 74, 97, 0.95);
}

.fx-savings-calculator input::placeholder {
    color: #b8d4f0;
}

.fx-savings-calculator select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23b8d4f0' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.fx-savings-calculator .calculate-btn {
    width: 100%;
    background: linear-gradient(135deg, #578cc8 0%, #6ba3d0 100%);
    color: #043145;
    border: none;
    padding: 16px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.fx-savings-calculator .calculate-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(87, 140, 200, 0.4);
}

.fx-savings-calculator .calculate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.fx-savings-calculator .calculate-btn::after {
    content: "→";
    font-size: 20px;
}

.fx-savings-calculator .calculate-btn:disabled::after {
    content: "";
}

.fx-savings-calculator .loading {
    display: none;
}

.fx-savings-calculator .loading.active {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: fx-calc-spin 0.6s linear infinite;
}

@keyframes fx-calc-spin {
    to { transform: rotate(360deg); }
}

.fx-savings-calculator .results-card {
    display: none;
    background: rgba(10, 74, 97, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(87, 140, 200, 0.2);
    border-radius: 16px;
    padding: 32px;
    margin-top: 24px;
    overflow: visible;
}

.fx-savings-calculator .results-card.show {
    display: block;
    animation: fx-calc-slide-in 0.45s ease;
}

@keyframes fx-calc-slide-in {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fx-savings-calculator .savings-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.fx-savings-calculator .savings-icon {
    width: 48px;
    height: 48px;
    background: rgba(87, 140, 200, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.fx-savings-calculator .savings-header h2 {
    color: #ffffff;
    font-size: 24px;
    margin: 0;
}

.fx-savings-calculator .savings-amount {
    background: linear-gradient(135deg, rgba(87, 140, 200, 0.2) 0%, rgba(87, 140, 200, 0.05) 100%);
    border: 1px solid rgba(87, 140, 200, 0.3);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.fx-savings-calculator .savings-amount.loss {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(239, 68, 68, 0.05) 100%);
    border-color: rgba(239, 68, 68, 0.3);
}

.fx-savings-calculator .savings-left h3 {
    color: #b8d4f0;
    font-size: 14px;
    font-weight: 400;
    margin: 0 0 8px;
}

.fx-savings-calculator .savings-value {
    color: #5dd86e;
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 8px;
}

.fx-savings-calculator .savings-amount.loss .savings-value {
    color: #ef4444;
}

.fx-savings-calculator .savings-percentage {
    color: #5dd86e;
    font-size: 20px;
    font-weight: 600;
}

.fx-savings-calculator .savings-amount.loss .savings-percentage {
    color: #ef4444;
}

.fx-savings-calculator .checkmark {
    width: 48px;
    height: 48px;
    background: rgba(87, 140, 200, 0.2);
    border: 2px solid #578cc8;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.fx-savings-calculator .savings-message {
    color: #b8d4f0;
    font-size: 14px;
    line-height: 1.5;
    margin: 12px 0 0;
}

.fx-savings-calculator .rates-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.fx-savings-calculator .rate-card {
    background: rgba(4, 49, 69, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
}

.fx-savings-calculator .rate-card.highlight {
    background: rgba(87, 140, 200, 0.1);
    border-color: rgba(87, 140, 200, 0.3);
}

.fx-savings-calculator .rate-label {
    color: #b8d4f0;
    font-size: 13px;
    margin-bottom: 8px;
}

.fx-savings-calculator .rate-value {
    color: #ffffff;
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 4px;
}

.fx-savings-calculator .rate-card.highlight .rate-value {
    color: #578cc8;
}

.fx-savings-calculator .rate-margin {
    color: #578cc8;
    font-size: 12px;
}

.fx-savings-calculator .rate-margin.negative {
    color: #ef4444;
}

.fx-savings-calculator .comparison-section h3 {
    color: #ffffff;
    font-size: 18px;
    margin: 0 0 16px;
}

.fx-savings-calculator .comparison-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.fx-savings-calculator .comparison-item {
    background: rgba(4, 49, 69, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
}

.fx-savings-calculator .comparison-label {
    color: #b8d4f0;
    font-size: 13px;
    margin-bottom: 8px;
}

.fx-savings-calculator .comparison-value {
    color: #ffffff;
    font-size: 24px;
    font-weight: 600;
}

.fx-savings-calculator .error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    padding: 16px;
    border-radius: 8px;
    margin-top: 16px;
}

@media (max-width: 768px) {
    .fx-savings-calculator .fx-calc-heading {
        font-size: 32px;
    }

    .fx-savings-calculator .form-grid,
    .fx-savings-calculator .rates-grid,
    .fx-savings-calculator .comparison-grid {
        grid-template-columns: 1fr;
    }

    .fx-savings-calculator .calculator-card {
        padding: 20px;
    }

    .fx-savings-calculator .savings-value {
        font-size: 28px;
    }

    .fx-savings-calculator .savings-amount {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

    .fx-savings-calculator .checkmark {
        margin-top: 0;
    }
}
