/* 分析页面专用样式 */

/* 页面布局 */
.analytics-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.analytics-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* 新增：仪表板主体布局 */
.dashboard-main {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    overflow: hidden;
    padding: 2rem;
}

.dashboard-grid {
    display: grid;
    gap: 2rem;
}

/* 分析仪表板 */
.analytics-content {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    overflow: hidden;
}

.dashboard-header {
    padding: 2rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.dashboard-header h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.dashboard-header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.dashboard-body {
    padding: 2rem;
}

/* KPI区域 */
.kpi-section {
    margin-bottom: 3rem;
}

.kpi-section h2 {
    color: #333;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.kpi-card {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 1px solid #e0e0e0;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
}

.kpi-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.kpi-icon {
    font-size: 2.5rem;
    color: #667eea;
}

.kpi-trend {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
}

.kpi-trend.up {
    background: #d4edda;
    color: #155724;
}

.kpi-trend.down {
    background: #f8d7da;
    color: #721c24;
}

.kpi-trend i {
    font-size: 0.8rem;
}

/* 新增：KPI卡片主体内容 */
.kpi-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.kpi-value {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 2.8rem;
    font-weight: 900;
    color: #333;
}

.value-number {
    font-size: 2.8rem;
    font-weight: 900;
    color: #333;
}

.unit {
    font-size: 1rem;
    color: #666;
    font-weight: 600;
}

.kpi-label {
    color: #666;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.kpi-compare {
    font-size: 0.9rem;
    color: #888;
}

.compare-period {
    font-weight: 600;
}

.compare-value {
    font-weight: 700;
    color: #667eea;
}

/* 图表容器 */
.chart-section {
    margin-bottom: 3rem;
}

.chart-section h2 {
    color: #333;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.chart-header h3 {
    color: #333;
    font-size: 1.5rem;
    font-weight: 700;
}

.chart-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* 新增：图表标签页 */
.chart-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #f0f0f0;
}

.chart-tab {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: #666;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.chart-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.chart-tab:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

/* 新增：图表内容区域 */
.chart-content {
    position: relative;
    height: 300px;
    margin-bottom: 1rem;
}

.chart-content canvas {
    width: 100% !important;
    height: 100% !important;
}

/* 图表图例 */
.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #666;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
}

.time-filter {
    display: flex;
    gap: 0.5rem;
}

.filter-btn {
    padding: 0.5rem 1rem;
    background: #f8f9fa;
    color: #666;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.filter-btn.active,
.filter-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.refresh-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.refresh-btn:hover {
    background: #5a6fd8;
}

.chart-container {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 1px solid #e0e0e0;
}

.chart-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 300px;
    background: #f8f9fa;
    border-radius: 10px;
    color: #666;
    font-size: 1.1rem;
}

.chart-bars {
    display: flex;
    align-items: end;
    justify-content: space-around;
    height: 300px;
    padding: 2rem 1rem 1rem;
    background: #fafafa;
    border-radius: 10px;
}

.bar-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 60px;
}

.bar {
    width: 40px;
    background: linear-gradient(to top, #667eea, #764ba2);
    border-radius: 4px 4px 0 0;
    transition: all 0.3s ease;
    position: relative;
}

.bar:hover {
    opacity: 0.8;
    transform: scale(1.05);
}

.bar-value {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8rem;
    font-weight: 600;
    color: #333;
}

.bar-label {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: #666;
    text-align: center;
}

.bar-label small {
    display: block;
    font-size: 0.7rem;
    color: #999;
}

/* AI洞察区域 */
.insights-section {
    margin-bottom: 3rem;
}

.insights-section h2 {
    color: #333;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* 新增：洞察容器 */
.insights-container {
    display: grid;
    gap: 1.5rem;
}

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

/* 新增：洞察卡片 */
.insight-card {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 1px solid #e0e0e0;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.insight-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: #667eea;
}

.insight-card.urgent::before {
    background: #f5576c;
}

.insight-card.positive::before {
    background: #28a745;
}

.insight-card.info::before {
    background: #17a2b8;
}

.insight-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.insight-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.insight-icon {
    font-size: 1.5rem;
    margin-right: 0.5rem;
}

.insight-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

.insight-priority {
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
    background: #e9ecef;
    color: #6c757d;
}

.insight-card.urgent .insight-priority {
    background: #f8d7da;
    color: #721c24;
}

.insight-card.positive .insight-priority {
    background: #d4edda;
    color: #155724;
}

.insight-card.info .insight-priority {
    background: #d1ecf1;
    color: #0c5460;
}

.insight-time {
    font-size: 0.8rem;
    color: #999;
}

.insight-content {
    margin-bottom: 1.5rem;
}

.insight-content h3 {
    color: #333;
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.insight-content p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 1rem;
}

/* 洞察数据展示 */
.insight-data {
    display: flex;
    gap: 2rem;
    margin-top: 1rem;
}

.data-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.data-label {
    font-size: 0.85rem;
    color: #666;
}

.data-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
}

/* 成效统计 */
.achievement-stats {
    display: flex;
    gap: 2rem;
    margin-top: 1rem;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.stat-number {
    font-size: 1.8rem;
    font-weight: 700;
    color: #28a745;
}

.stat-desc {
    font-size: 0.85rem;
    color: #666;
}

/* 时间段预览 */
.schedule-preview {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}

.time-slot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.time-slot.busy {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
}

.demand-level {
    padding: 0.25rem 0.5rem;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
}

.demand-level.high {
    background: #f8d7da;
    color: #721c24;
}

.insight-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.insight-item {
    background: white;
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 1px solid #e0e0e0;
    transition: all 0.3s ease;
}

.insight-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.insight-title {
    color: #333;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.insight-text {
    color: #666;
    line-height: 1.6;
}

.insight-action {
    margin-top: 1rem;
}

.action-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.action-btn.primary {
    background: #667eea;
    color: white;
}

.action-btn.secondary {
    background: #6c757d;
    color: white;
}

.action-btn.success {
    background: #28a745;
    color: white;
}

.action-btn.info {
    background: #17a2b8;
    color: white;
}

.action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* 实时监控区域 */
.monitoring-section {
    margin-bottom: 3rem;
}

.monitoring-section h2 {
    color: #333;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.monitor-card {
    background: white;
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 1px solid #e0e0e0;
}

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

.monitor-title {
    font-weight: 700;
    color: #333;
}

.live-indicator {
    font-size: 0.8rem;
    font-weight: 600;
    color: #dc3545;
    animation: pulse 2s infinite;
}

.auto-refresh {
    font-size: 0.8rem;
    color: #28a745;
    padding: 0.25rem 0.5rem;
    background: #d4edda;
    border-radius: 10px;
}

/* 状态列表 */
.status-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.status-label {
    color: #666;
    font-weight: 600;
}

.status-count {
    font-size: 1.2rem;
    font-weight: 700;
    color: #667eea;
}

/* 窗口状态 */
.window-status {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.window-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border-radius: 8px;
}

.window-item.busy {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
}

.window-item.normal {
    background: #d1ecf1;
    border-left: 4px solid #17a2b8;
}

.window-item.free {
    background: #d4edda;
    border-left: 4px solid #28a745;
}

.window-name {
    font-weight: 600;
    color: #333;
}

.busy-level {
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 10px;
}

.window-item.busy .busy-level {
    background: #ffc107;
    color: #856404;
}

.window-item.normal .busy-level {
    background: #17a2b8;
    color: white;
}

.window-item.free .busy-level {
    background: #28a745;
    color: white;
}

/* 数据表格区域 */
.data-table-section {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 1px solid #e0e0e0;
    margin-bottom: 2rem;
}

.table-header {
    margin-bottom: 2rem;
}

.table-header h3 {
    color: #333;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.table-header p {
    color: #666;
}

.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

.search-box {
    position: relative;
    flex: 1;
    max-width: 300px;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
}

.search-box input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.export-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.export-btn:hover {
    background: #218838;
    transform: translateY(-1px);
}

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

.data-table thead {
    background: #f8f9fa;
}

.data-table th,
.data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.data-table th {
    font-weight: 700;
    color: #333;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    color: #666;
}

.data-table tbody tr:hover {
    background: #f8f9fa;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-badge.completed {
    background: #d4edda;
    color: #155724;
}

.status-badge.pending {
    background: #fff3cd;
    color: #856404;
}

.status-badge.processing {
    background: #d1ecf1;
    color: #0c5460;
}

/* 实时指示器 */
.real-time-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #28a745;
    font-weight: 600;
}

.live-dot {
    width: 8px;
    height: 8px;
    background: #28a745;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.widget-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-widget {
    background: white;
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 1px solid #e0e0e0;
    transition: all 0.3s ease;
}

.stat-widget:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.widget-header {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.widget-icon {
    font-size: 1.5rem;
    margin-right: 0.75rem;
}

.widget-title {
    color: #666;
    font-size: 0.9rem;
    font-weight: 600;
}

.widget-value {
    font-size: 2rem;
    font-weight: 900;
    color: #333;
    margin-bottom: 0.5rem;
}

.widget-change {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.widget-change.positive {
    color: #28a745;
}

.widget-change.negative {
    color: #dc3545;
}

.widget-change i {
    font-size: 0.7rem;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .analytics-main {
        padding: 1.5rem;
    }

    .kpi-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }

    .insights-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .dashboard-header {
        padding: 1.5rem;
    }

    .dashboard-body {
        padding: 1.5rem;
    }

    .kpi-grid {
        grid-template-columns: 1fr;
    }

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

    .chart-controls {
        width: 100%;
        justify-content: flex-start;
    }

    .time-filter {
        flex-wrap: wrap;
    }

    .chart-bars {
        padding: 1rem 0.5rem;
        overflow-x: auto;
    }

    .bar-container {
        min-width: 50px;
    }

    .bar {
        width: 30px;
    }

    .bar-value {
        font-size: 0.7rem;
    }

    .insight-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .insight-action {
        margin-top: 1rem;
    }

    .table-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .search-box {
        max-width: none;
    }

    .data-table {
        font-size: 0.8rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.75rem 0.5rem;
    }

    .widget-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

/* 动画 */
.slide-up {
    animation: slideUp 0.6s ease forwards;
}

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

.fade-in {
    animation: fadeIn 0.8s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* 图表加载状态 */
.chart-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 300px;
    color: #666;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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