/* ==========================================================================
   style.css — 全局样式（金融主题深色背景）
   配色：bg_main #0e1117, bg_card #1a1f2e, 红涨绿跌
   ========================================================================== */

/* ---------------------------------------------------------------------------
   CSS 变量
   --------------------------------------------------------------------------- */
:root {
    /* 饱和蓝科技主色调 */
    --bg-main: #06101f;
    --bg-card: rgba(14, 27, 52, 0.58);
    --bg-sidebar: rgba(9, 19, 38, 0.72);
    --bg-topbar: rgba(9, 19, 38, 0.72);
    --text-primary: #eaf2ff;
    --text-secondary: #9fb3d1;
    --color-up: #ff5d6c;
    --color-down: #2fe39c;
    --color-accent: #2f7bff;
    --color-accent-soft: #6ea8ff;
    --color-gold: #fbbf24;
    --color-border: rgba(87, 132, 209, 0.22);
    --radius: 16px;
    --radius-sm: 10px;
    --shadow-card: 0 8px 24px rgba(3, 10, 28, 0.45);
    --shadow-card-hover: 0 14px 36px rgba(47, 123, 255, 0.30);
    --transition: all 0.25s ease;
}

/* ---------------------------------------------------------------------------
   重置 & 基础
   --------------------------------------------------------------------------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    /* 深蓝科技渐变背景：两层径向辉光 + 主色线性渐变 */
    background-color: var(--bg-main);
    background-image:
        radial-gradient(circle at 18% 12%, rgba(47, 123, 255, 0.18), transparent 42%),
        radial-gradient(circle at 82% 88%, rgba(41, 98, 255, 0.14), transparent 46%),
        linear-gradient(160deg, #06101f 0%, #08152b 48%, #050d1c 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
}

/* ---------------------------------------------------------------------------
   动态科技背景画布（蓝色粒子 + 金融地球网络），置于内容之下
   --------------------------------------------------------------------------- */
#techBackground {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    opacity: 0.85;
}

/* ==========================================================================
   科技装饰 · AI 芯片 HUD + 3D 立体芯片卡片
   ========================================================================== */

/* --- AI 芯片 HUD 四角框 --- */
.hud-frame {
    position: fixed;
    inset: 0;
    z-index: 40;
    pointer-events: none;
}

.hud-corner {
    position: absolute;
    width: 36px;
    height: 36px;
    border: 2px solid rgba(47, 123, 255, 0.55);
    filter: drop-shadow(0 0 6px rgba(47, 123, 255, 0.45));
}

.hud-tl { top: 14px; left: 14px; border-right: none; border-bottom: none; border-top-left-radius: 8px; }
.hud-tr { top: 14px; right: 14px; border-left: none; border-bottom: none; border-top-right-radius: 8px; }
.hud-bl { bottom: 14px; left: 14px; border-right: none; border-top: none; border-bottom-left-radius: 8px; }
.hud-br { bottom: 14px; right: 14px; border-left: none; border-top: none; border-bottom-right-radius: 8px; }

/* --- 右上角：透明 3D 立体芯片卡片 --- */
.chip-decoration {
    position: fixed;
    top: 70px;
    right: 26px;
    z-index: 6;
    width: 132px;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: chipFloat 5.5s ease-in-out infinite;
    transform-style: preserve-3d;
    perspective: 600px;
}

/* 透明 3D 立体芯片卡片 */
.chip-card {
    width: 118px;
    height: 118px;
    border-radius: 18px;
    background: linear-gradient(150deg, rgba(47, 123, 255, 0.22), rgba(8, 20, 44, 0.30));
    border: 1px solid rgba(110, 168, 255, 0.45);
    box-shadow:
        0 12px 30px rgba(3, 12, 32, 0.55),
        inset 0 1px 12px rgba(110, 168, 255, 0.30);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    transform: rotateX(12deg) rotateY(-16deg);
    transition: transform 0.4s ease;
}

.chip-svg { width: 92px; height: 92px; }

.chip-label {
    margin-top: 10px;
    font-size: 12px;
    letter-spacing: 1px;
    color: var(--color-accent-soft);
    text-shadow: 0 0 8px rgba(47, 123, 255, 0.55);
}

@keyframes chipFloat {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-10px); }
}

/* ==========================================================================
   Phosphor 图标统一样式（暗色玻璃形态）
   ========================================================================== */
/* 顶栏图标 */
.topbar-icon.ph {
    font-size: 24px;
    color: var(--color-accent);
}

/* 侧边栏标题图标 */
.sidebar-icon-title.ph {
    font-size: 22px;
    vertical-align: -3px;
    color: var(--color-accent);
}

/* 导航项图标 */
.nav-icon.ph {
    font-size: 20px;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
    color: var(--text-secondary);
    transition: var(--transition);
}

.nav-item.active .nav-icon.ph {
    color: var(--color-accent);
    filter: drop-shadow(0 0 4px rgba(47, 123, 255, 0.5));
}

.nav-item:hover .nav-icon.ph {
    color: var(--text-primary);
}

/* 页面标题图标 */
.page-title-icon.ph {
    font-size: 28px;
    vertical-align: -5px;
    margin-right: 6px;
    color: var(--color-accent);
}

/* 区块标题图标 */
.section-title-icon.ph {
    font-size: 18px;
    vertical-align: -3px;
    margin-right: 4px;
}

.section-title-icon.ph.up { color: var(--color-up); }
.section-title-icon.ph.down { color: var(--color-down); }

/* 信息栏图标 */
.info-box-icon.ph {
    font-size: 14px;
    margin-right: 4px;
    vertical-align: -2px;
    color: var(--color-accent-soft);
    opacity: 0.75;
}

/* 宏观 Tab 图标 */
.macro-tab-icon.ph {
    font-size: 16px;
    vertical-align: -3px;
    margin-right: 4px;
}

.macro-tab.active .macro-tab-icon.ph {
    color: var(--color-accent);
}

/* ==========================================================================
   玻璃拟态 & 轻阴影柔和圆角增强
   ========================================================================== */

/* 通用玻璃卡片质感 */
.metric-card,
.table-container,
.ranking-container,
.control-panel,
.info-box,
.chart-container {
    background-color: var(--bg-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--color-border);
}

/* ---------------------------------------------------------------------------
   布局
   --------------------------------------------------------------------------- */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    height: 56px;
    background-color: var(--bg-topbar);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border);
    box-shadow: 0 4px 18px rgba(3, 10, 28, 0.4);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-icon {
    font-size: 24px;
}

.topbar-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.topbar-right {
    display: flex;
    align-items: center;
}

.topbar-time {
    color: var(--text-secondary);
    font-size: 14px;
}

.main-layout {
    display: flex;
    flex: 1;
}

/* ---------------------------------------------------------------------------
   侧边栏
   --------------------------------------------------------------------------- */
.sidebar {
    width: 240px;
    background-color: var(--bg-sidebar);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-right: 1px solid var(--color-border);
    box-shadow: 4px 0 22px rgba(3, 10, 28, 0.35);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 20px 16px;
    text-align: center;
    border-bottom: 1px solid var(--color-border);
}

.sidebar-title {
    font-size: 20px;
    color: var(--color-accent);
    margin-bottom: 4px;
}

.sidebar-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--text-secondary);
    font-size: 14px;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background-color: var(--bg-card);
    color: var(--text-primary);
}

.nav-item.active {
    background-color: var(--bg-card);
    color: var(--color-accent);
    border-left-color: var(--color-accent);
    box-shadow: inset 3px 0 14px rgba(47, 123, 255, 0.25);
    text-shadow: 0 0 8px rgba(47, 123, 255, 0.4);
}

.nav-icon {
    font-size: 18px;
}

.sidebar-footer {
    padding: 16px;
}

.info-box {
    background-color: var(--bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 12px;
}

.info-box p {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.info-box p:last-child {
    margin-bottom: 0;
}

/* ---------------------------------------------------------------------------
   内容区
   --------------------------------------------------------------------------- */
.content-area {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    max-width: calc(100vw - 240px);
}

.page-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--color-border);
}

.page-title {
    font-size: 24px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ---------------------------------------------------------------------------
   区块 & 标题
   --------------------------------------------------------------------------- */
.section {
    margin-bottom: 32px;
}

.section-title {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-left: 10px;
    border-left: 3px solid var(--color-accent);
}

.section-row {
    display: flex;
    gap: 24px;
}

.section-col {
    flex: 1;
    min-width: 0;
}

/* ---------------------------------------------------------------------------
   卡片网格
   --------------------------------------------------------------------------- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.card-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.metric-card {
    background-color: var(--bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 20px;
    transition: var(--transition);
    box-shadow: var(--shadow-card);
}

.metric-card:hover {
    border-color: var(--color-accent);
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-3px);
}

.metric-card-name {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.metric-card-value {
    font-size: 28px;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.metric-card-change {
    font-size: 16px;
    font-weight: 500;
}

.metric-card-change.up {
    color: var(--color-up);
}

.metric-card-change.down {
    color: var(--color-down);
}

.metric-card-time {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 8px;
}

.metric-card-sub {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ---------------------------------------------------------------------------
   图表容器
   --------------------------------------------------------------------------- */
.chart-container {
    width: 100%;
    height: 400px;
    /* 更不透明，保证图表可读性 */
    background-color: rgba(9, 18, 36, 0.82);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 12px;
    box-shadow: var(--shadow-card);
}

.chart-large {
    height: 600px;
}

/* ---------------------------------------------------------------------------
   表格
   --------------------------------------------------------------------------- */
.table-container {
    overflow-x: auto;
    background-color: var(--bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table thead th {
    background-color: var(--bg-sidebar);
    color: var(--text-secondary);
    padding: 12px 16px;
    text-align: left;
    font-weight: 500;
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
    position: sticky;
    top: 0;
}

.data-table tbody td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--color-border);
    color: var(--text-primary);
    white-space: nowrap;
}

.data-table tbody tr:hover {
    background-color: rgba(88, 166, 255, 0.05);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.table-placeholder {
    text-align: center;
    color: var(--text-secondary);
    padding: 32px !important;
}

.text-up {
    color: var(--color-up);
}

.text-down {
    color: var(--color-down);
}

/* ---------------------------------------------------------------------------
   涨跌幅榜
   --------------------------------------------------------------------------- */
.ranking-container {
    background-color: var(--bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
}

.ranking-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--color-border);
    transition: var(--transition);
}

.ranking-item:hover {
    background-color: rgba(88, 166, 255, 0.05);
}

.ranking-item:last-child {
    border-bottom: none;
}

.ranking-rank {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    background-color: var(--bg-sidebar);
    color: var(--text-secondary);
    flex-shrink: 0;
}

.ranking-rank.top-3 {
    background-color: var(--color-gold);
    color: #000;
}

.ranking-info {
    flex: 1;
    margin: 0 12px;
    min-width: 0;
}

.ranking-name {
    font-size: 14px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ranking-code {
    font-size: 12px;
    color: var(--text-secondary);
}

.ranking-pct {
    font-size: 15px;
    font-weight: 600;
    flex-shrink: 0;
}

/* ---------------------------------------------------------------------------
   搜索栏
   --------------------------------------------------------------------------- */
.search-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.search-input {
    flex: 1;
    padding: 10px 16px;
    background-color: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    outline: none;
    transition: var(--transition);
}

.search-input:focus {
    border-color: var(--color-accent);
}

.search-input::placeholder {
    color: var(--text-secondary);
}

.search-info {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* ---------------------------------------------------------------------------
   按钮
   --------------------------------------------------------------------------- */
.btn-primary {
    padding: 10px 24px;
    background-color: var(--color-accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

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

/* ---------------------------------------------------------------------------
   控制面板
   --------------------------------------------------------------------------- */
.control-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
    background-color: var(--bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 20px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.control-action {
    justify-content: flex-end;
}

.control-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.control-input,
.control-select {
    padding: 8px 12px;
    background-color: var(--bg-main);
    color: var(--text-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    outline: none;
    transition: var(--transition);
    min-width: 140px;
}

.control-input:focus,
.control-select:focus {
    border-color: var(--color-accent);
}

.kline-meta {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* ---------------------------------------------------------------------------
   分页
   --------------------------------------------------------------------------- */
.pagination {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 16px;
}

.page-btn {
    padding: 6px 14px;
    background-color: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    transition: var(--transition);
}

.page-btn:hover {
    border-color: var(--color-accent);
}

.page-btn.active {
    background-color: var(--color-accent);
    color: #fff;
    border-color: var(--color-accent);
}

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

/* ---------------------------------------------------------------------------
   宏观 Tab
   --------------------------------------------------------------------------- */
.macro-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--color-border);
    flex-wrap: wrap;
}

.macro-tab {
    padding: 10px 20px;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.macro-tab:hover {
    color: var(--text-primary);
}

.macro-tab.active {
    color: var(--color-accent);
    border-bottom-color: var(--color-accent);
}

.macro-content {
    min-height: 400px;
}

/* ---------------------------------------------------------------------------
   加载 & 占位
   --------------------------------------------------------------------------- */
.loading-placeholder {
    padding: 40px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(14, 17, 23, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--color-border);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

.loading-text {
    color: var(--text-primary);
    font-size: 14px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ---------------------------------------------------------------------------
   Toast 提示
   --------------------------------------------------------------------------- */
.toast-container {
    position: fixed;
    top: 70px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: toastSlide 0.3s ease;
    max-width: 400px;
    word-wrap: break-word;
}

.toast.error {
    background-color: var(--color-up);
}

.toast.success {
    background-color: var(--color-down);
}

.toast.info {
    background-color: var(--color-accent);
}

@keyframes toastSlide {
    from {
        transform: translateX(120%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ---------------------------------------------------------------------------
   响应式
   --------------------------------------------------------------------------- */
@media (max-width: 1024px) {
    .card-grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .chart-large {
        height: 500px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }

    .sidebar-header,
    .sidebar-footer {
        display: none;
    }

    .nav-text {
        display: none;
    }

    .nav-item {
        justify-content: center;
        padding: 12px;
    }

    .content-area {
        max-width: calc(100vw - 60px);
        padding: 16px;
    }

    .card-grid,
    .card-grid-3 {
        grid-template-columns: 1fr;
    }

    .section-row {
        flex-direction: column;
    }

    .control-panel {
        flex-direction: column;
        align-items: stretch;
    }

    .control-input,
    .control-select {
        min-width: 100%;
    }

    .topbar-title {
        font-size: 14px;
    }

    .topbar-time {
        display: none;
    }
}

/* ---------------------------------------------------------------------------
   网站底部
   --------------------------------------------------------------------------- */
.site-footer {
    background-color: var(--bg-sidebar);
    border-top: 1px solid var(--color-border);
    padding: 20px 24px;
    text-align: center;
}

.footer-content {
    max-width: 800px;
    margin: 0 auto;
}

.footer-disclaimer {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 8px;
}

/* 备案信息：ICP 备案 + 公安备案 并排居中 */
.footer-icp {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.footer-icp a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
}

.footer-icp a:hover {
    color: var(--color-accent);
}

/* 两个备案号之间的分隔符 */
.beian-divider {
    color: var(--text-secondary);
    opacity: 0.45;
    user-select: none;
}

/* 公安备案国徽图标（原图 62x67px，等比缩放至 16px 高） */
.beian-emblem {
    height: 16px;
    width: auto;
    margin-right: 4px;
    vertical-align: -3px;
    display: inline-block;
    transition: var(--transition);
}

.footer-icp a:hover .beian-emblem {
    opacity: 0.75;
}
