/* Dashboard 美化样式 - 图表卡片和最近活动 */

/* ========== 图表卡片美化 ========== */
.chart-container {
    position: relative;
    cursor: default;
}

.chart-container canvas {
    transition: all 0.3s ease;
}

.chart-container:hover canvas {
    transform: scale(1.02);
    filter: brightness(1.05);
}

/* 图表加载状态 */
.chart-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
}

.chart-loading i {
    font-size: 24px;
    color: var(--color-primary);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 图表错误状态 */
.chart-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #ef4444;
    font-size: 14px;
    font-weight: 500;
    padding: 20px;
}

.chart-error i {
    font-size: 32px;
    color: #ef4444;
}

/* 图表工具栏 */
.chart-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    margin-top: 16px;
}

.chart-toolbar button {
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: white;
    color: #374151;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chart-toolbar button:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.chart-toolbar button.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

/* 图表图例增强 */
.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 16px;
    background: #f9fafb;
    border-radius: 12px;
    margin-top: 16px;
}

.chart-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.chart-legend-item:hover {
    background: #f3f4f6;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.chart-legend-item.disabled {
    opacity: 0.4;
    text-decoration: line-through;
}

.chart-legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    flex-shrink: 0;
}

.chart-legend-label {
    font-size: 13px;
    font-weight: 500;
    color: #374151;
}

/* ========== 图表卡片美化 ========== */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.chart-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 20px;
    padding: 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    overflow: visible;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    min-height: 420px;
}

.chart-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, #f97316 0%, #ef4444 100%);
    border-radius: 20px 20px 0 0;
    z-index: 1;
}

.chart-card:hover {
    transform: translateY(-6px) scale(1.01);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.12);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px 20px;
    background: transparent;
    border-bottom: 2px solid #f1f5f9;
    margin-bottom: 0;
}

.chart-header h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.02em;
}

.chart-header h3::before {
    content: '';
    width: 4px;
    height: 24px;
    background: linear-gradient(135deg, #f97316, #ef4444);
    border-radius: 2px;
}

.chart-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chart-filter {
    padding: 8px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #374151;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23374151' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

.chart-filter:hover {
    border-color: #d1d5db;
    background-color: #f9fafb;
}

.chart-filter:focus {
    outline: none;
    border-color: #f97316;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

.chart-container {
    padding: 24px 28px 32px;
    background: transparent;
    position: relative;
    min-height: 320px;
    display: flex;
    flex-direction: column;
}

/* ✅ 优化：移除!important，使用高特异性选择器 */
.dashboard-container .chart-container canvas,
.chart-container canvas {
    width: 100%;
    height: auto;
    min-height: 280px;
    max-height: 350px;
}

/* ========== 最近活动美化 ========== */
.recent-activities {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 20px;
    padding: 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.recent-activities:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1);
}

.recent-activities .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px 20px;
    background: transparent;
    border-bottom: 2px solid #f1f5f9;
    margin-bottom: 0;
    position: relative;
}

.recent-activities .section-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    height: 100%;
    background: linear-gradient(135deg, #dc2626, #ef4444);
    border-radius: 0 0 2px 2px;
}

.recent-activities .section-header h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.02em;
    padding-left: 12px;
}

.recent-activities .section-header h3::before {
    content: '';
    width: 4px;
    height: 24px;
    background: linear-gradient(135deg, #dc2626, #ef4444);
    border-radius: 2px;
}

.view-all {
    color: #dc2626;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 10px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.view-all:hover {
    background: #fef2f2;
    color: #991b1b;
    transform: translateX(2px);
}

.view-all::after {
    content: '→';
    font-size: 1.1rem;
    transition: transform 0.3s ease;
}

.view-all:hover::after {
    transform: translateX(3px);
}

.activities-list {
    padding: 24px 28px 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 18px 20px;
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
    border-radius: 16px;
    border: 1px solid #e5e7eb;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.activity-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(135deg, #dc2626, #ef4444);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.activity-item:hover {
    transform: translateX(4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    border-color: #d1d5db;
}

.activity-item:hover::before {
    transform: scaleY(1);
}

.activity-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.activity-icon::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.activity-item:hover .activity-icon::before {
    opacity: 1;
}

/* 不同活动类型的图标颜色 */
.activity-item:nth-child(1) .activity-icon {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 16px rgba(161, 22, 22, 0.3);
}

.activity-item:nth-child(2) .activity-icon {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.3);
}

.activity-item:nth-child(3) .activity-icon {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
}

.activity-item:nth-child(4) .activity-icon {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.3);
}

.activity-item:hover .activity-icon {
    transform: scale(1.1) rotate(5deg);
}

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-content h5 {
    font-size: 1rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 6px 0;
    letter-spacing: -0.01em;
}

.activity-content p {
    font-size: 0.95rem;
    color: #4b5563;
    margin: 0 0 8px 0;
    line-height: 1.5;
}

.activity-time {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #6b7280;
    font-weight: 500;
    padding: 4px 10px;
    background: #f3f4f6;
    border-radius: 8px;
}

.activity-time::before {
    content: '🕐';
    font-size: 0.9rem;
}

/* ========== 响应式设计 ========== */
@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .chart-card,
    .recent-activities {
        border-radius: 16px;
    }
    
    .chart-header,
    .recent-activities .section-header {
        padding: 20px 24px 16px;
    }
    
    .chart-container,
    .activities-list {
        padding: 20px 24px 24px;
    }
}

@media (max-width: 768px) {
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .chart-card,
    .recent-activities {
        border-radius: 12px;
    }
    
    .chart-header h3,
    .recent-activities .section-header h3 {
        font-size: 1.1rem;
    }
    
    .chart-header,
    .recent-activities .section-header {
        padding: 16px 20px 12px;
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .chart-container,
    .activities-list {
        padding: 16px 20px 20px;
    }
    
    .activity-item {
        padding: 14px 16px;
    }
    
    .activity-icon {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }
    
    .activity-content h5 {
        font-size: 0.95rem;
    }
    
    .activity-content p {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .chart-header,
    .recent-activities .section-header {
        padding: 12px 16px;
    }
    
    .chart-container,
    .activities-list {
        padding: 12px 16px 16px;
    }
    
    .activity-item {
        padding: 12px;
        gap: 12px;
    }
    
    .activity-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
}

