/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Calculator container */
.mortgage-calculator-wrapper {
    max-width: 1000px; /* Reduced from 1400px */
    margin: 30px auto;
    padding: 0 20px;
}

.mortgage-calculator-container {
    background: white;
    border-radius: 12px;
    padding: 32px; /* Reduced from 48px */
    box-shadow: 0 2px 16px rgba(0,0,0,0.06);
}

/* Main title */
.calculator-main-title {
    font-size: 24px; /* Reduced from 32px */
    font-weight: 700;
    color: #2d3748;
    text-align: center;
    margin-bottom: 32px; /* Reduced from 48px */
}

/* RESPONSIVE GRID - KEY TO 2 COLUMNS */
.calculator-grid {
    display: grid;
    grid-template-columns: 1fr; /* Mobile first: single column */
    gap: 32px; /* Reduced from 48px */
}

/* Desktop: 2 columns side by side */
@media (min-width: 992px) {
    .calculator-grid {
        grid-template-columns: 1fr 1fr; /* Two equal columns */
        gap: 40px; /* Reduced from 64px */
    }
}

/* Left and right columns */
.calculator-left-column,
.calculator-right-column {
    /* Column containers */
}

/* Form groups */
.calc-form-group {
    margin-bottom: 24px; /* Reduced from 32px */
}

.calc-form-group label {
    display: block;
    font-size: 13px; /* Reduced from 14px */
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 8px; /* Reduced from 12px */
}

/* INPUT WITH SUFFIX INSIDE THE BOX */
.input-with-suffix {
    position: relative;
    display: block;
}

.input-with-suffix input {
    width: 100%;
    padding: 10px 50px 10px 12px; /* Reduced padding */
    font-size: 15px; /* Reduced from 16px */
    font-weight: 600;
    color: #2d3748;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    outline: none;
    transition: all 0.2s;
}

.input-with-suffix input:focus {
    border-color: #4299e1;
    background: #f7fafc;
}

/* SUFFIX INSIDE THE INPUT BOX */
.input-suffix {
    position: absolute;
    right: 12px; /* Reduced from 16px */
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px; /* Reduced from 14px */
    font-weight: 600;
    color: #718096;
    pointer-events: none;
}

/* Range sliders */
input[type="range"] {
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 10px;
    outline: none;
    -webkit-appearance: none;
    margin: 12px 0 8px 0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: #4299e1;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #4299e1;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px; /* Reduced from 12px */
    color: #a0aec0;
}

.percentage-badge {
    display: inline-block;
    font-size: 12px; /* Reduced from 13px */
    font-weight: 600;
    color: #4299e1;
    margin-top: 6px; /* Reduced from 8px */
}

/* TAB-STYLE RESIDENCY SELECTOR - NOT RADIO BUTTONS */
.residency-tab-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    background: #f7fafc;
    border-radius: 8px;
    padding: 4px;
}

/* Hide the actual radio buttons */
.residency-tab-container input[type="radio"] {
    display: none;
}

/* Style the labels as tabs */
.residency-tab-label {
    padding: 10px 12px; /* Reduced from 14px 16px */
    text-align: center;
    font-size: 13px; /* Reduced from 14px */
    font-weight: 500;
    color: #718096;
    background: transparent;
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    margin: 0;
}

.residency-tab-label:hover {
    color: #2d3748;
    background: rgba(255,255,255,0.5);
}

/* Selected tab style */
.residency-tab-container input[type="radio"]:checked + .residency-tab-label {
    background: white;
    color: #2d3748;
    border-color: #cbd5e0;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Results section - right column */
.results-card {
    background: #f7fafc;
    border-radius: 12px;
    padding: 24px; /* Reduced from 32px */
    margin-bottom: 24px; /* Reduced from 32px */
}

.results-title {
    font-size: 17px; /* Reduced from 20px */
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 20px; /* Reduced from 24px */
    text-align: center;
}

.payment-values-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px; /* Reduced from 24px */
    margin-bottom: 20px; /* Reduced from 24px */
}

.payment-value-item {
    text-align: center;
}

.payment-value-label {
    font-size: 11px; /* Reduced from 12px */
    color: #718096;
    margin-bottom: 6px; /* Reduced from 8px */
    text-transform: lowercase;
}

.payment-value-amount {
    font-size: 24px; /* Reduced from 28px */
    font-weight: 700;
    color: #5a67d8;
}

.view-costs-button {
    width: 100%;
    padding: 14px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    color: #2d3748;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.view-costs-button:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
}

/* Contact form */
.contact-form-section {
    background: white;
}

.form-section-title {
    font-size: 16px; /* Reduced from 18px */
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 16px; /* Reduced from 20px */
}

.contact-form-section input[type="text"],
.contact-form-section input[type="email"],
.contact-form-section input[type="tel"] {
    width: 100%;
    padding: 11px 14px; /* Reduced from 14px 16px */
    font-size: 14px; /* Reduced from 15px */
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    outline: none;
    transition: all 0.2s;
    margin-bottom: 12px; /* Reduced from 16px */
}

.contact-form-section input:focus {
    border-color: #4299e1;
}

.contact-form-section input::placeholder {
    color: #a0aec0;
}

/* International Phone Input Styles */
.contact-form-section .iti {
    width: 100%;
    margin-bottom: 12px;
}

.contact-form-section .iti__flag-container {
    border-right: 1px solid #e2e8f0;
}

.contact-form-section .iti__selected-flag {
    padding: 0 8px 0 12px;
}

.contact-form-section .iti__country-list {
    max-width: 400px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border: 2px solid #e2e8f0;
}

.contact-form-section .iti__divider {
    border-bottom: 1px solid #e2e8f0;
}

.contact-form-section .iti__country {
    padding: 8px 12px;
}

.contact-form-section .iti__country:hover {
    background-color: #f7fafc;
}

.contact-form-section .iti__country.iti__highlight {
    background-color: #ebf8ff;
}

.submit-eligibility-btn {
    width: 100%;
    padding: 13px; /* Reduced from 16px */
    background: #e53e3e;
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 15px; /* Reduced from 16px */
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.submit-eligibility-btn:hover {
    background: #c53030;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(229, 62, 62, 0.3);
}

.form-success-message {
    margin-top: 16px;
    padding: 14px;
    background: #c6f6d5;
    color: #22543d;
    border-radius: 8px;
    display: none;
}

.form-success-message.show {
    display: block;
}

/* Modal */
.costs-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.costs-modal.active {
    display: flex;
}

.modal-content-wrapper {
    background: white;
    border-radius: 16px;
    padding: 32px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-header-title {
    font-size: 20px;
    font-weight: 600;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: #718096;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.modal-close-btn:hover {
    background: #f7fafc;
}

.breakdown-section {
    background: #f7fafc;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.breakdown-section-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 16px;
}

.breakdown-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #e2e8f0;
}

.breakdown-row:last-child {
    border-bottom: none;
}

.breakdown-label {
    font-size: 14px;
    color: #718096;
}

.breakdown-value {
    font-size: 15px;
    font-weight: 600;
    color: #2d3748;
}

.expandable-row {
    cursor: pointer;
}

.expandable-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.expandable-content.expanded {
    max-height: 500px;
}

.expand-icon {
    transition: transform 0.3s;
    display: inline-block;
    margin-left: 8px;
}

.expand-icon.rotated {
    transform: rotate(180deg);
}

.total-row {
    background: white;
    border-radius: 8px;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    margin-top: 16px;
}

.total-label {
    font-weight: 600;
}

.total-value {
    font-size: 18px;
    font-weight: 700;
    color: #5a67d8;
}

.calculations-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.calc-item {
    background: #f7fafc;
    padding: 14px;
    border-radius: 8px;
}

.calc-item-label {
    font-size: 12px;
    color: #718096;
    margin-bottom: 4px;
}

.calc-item-value {
    font-size: 16px;
    font-weight: 600;
}

/* RESPONSIVE ADJUSTMENTS */
@media (max-width: 991px) {
    .mortgage-calculator-container {
        padding: 24px; /* Reduced from 32px */
    }
    
    .calculator-main-title {
        font-size: 22px; /* Reduced from 26px */
    }
    
    .payment-values-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .payment-values-grid {
        grid-template-columns: 1fr;
        gap: 14px; /* Reduced from 16px */
    }
}

@media (max-width: 640px) {
    .mortgage-calculator-container {
        padding: 20px; /* Reduced from 24px */
    }
    
    .calculator-main-title {
        font-size: 20px; /* Reduced from 22px */
        margin-bottom: 24px; /* Reduced from 32px */
    }
    
    .payment-value-amount {
        font-size: 22px; /* Reduced from 24px */
    }
    
    /* Stack tabs vertically on mobile */
    .residency-tab-container {
        grid-template-columns: 1fr;
        gap: 6px; /* Reduced from 8px */
    }
    
    .residency-tab-label {
        padding: 10px; /* Reduced from 12px */
    }
    
    .calculations-grid {
        grid-template-columns: 1fr;
    }
}
