/**
 * Analytics Dashboard Styles
 * 分析仪表板页面样式
 */

/* Stats Overview */
.stats-overview {
    padding: 3rem 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-icon {
    font-size: 2.5rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 12px;
    flex-shrink: 0;
}

.stat-content {
    flex: 1;
}

.stat-content h3 {
    font-size: 0.875rem;
    font-weight: 500;
    color: #64748b;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-change {
    font-size: 0.75rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.stat-change.positive {
    color: #10b981;
}

.stat-change.negative {
    color: #ef4444;
}

.stat-change.neutral {
    color: #64748b;
}

/* Charts Section */
.charts-section {
    padding: 3rem 0;
    background: #f8fafc;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
}

.chart-card {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.chart-card.full-width {
    grid-column: 1 / -1;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.chart-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1e293b;
}

.chart-filter {
    padding: 0.375rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    font-size: 0.875rem;
    color: #374151;
}

.chart-controls {
    display: flex;
    gap: 0.5rem;
}

.chart-container {
    position: relative;
    height: 300px;
}

.chart-card.full-width .chart-container {
    height: 400px;
}

/* Top Keywords Section */
.top-keywords-section {
    padding: 3rem 0;
    background: white;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.section-header h2 {
    font-size: 1.875rem;
    font-weight: 700;
    color: #1e293b;
}

.keywords-table-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.keywords-table {
    width: 100%;
    border-collapse: collapse;
}

.keywords-table th {
    background: #f8fafc;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.keywords-table td {
    padding: 1rem;
    border-bottom: 1px solid #f3f4f6;
    color: #1e293b;
}

.keywords-table tr:hover {
    background: #f9fafb;
}

.keywords-table tr:last-child td {
    border-bottom: none;
}

/* KGR Score in table */
.kgr-score {
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.875rem;
}

.kgr-score.golden {
    background: #fef3c7;
    color: #d97706;
}

.kgr-score.good {
    background: #dbeafe;
    color: #1d4ed8;
}

.kgr-score.fair {
    background: #e5e7eb;
    color: #6b7280;
}

/* Search Volume */
.search-volume {
    font-weight: 500;
    color: #6b7280;
}

/* Competition Badge */
.competition-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.competition-badge.low {
    background: #dcfce7;
    color: #166534;
}

.competition-badge.medium {
    background: #fef3c7;
    color: #d97706;
}

.competition-badge.high {
    background: #fee2e2;
    color: #dc2626;
}

/* Collection Badge */
.collection-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Trend Indicator */
.trend-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.trend-indicator.up {
    color: #10b981;
}

.trend-indicator.down {
    color: #ef4444;
}

.trend-indicator.stable {
    color: #6b7280;
}

/* Filter Controls */
.filter-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.filter-select {
    padding: 0.5rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: white;
    font-size: 0.875rem;
    min-width: 180px;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .section-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .chart-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .chart-controls {
        justify-content: center;
    }

    .filter-controls {
        justify-content: center;
    }

    .keywords-table-container {
        overflow-x: auto;
    }

    .keywords-table {
        min-width: 700px;
    }

    .chart-container {
        height: 250px;
    }

    .chart-card.full-width .chart-container {
        height: 300px;
    }
}

/* Loading States */
.chart-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 300px;
    color: #64748b;
}

.chart-loading .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* No Data States */
.no-data {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 300px;
    color: #64748b;
    text-align: center;
}

.no-data-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.no-data h4 {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
    color: #374151;
}

.no-data p {
    font-size: 0.875rem;
    max-width: 300px;
    margin: 0 auto;
}

/* Custom Chart.js Styles */
canvas {
    max-height: 100%;
}

/* Tooltip Styles */
.chart-tooltip {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.875rem;
    pointer-events: none;
}