/* Base Styles */
.amortization-calculator-container {
    max-width: 850px;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(145deg, #f8faff 0%, #f0f4ff 100%);
    border-radius: 24px;
    box-shadow: rgba(0, 0, 0, 0.25) 0px 14px 28px, rgba(0, 0, 0, 0.22) 0px 10px 10px;
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.2);
    width: calc(100% - 40px);
    box-sizing: border-box;
}

/* Header Styles */
.calculator-header {
    background: rgba(255,255,255,0.7);
    backdrop-filter: blur(12px);
    padding: 15px 20px;
    border-radius: 18px;
    box-shadow: 0 8px 32px rgba(31,38,135,0.05);
    margin-bottom: 25px;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.3);
}

.calculator-header h1 {
    margin: 0;
    color: #1a237e;
    font-weight: 700;
    letter-spacing: -0.5px;
    font-size: clamp(22px, 4vw, 36px);
    background: linear-gradient(90deg, #3f51b5 0%, #2196f3 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.calculator-header p {
    margin: 8px 0 0;
    color: #5c6bc0;
    font-weight: 500;
    font-size: clamp(12px, 3vw, 14px);
}

/* Input Panel Styles */
.calculator-inputs {
    background: rgba(255,255,255,0.75);
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(31,38,135,0.05);
    margin-bottom: 25px;
    border: 1px solid rgba(255,255,255,0.3);
    backdrop-filter: blur(12px);
}

.input-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.input-group {
    position: relative;
}

.input-label {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.input-icon {
    min-width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
}

.loan-icon {
    background: linear-gradient(135deg, #3f51b5 0%, #2196f3 100%);
}

.interest-icon {
    background: linear-gradient(135deg, #ff5722 0%, #ff9800 100%);
}

.term-icon {
    background: linear-gradient(135deg, #4caf50 0%, #8bc34a 100%);
}

.date-icon {
    background: linear-gradient(135deg, #9c27b0 0%, #e91e63 100%);
}

.extra-icon {
    background: linear-gradient(135deg, #ff9800 0%, #ff5722 100%);
}

.frequency-icon {
    background: linear-gradient(135deg, #00bcd4 0%, #009688 100%);
}

.input-group label {
    font-weight: 600;
    color: #1a237e;
    font-size: clamp(13px, 3vw, 17px);
    letter-spacing: 0.5px;
}

.input-wrapper {
    position: relative;
}

.currency-symbol {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #5c6bc0;
    font-weight: 600;
}

.percent-symbol {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #5c6bc0;
    font-weight: 600;
}

.years-symbol {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #5c6bc0;
    font-weight: 600;
    white-space: nowrap;
    font-size: clamp(12px, 3vw, 14px);
}

.input-group input, .input-group select {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid rgba(31,38,135,0.1);
    border-radius: 12px;
    font-size: clamp(14px, 3vw, 16px);
    font-weight: 600;
    color: #1a237e;
    background: rgba(255,255,255,0.7);
    transition: all 0.3s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
    box-sizing: border-box;
}

.input-group input[type="number"] {
    padding-left: 40px;
}

.input-group input[type="month"] {
    padding: 13px 16px;
}

.input-group select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235c6bc0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 16px;
}

/* Action Buttons */
.action-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 10px;
}

.action-buttons button {
    padding: 16px;
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: clamp(14px, 3vw, 16px);
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-sizing: border-box;
}

#calculate-btn {
    background: linear-gradient(135deg, #3f51b5 0%, #2196f3 100%);
    box-shadow: 0 4px 15px rgba(33,150,243,0.3);
}

#reset-btn {
    background: linear-gradient(135deg, #f44336 0%, #e91e63 100%);
    box-shadow: 0 4px 15px rgba(233,30,99,0.3);
}

#calculate-spinner, #download-spinner, #email-spinner, #print-spinner,
#download-spinner-bottom, #email-spinner-bottom, #print-spinner-bottom {
    display: none;
    align-items: center;
    gap: 4px;
    font-size: clamp(13px, 3vw, 14px);
}

/* Summary Results */
#summary-results {
    display: none;
    background: rgba(255,255,255,0.7);
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(31,38,135,0.05);
    margin-bottom: 25px;
    border: 1px solid rgba(255,255,255,0.3);
    backdrop-filter: blur(12px);
    width: 100%;
    box-sizing: border-box;
}

.summary-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 15px;
}

.summary-header h2 {
    margin: 0;
    font-size: clamp(18px, 4vw, 22px);
    font-weight: 700;
    color: #1a237e;
    letter-spacing: -0.5px;
    flex: 1 1 20px;
}

.summary-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
    flex: 1 1 auto;
}

.summary-actions button {
    padding: 10px 15px;
    background: rgba(63,81,181,0.1);
    color: #3f51b5;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: clamp(12px, 3vw, 14px);
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
    backdrop-filter: blur(5px);
    white-space: nowrap;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.summary-card {
    background: rgba(255,255,255,0.9);
    padding: 15px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    border: 1px solid #d3d3d3;
    transition: all 0.3s;
    min-width: 0;
}

.card-header {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.card-icon {
    min-width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    flex-shrink: 0;
}

.payment-icon {
    background: linear-gradient(135deg, #2196f3 0%, #3f51b5 100%);
}

.interest-card-icon {
    background: linear-gradient(135deg, #ff5722 0%, #ff9800 100%);
}

.loan-card-icon {
    background: linear-gradient(135deg, #4caf50 0%, #8bc34a 100%);
}

.extra-card-icon {
    background: linear-gradient(135deg, #ff9800 0%, #ff5722 100%);
}

.date-card-icon {
    background: linear-gradient(135deg, #9c27b0 0%, #e91e63 100%);
}

.payments-card-icon {
    background: linear-gradient(135deg, #00bcd4 0%, #009688 100%);
}

.cost-card-icon {
    background: linear-gradient(135deg, #ff9800 0%, #ff5722 100%);
}

.saved-card-icon {
    background: linear-gradient(135deg, #4caf50 0%, #8bc34a 100%);
}

.card-header p {
    margin: 0;
    font-size: clamp(13px, 3vw, 14px);
    font-weight: 600;
    color: #5c6bc0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#monthly-payment, #total-interest, #loan-amount-taken {
    margin: 0;
    font-size: clamp(20px, 4vw, 26px);
    font-weight: 700;
    color: #00008b;
    letter-spacing: 1px;
    overflow: hidden;
    text-overflow: ellipsis;
	text-align: center;
}

#extra-principal-paid, #payoff-date, #num-payments, #total-cost, #interest-saved {
    margin: 0;
    font-size: clamp(14px, 3vw, 18px);
    font-weight: 600;
    color: #00008b;
    overflow: hidden;
    text-overflow: ellipsis;
text-align: center;
}

/* Chart Container */
#chart-container {
    margin: 25px 0;
    display: none;
    width: 100%;
}

#chart-container h2 {
    border-bottom: 1px solid rgba(31,38,135,0.1);
    padding-bottom: 12px;
    color: #1a237e;
    font-weight: 600;
    font-size: clamp(18px, 3vw, 20px);
}

.chart-wrapper {
    background: rgba(255,255,255,0.8);
    padding: 15px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    border: 1px solid rgba(255,255,255,0.5);
    width: 100%;
    box-sizing: border-box;
}

#amortization-chart {
    width: 100%;
    height: clamp(250px, 40vw, 300px);
}

/* Amortization Schedule */
#amortization-schedule {
    margin-top: 25px;
    display: none;
    width: 100%;
}

.schedule-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(31,38,135,0.1);
    padding-bottom: 12px;
    gap: 15px;
}

.schedule-header h2 {
    margin: 0;
    color: #1a237e;
    font-weight: 600;
    font-size: clamp(18px, 3vw, 20px);
    flex: 1 1 20px;
}

.schedule-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
    flex: 1 1 auto;
}

.schedule-actions button {
    padding: 10px 15px;
    background: rgba(63,81,181,0.1);
    color: #3f51b5;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: clamp(12px, 3vw, 14px);
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.table-container {
    overflow-x: auto;
    margin-top: 15px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    border: 1px solid rgba(255,255,255,0.5);
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

#schedule-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 16px;
    overflow: hidden;
    background: white;
    min-width: 600px;
}

#schedule-table thead tr {
    background: linear-gradient(135deg, #3f51b5 0%, #2196f3 100%);
    color: white;
}

#schedule-table th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 500;
    font-size: clamp(12px, 3vw, 14px);
}

#schedule-table tbody tr {
    background-color: white;
    transition: all 0.2s;
}

#schedule-table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

#schedule-table tbody tr:hover {
    background-color: #f1f5fe;
}

#schedule-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    font-weight: 500;
    font-size: clamp(12px, 3vw, 14px);
}

/* Load More Button */
.load-more-container {
    text-align: center;
    margin-top: 20px;
}

#load-more-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, #3f51b5 0%, #2196f3 100%);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: clamp(13px, 3vw, 15px);
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(33,150,243,0.3);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-sizing: border-box;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .input-grid {
        grid-template-columns: 1fr;
    }
    
    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .summary-grid {
        grid-template-columns: 1fr;
    }
    
    .summary-header, .schedule-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .summary-actions, .schedule-actions {
        justify-content: flex-start;
        width: 100%;
    }
}