:root {
    --primary-color: #4a90e2;
    --primary-hover: #357abd;
    --primary-light: rgba(74, 144, 226, 0.1);
    --secondary-color: #f5f5f5;
    --text-color: #333;
    --border-color: #ddd;
    --error-color: #e74c3c;
    --success-color: #2ecc71;
    --background-color: #f8f9fa;
    --card-color: #ffffff;
    --section-border: #e1e4e8;
    --transition-speed: 0.3s;
    --border-radius: 8px;
    --box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    transition: background-color var(--transition-speed) ease;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    transition: padding var(--transition-speed) ease;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 0 10px;
}

h1 {
    color: var(--primary-color);
    font-size: clamp(1.2rem, 4vw, 1.8rem);
    margin-bottom: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: font-size var(--transition-speed) ease;
}

/* 表单区块样式 */
.form-section {
    background-color: var(--card-color);
    border: 1px solid var(--section-border);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    width: 100%;
    box-shadow: var(--box-shadow);
    transition: all var(--transition-speed) ease;
    animation: fadeIn 0.5s ease-in-out;
}

.section-title {
    font-size: 1.2em;
    color: var(--primary-color);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--section-border);
}

/* 表单网格布局 */
.form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 20px;
    transition: all var(--transition-speed) ease;
}

/* 确保所有表单组件的一致布局 */
.form-group {
    margin: 0;
    padding: 0;
    width: 100%;
    box-sizing: border-box;
    transition: opacity var(--transition-speed) ease;
}

/* 表单组件悬停效果 */
label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 14px;
    color: #555;
}

input, select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    transition: all var(--transition-speed) ease;
    background-color: var(--card-color);
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2);
}

/* 补充公积金行 */
.supplementary-row {
    display: none;
    opacity: 0;
    transition: opacity var(--transition-speed) ease;
    animation: slideDown 0.3s ease-out;
}

/* 空白占位符 */
.placeholder {
    visibility: hidden;
}

input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button {
    opacity: 1;
}

/* 计算按钮 */
.calculate-btn {
    background-color: var(--primary-color);
    color: white;
    padding: 14px 28px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 16px;
    cursor: pointer;
    width: 100%;
    max-width: 400px;
    margin: 30px auto;
    display: block;
    transition: all 0.3s ease;
    font-weight: 500;
    box-shadow: 0 4px 6px rgba(50, 50, 93, 0.11), 0 1px 3px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
}

.calculate-btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 7px 14px rgba(50, 50, 93, 0.1), 0 3px 6px rgba(0, 0, 0, 0.08);
}

.calculate-btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 5px rgba(50, 50, 93, 0.1), 0 1px 2px rgba(0, 0, 0, 0.08);
}

.calculate-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%, -50%);
    transform-origin: 50% 50%;
}

.calculate-btn:focus:not(:active)::after {
    animation: ripple 1s ease-out;
}

/* 结果区域 */
.result-section {
    margin-top: 30px;
    padding: 25px;
    background-color: var(--card-color);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    width: 100%;
    animation: fadeIn 0.8s ease-in-out;
    transition: all var(--transition-speed) ease;
}

.result-section h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.4em;
    font-weight: 600;
    text-align: center;
}

/* 新的结果摘要样式 */
.result-summary {
    background-color: var(--secondary-color);
    border-radius: var(--border-radius);
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    animation: fadeInUp 0.5s ease-out;
    transition: transform 0.3s ease;
}

.result-summary:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.result-main {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px dashed var(--border-color);
}

.result-label {
    font-size: 1.1em;
    color: #666;
    margin-bottom: 10px;
    font-weight: 500;
}

.result-value-main {
    font-size: 2.2em;
    font-weight: 700;
    color: var(--primary-color);
    margin: 15px 0 5px;
    transition: all 0.3s ease;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    animation: pulse 1s ease-in-out;
}

.result-value-main.animated {
    animation: highlight 1s ease-in-out;
}

.result-unit-main {
    font-size: 1em;
    color: #666;
    margin-top: 5px;
}

.result-details {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    gap: 10px;
}

.result-detail-item {
    flex: 1;
    min-width: 120px;
    text-align: center;
    padding: 10px;
    color: #666;
    font-size: 0.95em;
    transition: background-color 0.2s ease;
    border-radius: 4px;
}

.result-detail-item:hover {
    background-color: rgba(74, 144, 226, 0.08);
}

.result-detail-item span:nth-child(2) {
    font-weight: 600;
    color: var(--primary-color);
    margin: 0 3px;
}

/* 计算明细 */
.calculation-details {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--section-border);
    animation: fadeIn 1s ease-in-out;
}

.calculation-details h3 {
    font-size: 1.1em;
    color: #555;
    margin-bottom: 15px;
    text-align: center;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 10px;
    border-bottom: 1px dashed var(--section-border);
    transition: background-color 0.2s ease;
    border-radius: 4px;
}

.detail-item:hover {
    background-color: var(--primary-light);
}

.detail-label {
    color: #666;
    font-size: 14px;
    flex: 0 0 40%;
    padding-right: 10px;
}

.detail-value {
    font-weight: 500;
    color: var(--primary-color);
    flex: 0 0 60%;
    text-align: right;
}

.info-note {
    color: #666;
    font-size: 13px;
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px dotted #eee;
}

/* 借款人明细区块样式 */
.borrower-details {
    background-color: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    position: relative;
    transition: all 0.3s ease;
}

.borrower-details:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.15);
}

.borrower-details h4 {
    color: var(--primary-color);
    font-size: 1.1em;
    font-weight: 600;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary-color);
    position: relative;
}

.borrower-details h4::before {
    content: '';
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 30px;
    height: 2px;
    background-color: var(--primary-color);
}

/* 主贷人特殊样式 */
#mainDetail {
    border-left: 4px solid var(--primary-color);
}

#mainDetail h4 {
    color: var(--primary-color);
}

/* 参贷人特殊样式 */
#coDetail {
    border-left: 4px solid var(--primary-color);
}

#coDetail h4 {
    color: var(--primary-color);
}

/* 最终取值样式已整合到明细框内，不再需要独立样式 */

/* 脉动动画 */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes highlight {
    0% {
        color: var(--primary-color);
    }
    50% {
        color: var(--success-color);
    }
    100% {
        color: var(--primary-color);
    }
}

/* 二维码样式 */
.qrcode-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 30px;
    padding: 20px 0;
    border-top: 1px solid #eaeaea;
    width: 100%;
}

.qrcode-image {
    width: 150px;
    height: 150px;
    margin-bottom: 15px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.qrcode-text {
    font-size: 15px;
    color: #555;
    text-align: center;
    margin: 0;
    line-height: 1.5;
    max-width: 90%;
}

/* 响应式设计调整 */
@media (max-width: 1024px) {
    .container {
        padding: 15px;
    }
    
    .form-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    h1 {
        font-size: clamp(1.2rem, 5vw, 1.6rem);
        padding: 0 5px;
    }
    
    .form-section, .result-section {
        padding: 15px;
    }
    
    .result-summary {
        padding: 20px;
    }
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    /* 在小屏幕上隐藏占位符 */
    .placeholder {
        display: none;
    }
    
    /* 优化灵活就业人员输入框在移动端的显示 */
    .deposit-ratio {
        width: 45%;
        display: inline-block;
        vertical-align: top;
        margin-right: 3%;
    }
    
    .deposit-time {
        width: 52%;
        display: inline-block;
        vertical-align: top;
    }
    
    h1 {
        white-space: normal;
        font-size: clamp(1.1rem, 5vw, 1.4rem);
    }
    
    .calculate-btn {
        max-width: 100%;
    }
    
    .result-value-main {
        font-size: 1.8em;
    }
    
    .result-details {
        flex-direction: column;
    }
    
    .result-detail-item {
        border-bottom: 1px solid rgba(0,0,0,0.05);
        padding: 8px 0;
    }
    
    .result-detail-item:last-child {
        border-bottom: none;
    }
    
    /* 移动端二维码样式优化 */
    .qrcode-container {
        padding: 15px 0;
        margin-top: 20px;
    }
    
    .qrcode-image {
        width: 130px;
        height: 130px;
    }
    
    .qrcode-text {
        font-size: 14px;
        padding: 0 15px;
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .form-section, .result-section {
        padding: 12px;
        border-radius: 6px;
    }
    
    .form-grid,
    .supplementary-row {
        gap: 15px;
    }
    
    .result-summary {
        padding: 15px;
    }
    
    .detail-item {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
    }
    
    .detail-label {
        flex: 0 0 50%;
        padding-right: 10px;
        font-size: 13px;
        white-space: normal;
    }
    
    .detail-value {
        flex: 0 0 50%;
        text-align: right;
        font-weight: 500;
        font-size: 13px;
        word-break: break-word;
    }
    
    input, select {
        padding: 10px;
    }
}

/* 错误提示样式 */
.error {
    border-color: var(--error-color);
    animation: shake 0.5s ease-in-out;
}

.error-message {
    color: var(--error-color);
    font-size: 12px;
    margin-top: 4px;
    animation: fadeIn 0.3s ease-in-out;
}

/* 免责声明样式 */
.disclaimer {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px dashed var(--section-border);
    color: #888;
    font-size: 14px;
    text-align: center;
    font-style: italic;
}

/* 动画定义 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from { 
        opacity: 0;
        transform: translateY(20px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 0.5;
    }
    20% {
        transform: scale(25, 25);
        opacity: 0.5;
    }
    100% {
        opacity: 0;
        transform: scale(40, 40);
    }
}

.full-width {
    grid-column: 1 / -1;
}