/* stock-analysis-premium - Modern Dashboard Theme */

/* ── CSS Variables ── */
:root {
    --bg-body: #ffffff;
    --bg-card: #f8f9fa;
    --bg-input: #f1f3f5;
    --bg-hover: #e9ecef;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --border: #dee2e6;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --up-color: #26c067;
    --dn-color: #f04050;
    --warning: #eab308;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.12);
    --transition: 0.2s ease;
    --max-width: 1280px;
}

[data-theme="dark"] {
    --bg-body: #060810;
    --bg-card: #0c0e14;
    --bg-input: #151720;
    --bg-hover: #1a1d28;
    --text-primary: #eef4f8;
    --text-secondary: #8b8fa3;
    --border: #1e2130;
    --accent: #3b82f6;
    --accent-hover: #60a5fa;
    --up-color: #16a34a;
    --dn-color: #dc2626;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.4);
}

/* ── 全局重置 ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: "Honor Sans CN", sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    transition: background var(--transition), color var(--transition);
}

/* ── 顶栏（复用全局组件） ── */
/* 顶栏样式由 components/topbar.css 提供，app.css 只补页面级样式 */

/* ── 布局（无侧边栏，全宽内容） ── */
.main-layout {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 20px 16px calc(36px + 20px);
}

/* ── 卡片 ── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    transition: box-shadow var(--transition);
    margin-bottom: 16px;
}
.card:hover { box-shadow: var(--shadow-hover); }
.card-title { font-size: 16px; font-weight: 600; margin-bottom: 12px; color: var(--text-primary); }

/* ── 搜索框 ── */
.search-box {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}
.search-input {
    flex: 1;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 14px;
    transition: border var(--transition);
}
.search-input:focus { outline: none; border-color: var(--accent); }
.search-btn {
    padding: 8px 20px;
    border: none;
    border-radius: var(--radius);
    background: var(--accent);
    color: #ffffff;
    font-size: 14px;
    cursor: pointer;
    transition: background var(--transition);
}
.search-btn:hover { background: var(--accent-hover); }

/* ── K线区域 ── */
#chart-container {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.chart-toolbar {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    align-items: center;
}
.chart-btn {
    padding: 4px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition);
}
.chart-btn:hover, .chart-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.chart-main {
    display: flex;
}
.chart-draw { flex: 1; }
.chart-sidebar {
    width: 180px;
    border-left: 1px solid var(--border);
    padding: 12px;
    font-size: 13px;
}
.chart-sidebar-item { display: flex; justify-content: space-between; padding: 3px 0; }
.chart-sidebar-item .label { color: var(--text-secondary); }
.chart-sidebar-item .value { font-weight: 600; }
.up { color: var(--up-color); }
.dn { color: var(--dn-color); }

/* ── 行情快照列表 ── */
.snapshot-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.snapshot-table th {
    padding: 10px 8px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
    font-size: 12px;
    text-transform: uppercase;
    background: var(--bg-hover);
}
.snapshot-table td {
    padding: 8px;
    border-bottom: 1px solid var(--border);
}
.snapshot-table tr:hover { background: var(--bg-hover); }

/* ── 深色模式开关 ── */
.theme-toggle { display: flex; align-items: center; gap: 8px; margin-left: auto; font-size: 13px; color: var(--text-secondary); }
.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}
.toggle-switch input { display: none; }
.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 24px;
    cursor: pointer;
    transition: var(--transition);
}
.toggle-slider::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: var(--transition);
}
input:checked + .toggle-slider { background: var(--accent); }
input:checked + .toggle-slider::after { transform: translateX(20px); }

/* ── 移动端适配 ── */
@media (max-width: 768px) {
    .main-layout { padding: 12px 8px calc(36px + 12px); }
    .chart-sidebar { width: 100px; font-size: 11px; padding: 8px; }
    .search-box { flex-direction: column; }
    .topbar-menu { font-size: 0.82rem; padding: 0 4px; }
}
@media (max-width: 480px) {
    .chart-sidebar { display: none; }
    .chart-toolbar { gap: 2px; }
    .chart-btn { padding: 4px 6px; font-size: 11px; }
    .snapshot-table { font-size: 12px; }
    .snapshot-table th, .snapshot-table td { padding: 4px 3px; }
    .topbar-brand { font-size: 0.82rem; }
}
