* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

.calculator-wrapper {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 30px;
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* 输入区域样式 */
.input-section {
    padding-right: 20px;
}

.input-section h2,
.result-section h2 {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #667eea;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input[readonly] {
    background-color: #f5f5f5;
    color: #666;
}

/* 首付比例输入框样式 */
.down-payment-wrapper {
    display: flex;
    align-items: center;
    position: relative;
}

.down-payment-wrapper input {
    padding-right: 35px;
}

.percent-symbol {
    position: absolute;
    right: 12px;
    color: #666;
    font-weight: 600;
    pointer-events: none;
}

/* 输入提示文字 */
.input-hint {
    display: block;
    font-size: 0.85rem;
    color: #999;
    margin-top: 5px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* 单选按钮组样式 */
.radio-group {
    display: flex;
    gap: 20px;
}

.radio-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 10px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.radio-option:hover {
    border-color: #667eea;
}

.radio-option input[type="radio"] {
    margin-right: 8px;
    width: auto;
}

.radio-option input[type="radio"]:checked + .radio-label {
    color: #667eea;
    font-weight: 600;
}

.radio-option:has(input[type="radio"]:checked) {
    border-color: #667eea;
    background-color: rgba(102, 126, 234, 0.05);
}

/* 计算按钮样式 */
.calculate-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 30px;
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.calculate-btn:active {
    transform: translateY(0);
}

.btn-icon {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.calculate-btn:hover .btn-icon {
    transform: translateX(5px);
}

/* 结果区域样式 */
.result-section {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 30px;
    border-radius: 15px;
}

.result-section h2 {
    border-color: #764ba2;
}

.result-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.result-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.result-card:hover {
    transform: translateY(-5px);
}

.result-label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 10px;
}

.result-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: #333;
}

.result-value.primary {
    color: #667eea;
    font-size: 1.4rem;
}

.result-value.warning {
    color: #f59e0b;
    font-size: 1.4rem;
}

/* 每月还款显示 */
.monthly-payment {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 30px;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.monthly-label {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    margin-bottom: 10px;
}

.monthly-value {
    color: white;
    font-size: 2.5rem;
    font-weight: 700;
}

/* 还款详情表格 */
.payment-details h3 {
    font-size: 1.2rem;
    color: #333;
    margin-bottom: 15px;
}

.table-container {
    max-height: 400px;
    overflow-y: auto;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

#paymentTable {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

#paymentTable thead {
    position: sticky;
    top: 0;
    background: #667eea;
    z-index: 10;
}

#paymentTable th {
    color: white;
    padding: 12px;
    font-weight: 600;
    text-align: center;
}

#paymentTable td {
    padding: 10px;
    text-align: center;
    border-bottom: 1px solid #e0e0e0;
}

#paymentTable tbody tr:hover {
    background-color: rgba(102, 126, 234, 0.05);
}

#paymentTable tbody tr:last-child td {
    border-bottom: none;
}

/* 滚动条样式 */
.table-container::-webkit-scrollbar {
    width: 8px;
}

.table-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

/* 页脚样式 */
footer {
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 30px;
    font-size: 0.9rem;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .calculator-wrapper {
        grid-template-columns: 1fr;
    }

    .result-cards {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .calculator-wrapper {
        padding: 25px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .result-cards {
        grid-template-columns: 1fr;
    }

    .radio-group {
        flex-direction: column;
        gap: 10px;
    }

    .monthly-value {
        font-size: 2rem;
    }

    #paymentTable th,
    #paymentTable td {
        padding: 8px;
        font-size: 0.9rem;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.input-section,
.result-section {
    animation: fadeIn 0.6s ease-out;
}

.result-section {
    animation-delay: 0.2s;
}
