/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.app-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 全屏模式 */
.app-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    background: white;
}

/* Header 样式 */
.app-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

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

.header-left {
    text-align: left;
}

.header-right {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.app-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #2c3e50;
    /* margin-bottom: 0.25rem; */
}

.app-header h1 i {
    color: #3498db;
    margin-right: 0.5rem;
}

.subtitle {
    font-size: 0.9rem;
    color: #7f8c8d;
    font-weight: 400;
}

/* Main Content 布局 */
.main-content {
    flex: 1;
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    height: calc(100vh - 120px);
    overflow: hidden;
}

/* Panel 通用样式 */
.left-panel,
.middle-panel,
.right-panel {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    height: 100%;
}

/* 左侧面板 - 数据输入 */
.left-panel {
    width: 340px;
    flex-shrink: 0;
}

/* 中间面板 - AI聊天 */
.middle-panel {
    width: 380px;
    flex-shrink: 0;
}

/* 右侧面板 - 图表预览 */
.right-panel {
    flex: 1;
    min-width: 400px;
}

/* 图表预览区域占主要空间 */
.chart-preview-section {
    flex: 1;
    min-height: 0;
}

/* 导出区域固定高度 */
.export-section {
    height: 140px;
  flex: unset;
}

/* 数据输入区域收起时的布局 */
.main-content.data-input-collapsed {
    gap: 0.75rem;
}

.main-content.data-input-collapsed .left-panel {
    width: 60px;
}

/* Section 通用样式 */
section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

section h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

section h2 i {
    color: #3498db;
}

/* 输入组样式 */
.input-group {
    margin-bottom: 1rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #34495e;
}

/* 文本输入样式 */
.data-textarea,
.config-input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
}

.data-textarea:focus,
.config-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.data-textarea {
    resize: vertical;
    min-height: 200px;
    font-family: 'Courier New', monospace;
    flex: 1;
    height: 100%;
}

/* API Key 容器 */
.api-key-container {
    display: flex;
    gap: 0.5rem;
}

.api-key-container .config-input {
    flex: 1;
}

/* 按钮样式 */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    background: transparent;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #2980b9, #1f5f8b);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.btn-secondary {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: linear-gradient(135deg, #7f8c8d, #6c7b7d);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(149, 165, 166, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: linear-gradient(135deg, #c0392b, #a93226);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.btn-export {
    background: linear-gradient(135deg, #27ae60, #229954);
    color: white;
}

.btn-export:hover:not(:disabled) {
    background: linear-gradient(135deg, #229954, #1e8449);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

.btn-icon {
    padding: 0.5rem;
    min-width: auto;
}

.config-btn {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    color: white;
}

.config-btn:hover {
    background: linear-gradient(135deg, #8e44ad, #7d3c98);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(155, 89, 182, 0.3);
}

.fullscreen-btn {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
}

.fullscreen-btn:hover {
    background: linear-gradient(135deg, #e67e22, #d35400);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(243, 156, 18, 0.3);
}

/* 操作按钮组 */
.input-actions,
.config-actions,
.export-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

/* 数据提示样式 */
.data-tips {
    background: rgba(52, 152, 219, 0.1);
    border: 1px solid rgba(52, 152, 219, 0.2);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
}

.data-tips h4 {
    color: #2980b9;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.data-tips ul {
    list-style: none;
    padding-left: 0;
}

.data-tips li {
    margin-bottom: 0.25rem;
    font-size: 0.85rem;
    color: #34495e;
}

.data-tips li strong {
    color: #2980b9;
}

/* 图表头部 */
.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

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

/* 图表容器 */
.chart-container {
    width: 100%;
    flex: 1;
    min-height: 0;
    border: none;
    border-radius: 8px;
    background: #f8f9fa;
    position: relative;
    overflow: hidden;
}

.chart-placeholder {
    text-align: center;
    color: #7f8c8d;
}

.chart-placeholder-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.chart-placeholder p {
    font-size: 1.1rem;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .main-content {
        flex-direction: column;
        height: auto;
        gap: 0.75rem;
    }

    .left-panel,
    .middle-panel,
    .right-panel {
        width: 100%;
        height: 350px;
        flex-shrink: 0;
    }

    .main-content.data-input-collapsed .left-panel {
        height: 60px;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 0.75rem;
        gap: 0.5rem;
    }

    .left-panel,
    .middle-panel,
    .right-panel {
        height: 300px;
    }

    .app-header {
        padding: 0.75rem 1rem;
    }

    .app-header h1 {
        font-size: 1.5rem;
    }

    section {
        padding: 0.75rem;
    }

    .input-actions,
    .config-actions,
    .export-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* 数据输入区域收起/展开功能 */
.data-input-section {
    transition: all 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* 数据输入区域收起状态 */
.data-input-section.collapsed {
    padding: 1rem 0.5rem;
    width: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* 区域标题样式 */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    width: 100%;
}

.section-header h2 {
    margin: 0;
    transition: all 0.3s ease;
}

/* 收起状态下的标题 */
.data-input-section.collapsed .section-header {
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 0;
}

.data-input-section.collapsed .section-header h2 {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-size: 0.9rem;
    white-space: nowrap;
}

/* 收起状态下的按钮 */
.data-input-section.collapsed .toggle-section-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 切换按钮样式 */
.toggle-section-btn {
    background: rgba(52, 152, 219, 0.1);
    border: 1px solid rgba(52, 152, 219, 0.3);
    color: #3498db;
    transition: all 0.3s ease;
}

.toggle-section-btn:hover {
    background: rgba(52, 152, 219, 0.2);
    transform: scale(1.05);
}

/* 清空对话按钮样式 */
.clear-chat-btn {
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.3);
    color: #e74c3c;
    transition: all 0.3s ease;
}

.clear-chat-btn:hover {
    background: rgba(231, 76, 60, 0.2);
    transform: scale(1.05);
}

.clear-chat-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* 数据输入内容区域 */
.data-input-content {
    transition: all 0.3s ease;
    overflow: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.data-input-content .input-group {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* 收起状态下隐藏内容 */
.data-input-section.collapsed .data-input-content {
    opacity: 0;
    height: 0;
    margin: 0;
    padding: 0;
}
