/* 现代化数据可视化样式 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #8b5cf6;
    --accent-color: #ec4899;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    line-height: 1.6;
    color: var(--gray-800);
    background: linear-gradient(135deg, var(--gray-50) 0%, #f0f9ff 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

/* 应用容器 */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* 顶部导航 */
.app-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 0.8rem 1.5rem;
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-section h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.1rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.logo-section p {
    font-size: 0.85rem;
    opacity: 0.9;
    font-weight: 400;
}

.theme-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

.theme-icon {
    font-size: 1rem;
}

/* 主要内容区域 */
.app-main {
    flex: 1;
    padding: 1rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
}

.layout-grid {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 1.5rem;
    height: calc(100vh - 120px);
    min-height: 650px;
    align-items: start;
}

/* 控制面板 */
.control-panel {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--gray-200);
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2.5rem);
    transition: var(--transition);
}

.control-panel:hover {
    transform: translateY(-2px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.panel-header {
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%);
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.panel-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-800);
    margin: 0;
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    max-height: calc(100vh - 250px);
}

.panel-content::-webkit-scrollbar {
    width: 8px;
}

.panel-content::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 4px;
}

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

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

/* 控制区块 */
.control-section {
    margin-bottom: 2rem;
}

.control-section:last-child {
    margin-bottom: 0;
}

.section-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.8rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--gray-200);
}

/* 图表类型选择器 */
.chart-type-selector {
    width: 100%;
}

.chart-select {
    width: 100%;
    padding: 1rem;
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius-sm);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--gray-800);
    cursor: pointer;
    transition: var(--transition);
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.5rem;
    padding-right: 3rem;
}

.chart-select:hover {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    transform: translateY(-1px);
}

.chart-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* 现代开关样式 */
.toggle-switch {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.toggle-switch input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 48px;
    height: 24px;
    background: var(--gray-300);
    border-radius: 24px;
    transition: var(--transition);
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.toggle-switch input[type="checkbox"]:checked + .toggle-slider {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

.toggle-switch input[type="checkbox"]:checked + .toggle-slider::after {
    transform: translateX(24px);
}

.toggle-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
}

.style-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.control-item {
    display: flex;
    align-items: center;
}

.control-group {
    margin-bottom: 1rem;
}

.control-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

/* 现代输入框样式 */
.modern-input,
.modern-select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    background: white;
    transition: var(--transition);
    color: var(--gray-800);
}

.modern-input:focus,
.modern-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    transform: translateY(-1px);
}

.modern-input::placeholder {
    color: var(--gray-400);
}

/* 数据控件 */
.data-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* 现代按钮样式 */
.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.action-buttons .btn-primary {
    grid-column: 1 / -1;
}

.btn-primary,
.btn-secondary,
.btn-outline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 2px solid var(--gray-200);
}

.btn-secondary:hover {
    background: var(--gray-200);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-outline {
    background: transparent;
    color: var(--gray-600);
    border: 2px solid var(--gray-300);
}

.btn-outline:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
    color: var(--gray-700);
}

.btn-icon {
    font-size: 1rem;
}

/* 图表显示区域 */
.chart-display {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--gray-200);
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.98);
    transition: var(--transition);
}

.chart-display:hover {
    transform: translateY(-2px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.chart-header {
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%);
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chart-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gray-800);
    margin: 0;
}

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

.action-btn {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-sm);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1rem;
}

.action-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.chart-container {
    flex: 1;
    padding: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 400px;
}

.chart-container canvas {
    max-width: 100%;
    max-height: 100%;
}

/* 数据表格容器 */
.data-table-container {
    padding: 1.5rem;
    border-top: 1px solid var(--gray-200);
    background: linear-gradient(135deg, var(--gray-50) 0%, white 100%);
    max-height: 400px;
    overflow-y: auto;
    transition: all 0.3s ease;
}

.data-table-container h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.data-table-container h3::before {
    content: '📊';
    font-size: 1.25rem;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .layout-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        height: auto;
    }
    
    .control-panel {
        max-height: 400px;
    }
    
    .chart-display {
        min-height: 500px;
    }
}

@media (max-width: 768px) {
    .app-header {
        padding: 1rem 1.5rem;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .logo-section h1 {
        font-size: 1.75rem;
    }
    
    .app-main {
        padding: 1rem;
    }
    
    .chart-type-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .chart-type-card {
        padding: 0.75rem 0.5rem;
    }
    
    .chart-type-card .chart-icon {
        font-size: 1.25rem;
    }
    
    .chart-type-card span {
        font-size: 0.75rem;
    }
    
    .panel-content {
        padding: 1rem;
    }
    
    .chart-container {
        padding: 1rem;
        min-height: 300px;
    }
    
    .chart-header {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .chart-header h2 {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    .chart-type-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .action-buttons {
        grid-template-columns: 1fr;
    }
    
    .theme-toggle {
        width: 40px;
        height: 40px;
    }
    
    .chart-header h2 {
        font-size: 1.125rem;
    }
}

/* 加载动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.control-panel,
.chart-display {
    animation: fadeIn 0.6s ease-out;
}

/* 微交互效果 */
.chart-type-card,
.btn-primary,
.btn-secondary,
.btn-outline,
.action-btn,
.modern-input,
.modern-select {
    animation: fadeIn 0.4s ease-out backwards;
}

.chart-type-card:nth-child(1) { animation-delay: 0.1s; }
.chart-type-card:nth-child(2) { animation-delay: 0.2s; }
.chart-type-card:nth-child(3) { animation-delay: 0.3s; }
.chart-type-card:nth-child(4) { animation-delay: 0.4s; }
.chart-type-card:nth-child(5) { animation-delay: 0.5s; }
.chart-type-card:nth-child(6) { animation-delay: 0.6s; }
.chart-type-card:nth-child(7) { animation-delay: 0.7s; }
.chart-type-card:nth-child(8) { animation-delay: 0.8s; }

/* 图表特定样式优化 */
.chartjs-render-monitor {
    border-radius: var(--border-radius-sm);
}

/* 全屏模式 */
.chart-display.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
    border-radius: 0;
}

.chart-display.fullscreen .chart-container {
    height: calc(100vh - 80px);
}

/* 暗色主题支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --gray-50: #111827;
        --gray-100: #1f2937;
        --gray-200: #374151;
        --gray-300: #4b5563;
        --gray-400: #6b7280;
        --gray-500: #9ca3af;
        --gray-600: #d1d5db;
        --gray-700: #e5e7eb;
        --gray-800: #f3f4f6;
        --gray-900: #f9fafb;
    }
    
    body {
        background: linear-gradient(135deg, var(--gray-50) 0%, #1a202c 100%);
        color: var(--gray-800);
    }
    
    .control-panel,
    .chart-display {
        background: var(--gray-100);
        border-color: var(--gray-200);
    }
    
    .modern-input,
    .modern-select {
        background: var(--gray-100);
        border-color: var(--gray-200);
        color: var(--gray-800);
    }
}

/* 悬浮提示 */
[data-tooltip] {
    position: relative;
}

[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--gray-800);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 0.5rem;
    box-shadow: var(--shadow-lg);
}

[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--gray-800);
    z-index: 1000;
    margin-bottom: -6px;
}

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

::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
}

/* 额外的美化样式 */
.chart-container {
    flex: 1;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 450px;
    background: radial-gradient(circle at center, rgba(99, 102, 241, 0.03) 0%, transparent 70%);
    transition: var(--transition);
}

.chart-container canvas {
    max-width: 100%;
    max-height: 100%;
    filter: drop-shadow(0 4px 20px rgba(0, 0, 0, 0.1));
    transition: transform 0.3s ease;
    border-radius: var(--border-radius-sm);
}

.chart-container canvas:hover {
    transform: scale(1.01);
}

/* 控制面板美化 */
.control-section {
    margin-bottom: 1rem;
    padding: 0.8rem;
    background: linear-gradient(135deg, var(--gray-50) 0%, white 100%);
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--gray-100);
    transition: var(--transition);
}

.control-section:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* 按钮美化 */
.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, var(--gray-300) 0%, var(--gray-200) 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* 输入框美化 */
.modern-input:focus,
.modern-select:focus {
    transform: translateY(-1px);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1), var(--shadow-md);
}