/* 天气图表组件样式 */

.weather-charts-section {
    margin: 20px 0;
    padding: 20px;
    background: var(--card-bg, #ffffff);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.weather-charts-section:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.weather-charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 16px;
}

/* 图表卡片样式 */
.weather-chart-card {
    background: var(--card-bg, #ffffff);
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 8px;
    padding: 16px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.weather-chart-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.weather-chart-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color, #2196F3), var(--secondary-color, #FFC107));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.weather-chart-card:hover::before {
    opacity: 1;
}

/* 图表标题样式 */
.weather-chart-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color, #333333);
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.weather-chart-title .chart-icon {
    font-size: 18px;
}

.weather-chart-subtitle {
    font-size: 12px;
    color: var(--text-secondary, #666666);
    margin: 0 0 16px 0;
    font-weight: 400;
}

/* 图表容器样式 */
.weather-chart {
    width: 100%;
    height: 200px;
    position: relative;
    background: var(--chart-bg, #fafafa);
    border-radius: 6px;
    overflow: hidden;
}

.weather-chart canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

/* 图表加载状态 */
.weather-chart-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--text-secondary, #666666);
    font-size: 14px;
}

.weather-chart-loading::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color, #e0e0e0);
    border-top: 2px solid var(--primary-color, #2196F3);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

/* 图表错误状态 */
.weather-chart-error {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--error-color, #f44336);
    font-size: 14px;
    flex-direction: column;
    gap: 8px;
}

.weather-chart-error::before {
    content: '⚠️';
    font-size: 24px;
}

/* 图表空数据状态 */
.weather-chart-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--text-secondary, #666666);
    font-size: 14px;
    flex-direction: column;
    gap: 8px;
}

.weather-chart-empty::before {
    content: '📊';
    font-size: 24px;
    opacity: 0.5;
}

/* 图表控制按钮 */
.weather-chart-controls {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.weather-chart-control-btn {
    padding: 6px 12px;
    border: 1px solid var(--border-color, #e0e0e0);
    background: var(--button-bg, #ffffff);
    color: var(--text-color, #333333);
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.weather-chart-control-btn:hover {
    background: var(--button-hover-bg, #f5f5f5);
    border-color: var(--primary-color, #2196F3);
}

.weather-chart-control-btn.active {
    background: var(--primary-color, #2196F3);
    color: white;
    border-color: var(--primary-color, #2196F3);
}

/* 图表提示框 */
.weather-chart-tooltip {
    position: absolute;
    background: var(--tooltip-bg, rgba(0, 0, 0, 0.8));
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.weather-chart-tooltip.show {
    opacity: 1;
}

.weather-chart-tooltip::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid var(--tooltip-bg, rgba(0, 0, 0, 0.8));
}

/* 图表图例 */
.weather-chart-legend {
    display: flex;
    gap: 16px;
    margin-top: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.weather-chart-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-color, #333333);
}

.weather-chart-legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    border: 1px solid var(--border-color, #e0e0e0);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .weather-charts-container {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .weather-chart {
        height: 180px;
    }
    
    .weather-chart-card {
        padding: 12px;
    }
    
    .weather-chart-title {
        font-size: 14px;
    }
    
    .weather-chart-controls {
        gap: 6px;
    }
    
    .weather-chart-control-btn {
        padding: 4px 8px;
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .weather-charts-section {
        margin: 16px 0;
        padding: 16px;
    }
    
    .weather-chart {
        height: 160px;
    }
    
    .weather-chart-card {
        padding: 10px;
    }
}

/* 暗色主题支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --card-bg: #1e1e1e;
        --chart-bg: #2a2a2a;
        --text-color: #ffffff;
        --text-secondary: #b0b0b0;
        --border-color: #404040;
        --button-bg: #2a2a2a;
        --button-hover-bg: #333333;
        --tooltip-bg: rgba(0, 0, 0, 0.9);
    }
}

/* 动画效果 */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.weather-chart-card {
    animation: fadeIn 0.3s ease forwards;
}

.weather-chart-card:nth-child(1) { animation-delay: 0.1s; }
.weather-chart-card:nth-child(2) { animation-delay: 0.2s; }
.weather-chart-card:nth-child(3) { animation-delay: 0.3s; }

/* 图表特定样式 */
.temperature-chart .weather-chart-title .chart-icon::before {
    content: '🌡️';
}

.precipitation-chart .weather-chart-title .chart-icon::before {
    content: '🌧️';
}

.wind-chart .weather-chart-title .chart-icon::before {
    content: '💨';
}

/* 图表切换按钮样式 */
.charts-toggle-btn {
    background: var(--button-bg, #ffffff);
    border: 1px solid var(--border-color, #e0e0e0);
    color: var(--text-color, #333333);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
}

.charts-toggle-btn:hover {
    background: var(--button-hover-bg, #f5f5f5);
    border-color: var(--primary-color, #2196F3);
}

.charts-toggle-btn:active {
    transform: scale(0.98);
}

.charts-icon {
    font-size: 16px;
    transition: transform 0.2s ease;
}

.charts-toggle-btn:hover .charts-icon {
    transform: scale(1.1);
}