/* MSB Saving Calculator Styles V3.0 */
/* Matches msb_loan_calculator design patterns */

.msb-saving-calculator {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: #111;
    background: #fff;
    padding: 24px;
    max-width: 1366px;
    margin: 0 auto;

    /* MSB Card Style */
    border: 1px solid var(--alias-border-card, #ffffff);
    box-shadow: 0px 0px 16px 0px #1d29390f;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: 12px;
}

.msb-saving-calculator * {
    box-sizing: border-box;
}

/* ========== TWO COLUMN TABLE LAYOUT ========== */
.msb-saving-calculator-wrapper.table-layout {
    max-width: 100%;
}

.msb-saving-calculator-wrapper.table-layout .msb-saving-calculator {
    padding: 24px;
    background: #fff;
    box-shadow: 0px 0px 16px 0px #1d29390f;
    border-radius: 12px;
}


.calc-two-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
}

.msb-saving-calculator-wrapper.table-layout .calc-column {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
}

.section-title {
    font-size: 18px;
    font-weight: 700;
    color: #1F2937;
    margin: 0 0 20px 0;
}

/* ========== RATE TABLE SECTION ========== */
.rate-table-section {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Term Range Tabs */
.term-tabs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.term-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 400;
    color: #6B7280;
    transition: color 0.2s;
}

.term-tab input[type="radio"] {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.term-tab input[type="radio"]:checked + .term-tab-radio {
    border-color: #F37021;
    background: #fff;
}

.term-tab input[type="radio"]:checked + .term-tab-radio::after {
    opacity: 1;
}

.term-tab input[type="radio"]:checked + .term-tab-radio + span {
    color: #1F2937;
    font-weight: 400;
}

.term-tab .term-tab-radio {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border: 2px solid #D1D5DB;
    border-radius: 50%;
    background: #fff;
    position: relative;
    transition: border-color 0.2s, background 0.2s;
}

.term-tab .term-tab-radio::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #F37021;
    opacity: 0;
    transition: opacity 0.2s;
}

.term-tab span {
    color: inherit;
}

.term-tab:hover .term-tab-radio {
    border-color: #9CA3AF;
}

.term-tab input[type="radio"]:checked:hover + .term-tab-radio {
    border-color: #F37021;
}

/* Product Filter in Tabs Row */
.term-tabs .product-filter {
    margin-left: auto;
    min-width: 180px;
}

/* Rate Table */
.rate-table-wrapper {
    flex: 1;
    overflow-x: auto;
    margin-bottom: 16px;
}

.rate-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 14px;
}

.rate-table th,
.rate-table td {
    padding: 12px 16px;
    border: 1px solid #E5E7EB;
    vertical-align: middle;
    line-height: 1.4;
}

.rate-table thead th {
    background: #1F2937;
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    height: 48px;
    box-sizing: border-box;
    text-align: left;
}

.rate-table thead th:first-child {
    border-radius: 8px 0 0 0;
}

.rate-table thead th:last-child {
    border-radius: 0 8px 0 0;
}

.rate-table thead th:nth-child(2),
.rate-table thead th:nth-child(3) {
    text-align: center;
}

.rate-table tbody tr:hover td {
    background-color: #FFF7ED;
}

.rate-table tbody tr:hover td:first-child {
    background-color: #F9FAFB;
}

.rate-table tbody td {
    height: 48px;
    box-sizing: border-box;
    color: #374151;
}

.rate-table tbody td:first-child {
    font-weight: 600;
    color: #1F2937;
    background: #F9FAFB;
    text-align: left;
}

.rate-table tbody td:nth-child(2),
.rate-table tbody td:nth-child(3) {
    text-align: center;
}

/* View Rate Link */
.view-rate-link {
    margin-top: auto;
}

.view-rate-link a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #F37021;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.view-rate-link a:hover {
    color: #D65A0F;
}

.view-rate-link a svg {
    transition: transform 0.2s;
}

.view-rate-link a:hover svg {
    transform: translateX(4px);
}

/* ========== CALCULATOR FORM SECTION ========== */
.calculator-form-section {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.calculator-form-section .calculator-results {
    margin-top: auto;
}

/* ========== COMMON FORM STYLES ========== */
.calculator-inputs {
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
    color: #4B5563;
}

/* Inputs */
.form-control {
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: 8px !important;
    font-size: 16px;
    font-weight: 500;
    line-height: 24px;
    color: #111;
    transition: all 0.2s;
    height: 44px !important;
    margin: 0;
    box-sizing: border-box;
    box-shadow: inset 0 0 0 1px #D1D5DB;
}

.form-control:hover {
    box-shadow: inset 0 0 0 1px #D1D5DB;
}

.form-control:focus {
    outline: none !important;
    box-shadow: inset 0 0 0 1px #F37021 !important;
}

.msb-saving-calculator .form-control:focus {
    outline: none !important;
    box-shadow: inset 0 0 0 1px #F37021 !important;
}

.form-control[readonly] {
    background-color: #F9FAFB;
    color: #6B7280;
}

.form-control::placeholder {
    color: #9CA3AF;
    font-weight: 500;
}

/* Hide number spinners */
.form-control[type="number"] {
    -moz-appearance: textfield;
}

.form-control[type="number"]::-webkit-outer-spin-button,
.form-control[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.msb-input-group {
    position: relative;
    display: flex;
    align-items: stretch;
}

.amount-field-inner {
    position: relative;
}

.amount-with-suffix {
    position: relative;
    overflow: visible;
}

.amount-with-suffix .form-control {
    width: 100%;
    padding-right: 60px;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    height: 44px;
    box-shadow: none;
    font-weight: 600;
}

.amount-with-suffix .form-control:focus {
    outline: none;
    border-color: #F37021;
    box-shadow: 0 0 0 1px #F37021;
}

.amount-with-suffix .input-suffix {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #6B7280;
    font-size: 14px;
    font-weight: 500;
    pointer-events: none;
    display: flex;
    align-items: center;
}

.amount-input-wrapper:not(.amount-with-suffix) .form-control {
    padding-right: 90px;
}

/* Dynamic Dropdown Suggestions */
.amount-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    margin-top: 0;
    background: #fff;
    border: 1px solid #D1D5DB;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 100;
    max-height: 250px;
    overflow-y: auto;
    padding: 8px 0;
}

.dropdown-item {
    padding: 12px 24px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #111;
    transition: background-color 0.15s;
    border-bottom: 1px solid #F3F4F6;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background-color: #FFF7ED;
    color: #F37021;
}

/* Select Wrapper */
.msb-select-wrapper {
    position: relative;
}

.msb-select-wrapper::after {
    content: '';
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 6px;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%236B7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    pointer-events: none;
}

.msb-select-wrapper select {
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    background-color: #fff;
    background-image: none !important;
    cursor: pointer;
    width: 100%;
    padding: 10px 36px 10px 16px;
    height: 44px !important;
    box-sizing: border-box;
    min-width: 0;
    line-height: 24px;
    font-size: 16px;
}

.msb-select-wrapper select:hover {
    box-shadow: inset 0 0 0 1px #D1D5DB !important;
}

.msb-select-wrapper select:focus {
    outline: none;
}

/* Grid System */
.form-row.two-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-row.three-cols {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
}

/* ========== RESULTS SECTION ========== */
.calculator-results {
    background-color: #FFF7ED;
    border-radius: 12px;
    padding: 24px;
}

.result-main {
    margin-bottom: 24px;
}

.result-label {
    font-size: 14px;
    font-weight: 700;
    color: #1F2937;
    margin-bottom: 8px;
}

.result-value-lg {
    font-size: 32px;
    line-height: 40px;
    font-weight: 700;
    color: #F37021;
}

.result-value-lg .currency {
    font-size: 20px;
    font-weight: 600;
    color: #1F2937;
    margin-left: 4px;
}

.result-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.detail-item {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.detail-item.right {
    text-align: right;
}

.detail-item .label {
    font-size: 14px;
    font-weight: 600;
    color: #4B5563;
    margin-bottom: 0;
}

.detail-item .value {
    font-size: 18px;
    font-weight: 700;
    color: #1F2937;
}

/* Footer Section */
.result-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
}

.footer-left {
    font-size: 12px;
    line-height: 1.5;
}

.update-time {
    display: block;
    color: #4B90E2;
    font-size: 13px;
    margin-bottom: 4px;
}

.disclaimer {
    color: #6B7280;
    font-size: 12px;
    font-style: italic;
}

/* Buttons */
.btn-msb {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    height: 44px;
    cursor: pointer;
    min-width: 140px;
    text-transform: none;
}

.btn-msb.btn-orange {
    background: linear-gradient(180deg, #FF9F5C 0%, #F37021 50%, #E65A0F 100%);
    color: #fff;
    border: 1px solid #E65A0F;
    font-weight: 700;
}

.btn-msb.btn-orange:hover {
    background: linear-gradient(180deg, #F37021 0%, #D65A0F 100%);
    color: #fff;
}

.btn-msb.btn-outline {
    background-color: #fff;
    color: #F37021;
    border: 1px solid #F37021;
}

.btn-msb.btn-outline:hover {
    background-color: #FFF7ED;
}


/* ========== RESPONSIVE ========== */
@media (max-width: 1024px) {
    .calc-two-columns {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .term-tabs {
        flex-wrap: wrap;
    }
    
    .term-tabs .product-filter {
        width: 100%;
        margin-left: 0;
        margin-top: 12px;
    }
}

@media (max-width: 768px) {
    .form-row.two-cols,
    .form-row.three-cols {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .result-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .footer-right {
        width: 100%;
        display: flex;
    }

    .btn-msb {
        width: 100%;
    }

    .result-details {
        flex-direction: column;
        gap: 16px;
    }

    .detail-item.right {
        text-align: left;
        align-items: flex-start;
    }

    .rate-table th,
    .rate-table td {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .term-tab {
        font-size: 13px;
    }
    
    .section-title {
        font-size: 16px;
    }
}