/* style.css */

/* ==================== 1. 全局样式 (默认深色) ==================== */
body { 
    background: #100C2A; color: #e0e0e0; 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; 
    margin: 0; padding: 0; 
    height: 100vh; overflow: hidden; 
}
[data-theme="light"] body { background: #f5f7fa; color: #333333; }

/* ==================== 2. 顶部导航 ==================== */
.navbar { 
    background: #1b1b38; padding: 0 15px; display: flex; gap: 10px; align-items: center; 
    border-bottom: 1px solid #2d2d44; box-shadow: 0 4px 12px rgba(0,0,0,0.3); height: 56px; z-index: 100;
}
[data-theme="light"] .navbar { background: #ffffff; border-bottom-color: #e6e8eb; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }

.app-title { font-weight: 800; font-size: 18px; color: #5d55fa; letter-spacing: 1px; }
[data-theme="light"] .app-title { color: #2962ff; }

/* 输入框与下拉框 */
input, select { 
    background: rgba(128,128,128,0.1); border: 1px solid #2d2d44; color: #e0e0e0; 
    padding: 8px; border-radius: 4px; font-size: 16px; outline: none;
}
input { width: 80px; text-align: center; }
select { padding: 8px 4px; font-size: 14px; cursor: pointer; max-width: 150px; }

input:focus, select:focus { border-color: #5d55fa; }

[data-theme="light"] input, [data-theme="light"] select { border-color: #e6e8eb; color: #333333; }
[data-theme="light"] input:focus, [data-theme="light"] select:focus { border-color: #2962ff; }

/* 按钮 */
.btn { 
    border: none; padding: 8px 16px; border-radius: 4px; 
    cursor: pointer; color: #fff; 
    font-size: 14px; font-weight: 600; white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; filter: grayscale(1); }

.btn-primary { background: #5d55fa; }
[data-theme="light"] .btn-primary { background: #2962ff; }

.btn-action { background: #FD1050; }
[data-theme="light"] .btn-action { background: #d93025; }

.btn-theme { background: transparent; border: 1px solid #2d2d44; color: #e0e0e0; padding: 7px 12px; }
[data-theme="light"] .btn-theme { border-color: #e6e8eb; color: #333333; }

/* ==================== 3. 布局容器与卡片 ==================== */
.container { 
    padding: 15px; display: grid; grid-template-columns: 2.5fr 1fr; 
    gap: 15px; height: calc(100vh - 56px); box-sizing: border-box;
}

.card { 
    background: #1b1b38; border-radius: 8px; display: flex; flex-direction: column; 
    border: 1px solid #2d2d44; position: relative; overflow: hidden; box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
[data-theme="light"] .card { background: #ffffff; border-color: #e6e8eb; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }

.card-header { 
    padding: 12px 15px; display: flex; justify-content: space-between; align-items: center; 
    border-bottom: 1px solid #2d2d44; background: rgba(0,0,0,0.02);
}
[data-theme="light"] .card-header { border-bottom-color: #e6e8eb; }

.title { font-weight: bold; font-size: 15px; color: #e0e0e0; }
[data-theme="light"] .title { color: #333333; }

.status { font-size: 12px; color: #888; font-family: monospace; }
[data-theme="light"] .status { color: #666; }

.chart-wrapper { flex: 1; width: 100%; min-height: 0; position: relative; }
#kline { width: 100%; height: 100%; }

/* ==================== 4. AI 报告样式 ==================== */
.ai-wrapper { 
    flex: 1; overflow-y: auto; padding: 15px; 
    font-size: 14px; line-height: 1.7; 
}

/* 【核心：防打断】生成期间让内部元素不响应触控，防止DOM刷新吃掉滑动事件 */
.ai-wrapper.generating * {
    pointer-events: none !important;
}

.ai-wrapper h3 { font-size: 15px; color: #888; text-transform: uppercase; margin: 20px 0 10px; padding-bottom: 5px; border-bottom: 1px dashed #2d2d44; }
.ai-wrapper h3:first-child { margin-top: 0; }
[data-theme="light"] .ai-wrapper h3 { color: #666; border-bottom-color: #e6e8eb; }

.ai-wrapper ul { padding-left: 18px; margin: 0; color: #888; }
.ai-wrapper small { color: #888; font-size: 0.85em; margin-left: 5px; }
[data-theme="light"] .ai-wrapper ul, [data-theme="light"] .ai-wrapper small { color: #666; }

.ai-wrapper li { margin-bottom: 8px; position: relative; }
.ai-wrapper p { margin-bottom: 10px; }

.ai-wrapper b { color: #e0e0e0; font-weight: 700; }
[data-theme="light"] .ai-wrapper b { color: #333333; }

/* 语义化高亮 */
.ai-wrapper b.up { color: #FD1050; background: rgba(253, 16, 80, 0.1); padding: 0 4px; border-radius: 3px; }
[data-theme="light"] .ai-wrapper b.up { color: #d93025; background: rgba(217, 48, 37, 0.1); }

.ai-wrapper b.down { color: #0CF49B; background: rgba(12, 244, 155, 0.1); padding: 0 4px; border-radius: 3px; }
[data-theme="light"] .ai-wrapper b.down { color: #188038; background: rgba(24, 128, 56, 0.1); }

/* 策略盒子 */
.ai-wrapper .strategy-box { margin-top: 15px; padding: 15px; border: 1px solid #2d2d44; border-left: 4px solid #5d55fa; border-radius: 6px; background: rgba(255, 255, 255, 0.05); }
[data-theme="light"] .ai-wrapper .strategy-box { border-color: #e6e8eb; border-left-color: #2962ff; background: rgba(0, 0, 0, 0.03); }

.ai-wrapper .strategy-box .signal { font-size: 1.1em; color: #5d55fa; }
.ai-wrapper .strategy-box span { color: #5d55fa; font-weight: bold; }
[data-theme="light"] .ai-wrapper .strategy-box .signal, [data-theme="light"] .ai-wrapper .strategy-box span { color: #2962ff; }

/* 空状态 */
.empty-state { display: flex; flex-direction: column; justify-content: center; align-items: center; height: 100%; color: #888; opacity: 0.3; }
[data-theme="light"] .empty-state { color: #666; }
.empty-state svg { width: 64px; height: 64px; margin-bottom: 15px; }

/* Loading */
.loader { position: absolute; top:0; left:0; right:0; bottom:0; background: rgba(0,0,0,0.6); backdrop-filter: blur(2px); display: none; justify-content: center; align-items: center; z-index: 20; flex-direction: column; gap: 10px; font-size: 12px; color: #fff; }
.spinner { width: 24px; height: 24px; border: 3px solid rgba(255,255,255,0.3); border-top-color: #5d55fa; border-radius: 50%; animation: spin 0.8s linear infinite; }
[data-theme="light"] .spinner { border-top-color: #2962ff; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ==================== 5. 移动端适配 ==================== */
@media (max-width: 900px) {
    body { overflow: auto; height: auto; }
    .navbar { padding: 10px; justify-content: space-between; flex-wrap: wrap; height: auto; }
    .app-title { display: none; }
    .container { display: block; height: auto; padding: 10px; }
    .card { margin-bottom: 20px; }
    .chart-wrapper { height: 450px; min-height: 450px; }
    .ai-wrapper { height: auto; min-height: 300px; max-height: 600px; }
    input { width: 80px; }
    .btn { padding: 8px 12px; }
}