/* 圖表專用樣式 - charts.css */
/* 適用於所有圖表元素的專用樣式 */

/* 圖表容器 */
.chart-container {
    position: relative;
    height: 400px;
    margin: 30px 0;
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.chart-title {
    font-size: 1.3em;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 20px;
    text-align: center;
}

/* 對比圖表網格 */
.comparison-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin: 30px 0;
}

.comparison-card {
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* 調整前圖表樣式 */
.before-card {
    background: linear-gradient(135deg, #fff5f5 0%, #fed7d7 100%);
    border: 2px solid #fc8181;
}

.before-card h3 {
    color: #c53030;
    margin-bottom: 20px;
}

/* 調整後圖表樣式 */
.after-card {
    background: linear-gradient(135deg, #f0fff4 0%, #c6f6d5 100%);
    border: 2px solid #48bb78;
}

.after-card h3 {
    color: #276749;
    margin-bottom: 20px;
}

/* 圓餅圖容器 */
.pie-chart-container {
    position: relative;
    height: 300px;
    margin: 20px 0;
}

/* 線圖容器 */
.line-chart-container {
    position: relative;
    height: 450px;
    margin: 30px 0;
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

/* 圖表說明文字 */
.chart-description {
    margin-top: 15px;
    font-size: 0.9em;
    color: #666;
    font-style: italic;
}

.before-card .chart-description {
    color: #c53030;
}

.after-card .chart-description {
    color: #276749;
}

/* 圖表統計數據 */
.chart-stats {
    display: flex;
    justify-content: space-around;
    margin-top: 20px;
    padding: 15px;
    background: rgba(255,255,255,0.7);
    border-radius: 8px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 1.5em;
    font-weight: bold;
    color: #667eea;
}

.stat-label {
    font-size: 0.8em;
    color: #666;
    margin-top: 5px;
}

/* 圖表圖例樣式 */
.chart-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
}

/* 圖表載入狀態 */
.chart-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    color: #666;
    font-style: italic;
}

.chart-loading::before {
    content: "📊 ";
    margin-right: 8px;
}

/* 圖表錯誤狀態 */
.chart-error {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    color: #e53e3e;
    font-style: italic;
}

.chart-error::before {
    content: "⚠️ ";
    margin-right: 8px;
}

/* 互動提示 */
.chart-tooltip {
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.85em;
    pointer-events: none;
}

/* 圖表動畫 */
.chart-container canvas {
    animation: fadeIn 0.8s ease-in-out;
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(20px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

/* 圖表響應式設計 */
@media (max-width: 768px) {
    .comparison-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .chart-container {
        height: 300px;
        padding: 15px;
    }
    
    .line-chart-container {
        height: 350px;
        padding: 20px;
    }
    
    .pie-chart-container {
        height: 250px;
    }
    
    .chart-stats {
        flex-direction: column;
        gap: 10px;
    }
    
    .chart-legend {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
}