/* ============================================
   非洲恐怖主义数据分析平台 - 样式文件
   ============================================ */

/* CSS变量 */
:root {
    --primary: #d63031;
    --primary-dark: #b71c1c;
    --secondary: #6c5ce7;
    --accent: #e17055;
    --success: #00b894;
    --warning: #fdcb6e;
    --danger: #e74c3c;
    --dark: #1a1d24;
    --gray-900: #212529;
    --gray-800: #343a40;
    --gray-700: #495057;
    --gray-600: #6c757d;
    --gray-500: #adb5bd;
    --gray-400: #ced4da;
    --gray-300: #dee2e6;
    --gray-200: #e9ecef;
    --gray-100: #f8f9fa;
    --bg-light: #f5f6f8;
    --bg-card: #ffffff;
    --text-primary: #1a1d24;
    --text-secondary: #5a6478;
    --text-muted: #8c95a6;
    --border: #e2e5ea;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --transition: all 0.3s ease;
}

/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
}

/* 容器 */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ============================================
   导航栏
   ============================================ */
.main-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
}

.nav-brand i {
    font-size: 1.5rem;
}

.nav-menu {
    display: flex;
    gap: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
}

.nav-link:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--primary);
    color: white;
}

.nav-link i {
    font-size: 1.1rem;
}

.nav-toggle {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
    color: var(--text-secondary);
}

/* ============================================
   主内容区域
   ============================================ */
.main-content {
    padding-top: 70px;
}

/* 概览区域 */
.overview-section {
    background: linear-gradient(135deg, var(--gray-900) 0%, var(--gray-800) 100%);
    padding: 60px 0;
    color: white;
}

.overview-section .section-title {
    color: white;
    margin-bottom: 40px;
}

.overview-section .section-title::before {
    background: white;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: var(--transition);
}

.stat-card:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-4px);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* 通用区块样式 */
.section {
    padding: 80px 0;
}

.section.bg-light {
    background: var(--bg-light);
}

.section-header {
    text-align: center;
    margin-bottom: 50px;
}

.section-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.section-title i {
    color: var(--primary);
}

.section-desc {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* ============================================
   地图区域
   ============================================ */
.map-wrapper {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 24px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
}

.map-controls {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.control-group {
    background: var(--gray-100);
    border-radius: var(--radius-md);
    padding: 16px;
}

.control-group h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-group h4 i {
    color: var(--primary);
}

.timeline-control {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.timeline-control input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--gray-300);
    outline: none;
    -webkit-appearance: none;
}

.timeline-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: 3px solid white;
    box-shadow: var(--shadow-sm);
}

.timeline-display {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.timeline-buttons {
    display: flex;
    gap: 8px;
}

.btn-sm {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: white;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.btn-sm:hover {
    background: var(--primary-dark);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.checkbox-label input {
    display: none;
}

.checkbox-label .checkmark {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 2px solid var(--gray-400);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.checkbox-label input:checked + .checkmark {
    border-color: var(--primary);
}

.checkbox-label input:checked + .checkmark::after {
    content: '✓';
    color: white;
    font-size: 12px;
    background: var(--primary);
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* 地图源切换器样式 */
.tile-layers-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.tile-layer-btn {
    padding: 8px 10px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
    text-align: center;
}

.tile-layer-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primaryBg);
}

.tile-layer-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.tile-layer-btn i {
    font-size: 0.9rem;
}

.marker-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.marker-dot.small { width: 8px; height: 8px; }
.marker-dot.medium { width: 12px; height: 12px; }
.marker-dot.large { width: 16px; height: 16px; }

.map-container {
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

#map {
    height: 600px;
    width: 100%;
    background: var(--gray-200);
}

/* ============================================
   图表区域
   ============================================ */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.chart-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.chart-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

.chart-card.wide {
    grid-column: span 2;
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.chart-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.chart-tag {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    background: var(--gray-100);
    color: var(--text-secondary);
}

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

.chart-container.pie-container {
    height: 320px;
}

.chart-container.scatter-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    height: auto;
}

.scatter-plot {
    text-align: center;
}

.scatter-plot h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.scatter-plot canvas {
    height: 200px !important;
}

.scatter-label {
    margin-top: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
}

.chart-insight {
    margin-top: 16px;
    padding: 12px 16px;
    background: var(--gray-100);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.chart-insight i {
    color: var(--warning);
    margin-top: 2px;
}

/* ============================================
   分析报告区域
   ============================================ */
.analysis-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.analysis-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    display: flex;
    gap: 20px;
}

.analysis-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

.analysis-icon {
    width: 56px;
    height: 56px;
    min-width: 56px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: white;
}

.analysis-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.analysis-content p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 16px;
}

.analysis-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tag {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 20px;
    background: var(--gray-100);
    color: var(--text-secondary);
}

.tag.warning {
    background: rgba(253, 203, 110, 0.2);
    color: #e67e22;
}

.tag.danger {
    background: rgba(214, 48, 49, 0.1);
    color: var(--danger);
}

/* ============================================
   页脚
   ============================================ */
.main-footer {
    background: var(--gray-900);
    color: white;
    padding: 60px 0 0;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
    padding-bottom: 40px;
    border-bottom: 1px solid var(--gray-700);
}

.footer-info h4 {
    font-size: 1.2rem;
    margin-bottom: 16px;
}

.footer-info p {
    color: var(--gray-500);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.team-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--gray-700);
}

.team-section h5 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--gray-400);
    display: flex;
    align-items: center;
    gap: 8px;
}

.team-section h5 i {
    color: var(--primary);
}

.team-names {
    color: var(--gray-400) !important;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    line-height: 1.8;
}

.footer-links h4 {
    font-size: 1rem;
    margin-bottom: 16px;
}

.footer-links a {
    display: block;
    color: var(--gray-500);
    padding: 6px 0;
    font-size: 0.9rem;
    transition: var(--transition);
}

.footer-links a:hover {
    color: white;
}

.footer-bottom {
    padding: 20px 0;
    text-align: center;
    color: var(--gray-600);
    font-size: 0.85rem;
}

/* ============================================
   响应式设计
   ============================================ */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .analysis-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 992px) {
    .map-wrapper {
        grid-template-columns: 1fr;
    }
    
    .map-controls {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .control-group {
        flex: 1;
        min-width: 200px;
    }
    
    #map {
        height: 500px;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .chart-card.wide {
        grid-column: span 1;
    }
}

@media (max-width: 768px) {
    .nav-menu {
        display: none;
        position: absolute;
        top: 70px;
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        padding: 16px;
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow-md);
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    .nav-toggle {
        display: block;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .section {
        padding: 50px 0;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .analysis-grid {
        grid-template-columns: 1fr;
    }
    
    .analysis-card {
        flex-direction: column;
        text-align: center;
    }
    
    .analysis-icon {
        margin: 0 auto;
    }
    
    .chart-container.scatter-container {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
}

/* 加载动画 */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
}

.loading::after {
    content: '';
    width: 24px;
    height: 24px;
    border: 3px solid var(--gray-300);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}
