/* 数据分析页面样式 */

/* 页面布局 */
.main-container {
    display: flex;
    min-height: calc(100vh - 80px);
    background: #f8fafc;
}

.sidebar {
    width: 280px;
    background: #fff;
    border-right: 1px solid #e2e8f0;
    box-shadow: 2px 0 10px rgba(0,0,0,0.05);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
}

.sidebar-header h3 {
    margin: 0;
    color: #2d3748;
    font-size: 18px;
    font-weight: 600;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu li {
    border-bottom: 1px solid #f1f5f9;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: #64748b;
    text-decoration: none;
    transition: all 0.3s ease;
}

.sidebar-menu li a:hover,
.sidebar-menu li.active a {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
}

.sidebar-menu li a i {
    margin-right: 12px;
    width: 20px;
    text-align: center;
}

.main-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

/* 内容区域 */
.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
}

.section-header h2 {
    margin: 0;
    color: #2d3748;
    font-size: 24px;
    font-weight: 600;
}

.section-header h2 i {
    margin-right: 10px;
    color: #667eea;
}

.header-actions {
    display: flex;
    gap: 15px;
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: #fff;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.stat-title {
    font-size: 14px;
    color: #64748b;
    font-weight: 500;
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #fff;
}

.stat-icon.blue { background: linear-gradient(135deg, #667eea, #764ba2); }
.stat-icon.green { background: linear-gradient(135deg, #43e97b, #38f9d7); }
.stat-icon.orange { background: linear-gradient(135deg, #fa709a, #fee140); }
.stat-icon.red { background: linear-gradient(135deg, #ff6b6b, #ee5a24); }

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 8px;
}

.stat-change {
    display: flex;
    align-items: center;
    font-size: 14px;
    font-weight: 500;
}

.stat-change.up {
    color: #43e97b;
}

.stat-change.down {
    color: #ff6b6b;
}

.stat-change i {
    margin-right: 4px;
}

/* 图表容器 */
.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.chart-card {
    background: #fff;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border: 1px solid #e2e8f0;
}

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

.chart-header h3 {
    margin: 0;
    color: #2d3748;
    font-size: 18px;
    font-weight: 600;
}

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

/* 排行榜 */
.ranking-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.ranking-card {
    background: #fff;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border: 1px solid #e2e8f0;
}

.ranking-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.ranking-header h3 {
    margin: 0;
    color: #2d3748;
    font-size: 18px;
    font-weight: 600;
}

.ranking-list {
    max-height: 400px;
    overflow-y: auto;
}

.ranking-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
}

.ranking-item:last-child {
    border-bottom: none;
}

.ranking-number {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    margin-right: 15px;
}

.ranking-number.top-3 {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
}

.ranking-number.other {
    background: #f8fafc;
    color: #64748b;
}

.ranking-info {
    flex: 1;
}

.ranking-name {
    font-weight: 500;
    color: #2d3748;
    margin-bottom: 2px;
}

.ranking-detail {
    font-size: 12px;
    color: #64748b;
}

.ranking-value {
    font-weight: 600;
    color: #667eea;
}

/* 分析卡片 */
.analysis-section,
.behavior-analysis,
.value-analysis,
.cycle-analysis,
.comparison-analysis,
.performance-metrics,
.heat-analysis {
    margin-bottom: 30px;
}

.analysis-card,
.behavior-card,
.value-card,
.cycle-card,
.comparison-card,
.metrics-card,
.heat-card {
    background: #fff;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border: 1px solid #e2e8f0;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-header h3 {
    margin: 0;
    color: #2d3748;
    font-size: 18px;
    font-weight: 600;
}

.card-actions {
    display: flex;
    gap: 10px;
}

/* 行为指标 */
.behavior-metrics,
.quality-metrics,
.cycle-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.behavior-item,
.metric-item,
.cycle-item {
    text-align: center;
    padding: 20px;
    background: #f8fafc;
    border-radius: 8px;
}

.behavior-label,
.metric-label,
.cycle-label {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 8px;
}

.behavior-value,
.metric-value,
.cycle-value {
    font-size: 24px;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 5px;
}

.behavior-trend,
.metric-trend,
.cycle-trend {
    font-size: 12px;
    font-weight: 500;
}

.behavior-trend.up,
.metric-trend.up,
.cycle-trend.up {
    color: #43e97b;
}

.behavior-trend.down,
.metric-trend.down,
.cycle-trend.down {
    color: #ff6b6b;
}

/* 价值分析 */
.value-chart {
    height: 300px;
    margin-bottom: 20px;
}

.value-legend {
    display: flex;
    justify-content: center;
    gap: 30px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

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

/* 对比表格 */
.comparison-table {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

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

.data-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #2d3748;
}

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

.trend-up {
    color: #43e97b;
    font-weight: 600;
}

.trend-down {
    color: #ff6b6b;
    font-weight: 600;
}

/* 绩效指标 */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.metric-card {
    background: #fff;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border: 1px solid #e2e8f0;
    text-align: center;
}

.metric-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.metric-header h4 {
    margin: 0;
    color: #2d3748;
    font-size: 16px;
    font-weight: 600;
}

.metric-icon {
    font-size: 24px;
    color: #667eea;
}

.metric-target {
    font-size: 12px;
    color: #64748b;
    margin-top: 5px;
}

/* 热度地图 */
.heat-map {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.heat-item {
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    color: #fff;
    font-weight: 600;
    transition: all 0.3s ease;
}

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

.heat-name {
    font-size: 16px;
    margin-bottom: 8px;
}

.heat-value {
    font-size: 24px;
    font-weight: 700;
}

/* 报表列表 */
.reports-list {
    display: grid;
    gap: 20px;
}

.report-card {
    background: #fff;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border: 1px solid #e2e8f0;
}

.report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.report-header h3 {
    margin: 0;
    color: #2d3748;
    font-size: 18px;
    font-weight: 600;
}

.report-status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

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

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

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

.report-info {
    margin-bottom: 20px;
}

.report-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 14px;
    color: #64748b;
}

.report-item i {
    width: 16px;
    text-align: center;
    color: #667eea;
}

.report-actions {
    display: flex;
    gap: 10px;
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #2d3748;
}

.form-control {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
}

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

.checkbox-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-item input[type="checkbox"] {
    margin: 0;
}

/* 按钮样式 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #f8fafc;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.btn-secondary:hover {
    background: #e2e8f0;
}

.btn-outline {
    background: transparent;
    color: #667eea;
    border: 1px solid #667eea;
}

.btn-outline:hover {
    background: #667eea;
    color: #fff;
}

.btn-danger {
    background: #ff6b6b;
    color: #fff;
}

.btn-danger:hover {
    background: #ee5a24;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
}

.modal-content {
    background: #fff;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid #e2e8f0;
}

.modal-header h3 {
    margin: 0;
    color: #2d3748;
    font-size: 20px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #64748b;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: #f8fafc;
    color: #2d3748;
}

.modal-body {
    padding: 30px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    padding: 20px 30px;
    border-top: 1px solid #e2e8f0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        order: 2;
    }
    
    .sidebar-menu {
        display: flex;
        overflow-x: auto;
        padding: 0 15px;
    }
    
    .sidebar-menu li {
        border-bottom: none;
        border-right: 1px solid #f1f5f9;
        min-width: 120px;
    }
    
    .sidebar-menu li a {
        flex-direction: column;
        text-align: center;
        padding: 15px 10px;
    }
    
    .sidebar-menu li a i {
        margin-right: 0;
        margin-bottom: 5px;
    }
    
    .main-content {
        padding: 20px;
        order: 1;
    }
    
    .section-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .header-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .charts-container {
        grid-template-columns: 1fr;
    }
    
    .ranking-section {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
    
    .heat-map {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .checkbox-group {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .modal-body {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 15px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .heat-map {
        grid-template-columns: 1fr;
    }
    
    .behavior-metrics,
    .quality-metrics,
    .cycle-metrics {
        grid-template-columns: 1fr;
    }
    
    .metrics-grid {
        grid-template-columns: 1fr;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    .main-container {
        background: #1a202c;
    }
    
    .sidebar {
        background: #2d3748;
        border-right-color: #4a5568;
    }
    
    .sidebar-header {
        border-bottom-color: #4a5568;
    }
    
    .sidebar-header h3 {
        color: #fff;
    }
    
    .sidebar-menu li {
        border-bottom-color: #4a5568;
    }
    
    .sidebar-menu li a {
        color: #a0aec0;
    }
    
    .sidebar-menu li a:hover,
    .sidebar-menu li.active a {
        background: linear-gradient(135deg, #667eea, #764ba2);
        color: #fff;
    }
    
    .section-header {
        border-bottom-color: #4a5568;
    }
    
    .section-header h2 {
        color: #fff;
    }
    
    .stat-card,
    .chart-card,
    .ranking-card,
    .analysis-card,
    .behavior-card,
    .value-card,
    .cycle-card,
    .comparison-card,
    .metric-card,
    .heat-card,
    .report-card {
        background: #2d3748;
        border-color: #4a5568;
    }
    
    .stat-title,
    .chart-header h3,
    .ranking-header h3,
    .card-header h3,
    .behavior-label,
    .metric-label,
    .cycle-label,
    .report-header h3 {
        color: #fff;
    }
    
    .stat-value,
    .behavior-value,
    .metric-value,
    .cycle-value {
        color: #fff;
    }
    
    .data-table th {
        background: #4a5568;
        color: #fff;
    }
    
    .data-table td {
        color: #a0aec0;
    }
    
    .data-table tr:hover {
        background: #4a5568;
    }
    
    .behavior-item,
    .metric-item,
    .cycle-item {
        background: #4a5568;
    }
    
    .form-control {
        background: #4a5568;
        border-color: #667eea;
        color: #fff;
    }
    
    .form-control:focus {
        border-color: #667eea;
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
    }
    
    .btn-secondary {
        background: #4a5568;
        border-color: #667eea;
        color: #fff;
    }
    
    .btn-secondary:hover {
        background: #667eea;
    }
    
    .btn-outline {
        color: #667eea;
        border-color: #667eea;
    }
    
    .btn-outline:hover {
        background: #667eea;
    }
    
    .modal-content {
        background: #2d3748;
    }
    
    .modal-header,
    .modal-footer {
        border-color: #4a5568;
    }
    
    .modal-header h3 {
        color: #fff;
    }
    
    .close-btn {
        color: #a0aec0;
    }
    
    .close-btn:hover {
        background: #4a5568;
        color: #fff;
    }
}

/* 打印样式 */
@media print {
    .navbar,
    .sidebar,
    .header-actions,
    .report-actions {
        display: none !important;
    }
    
    .main-container {
        display: block;
    }
    
    .main-content {
        padding: 0;
    }
    
    .stat-card,
    .chart-card,
    .ranking-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .charts-container {
        break-inside: avoid;
    }
    
    .chart-content {
        height: 200px;
    }
}