/* EMI Calculator Specific Styles */
.calculator-hero {
    background: linear-gradient(to right, rgba(0, 67, 107, 0.9), rgba(15, 23, 42, 0.7)), url('../assets/photos/hero-background-all/emi-calculator.png');
    background-size: cover;
    background-position: center;
    min-height: 60vh;
}

.calculator-section {
    padding: 80px 0;
    background-color: #f8fafc;
}

.calculator-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin: 50px 0;
    background: white;
    border-radius: 15px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.calculator-inputs {
    padding-right: 30px;
    border-right: 1px solid #e5e7eb;
}

.input-group {
    margin-bottom: 50px;
}

.input-group label {
    display: block;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 12px;
}

.range-input-container {
    display: flex;
    align-items: center;
    gap: 20px;
}

.range-input-container input[type="range"] {
    flex: 1;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    appearance: none;
    margin: 10px 0;
}

.range-input-container input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--accent-color);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.range-input-container input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    background: #1d4ed8;
}

.text-input-wrapper {
    position: relative;
    width: 130px;
}

/* Specific styling for interest rate input */
.input-group:nth-child(2) .text-input-wrapper {
    width: 130px;
}

.input-group:nth-child(2) input[type="number"] {
    padding-right: 30px !important; /* Force more padding on the right */
    text-align: right;
}

.currency-symbol {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-color);
}

.unit-symbol {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-color);
    z-index: 2; /* Ensure it's above the input */
    pointer-events: none; /* Allow clicking through the symbol to the input */
    background: rgba(255, 255, 255, 0.8); /* Semi-transparent background */
    padding: 0 2px; /* Small padding to create separation */
}

.text-input-wrapper input[type="number"] {
    width: 100%;
    padding: 10px;
    padding-left: 25px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 15px;
    text-align: right;
}

.text-input-wrapper input[type="number"]:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.unit-selector {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
}

.unit-selector select {
    height: 100%;
    padding: 0 10px;
    border: none;
    background: transparent;
    font-size: 15px;
    color: var(--text-color);
    cursor: pointer;
    appearance: none;
    padding-right: 20px;
}

.unit-selector::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 5px;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid var(--text-color);
    pointer-events: none;
}

.range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--secondary-color);
    margin-top: 5px;
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 16px;
    margin-top: 20px;
}

.btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.2);
}

.calculator-results {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto 1fr;
    gap: 20px;
}

.result-card {
    background: var(--light-color);
    border-radius: 10px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s ease;
}

.result-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
}

.result-card .result-icon {
    width: 50px;
    height: 50px;
    background: rgba(37, 99, 235, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-color);
    font-size: 20px;
}

.result-card h3 {
    font-size: 14px;
    margin: 0 0 5px;
    color: var(--secondary-color);
}

.result-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary-color);

}

.monthly-payment {
    grid-column: 1;
}

.total-interest {
    grid-column: 2;
}

.total-payment {
    grid-column: span 2;
}

.chart-container {
    grid-column: span 2;
    border-radius: 10px;
    overflow: hidden;
    background: white;
    padding: 20px;
    height: 280px;
    border: 1px solid #e5e7eb;
}

.amortization-container {
    margin-top: 60px;
}

/* Styling for the amortization header with download button */
.amortization-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.btn-secondary {
    background-color: #38a169;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background-color: #2f855a;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(56, 161, 105, 0.2);
}

.btn-secondary .fas {
    font-size: 14px;
}

.widget-title {
    font-size: 20px;
    margin-bottom: 20px;
    color: var(--primary-color);
    font-family: var(--heading-font);
    position: relative;
    padding-left: 15px;
}

.widget-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 5px;
    bottom: 5px;
    width: 4px;
    background: var(--accent-color);
    border-radius: 2px;
}

.amortization-table-wrapper {
    background: white;
    border-radius: 10px;
    overflow: auto;
    max-height: 400px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.amortization-table {
    width: 100%;
    border-collapse: collapse;
}

.amortization-table th,
.amortization-table td {
    padding: 15px 20px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.amortization-table th {
    background: var(--light-color);
    font-weight: 600;
    color: var(--primary-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.amortization-table tbody tr:hover {
    background: rgba(37, 99, 235, 0.03);
}

.amortization-table td:first-child {
    font-weight: 500;
}

.emi-info-section {
    padding: 80px 0;
    background: white;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.info-card {
    padding: 30px;
    border-radius: 10px;
    background: var(--light-color);
    transition: all 0.3s ease;
}

.info-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.08);
}

.info-icon {
    width: 60px;
    height: 60px;
    background: rgba(37, 99, 235, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    color: var(--accent-color);
    font-size: 24px;
}

.info-card h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: var(--primary-color);
    font-family: var(--heading-font);
}

.info-card p {
    color: var(--text-color);
    line-height: 1.6;
}

.text-link {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.text-link:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

.cta-section {
    padding: 60px 0;
    background: linear-gradient(135deg, var(--primary-color) 0%, #192a56 100%);
    color: white;
    position: relative;
    overflow: hidden;
}

.cta-section::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 70%);
}

.cta-section::after {
    content: '';
    position: absolute;
    bottom: -80px;
    left: -80px;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0) 70%);
}

.cta-content {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.cta-content h2 {
    font-size: 32px;
    margin-bottom: 15px;
    font-family: var(--heading-font);
}

.cta-content p {
    font-size: 18px;
    margin-bottom: 30px;
    opacity: 0.9;
}

.cta-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.btn-outline {
    padding: 12px 24px;
    background: transparent;
    color: white;
    border: 2px solid white;
    border-radius: 6px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* Specialized styling for the loan term input */
.loan-term-wrapper {
    display: flex;
    width: 150px; /* Increased from 140px */
}

.loan-term-wrapper input[type="number"] {
    width: 70px; /* Increased from 60px */
    text-align: center;
    border-radius: 6px 0 0 6px;
    border-right: none;
    padding-left: 10px;
    padding-right: 10px;
    /* Ensure numbers don't get cut off */
    overflow: visible;
}

/* Ensure consistent sizing when the term unit is set to months (3-digit numbers) */
.loan-term-wrapper.months-active input[type="number"] {
    width: 80px;
}

.loan-term-wrapper .unit-selector {
    position: relative;
    width: 100px;
    height: 100%;
}

.loan-term-wrapper select {
    width: 100%;
    height: 100%;
    padding: 10px;
    border: 1px solid #e5e7eb;
    border-radius: 0 6px 6px 0;
    background: #f8fafc;
    font-size: 15px;
    color: var(--text-color);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    cursor: pointer;
}

.loan-term-wrapper .unit-selector::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid var(--text-color);
    pointer-events: none;
}

.loan-term-wrapper select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.loan-term-wrapper input:focus + .unit-selector select {
    border-color: var(--accent-color);
}

/* Improved styling for the unit selector dropdown */
.loan-term-wrapper .unit-selector {
    position: relative;
    width: 200px;
}

.loan-term-wrapper .unit-selector select {
    width: 100%;
    height: 100%;
    padding: 10px 20px 10px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 0 6px 6px 0;
    background: #f9fafb;
    font-size: 15px;
    color: var(--primary-color);
    cursor: pointer;
    
    /* Reset default select styling */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Style the arrow */
.loan-term-wrapper .unit-selector::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 5px;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid var(--accent-color);
    pointer-events: none; /* Ensures clicks pass through to select */
}

/* Focus state */
.loan-term-wrapper .unit-selector select:focus,
.loan-term-wrapper .unit-selector select:active {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Ensure dropdown is visible */
.loan-term-wrapper .unit-selector select option {
    padding: 10px;
    background: white;
    color: var(--primary-color);
}

/* When select is open (for browsers that support :focus-within) */
.loan-term-wrapper .unit-selector:focus-within::after {
    transform: translateY(-50%) rotate(180deg);
}

/* For Safari */
@media not all and (min-resolution:.001dpcm) {
    @supports (-webkit-appearance:none) {
        .loan-term-wrapper .unit-selector select {
            padding-right: 25px;
        }
    }
}

/* For Firefox */
@-moz-document url-prefix() {
    .loan-term-wrapper .unit-selector select {
        text-indent: 0;
        text-overflow: ellipsis;
        padding-right: 25px;
    }
}

@media (max-width: 992px) {
    .calculator-container {
        grid-template-columns: 1fr;
    }
    
    .calculator-inputs {
        padding-right: 0;
        padding-bottom: 30px;
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
    }
}

@media (max-width: 768px) {
    .calculator-results {
        grid-template-columns: 1fr;
    }
    
    .monthly-payment,
    .total-interest,
    .total-payment,
    .chart-container {
        grid-column: 1;
    }
    
    .cta-buttons {
        flex-direction: column;
        max-width: 300px;
        margin: 0 auto;
    }
    
    .info-card {
        padding: 20px;
    }
}