/* style.css */

/* ==================== 1. 主题变量系统 ==================== */
:root {
    /* 深色模式 */
    --bg: #100C2A; 
    --panel: #1b1b38; 
    --text: #e0e0e0; 
    --text-muted: #888;
    --border: #2d2d44;
    --accent: #5d55fa; 
    --red: #FD1050; 
    --green: #0CF49B;
    --btn-text: #fff;
    --shadow: 0 4px 12px rgba(0,0,0,0.3);
    --box-bg: rgba(255, 255, 255, 0.05);
}

[data-theme="light"] {
    /* 浅色模式 */
    --bg: #f5f7fa; 
    --panel: #ffffff; 
    --text: #333333; 
    --text-muted: #666;
    --border: #e6e8eb;
    --accent: #2962ff; 
    --red: #d93025; 
    --green: #188038;
    --btn-text: #fff;
    --shadow: 0 2px 8px rgba(0,0,0,0.05);
    --box-bg: rgba(0, 0, 0, 0.03);
}

/* ==================== 2. 全局样式 ==================== */
body { 
    background: var(--bg); color: var(--text); 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; 
    margin: 0; padding: 0; 
    height: 100vh; overflow: hidden; /* 电脑端禁止整体滚动 */
}

/* 顶部导航 */
.navbar { 
    background: var(--panel); padding: 0 15px; display: flex; gap: 10px; align-items: center; 
    border-bottom: 1px solid var(--border); box-shadow: var(--shadow); height: 56px; z-index: 100;
}

.app-title { font-weight: 800; font-size: 18px; color: var(--accent); letter-spacing: 1px; }

input { 
    background: rgba(128,128,128,0.1); border: 1px solid var(--border); color: var(--text); 
    padding: 8px; border-radius: 4px; width: 80px; text-align: center; font-size: 16px; outline: none;
}
input:focus { border-color: var(--accent); }

/* 模型选择下拉框 */
select {
    background: rgba(128,128,128,0.1); border: 1px solid var(--border); color: var(--text);
    padding: 8px 4px; border-radius: 4px; font-size: 14px; outline: none; cursor: pointer;
    max-width: 100px;
}
select:focus { border-color: var(--accent); }

/* 按钮 */
.btn { 
    border: none; padding: 8px 16px; border-radius: 4px; 
    cursor: pointer; color: var(--btn-text); 
    font-size: 14px; font-weight: 600; white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; filter: grayscale(1); }
.btn-primary { background: var(--accent); }
.btn-action { background: var(--red); }
.btn-theme { background: transparent; border: 1px solid var(--border); color: var(--text); padding: 7px 12px; }

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

.card { 
    background: var(--panel); border-radius: 8px; display: flex; flex-direction: column; 
    border: 1px solid var(--border); position: relative; overflow: hidden; box-shadow: var(--shadow);
}

.card-header { 
    padding: 12px 15px; display: flex; justify-content: space-between; align-items: center; 
    border-bottom: 1px solid var(--border); background: rgba(0,0,0,0.02);
}
.title { font-weight: bold; font-size: 15px; color: var(--text); }
.status { font-size: 12px; color: var(--text-muted); font-family: monospace; }

/* 图表容器 */
.chart-wrapper { flex: 1; width: 100%; min-height: 0; position: relative; }
#kline { width: 100%; height: 100%; }

/* ==================== 3. AI 报告样式 (专业版) ==================== */
.ai-wrapper { 
    flex: 1; overflow-y: auto; padding: 15px; 
    font-size: 14px; line-height: 1.7; scroll-behavior: smooth;
}
.ai-wrapper h3 { font-size: 15px; color: var(--text-muted); text-transform: uppercase; margin: 20px 0 10px; padding-bottom: 5px; border-bottom: 1px dashed var(--border); }
.ai-wrapper h3:first-child { margin-top: 0; }
.ai-wrapper ul { padding-left: 18px; margin: 0; color: var(--text-muted); }
.ai-wrapper li { margin-bottom: 8px; position: relative; }
.ai-wrapper p { margin-bottom: 10px; }
.ai-wrapper b { color: var(--text); font-weight: 700; }
.ai-wrapper small { color: var(--text-muted); font-size: 0.85em; margin-left: 5px; }

/* 语义化高亮 */
.ai-wrapper b.up { color: var(--red); background: rgba(253, 16, 80, 0.1); padding: 0 4px; border-radius: 3px; }
.ai-wrapper b.down { color: var(--green); background: rgba(12, 244, 155, 0.1); padding: 0 4px; border-radius: 3px; }

/* 策略盒子 */
.ai-wrapper .strategy-box { margin-top: 15px; padding: 15px; border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 6px; background: var(--box-bg); }
.ai-wrapper .strategy-box .signal { font-size: 1.1em; color: var(--accent); }
.ai-wrapper .strategy-box span { color: var(--accent); font-weight: bold; }

/* 空状态 */
.empty-state { display: flex; flex-direction: column; justify-content: center; align-items: center; height: 100%; color: var(--text-muted); opacity: 0.3; }
.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: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ==================== 4. 移动端适配 ==================== */
@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; }
}