/* results-display.css - 结果显示组件样式文件 */

/* ===== 基础样式重置 ===== */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f8fafc;
}

/* ===== 布局控制 ===== */
/* 确保没有元素遮挡主要内容 */
.app-main {
    position: relative;
    z-index: 1;
}

.app-content {
    position: relative;
    z-index: 2;
    overflow-x: auto;
    padding: 1rem;
    min-height: calc(100vh - 80px);
}

/* 防止任何浮动元素遮挡 */
.floating-element {
    z-index: 10 !important;
    position: relative;
}

/* 确保所有按钮都不会浮动遮挡 */
button, .btn {
    position: relative;
    z-index: 3;
}

/* ===== 工作流程步骤样式 ===== */
.workflow-step {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.workflow-step:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.workflow-step.step-active {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.step-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    margin-top: 0;
}

.step-details.show {
    max-height: 300px;
    margin-top: 1rem;
}

.step-formula {
    background: #f8fafc;
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    font-family: monospace;
    font-size: 0.9rem;
}

/* ===== 结果显示区域 ===== */
.results-container {
    margin-top: 2rem;
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e5e7eb;
}

.results-header h3 {
    margin: 0;
    color: #1f2937;
    font-size: 1.5rem;
    font-weight: 600;
}

.results-actions {
    display: flex;
    gap: 0.5rem;
}

/* ===== 结果面板内容 ===== */
#basic-results-content {
    padding: 1.5rem;
}

.result-panel {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.panel-header {
    background: white;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h4 {
    margin: 0;
    color: #374151;
    font-size: 1.125rem;
    font-weight: 600;
}

.toggle-icon {
    transition: transform 0.3s ease;
}

/* ===== 结果卡片网格 ===== */
.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.result-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}

.result-card h5 {
    margin: 0 0 0.5rem 0;
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
}

.result-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
}

.result-value.positive {
    color: #16a34a;
}

.result-value.warning {
    color: #f59e0b;
}

/* ===== 分配显示组件 ===== */
.allocation-display {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
}

.key-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.metric-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}

.metric-label {
    font-size: 0.875rem;
    color: #64748b;
    margin-bottom: 0.5rem;
}

.metric-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
}

.metric-value.positive {
    color: #16a34a;
}

/* ===== 图表和表格区域 ===== */
.chart-section, 
.allocation-table, 
.tax-breakdown {
    margin-bottom: 2rem;
}

.section-subtitle {
    font-size: 1.125rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ===== 饼图组件 ===== */
.pie-chart-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.pie-chart-placeholder {
    width: 100%;
    height: 250px;
    background: #f9fafb;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.chart-icon {
    text-align: center;
    color: #6b7280;
}

.chart-icon i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: block;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 2px;
}

/* ===== 数据表格 ===== */
.table-container {
    overflow-x: auto;
    max-width: 100%;
    margin: 1rem 0;
}

.allocation-data-table {
    width: 100%;
    min-width: 800px; /* 确保表格有最小宽度 */
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

.allocation-data-table th,
.allocation-data-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.allocation-data-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #374151;
}

.allocation-data-table tbody tr:hover {
    background: #f8fafc;
}

.topup-breakdown {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

/* ===== 移动端卡片 ===== */
.mobile-cards {
    display: none;
}

.jurisdiction-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.allocation-badge {
    background: #3b82f6;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.card-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.card-row.total {
    font-weight: 600;
    padding-top: 0.5rem;
    border-top: 1px solid #e5e7eb;
}

/* ===== 税负构成分析 ===== */
.breakdown-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.breakdown-item {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem;
}

.breakdown-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.breakdown-icon {
    font-size: 1.25rem;
}

.breakdown-label {
    font-weight: 600;
    color: #374151;
}

.breakdown-amount {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.25rem;
}

.breakdown-percentage {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.breakdown-bar {
    width: 100%;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
}

.breakdown-fill {
    height: 100%;
    transition: width 0.3s ease;
}

/* ===== 交互控件 ===== */
.chart-placeholder {
    background: #f9fafb;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    color: #6b7280;
    margin: 1rem 0;
}

.collapsible-content {
    padding: 1.5rem;
    display: none;
}

.sensitivity-controls,
.scenario-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.sensitivity-controls label,
.scenario-controls label {
    font-weight: 500;
    color: #374151;
}

.sensitivity-controls select,
.scenario-controls select {
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
}

/* ===== 响应式设计 ===== */
@media (max-width: 768px) {
    .desktop-table {
        display: none;
    }
    
    .mobile-cards {
        display: block;
    }
    
    .key-metrics {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .breakdown-grid {
        grid-template-columns: 1fr;
    }
    
    .results-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .results-actions {
        justify-content: center;
    }
    
    .sensitivity-controls,
    .scenario-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .result-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .result-grid {
        grid-template-columns: 1fr;
    }
    
    .key-metrics {
        grid-template-columns: 1fr;
    }
    
    .app-content {
        padding: 0.5rem;
    }
    
    .results-container {
        padding: 1rem;
    }
}