/* A股大数据 - 深色终端风格 */
/* 主色调: 蓝紫渐变 #667eea→#764ba2 | 涨 #e17055 | 跌 #00b894 | 金 #f39c12 */

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #0d1117;
    color: #c9d1d9;
    min-height: 100vh;
    display: flex;
}

/* ===== 左侧导航 ===== */
.sidebar {
    width: 240px;
    min-width: 240px;
    background: #161b22;
    border-right: 1px solid #21262d;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
    transition: transform 0.3s ease;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: #30363d; border-radius: 2px; }

.sidebar-logo {
    padding: 18px 16px;
    border-bottom: 1px solid #21262d;
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-logo img { height: 32px; width: 32px; border-radius: 8px; }
.sidebar-logo-text { font-size: 20px; font-weight: 800; color: #f0f6fc; letter-spacing: 1px; }
.sidebar-logo-text span { color: #667eea; }

/* 一级分类 */
.nav-category {
    padding: 12px 18px 6px;
    font-size: 15px;
    color: #8b949e;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
    transition: color 0.2s;
}
.nav-category:hover { color: #c9d1d9; }
.nav-category .cat-icon { margin-right: 10px; font-size: 18px; }
.nav-category .cat-label { flex: 1; }
.nav-category .cat-arrow { font-size: 12px; transition: transform 0.2s; color: #484f58; }
.nav-category.open .cat-arrow { transform: rotate(90deg); }

/* 二级菜单 */
.nav-sub {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}
.nav-sub.open { max-height: 500px; }
.nav-sub a {
    display: block;
    padding: 10px 18px 10px 44px;
    color: #8b949e;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.15s;
    position: relative;
    white-space: nowrap;
}
.nav-sub a:hover { color: #c9d1d9; background: #1c2333; }
.nav-sub a.active {
    color: #f0f6fc;
    background: linear-gradient(90deg, #667eea18 0%, transparent 100%);
}
.nav-sub a.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 4px;
    bottom: 4px;
    width: 3px;
    background: linear-gradient(180deg, #667eea, #764ba2);
    border-radius: 0 3px 3px 0;
}

/* ===== 主内容区 ===== */
.main-content {
    flex: 1;
    margin-left: 240px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== 页面头部 ===== */
.page-header {
    background: linear-gradient(135deg, #161b22 0%, #1a1b2e 100%);
    border-bottom: 1px solid #21262d;
    padding: 16px 24px;
}
.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: #f0f6fc;
    display: flex;
    align-items: center;
    gap: 8px;
}
.page-header h1 span { color: #667eea; }
.page-header .subtitle { font-size: 14px; color: #8b949e; margin-top: 4px; }

/* ===== 汉堡菜单（移动端） ===== */
.hamburger {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 200;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #161b22;
    border: 1px solid #30363d;
    color: #c9d1d9;
    font-size: 20px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 90;
}

/* ===== 统计栏 ===== */
.stats-bar {
    display: flex;
    justify-content: center;
    gap: 24px;
    padding: 12px 20px;
    background: #161b22;
    border-bottom: 1px solid #21262d;
    flex-wrap: wrap;
}
.stat-item { text-align: center; min-width: 60px; }
.stat-item .value { font-size: 22px; font-weight: 700; color: #667eea; }
.stat-item .value.up { color: #e17055; }
.stat-item .value.down { color: #00b894; }
.stat-item .value.gold { color: #f39c12; }
.stat-item .value.red { color: #e17055; }
.stat-item .value.green { color: #00b894; }
.stat-item .value.purple { color: #a855f7; }
.stat-item .value.blue { color: #667eea; }
.stat-item .value.orange { color: #f59e0b; }
.stat-item .label { font-size: 14px; color: #8b949e; margin-top: 2px; }

/* ===== 容器 ===== */
.container { max-width: 1400px; margin: 0 auto; padding: 16px 20px; width: 100%; }
.content { max-width: 1400px; margin: 0 auto; padding: 16px 20px; width: 100%; }

/* ===== 卡片 ===== */
.card {
    background: #1c2333;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid #21262d;
}
.card-title { font-size: 16px; font-weight: 700; color: #c9d1d9; margin-bottom: 12px; }

/* ===== 日期导航条 ===== */
.date-bar {
    display: flex;
    gap: 5px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 14px;
    padding: 8px 20px;
    background: #161b22;
    border-bottom: 1px solid #21262d;
}
.date-bar a {
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 14px;
    text-decoration: none;
    color: #8b949e;
    background: #0d1117;
    border: 1px solid #21262d;
    white-space: nowrap;
    transition: all 0.2s;
}
.date-bar a:hover { border-color: #667eea; color: #667eea; }
.date-bar a.active { background: #667eea; color: #fff; border-color: #667eea; }

/* ===== 表格 ===== */
.table-wrap {
    background: #161b22;
    border-radius: 10px;
    border: 1px solid #21262d;
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}
thead th {
    background: #1c2333;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: #8b949e;
    border-bottom: 1px solid #21262d;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}
thead th:hover { color: #667eea; }
thead th .sort-arrow { font-size: 10px; margin-left: 2px; }
tbody td { padding: 12px 14px; border-bottom: 1px solid #21262d; }
tbody tr:hover td { background: #1c2333; }
/* 深色行交替 */
tbody tr:nth-child(even) td { background: #0d111708; }
tbody tr:nth-child(even):hover td { background: #1c2333; }

/* 表格颜色 */
.up, .pct-up { color: #e17055; font-weight: 600; }
.down, .pct-down { color: #00b894; font-weight: 600; }
.amount { color: #f39c12; }
.stock-code { color: #8b949e; font-size: 14px; }
.stock-name { color: #c9d1d9; font-weight: 600; }

/* 标签 */
.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}
.tag-up { background: #e1705518; color: #e17055; }
.tag-down { background: #00b89418; color: #00b894; }
.tag-gold { background: #f39c1218; color: #f39c12; }
.tag-primary { background: #667eea18; color: #667eea; }

/* ===== 按钮 ===== */
.btn {
    padding: 8px 18px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-primary { background: #667eea; color: #fff; }
.btn-primary:hover { background: #5a6fd6; }
.btn-secondary { background: #21262d; color: #8b949e; border: 1px solid #30363d; }
.btn-secondary:hover { background: #30363d; color: #c9d1d9; }
.btn-outline { background: transparent; color: #667eea; border: 1px solid #667eea; }
.btn-outline:hover { background: #667eea; color: #fff; }
.btn-sm { padding: 4px 12px; font-size: 14px; border-radius: 4px; }

/* ===== Tab 切换 ===== */
.tabs {
    display: flex;
    gap: 0;
    background: #161b22;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 16px;
    border: 1px solid #21262d;
}
.tab-btn {
    flex: 1;
    padding: 10px 16px;
    text-align: center;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    border: none;
    background: transparent;
    color: #8b949e;
    transition: all 0.2s;
}
.tab-btn.active { background: #667eea; color: #fff; }
.tab-btn:hover:not(.active) { background: #1c2333; }

/* ===== 表单 ===== */
.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 14px; color: #8b949e; margin-bottom: 4px; font-weight: 600; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #30363d;
    border-radius: 6px;
    font-size: 15px;
    color: #c9d1d9;
    outline: none;
    transition: border-color 0.2s;
    background: #0d1117;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: #667eea; }

/* ===== 空状态 ===== */
.empty, .empty-state { text-align: center; padding: 48px 20px; color: #8b949e; font-size: 14px; }
.empty-state .icon { font-size: 48px; margin-bottom: 15px; }

/* ===== 刷新按钮 ===== */
.refresh-btn {
    background: #667eea;
    color: #fff;
    border: none;
    padding: 5px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    transition: all 0.2s;
}
.refresh-btn:hover { background: #5a6fd6; }
.refresh-btn:disabled { background: #30363d; color: #8b949e; cursor: not-allowed; }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.show { display: block; }
    .hamburger { display: flex; }
    .main-content { margin-left: 0; }
    .page-header h1 { font-size: 18px; padding-left: 44px; }
    .page-header .subtitle { padding-left: 44px; }
    .stats-bar { gap: 12px; }
    .stat-item .value { font-size: 18px; }
    table { font-size: 14px; }
    thead th, tbody td { padding: 8px 6px; }
    .container, .content { padding: 12px; }
    .date-bar a { padding: 3px 8px; font-size: 11px; }
}

/* ===== 通用页面组件 ===== */
.stock-name-link { color: #667eea; font-weight: bold; text-decoration: none; cursor: pointer; }
.stock-name-link:hover { text-decoration: underline; color: #8b9df7; }
.inflow-up { color: #e17055; font-weight: bold; }
.inflow-down { color: #00b894; font-weight: bold; }
.pct-tag { font-size: 11px; color: #8b949e; margin-left: 3px; }
.cb-badge { background: #e17055; color: white; padding: 1px 6px; border-radius: 3px; font-size: 11px; font-weight: bold; }
.reason-tag { background: #667eea20; color: #667eea; padding: 2px 8px; border-radius: 4px; font-size: 11px; }
.legend { display: flex; justify-content: center; gap: 12px; padding: 8px 20px; background: #161b22; border-bottom: 1px solid #21262d; flex-wrap: wrap; font-size: 14px; color: #8b949e; }
.legend-item { display: flex; align-items: center; gap: 4px; }

/* 评分条 */
.score-bar { display: flex; align-items: center; gap: 4px; }
.score-fill { height: 8px; border-radius: 4px; transition: width 0.3s; }
.score-s { background: linear-gradient(90deg, #f39c12, #e17055); }
.score-a { background: linear-gradient(90deg, #f59e0b, #f39c12); }
.score-b { background: linear-gradient(90deg, #667eea, #764ba2); }
.score-c { background: #30363d; }

/* 通用标签扩展 */
.tag-fire { background: #e1705520; color: #e17055; }
.tag-dragon { background: #667eea20; color: #667eea; }
.tag-money { background: #f39c1220; color: #f39c12; }
.tag-board { background: #667eea15; color: #667eea; }
.tag-normal { background: #21262d; color: #8b949e; }
.tag-sector { background: #667eea15; color: #667eea; }
.tag-time { background: #00b89420; color: #00b894; }
.tag-days { background: #667eea20; color: #667eea; }

/* 排名徽章 */
.rank-badge { display: inline-block; width: 28px; height: 28px; line-height: 28px; text-align: center; border-radius: 6px; font-weight: bold; font-size: 15px; }

/* nav-bar（旧日期栏兼容） */
.nav-bar { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; padding: 8px 20px; background: #161b22; border-bottom: 1px solid #21262d; }
.nav-bar a { padding: 4px 12px; border-radius: 6px; font-size: 14px; text-decoration: none; color: #8b949e; background: #0d1117; border: 1px solid #21262d; white-space: nowrap; transition: all 0.2s; }
.nav-bar a:hover { border-color: #667eea; color: #667eea; }
.nav-bar a.active { background: #667eea; color: #fff; border-color: #667eea; }
.nav-bar .refresh-btn { margin-left: auto; }

/* Tab-bar（pill风格） */
.tab-bar { display: flex; gap: 0; background: #161b22; border-radius: 8px; overflow: hidden; margin-bottom: 16px; border: 1px solid #21262d; }
.tab-bar .tab-btn { flex: 1; padding: 10px 16px; text-align: center; cursor: pointer; font-size: 16px; font-weight: 600; border: none; background: transparent; color: #8b949e; transition: all 0.2s; }
.tab-bar .tab-btn.active { background: #667eea; color: #fff; }
.tab-bar .tab-btn:hover:not(.active) { background: #1c2333; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ===== 深色系适配 - 全局补充 ===== */
a { color: #667eea; }
a:hover { color: #8b9df7; }

/* 弹窗适配 */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); z-index: 100; justify-content: center; align-items: flex-start; padding-top: 40px; overflow-y: auto; }
.modal-overlay.show { display: flex; }
.modal { background: #1c2333; border-radius: 12px; padding: 24px; width: 90%; max-width: 600px; margin-bottom: 40px; box-shadow: 0 4px 24px rgba(0,0,0,0.4); border: 1px solid #21262d; }
.modal h3 { color: #667eea; font-size: 18px; margin-bottom: 16px; }
.modal .detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.modal .detail-item { background: #0d1117; border-radius: 8px; padding: 12px; }
.modal .detail-item .label { font-size: 11px; color: #8b949e; margin-bottom: 4px; }
.modal .detail-item .val { font-size: 18px; font-weight: bold; }
.modal .analysis-box { background: #0d1117; border-radius: 8px; padding: 16px; margin-bottom: 16px; white-space: pre-wrap; font-size: 15px; line-height: 1.8; color: #c9d1d9; }
.modal .capital-table { width: 100%; border-collapse: collapse; }
.modal .capital-table th { font-size: 11px; color: #8b949e; padding: 6px; text-align: left; border-bottom: 1px solid #21262d; }
.modal .capital-table td { font-size: 14px; padding: 6px; border-bottom: 1px solid #21262d; }
.modal .btn-row { display: flex; gap: 8px; justify-content: flex-end; }

/* 去掉旧的 header/top-nav 样式，保留用于覆盖但设为暗色 */
.header {
    background: linear-gradient(135deg, #1a1b2e 0%, #161b22 100%);
    color: #f0f6fc;
    padding: 16px 24px;
    border-bottom: 1px solid #21262d;
}
.header h1 { font-size: 20px; font-weight: 700; display: flex; align-items: center; gap: 8px; color: #f0f6fc; }
.header h1 span { color: #667eea; }
.header .subtitle { font-size: 12px; color: #8b949e; margin-top: 4px; }

/* 旧 top-nav 隐藏 - 改用左侧导航 */
.top-nav { display: none; }

/* 一级核心入口 */
.nav-primary {
    margin: 10px 10px 12px;
    padding: 8px;
    border: 1px solid rgba(102, 126, 234, 0.16);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(102, 126, 234, 0.10) 0%, rgba(13, 17, 23, 0.12) 100%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.035);
}
.nav-section-title {
    padding: 5px 10px 8px;
    color: #6e7681;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}
.nav-section-title-sub {
    margin: 4px 18px 2px;
    padding: 8px 0 4px;
    border-top: 1px solid rgba(139, 148, 158, 0.12);
}
.nav-top-link {
    min-height: 42px;
    margin: 3px 0;
    padding: 9px 10px;
    border: 1px solid transparent;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #9aa4b2;
    text-decoration: none;
    font-size: 15px;
    font-weight: 750;
    position: relative;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
.nav-top-link .top-icon {
    width: 28px;
    height: 28px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 28px;
    font-size: 16px;
    background: rgba(139, 148, 158, 0.10);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}
.nav-top-link .top-label {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nav-top-link:hover {
    color: #f0f6fc;
    background: rgba(102, 126, 234, 0.12);
    border-color: rgba(102, 126, 234, 0.22);
    transform: translateX(2px);
}
.nav-top-link.active {
    color: #ffffff;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.32) 0%, rgba(118, 75, 162, 0.26) 100%);
    border-color: rgba(102, 126, 234, 0.45);
    box-shadow: 0 8px 22px rgba(102, 126, 234, 0.14), inset 0 1px 0 rgba(255,255,255,0.08);
}
.nav-top-link.active .top-icon {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}
.nav-top-link.active::before {
    content: '';
    position: absolute;
    left: -9px;
    top: 10px;
    bottom: 10px;
    width: 3px;
    background: linear-gradient(180deg, #667eea, #764ba2);
    border-radius: 0 3px 3px 0;
}

/* Chrome/Chromium 适配：一级菜单渲染稳定性 */
@supports (-webkit-appearance: none) {
    .sidebar {
        -webkit-font-smoothing: antialiased;
        text-rendering: optimizeLegibility;
        scrollbar-gutter: stable;
    }
    .nav-primary {
        width: calc(100% - 20px);
        overflow: visible;
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
    }
    .nav-top-link {
        box-sizing: border-box;
        width: 100%;
        -webkit-tap-highlight-color: transparent;
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
        will-change: background-color, border-color, transform;
    }
    .nav-top-link .top-icon {
        line-height: 1;
        font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", system-ui, sans-serif;
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
    }
    .nav-top-link .top-label {
        display: block;
        line-height: 1.2;
    }
}

@media (hover: none) {
    .nav-top-link:hover {
        transform: none;
    }
}

@media (max-width: 768px) {
    .nav-primary {
        margin: 8px 10px 10px;
        padding: 7px;
    }
    .nav-top-link {
        min-height: 44px;
        padding: 9px 10px;
    }
    .nav-top-link .top-icon {
        width: 30px;
        height: 30px;
        flex-basis: 30px;
    }
}
