@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap');

.kpr-calculator {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    font-family: 'Poppins', sans-serif;
    color: #333;
}

.kpr-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.kpr-header h2 {
    font-size: 2rem;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.kpr-header p {
    color: #666;
    font-size: 15px;
}

.kpr-main-container {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    justify-content: space-between;
}

.kpr-form-container, .kpr-result-container {
    flex: 1;
    min-width: 300px;
    padding: 25px;
    background-color: #fff;
}

.kpr-form-container form {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 15px;
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #2c3e50;
}

.input-with-icon {
    position: relative;
}

.input-with-icon .currency {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #7f8c8d;
}

.kpr-calculator input[type="text"],
.kpr-calculator input[type="number"],
.kpr-calculator select {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background-color: #fff;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.kpr-calculator input[type="text"]:focus,
.kpr-calculator input[type="number"]:focus,
.kpr-calculator select:focus {
    border-color: #0054A6;
    outline: none;
    box-shadow: 0 2px 6px rgba(0, 84, 166, 0.2);
}

.numeric-input {
    width: 100%;
    padding: 0.75rem 3rem!important;
    font-size: 1rem;
}

.dp-percent-container, .dp-amount-container {
    position: relative;
    display: inline-block;
}

.dp-percent-input {
    width: 100px;
    padding: 12px 30px 12px 10px;
    font-size: 14px;
    text-align: center;
}

.dp-amount-input {
    width: 160px;
}

.percent-symbol {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    font-size: 14px;
    pointer-events: none;
}

.rp-symbol {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    font-size: 14px;
    pointer-events: none;
}

.down-payment-group {
    position: relative;
    margin-bottom: 10px;
}

.dp-input-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.down-payment-group input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: #e0e0e0;
    border-radius: 10px;
    outline: none;
}

.down-payment-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #0054A6;
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.down-payment-group input[type="range"]::-webkit-slider-thumb:hover {
    background: #003087;
    transform: scale(1.1);
}

.range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

.range-min, .range-max {
    font-weight: 500;
}

.tenor-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tenor-input {
    position: relative;
    display: flex;
    align-items: center;
}

.tenor-value {
    width: 60px;
    height: 40px;
    padding: 8px 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.tenor-unit {
    margin-left: 8px;
    color: #333;
    font-size: 14px;
    font-weight: 500;
}

.tenor-group input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: #e0e0e0;
    border-radius: 10px;
    outline: none;
}

.tenor-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #0054A6;
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tenor-group input[type="range"]::-webkit-slider-thumb:hover {
    background: #003087;
    transform: scale(1.1);
}

.tenor-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

.tenor-min, .tenor-max {
    font-weight: 500;
}

.medium-input {
    width: 220px;
}

.calculate-btn {
    background-color: #0054A6;
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: background 0.3s ease, transform 0.2s ease;
    align-self: flex-start;
    width: 250px;
    box-shadow: 0 2px 6px rgba(0, 84, 166, 0.2);
}

.calculate-btn:hover {
    background-color: #003087;
    transform: translateY(-2px);
}

.calculate-btn.loading {
    opacity: 0.7;
    cursor: not-allowed;
}

.kpr-result-container {
    padding: 20px;
}

.result-header {
    background-color: #ffebee;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.result-header h3 {
    color: #0054A6;
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.result-subheader {
    display: flex;
    justify-content: space-between;
    color: #666;
    font-size: 14px;
    margin-top: 5px;
}

.result-amount {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.amount-label {
    font-size: 16px;
    color: #333;
}

.amount-value {
    font-size: 24px;
    font-weight: 600;
    color: #0054A6;
}

.payment-details {
    margin-bottom: 20px;
}

.payment-details h4 {
    color: #0054A6;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toggle-details {
    cursor: pointer;
    font-size: 14px;
}

.details-content {
    display: none;
    padding: 10px;
    background-color: #f9f9f9;
    border-radius: 8px;
}

.detail-section h5 {
    color: #333;
    font-size: 16px;
    font-weight: 500;
    margin-top: 10px;
    margin-bottom: 5px;
}

.detail-item, .detail-total {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
}

.detail-value {
    font-weight: 500;
    color: #0054A6;
}

.info-icon {
    font-size: 12px;
    color: #666;
    margin-left: 5px;
    cursor: pointer;
}

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

.export-btn {
    background-color: #0054A6;
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    width: 100%;
    margin-top: 10px;
    box-shadow: 0 2px 6px rgba(0, 84, 166, 0.2);
}

.export-btn:hover {
    background-color: #003087;
    transform: translateY(-2px);
}

.kpr-disclaimer {
    margin-top: 2rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #7f8c8d;
    text-align: center;
}

#kpr-details {
    margin-top: 25px;
    display: none;
}

.table-container {
    max-height: 300px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #0054A6 #f0f0f0;
}

.table-container::-webkit-scrollbar {
    width: 8px;
}

.table-container::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb {
    background-color: #0054A6;
    border-radius: 4px;
}

#schedule-table {
    width: 100%;
    border-collapse: collapse;
}

#schedule-table th,
#schedule-table td {
    border: 1px solid #e0e0e0;
    padding: 12px;
    text-align: center;
    font-size: 14px;
    background-color: #fff;
}

#schedule-table th {
    background-color: #0054A6;
    color: white;
    position: sticky;
    top: 0;
    z-index: 1;
    font-weight: 600;
}

#schedule-table tbody tr:hover {
    background-color: #f5f7fa;
}

/* Media Queries */
@media (max-width: 768px) {
    .kpr-main-container {
        flex-direction: column;
    }

    .kpr-form-container,
    .kpr-result-container {
        min-width: 100%;
        padding: 20px;
    }

    .dp-input-row {
        flex-direction: column;
        gap: 10px;
    }

    .dp-percent-container,
    .dp-amount-container {
        width: 100%;
    }

    .dp-percent-input {
        width: 100%;
    }

    .dp-amount-input {
        width: 100%;
    }

    .tenor-input {
        width: 100%;
    }

    .tenor-value {
        width: 60px;
    }

    .medium-input {
        width: 100%;
    }

    .calculate-btn,
    #export-pdf {
        width: 100%;
        text-align: center;
    }

    .table-container {
        max-height: 200px;
    }
}

@media (max-width: 480px) {
    .kpr-calculator {
        padding: 15px;
    }

    .kpr-header h2 {
        font-size: 24px;
    }

    .kpr-header p {
        font-size: 14px;
    }

    .form-group label {
        font-size: 14px;
    }

    .kpr-calculator input[type="text"],
    .kpr-calculator input[type="number"],
    .kpr-calculator select {
        font-size: 14px;
        padding: 10px 15px 10px 40px;
    }

    .calculate-btn,
    #export-pdf{
        font-size: 15px;
        padding: 10px 20px;
    }

    .table-container {
        max-height: 150px;
    }
}