/* 基础样式和重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    transition: all 0.5s ease;
    overflow-x: hidden;
}

/* 应用容器布局 */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
}

/* 顶部导航区域 */
.app-header {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
}

/* Logo区域 */
.logo-section {
    flex: 1;
    min-width: 250px;
}

.main-title {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(45deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 5px;
}

.subtitle {
    font-size: 0.9rem;
    color: #666;
    font-weight: 400;
}

/* 主题控制 */
.theme-controls {
    display: flex;
    gap: 10px;
}

.theme-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.85rem;
    position: relative;
    overflow: hidden;
}

.theme-icon-btn {
    padding: 10px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon {
    width: 20px;
    height: 20px;
    display: block;
}

.theme-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.theme-btn::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    transform: scale(0);
    transition: transform 0.3s ease;
}

.theme-btn:hover::after {
    transform: scale(1);
}

/* 主要内容区域 */
.app-main {
    flex: 1;
    padding: 20px;
}

.main-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin-bottom: 30px;
}

/* 图表选择区域 */
.chart-selector-section {
    background: white;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e0e0e0;
}

.section-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
}

.chart-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.chart-card:hover {
    border-color: #667eea;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.2);
}

.chart-card.active {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

.card-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    border-radius: 8px;
    margin-top: 2px;
}

.card-content {
    flex: 1;
    min-width: 0;
}

.chart-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
    line-height: 1.2;
}

.chart-card p {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 6px;
    line-height: 1.2;
}

.card-description {
    font-size: 0.7rem;
    color: #999;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 图表显示区域 */
.chart-display-section {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e0e0e0;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.chart-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #333;
    flex: 1;
}

.chart-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

/* 按钮样式 */
.btn {
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 120px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: white;
    color: #666;
    border: 2px solid #e0e0e0;
}

.btn-secondary:hover {
    background: #f8f9fa;
    border-color: #667eea;
    color: #667eea;
    transform: translateY(-2px);
}

/* 图表描述 */
.chart-description {
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.chart-description p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #666;
    margin: 0;
}

/* 图表容器 */
.chart-container {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid #f0f0f0;
    margin-bottom: 25px;
    position: relative;
    min-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-right: 30px;
}

#plotly-chart {
    width: 100% !important;
    height: 600px !important;
}

/* 数据信息区域 */
.data-info-section {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid #f0f0f0;
}

.data-info-section h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.data-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.info-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 3px solid #667eea;
}

.info-label {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
}

.info-value {
    font-size: 1rem;
    color: #333;
    font-weight: 600;
}

/* 底部版权信息 */
.app-footer {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-top: 1px solid #e0e0e0;
    padding: 20px;
    text-align: center;
    color: #666;
    font-size: 0.85rem;
}

/* 主题变换样式 */
body[data-theme="light"] {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

body[data-theme="dark"] {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

/* 白天模式样式 */
body[data-theme="light"] .app-container {
    background: rgba(255, 255, 255, 0.95);
    color: #111827;
}

body[data-theme="light"] .app-header {
    background: rgba(255, 255, 255, 0.95);
    border-bottom-color: #e5e7eb;
}

body[data-theme="light"] .chart-selector-section,
body[data-theme="light"] .chart-display-section,
body[data-theme="light"] .data-info-section {
    background: #ffffff;
    border-color: #e5e7eb;
}

body[data-theme="light"] .section-title,
body[data-theme="light"] .chart-header h2,
body[data-theme="light"] .data-info-section h3 {
    color: #333;
}

body[data-theme="light"] .main-title {
    background: linear-gradient(45deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

body[data-theme="light"] .chart-card {
    background: #ffffff;
    border-color: #e0e0e0;
}

body[data-theme="light"] .chart-card h3 {
    color: #333;
}

body[data-theme="light"] .chart-container {
    background: #ffffff;
    border-color: #f0f0f0;
}

body[data-theme="light"] .chart-description {
    background: #f8f9fa;
    border-left-color: #667eea;
}

body[data-theme="light"] .info-card {
    background: #f8f9fa;
    border-left-color: #667eea;
}

body[data-theme="light"] .info-label {
    color: #666;
}

body[data-theme="light"] .info-value {
    color: #333;
}

/* 黑夜模式样式 */
body[data-theme="dark"] .app-container {
    background: rgba(31, 41, 55, 0.95);
    color: #f9fafb;
}

body[data-theme="dark"] .app-header {
    background: rgba(31, 41, 55, 0.95);
    border-bottom-color: #374151;
}

body[data-theme="dark"] .chart-selector-section,
body[data-theme="dark"] .chart-display-section,
body[data-theme="dark"] .data-info-section {
    background: #1f2937;
    border-color: #374151;
    color: #f9fafb;
}

body[data-theme="dark"] .section-title,
body[data-theme="dark"] .chart-header h2,
body[data-theme="dark"] .data-info-section h3 {
    color: #f9fafb;
}

body[data-theme="dark"] .main-title {
    background: linear-gradient(45deg, #9ca3af, #6b7280);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

body[data-theme="dark"] .subtitle {
    color: #9ca3af;
}

body[data-theme="dark"] .chart-card {
    background: #374151;
    border-color: #4b5563;
    color: #f9fafb;
}

body[data-theme="dark"] .chart-card h3 {
    color: #f9fafb;
}

body[data-theme="dark"] .chart-card p {
    color: #d1d5db;
}

body[data-theme="dark"] .card-description {
    color: #9ca3af;
}

body[data-theme="dark"] .chart-container {
    background: #374151;
    border-color: #4b5563;
    color: #f9fafb;
}

body[data-theme="dark"] .chart-description {
    background: #374151;
    border-left-color: #9ca3af;
}

body[data-theme="dark"] .chart-description p {
    color: #d1d5db;
}

body[data-theme="dark"] .chart-header {
    border-bottom-color: #4b5563;
}

body[data-theme="dark"] .info-card {
    background: #374151;
    border-left-color: #9ca3af;
}

body[data-theme="dark"] .info-label {
    color: #9ca3af;
}

body[data-theme="dark"] .info-value {
    color: #f9fafb;
}

body[data-theme="dark"] .btn-secondary {
    background: #374151;
    color: #f9fafb;
    border-color: #4b5563;
}

body[data-theme="dark"] .btn-secondary:hover {
    background: #4b5563;
    border-color: #9ca3af;
    color: #f9fafb;
}

body[data-theme="dark"] .app-footer {
    background: rgba(31, 41, 55, 0.9);
    border-top-color: #374151;
    color: #9ca3af;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* 深色滚动条 */
body[data-theme="dark"] ::-webkit-scrollbar-track {
    background: #374151;
}

body[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #6b7280;
}

body[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .logo-section {
        text-align: center;
    }

    .theme-controls {
        justify-content: center;
    }

    .chart-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 12px;
    }

    .chart-card {
        padding: 12px;
        gap: 10px;
    }

    .card-icon {
        font-size: 1.3rem;
        width: 25px;
        height: 25px;
        margin-top: 1px;
    }

    .chart-card h3 {
        font-size: 0.9rem;
    }

    .chart-card p {
        font-size: 0.8rem;
    }

    .card-description {
        font-size: 0.68rem;
    }

    .chart-header {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .chart-actions {
        flex-direction: row;
        justify-content: center;
        gap: 8px;
    }

    .main-title {
        font-size: 1.5rem;
    }

    .app-main {
        padding: 15px;
    }

    .data-info-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .chart-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .chart-card {
        padding: 10px;
        gap: 8px;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .card-icon {
        font-size: 1.2rem;
        width: 22px;
        height: 22px;
        margin-top: 0;
    }

    .card-content {
        text-align: center;
        width: 100%;
    }

    .chart-card h3 {
        font-size: 0.85rem;
        margin-bottom: 2px;
    }

    .chart-card p {
        font-size: 0.75rem;
        margin-bottom: 3px;
    }

    .card-description {
        font-size: 0.62rem;
        line-height: 1.2;
    }

    .theme-controls {
        flex-direction: column;
        gap: 8px;
    }

    .chart-actions {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }

    #plotly-chart {
        height: 400px !important;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chart-selector-section,
.chart-display-section {
    animation: fadeIn 0.6s ease;
}

.chart-card {
    transition: all 0.3s ease;
}

.info-card {
    transition: all 0.3s ease;
}

.info-card:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
}

/* 全屏模式样式 */
.chart-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
    border-radius: 0;
    padding: 40px;
}

.chart-container.fullscreen #plotly-chart {
    height: calc(100vh - 80px) !important;
}

/* 加载状态 */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    color: #666;
    font-size: 1.1rem;
}

.loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid #f0f0f0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 15px;
}

/* 错误状态 */
.error {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    color: #ef4444;
    font-size: 1.1rem;
    background: rgba(239, 68, 68, 0.05);
    border: 2px dashed #ef4444;
    border-radius: 8px;
    margin: 20px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}