/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    transition: background 0.8s ease, color 0.5s ease;
    scroll-behavior: smooth;
}

/* 主题过渡动画 */
body.theme-transition {
    transition: all 0.5s ease-in-out;
}

/* 响应式布局优化 */
.charts-section .row.flex-nowrap {
    overflow-x: auto;
    flex-wrap: nowrap;
    gap: 1.5rem;
    padding-bottom: 1rem;
}

.charts-section .row.flex-nowrap .chart-card {
    min-width: 400px;
    flex: 0 0 auto;
}

/* 横向滚动条样式 */
.charts-section .row.flex-nowrap::-webkit-scrollbar {
    height: 8px;
}

.charts-section .row.flex-nowrap::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.charts-section .row.flex-nowrap::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.5);
    border-radius: 10px;
}

.charts-section .row.flex-nowrap::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.8);
}

.container-fluid {
    padding: 0;
    max-width: 1400px;
    margin: 0 auto;
}

/* 头部导航样式 */
.navbar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 1rem 0;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: white !important;
}

.nav-link {
    color: rgba(255,255,255,0.8) !important;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: white !important;
}

/* 主内容区域 */
.main-content {
    padding: 2rem;
    background: rgba(255,255,255,0.95);
    min-height: calc(100vh - 76px);
    margin: 1rem;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

/* 区域标题样式 */
.section-header {
    position: relative;
    margin-bottom: 2rem;
}

.section-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
}

.section-subtitle {
    font-size: 1rem;
    color: #718096;
    margin: 0;
}

.section-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

/* 索引导航样式 */
.charts-index-section {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 15px;
    padding: 2rem;
    margin: 2rem 0;
}

.chart-index-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    border: 2px solid transparent;
    display: flex;
    align-items: center;
    gap: 1rem;
    min-height: 120px;
}

.chart-index-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 12px 25px rgba(0,0,0,0.15);
    border-color: #667eea;
}

.chart-index-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.chart-index-card:hover::before {
    opacity: 1;
}

.chart-index-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.chart-index-card:hover .chart-index-icon {
    transform: scale(1.1);
}

.chart-icon-line {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.chart-icon-pie {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.chart-icon-bar {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.chart-icon-radar {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.chart-icon-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.chart-icon-heatmap {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.chart-index-content {
    flex: 1;
    min-width: 0;
}

.chart-index-content h5 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 0.5rem;
}

.chart-index-content p {
    font-size: 0.9rem;
    color: #718096;
    margin: 0;
    margin-bottom: 0.8rem;
}

.chart-index-badge {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
}

.chart-index-arrow {
    color: #a0aec0;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    opacity: 0;
}

.chart-index-card:hover .chart-index-arrow {
    opacity: 1;
    transform: translateX(5px);
}

/* 概览区域样式 */
.overview-section {
    position: relative;
}

/* 滚动动画 */
html {
    scroll-behavior: smooth;
}

/* 高亮效果 */
.chart-highlight {
    border: 3px solid #667eea !important;
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.3) !important;
    animation: highlightPulse 1.5s ease-in-out;
}

@keyframes highlightPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 0 30px rgba(102, 126, 234, 0.5);
    }
}

/* 统计卡片样式 */
.stats-section {
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
    min-height: 140px;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.15);
}

.stat-card.bg-gradient-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.stat-card.bg-gradient-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.stat-card.bg-gradient-warning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.stat-card.bg-gradient-info {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.stat-icon {
    font-size: 3rem;
    opacity: 0.8;
}

.stat-content {
    flex: 1;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: inherit;
}

.stat-label {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

.stat-change {
    font-size: 0.8rem;
    font-weight: bold;
    padding: 0.2rem 0.5rem;
    border-radius: 20px;
    background: rgba(255,255,255,0.2);
    display: inline-block;
}

.stat-change.positive {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.stat-change.negative {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* 筛选器样式 */
.filter-section {
    margin-bottom: 2rem;
}

.filter-section .card {
    border: none;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
}

.filter-section .card-body {
    padding: 1.5rem;
}

.form-label {
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 0.5rem;
}

.form-select {
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.75rem;
    transition: border-color 0.3s ease;
}

.form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 10px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    transition: transform 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.3);
}

/* 图表卡片样式 */
.charts-section {
    margin-top: 2rem;
}

.chart-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
}

.chart-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.chart-card .card-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #dee2e6;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chart-card .card-title {
    color: #2d3748;
    font-weight: 600;
    font-size: 1.1rem;
}

.card-actions {
    display: flex;
    gap: 0.5rem;
}

.chart-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.chart-controls .btn-group {
    flex-shrink: 0;
}

.chart-controls .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    line-height: 1.2;
    min-width: auto;
}

/* 图表交互提示 */
.chart-card {
    position: relative;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chart-card::before {
    content: '💡 点击数据点可直接编辑数值';
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.3rem 0.6rem;
    border-radius: 15px;
    font-size: 0.7rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
    pointer-events: none;
}

.chart-card:hover::before {
    opacity: 1;
}

/* 动画效果 */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

@keyframes slideInChart {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.chart-card:hover {
    animation: pulse 0.6s ease;
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.15);
}

/* 图表入场动画 */
.chart-card {
    animation: slideInChart 0.8s ease-out forwards;
}

.chart-card:nth-child(1) { animation-delay: 0.1s; }
.chart-card:nth-child(2) { animation-delay: 0.2s; }
.chart-card:nth-child(3) { animation-delay: 0.3s; }
.chart-card:nth-child(4) { animation-delay: 0.4s; }
.chart-card:nth-child(5) { animation-delay: 0.5s; }
.chart-card:nth-child(6) { animation-delay: 0.6s; }

/* 主题切换动画 */
.theme-transition {
    transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* 布局切换动画 */
.layout-transition {
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* 统计卡片动画 */
.stat-card {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: fadeInScale 0.6s ease-out forwards;
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }
.stat-card:nth-child(4) { animation-delay: 0.4s; }

.stat-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

/* 按钮动画效果 */
.btn {
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

/* 导航栏下拉菜单动画 */
.dropdown-menu {
    animation: slideDown 0.3s ease-out;
    transform-origin: top;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: scaleY(0.8) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scaleY(1) translateY(0);
    }
}

/* 数据编辑对话框动画 */
.data-edit-modal {
    animation: modalSlideIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1) translateY(0);
    }
}

.btn-outline-primary {
    border-color: #667eea;
    color: #667eea;
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.btn-outline-primary:hover {
    background: #667eea;
    border-color: #667eea;
    transform: translateY(-1px);
}

.chart-card .card-body {
    padding: 1.5rem;
    position: relative;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .main-content {
        margin: 0.5rem;
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    .main-content {
        margin: 0;
        padding: 1rem;
        border-radius: 0;
        min-height: 100vh;
    }
    
    .stat-card {
        margin-bottom: 1rem;
        min-height: 120px;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    .stat-icon {
        font-size: 2rem;
    }
    
    .chart-card .card-body {
        padding: 1rem;
    }
    
    .filter-section .card-body {
        padding: 1rem;
    }
    
    .row.g-4 > [class*="col-"] {
        margin-bottom: 1rem;
    }
}

@media (max-width: 576px) {
    .navbar-brand {
        font-size: 1.2rem;
    }
    
    .stat-number {
        font-size: 1.3rem;
    }
    
    .stat-card {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
    
    .filter-section .row {
        gap: 1rem;
    }
    
    .chart-card .card-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
}

/* 动画效果 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stat-card {
    animation: fadeInUp 0.6s ease forwards;
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }
.stat-card:nth-child(4) { animation-delay: 0.4s; }

.chart-card {
    animation: fadeInUp 0.8s ease forwards;
}

.chart-card:nth-child(1) { animation-delay: 0.2s; }
.chart-card:nth-child(2) { animation-delay: 0.4s; }
.chart-card:nth-child(3) { animation-delay: 0.6s; }
.chart-card:nth-child(4) { animation-delay: 0.8s; }

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0,0,0,0.1);
    border-radius: 50%;
    border-top-color: #667eea;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 数据提示样式 */
.chart-tooltip {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    pointer-events: none;
    position: absolute;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.chart-tooltip.show {
    opacity: 1;
}

/* Matplotlib样式 */
.matplotlib-section {
    margin-bottom: 2rem;
}

.matplotlib-section .card {
    border: none;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
}

.matplotlib-section .card-header {
    border-radius: 15px 15px 0 0;
    font-family: 'Courier New', monospace;
}

.matplotlib-container {
    border: 2px solid #dee2e6;
    border-radius: 8px;
    background: white;
    position: relative;
}

.matplotlib-canvas {
    display: block;
    max-width: 100%;
    height: auto;
    background: white;
    cursor: crosshair;
}

.form-control {
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.75rem;
    transition: border-color 0.3s ease;
    font-family: 'Courier New', monospace;
}

.form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    border: none;
    border-radius: 10px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    transition: transform 0.3s ease;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(17, 153, 142, 0.3);
}

.btn-info {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    border: none;
    border-radius: 10px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    transition: transform 0.3s ease;
}

.btn-info:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(79, 172, 254, 0.3);
}

.btn-warning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border: none;
    border-radius: 10px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    color: white;
    transition: transform 0.3s ease;
}

.btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(240, 147, 251, 0.3);
    color: white;
}

/* 代码显示样式 */
pre {
    margin: 0;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
}

code {
    color: inherit;
    background: none;
}

/* 历史记录样式 */
.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    border-bottom: 1px solid #e9ecef;
    transition: background-color 0.2s ease;
}

.history-item:hover {
    background-color: #f8f9fa;
}

.history-item:last-child {
    border-bottom: none;
}

.history-content {
    flex: 1;
    min-width: 0;
}

.history-content strong {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 0.2rem;
}

.history-content small {
    display: block;
    font-size: 0.75rem;
    margin-bottom: 0.2rem;
}

.history-data {
    font-size: 0.8rem;
    color: #6c757d;
    word-break: break-all;
}

.history-actions {
    display: flex;
    gap: 0.3rem;
    flex-shrink: 0;
}

.btn-group .btn {
    font-size: 0.8rem;
    padding: 0.4rem 0.6rem;
}

.form-control-color {
    width: 100%;
    height: 38px;
    padding: 0.2rem;
}

.btn-sm {
    font-size: 0.875rem;
}

/* 坐标轴样式 */
.axis {
    stroke: #333;
    stroke-width: 2;
}

.grid {
    stroke: #e0e0e0;
    stroke-width: 0.5;
    stroke-dasharray: 2,2;
}

.tick-label {
    fill: #333;
    font-size: 12px;
    font-family: 'Arial', sans-serif;
}

.title {
    fill: #333;
    font-size: 16px;
    font-weight: bold;
    font-family: 'Arial', sans-serif;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
}