/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 顶部导航区 */
.header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #4a6fa5 0%, #166bb3 100%);
    color: white;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}

.logo i {
    font-size: 2.5rem;
    margin-right: 15px;
}

.logo h1 {
    font-size: 2rem;
    font-weight: 700;
}

.description {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* 计算器容器 */
.calculator-container {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    margin-bottom: 40px;
}

/* 输入表单区 */
.input-section {
    flex: 1;
    min-width: 300px;
    background-color: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.calculation-mode {
    margin-bottom: 25px;
}

.mode-toggle {
    display: flex;
    margin-top: 10px;
}

.mode-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background-color: #f0f2f5;
    color: #333;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mode-btn:first-child {
    border-radius: 5px 0 0 5px;
}

.mode-btn:last-child {
    border-radius: 0 5px 5px 0;
}

.mode-btn.active {
    background-color: #166bb3;
    color: white;
}

.mode-btn:hover:not(.active) {
    background-color: #e1e4e8;
}

.form-group {
    margin-bottom: 25px;
}

.form-group h2 {
    margin-bottom: 15px;
    color: #166bb3;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
}

.form-group h2 i {
    margin-right: 8px;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
}

.form-item {
    flex: 1;
    min-width: 200px;
}

.form-item label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
    display: flex;
    align-items: center;
}

.form-item label i {
    margin-right: 8px;
    color: #166bb3;
}

.form-item input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-item input:focus {
    outline: none;
    border-color: #166bb3;
    box-shadow: 0 0 0 3px rgba(22, 107, 179, 0.1);
}

.error-message {
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 5px;
    height: 20px;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

#calculate-btn, #reset-btn {
    flex: 1;
    padding: 14px;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#calculate-btn {
    background-color: #166bb3;
    color: white;
}

#calculate-btn:hover {
    background-color: #135a96;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

#reset-btn {
    background-color: #f0f2f5;
    color: #333;
}

#reset-btn:hover {
    background-color: #e1e4e8;
    transform: translateY(-2px);
}

#calculate-btn i, #reset-btn i {
    margin-right: 8px;
}

/* 计算结果区 */
.result-section {
    flex: 1;
    min-width: 300px;
    background-color: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.result-section h2 {
    margin-bottom: 20px;
    color: #166bb3;
    font-size: 1.3rem;
}

.result-card {
    background: linear-gradient(135deg, #f0f7ff 0%, #e6f7ff 100%);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.result-item:last-child {
    border-bottom: none;
}

.result-item .label {
    font-size: 1rem;
    color: #555;
}

.result-item .value {
    font-size: 1.2rem;
    font-weight: 700;
    color: #333;
}

.result-item .unit {
    margin-left: 5px;
    font-size: 0.9rem;
    color: #777;
}

.result-item.highlighted {
    background-color: rgba(22, 107, 179, 0.05);
    padding: 15px;
    border-radius: 5px;
    margin: 10px -5px;
}

.result-item.highlighted .value {
    color: #166bb3;
    font-size: 1.3rem;
}

.yearly-summary {
    background-color: #f9f9f9;
    border-radius: 8px;
    padding: 20px;
}

.yearly-summary h3 {
    margin-bottom: 15px;
    color: #166bb3;
    font-size: 1.1rem;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.summary-item {
    background-color: white;
    padding: 15px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
}

.summary-item .label {
    font-size: 0.9rem;
    color: #777;
    margin-bottom: 5px;
    display: block;
}

.summary-item .value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #333;
}

.summary-item .unit {
    margin-left: 3px;
    font-size: 0.8rem;
    color: #999;
}

/* 说明区 */
.explanation-section {
    margin-bottom: 40px;
}

.explanation-section h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #166bb3;
    font-size: 1.5rem;
}

.explanation-card {
    background-color: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    margin-bottom: 25px;
}

.explanation-card h3 {
    margin-bottom: 15px;
    color: #166bb3;
    font-size: 1.2rem;
}

.formula {
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 5px;
    margin-top: 10px;
}

.formula p {
    margin-bottom: 10px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.95rem;
}

.tax-table-container, .deduction-table-container {
    overflow-x: auto;
    margin-top: 15px;
}

.tax-table, .deduction-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.tax-table th, .tax-table td, .deduction-table th, .deduction-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.tax-table th, .deduction-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

.tax-table tr:hover, .deduction-table tr:hover {
    background-color: #f1f3f5;
}

/* 底部信息区 */
.footer {
    background-color: #343a40;
    color: white;
    padding: 30px 0;
    border-radius: 10px;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    text-align: center;
}

.footer-content p {
    margin-bottom: 10px;
    opacity: 0.8;
}

.disclaimer {
    font-size: 0.9rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .logo h1 {
        font-size: 1.5rem;
    }

    .logo i {
        font-size: 2rem;
    }

    .form-row {
        flex-direction: column;
        gap: 15px;
    }

    .form-item {
        min-width: 100%;
    }

    .form-actions {
        flex-direction: column;
    }

    .summary-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    .header {
        padding: 15px;
    }

    .logo {
        flex-direction: column;
    }

    .logo i {
        margin-right: 0;
        margin-bottom: 10px;
    }

    .input-section, .result-section {
        padding: 15px;
    }

    .result-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .result-item .unit {
        margin-left: 0;
        margin-top: 5px;
    }

    .summary-grid {
        grid-template-columns: 1fr;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-card, .yearly-summary {
    animation: fadeIn 0.5s ease;
}

.result-item {
    transition: all 0.3s ease;
}

.result-item.highlighted {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(22, 107, 179, 0.2); }
    70% { box-shadow: 0 0 0 10px rgba(22, 107, 179, 0); }
    100% { box-shadow: 0 0 0 0 rgba(22, 107, 179, 0); }
}
