/**
 * 图表相关样式
 * Charts Styles - All chart-related CSS
 * 文件路径: static/css/charts.css
 */

/* ===== 饼图样式 ===== */
.pie-chart-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.pie-chart-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.pie-chart-svg {
    max-width: 100%;
    height: auto;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.pie-slice {
    transition: transform 0.3s ease, filter 0.3s ease;
    transform-origin: center;
}

.pie-slice:hover {
    filter: brightness(1.1);
    transform: scale(1.05);
    stroke-width: 3;
}

.chart-center-title {
    font-size: 14px;
    font-weight: 600;
    fill: #374151;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.chart-center-subtitle {
    font-size: 10px;
    fill: #6b7280;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* ===== 图例样式 ===== */
.chart-legend {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
    max-width: 400px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: #f9fafb;
    border-radius: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.legend-item:hover {
    background: #f3f4f6;
    transform: translateX(4px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.legend-item.jurisdiction-highlighted {
    background: #dbeafe;
    border: 2px solid #3b82f6;
    transform: translateX(6px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.legend-label {
    font-weight: 600;
    color: #374151;
    flex: 1;
    min-width: 0;
}

.legend-value {
    font-weight: 700;
    color: #1f2937;
    font-size: 0.9rem;
}

.legend-amount {
    font-size: 0.8rem;
    color: #6b7280;
    font-weight: 500;
}

/* ===== 空图表占位符 ===== */
.empty-chart-placeholder {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
    background: #f9fafb;
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    margin: 1rem 0;
}

.empty-chart-icon {
    text-align: center;
    color: #9ca3af;
}

.empty-chart-icon i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-chart-icon p {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.empty-chart-icon small {
    font-size: 0.9rem;
    opacity: 0.7;
}

/* ===== 税负构成条形图 ===== */
.breakdown-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.breakdown-item {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1.25rem;
    transition: all 0.3s ease;
}

.breakdown-item:hover {
    border-color: #d1d5db;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.breakdown-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.breakdown-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 8px;
    font-size: 1.2rem;
}

.breakdown-label {
    font-weight: 600;
    color: #374151;
    font-size: 1rem;
}

.breakdown-amount {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.breakdown-percentage {
    font-size: 0.9rem;
    color: #6b7280;
    margin-bottom: 1rem;
}

.breakdown-bar {
    width: 100%;
    height: 8px;
    background: #f3f4f6;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.breakdown-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.8s ease-in-out;
    position: relative;
}

.breakdown-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ===== 趋势图样式 ===== */
.trend-chart-container {
    background: #ffffff;
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid #e5e7eb;
}

.trend-chart-header {
    margin-bottom: 1.5rem;
    text-align: center;
}

.trend-chart-header h5 {
    color: #374151;
    font-weight: 600;
    margin: 0;
}

.trend-chart-placeholder {
    position: relative;
    height: 200px;
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.trend-line-mock {
    position: relative;
    width: 80%;
    height: 60%;
}

.trend-point {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #3b82f6;
    border: 3px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
    transition: all 0.3s ease;
}

.trend-point:hover {
    transform: scale(1.2);
    background: #1d4ed8;
}

.trend-point.active {
    background: #ef4444;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.trend-axis {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
}

.axis-label {
    font-size: 0.8rem;
    color: #6b7280;
    font-weight: 500;
}

/* ===== 分配显示样式 ===== */
.allocation-display {
    width: 100%;
}

.key-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.metric-card {
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
}

.metric-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.1);
    transform: translateY(-2px);
}

.metric-label {
    font-size: 0.9rem;
    color: #6b7280;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.metric-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1f2937;
}

.metric-value.positive {
    color: #16a34a;
}

.metric-value.negative {
    color: #dc2626;
}

/* ===== 图表部分标题样式 ===== */
.chart-section {
    margin: 2rem 0;
}

.section-subtitle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e5e7eb;
}

.section-subtitle i {
    color: #3b82f6;
}

/* ===== 响应式设计 ===== */
@media (max-width: 768px) {
    .pie-chart-container {
        padding: 1rem;
        gap: 1rem;
    }
    
    .chart-legend {
        max-width: 100%;
    }
    
    .legend-item {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .legend-amount {
        flex-basis: 100%;
        text-align: right;
        margin-top: 0.25rem;
    }
    
    .key-metrics {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .metric-card {
        padding: 1rem;
    }
    
    .metric-value {
        font-size: 1.4rem;
    }
    
    .breakdown-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .key-metrics {
        grid-template-columns: 1fr;
    }
    
    .pie-chart-svg {
        width: 180px;
        height: 180px;
    }
    
    .metric-card {
        padding: 0.75rem;
    }
    
    .metric-value {
        font-size: 1.2rem;
    }
}

/* ===== 高亮和动画效果 ===== */
.jurisdiction-highlighted {
    animation: highlight 0.5s ease-in-out;
    background: #dbeafe !important;
    border-color: #3b82f6 !important;
}

@keyframes highlight {
    0% { background: #ffffff; }
    50% { background: #bfdbfe; }
    100% { background: #dbeafe; }
}

/* ===== 图表加载动画 ===== */
.chart-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
}

.chart-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f4f6;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== 图表工具栏 ===== */
.chart-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: #f9fafb;
    border-radius: 8px;
}

.chart-tools {
    display: flex;
    gap: 0.5rem;
}

.chart-tool-btn {
    padding: 0.5rem;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.chart-tool-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.chart-tool-btn.active {
    background: #3b82f6;
    color: #ffffff;
    border-color: #3b82f6;
}

/* ===== 图表导出样式 ===== */
.chart-export-menu {
    position: relative;
    display: inline-block;
}

.export-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    min-width: 150px;
    display: none;
}

.export-dropdown.show {
    display: block;
}

.export-option {
    padding: 0.75rem;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid #f3f4f6;
}

.export-option:last-child {
    border-bottom: none;
}

.export-option:hover {
    background: #f9fafb;
}

.export-option i {
    margin-right: 0.5rem;
    color: #6b7280;
}