/* 基础样式 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    color: #1a202c;
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    min-height: 100vh;
    padding: 2rem 1rem;
    max-width: 80rem;
    margin: 0 auto;
}

/* 主布局 */
.main-layout {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.calculator-section {
    flex: 1;
    min-width: 0;
    width: 100%;
}

.sidebar-section {
    width: 320px;
    flex-shrink: 0;
}

.header {
    text-align: center;
    margin-bottom: 2rem;
    margin-top: 0;
}

.title {
    font-size: 1.875rem;
    font-weight: 700;
    color: #2d3748;
    display: flex;
    align-items: center;
    justify-content: center;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.title .icon {
    margin-right: 0.5rem;
}

.subtitle {
    margin-top: 0.75rem;
    font-size: 1rem;
    color: #718096;
    font-weight: 400;
}

/* 卡片样式 */
.calculator-card, .result-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.calculator-card:hover, .result-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12), 0 4px 8px rgba(0, 0, 0, 0.08);
}

/* 分组样式 */
.section-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, #4299e1, #63b3ed);
    border-radius: 1px;
}

.subsection-title {
    font-size: 1rem;
    font-weight: 500;
    color: #4a5568;
    margin-bottom: 1rem;
    padding-left: 0.5rem;
    border-left: 3px solid #bee3f8;
}

.income-type-section,
.insurance-section {
    margin-bottom: 1.5rem;
}

.income-section {
    margin-bottom: 2rem;
}

/* 单选按钮组样式 */
.radio-group {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.radio-option {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.radio-option input[type="radio"] {
    margin-right: 0.5rem;
    width: 1rem;
    height: 1rem;
    accent-color: #2563eb;
}

.radio-label {
    font-size: 0.875rem;
    color: #4a5568;
    font-weight: 500;
    transition: color 0.2s ease;
}

.radio-option:hover .radio-label {
    color: #2d3748;
}

/* 表单样式 */
.form-group {
    margin-bottom: 0.75rem;
}

.form-label {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    font-weight: 500;
    color: #4a5568;
    margin-bottom: 0.375rem;
}

.form-label .icon {
    margin-right: 0.375rem;
}

.input-wrapper {
    position: relative;
}

.form-input {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.875rem;
    line-height: 1.4;
    color: #2d3748;
    background-color: rgba(255, 255, 255, 0.8);
    transition: all 0.2s ease;
    padding-right: 2.5rem;
    backdrop-filter: blur(5px);
}

.form-input:focus {
    outline: none;
    border-color: #4299e1;
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.15), 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.input-suffix {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #a0aec0;
    font-size: 0.75rem;
    font-weight: 500;
    pointer-events: none;
}

/* 月度收入网格 */
.monthly-income-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
}

/* 五险一金网格 */
.insurance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
    margin-top: 0.75rem;
}

/* 隐藏元素 */
.hidden {
    display: none !important;
}

/* 按钮样式 */
.button-container {
    margin-top: 2.5rem;
    margin-bottom: 1.3rem;
}

.calculate-button {
    display: flex;
    width: 100%;
    justify-content: center;
    align-items: center;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(66, 153, 225, 0.3);
    letter-spacing: 0.025em;
}

.calculate-button:hover {
    background: linear-gradient(135deg, #3182ce 0%, #2c5aa0 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(66, 153, 225, 0.4);
}

.calculate-button:active {
    transform: scale(0.98);
}

/* 结果卡片样式 */
.result-card {
    display: block;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.result-card.hidden {
    display: none;
    opacity: 0;
    transform: translateY(20px);
}

.result-title {
    font-size: 1rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.result-title .icon {
    margin-right: 0.5rem;
}

.result-summary {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
    .result-summary {
        grid-template-columns: 1fr 1fr;
    }
}

@media (min-width: 1024px) {
    .result-summary {
        grid-template-columns: 1fr 1fr 1fr 1fr;
    }
}

.result-item {
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    transition: all 0.2s ease;
}

.result-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.result-item.blue {
    background: linear-gradient(135deg, #ebf8ff 0%, #bee3f8 100%);
}

.result-item.purple {
    background: linear-gradient(135deg, #faf5ff 0%, #e9d8fd 100%);
}

.result-item.green {
    background: linear-gradient(135deg, #f0fff4 0%, #c6f6d5 100%);
}

.result-item.orange {
    background: linear-gradient(135deg, #fffaf0 0%, #fbd38d 100%);
}

.result-label {
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.result-item.blue .result-label {
    color: #2b6cb0;
}

.result-item.purple .result-label {
    color: #6b46c1;
}

.result-item.green .result-label {
    color: #2f855a;
}

.result-item.orange .result-label {
    color: #c05621;
}

.result-value {
    font-size: 1.35rem;
    font-weight: 700;
    margin-top: 0.25rem;
    letter-spacing: -0.025em;
}

.result-item.blue .result-value {
    color: #2563eb;
}

.result-item.purple .result-value {
    color: #7c3aed;
}

.result-item.green .result-value {
    color: #059669;
}

.result-item.orange .result-value {
    color: #ea580c;
}

/* 表格样式 */
.table-container {
    overflow-x: auto;
    margin-bottom: 2rem;
}

.result-table {
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.result-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    color: #6b7280;
    background-color: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.result-table td {
    padding: 1rem;
    font-size: 0.875rem;
    color: #6b7280;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}

.detail-button {
    background-color: #3b82f6;
    color: white;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.detail-button:hover {
    background-color: #2563eb;
}

/* 个税计算说明样式 */
.tax-explanation {
    background-color: #f8fafc;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-top: 2rem;
}

.explanation-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 1rem;
}

.explanation-content h4 {
    font-size: 1rem;
    font-weight: 500;
    color: #374151;
    margin: 1rem 0 0.5rem 0;
}

.explanation-content h4:first-child {
    margin-top: 0;
}

.formula {
    background-color: #e0e7ff;
    padding: 0.75rem;
    border-radius: 0.375rem;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    color: #3730a3;
    margin-bottom: 1rem;
    word-break: break-all;
}

.tax-table-container {
    overflow-x: auto;
    margin: 1rem 0;
}

.tax-rate-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.tax-rate-table th,
.tax-rate-table td {
    padding: 0.5rem;
    text-align: left;
    border: 1px solid #d1d5db;
}

.tax-rate-table th {
    background-color: #f3f4f6;
    font-weight: 500;
    color: #374151;
}

.tax-rate-table td {
    color: #6b7280;
}

.explanation-list {
    list-style-type: disc;
    padding-left: 1.5rem;
    color: #6b7280;
}

.explanation-list li {
    margin-bottom: 0.25rem;
}

/* 弹窗样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background-color: white;
    border-radius: 0.5rem;
    width: 90%;
    max-width: 800px;
    max-height: 90%;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #374151;
}

.modal-body {
    padding: 1.5rem;
}

/* 高级功能样式 */
.advanced-section {
    background: rgba(248, 250, 252, 0.8);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-top: 16px;
    overflow: hidden;
    backdrop-filter: blur(10px);
    transition: all 0.2s ease;
}

.advanced-section:hover {
    border-color: #cbd5e0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.advanced-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(5px);
}

.advanced-toggle:hover {
    background: rgba(247, 250, 252, 0.95);
    transform: translateY(-1px);
}

.advanced-toggle .section-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #2d3748;
    letter-spacing: 0.025em;
}

.toggle-btn {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-btn:hover {
    background: #e2e8f0;
}

.toggle-icon {
    transition: transform 0.3s ease;
    color: #4a5568;
}

.advanced-toggle.expanded .toggle-icon {
    transform: rotate(180deg);
}

.advanced-content {
    padding: 16px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
}

.advanced-content.hidden {
    display: none;
}

/* 分别设置基数样式 */
#separateBaseSection {
    margin-top: 16px;
    padding: 16px;
    background: rgba(247, 250, 252, 0.8);
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    backdrop-filter: blur(5px);
    transition: all 0.2s ease;
}

#separateBaseSection:hover {
    background: rgba(247, 250, 252, 0.9);
    border-color: #cbd5e0;
}

#separateBaseSection.hidden {
    display: none;
}

/* 侧边栏样式 */
.sidebar-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.sidebar-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12), 0 4px 8px rgba(0, 0, 0, 0.08);
}

.tax-image-container {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 0;
}

.tax-image {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.sidebar-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
    position: relative;
}

.sidebar-title::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 40px;
    height: 2px;
    background: linear-gradient(90deg, #4299e1, #63b3ed);
    border-radius: 1px;
}

.tax-tips {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.tip-item {
    padding: 1rem;
    background: rgba(247, 250, 252, 0.8);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.tip-item:hover {
    background: rgba(247, 250, 252, 1);
    transform: translateX(2px);
}

.tip-item h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 0.5rem;
}

.tip-item p {
    font-size: 0.8rem;
    color: #4a5568;
    line-height: 1.5;
}

.related-tools {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.tool-link {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: rgba(247, 250, 252, 0.8);
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.tool-link:hover {
    background: rgba(66, 153, 225, 0.1);
    border-color: #4299e1;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.15);
}

.tool-icon {
    font-size: 1.5rem;
    margin-right: 0.75rem;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(66, 153, 225, 0.1);
    border-radius: 6px;
}

.tool-info h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 0.25rem;
}

.tool-info p {
    font-size: 0.75rem;
    color: #4a5568;
    line-height: 1.4;
}

@media (max-width: 1440px) {
    .sidebar-section {
        display: none;
    }
}

/* 响应式设计 */
@media (min-width: 1200px) {
    .modal-content {
        width: 70%;
        max-width: 900px;
    }
}

@media (min-width: 992px) and (max-width: 1199px) {
    .modal-content {
        width: 80%;
        max-width: 800px;
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .modal-content {
        width: 85%;
        max-width: 700px;
    }
}

@media (max-width: 768px) {

    .main-layout {
        flex-direction: column;
    }

    .sidebar-section {
        display: block;
    }
    
    .sidebar-section {
        width: 100%;
    }
    
    .sidebar-card {
        margin-bottom: 1rem;
    }
}



@media (max-width: 767px) {
    .container {
        padding: 1rem 0.5rem;
    }
    
    .calculator-card, .result-card, .sidebar-card {
        padding: 1rem;
    }
    
    .radio-group {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .monthly-income-grid,
    .insurance-grid {
        grid-template-columns: 1fr;
    }
    
    .result-summary {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
        max-width: none;
        margin: 0.5rem;
        max-height: 95%;
    }
    
    .modal-header,
    .modal-body {
        padding: 1rem;
    }
    
    .tip-item, .tool-link {
        padding: 0.75rem;
    }
}

@media (max-width: 480px) {
    .modal-content {
        width: 98%;
        margin: 0.25rem;
        border-radius: 0.25rem;
    }
    
    .modal-header,
    .modal-body {
        padding: 0.75rem;
    }
    
    .modal-title {
        font-size: 1rem;
    }
}