/* =======================================================================
 * Lilith Financial Dashboard - 样式文件 (style.css) v4
 * ======================================================================= */

/* (此处省略 :root, body.light-mode, body.invert-colors, 全局 body 样式，与之前版本相同) */
:root {
    --bg-color: #121212;
    --card-bg-color: #1e1e1e;
    --text-color: #e0e0e0;
    --text-color-secondary: #888;
    --border-color: #333;
    --header-bg-color: #1e1e1e;
    --shadow-color: rgba(0, 0, 0, 0.2);
    --color-positive: #4caf50;
    --color-negative: #f44336;
    --color-zero: #9e9e9e;
}
body.light-mode {
    --bg-color: #f0f2f5;
    --card-bg-color: #ffffff;
    --text-color: #333333;
    --text-color-secondary: #666;
    --border-color: #e0e0e0;
    --header-bg-color: #ffffff;
    --shadow-color: rgba(0, 0, 0, 0.1);
}
body.invert-colors {
    --color-positive: #f44336;
    --color-negative: #4caf50;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding-top: 60px;
    padding-bottom: 120px;
    transition: background-color 0.3s, color 0.3s;
}


/* 顶部导航栏 */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background-color: var(--header-bg-color);
    box-shadow: 0 2px 5px var(--shadow-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 25px;
    box-sizing: border-box;
    z-index: 1000;
}
.header-left { display: flex; align-items: center; gap: 50px; }
.header-right {
    display: flex;
    align-items: center;
    gap: 15px; /* 在“功能按钮组”和“汉堡按钮”之间增加15px的间距 */
}
.header .logo { font-size: 1.5em; font-weight: 600; }

/* 新增：导航菜单 */
.nav-menu a {
    color: var(--text-color-secondary);
    text-decoration: none;
    font-size: 1em;
    padding: 10px 15px;
    border-radius: 5px;
    transition: background-color 0.3s, color 0.3s;
}
.nav-menu a.active { color: var(--text-color); font-weight: 500; }
.nav-menu a:hover { background-color: var(--bg-color); color: var(--text-color); }

.header .controls { display: flex; align-items: center; gap: 15px; }
/* (此处省略 .icon-button, .lang-menu 等样式，与之前版本相同) */
.header .icon-button { background: none; border: none; cursor: pointer; padding: 5px; display: flex; align-items: center; justify-content: center; }
.header .icon-button svg { width: 24px; height: 24px; fill: var(--text-color-secondary); transition: fill 0.3s; }
.header .icon-button:hover svg { fill: var(--text-color); }
.lang-menu { position: relative; }
.lang-dropdown { display: none; position: absolute; top: 40px; right: 0; background-color: var(--card-bg-color); border-radius: 5px; box-shadow: 0 4px 8px var(--shadow-color); overflow: hidden; z-index: 1001; }
.lang-dropdown.show { display: block; }
.lang-dropdown button { display: block; width: 100%; padding: 10px 20px; background: none; border: none; color: var(--text-color); text-align: left; cursor: pointer; white-space: nowrap;}
.lang-dropdown button:hover { background-color: var(--bg-color); }


/* (此处省略 .dashboard-container, .group-header, 卡片样式, 颜色样式, .footer 样式，与之前版本相同) */
.dashboard-container { display: flex; flex-wrap: wrap; gap: 20px; padding: 20px; justify-content: center; }
.group-header { width: 100%; text-align: center; margin-top: 30px; margin-bottom: 10px; font-size: 1.8em; font-weight: 300; letter-spacing: 1px; color: var(--text-color-secondary); }
.quote-card { cursor: pointer; background-color: var(--card-bg-color); border-radius: 8px; padding: 15px 20px; width: 300px; box-shadow: 0 4px 8px var(--shadow-color); border-left: 5px solid; transition: all 0.3s ease; }
.quote-card:hover { transform: translateY(-5px); box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3); }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; border-bottom: 1px solid var(--border-color); padding-bottom: 10px; }
.card-header .name { font-size: 1.2em; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-header .short-name { font-size: 0.9em; color: var(--text-color-secondary); font-weight: bold; }
.card-body .price { font-size: 2.2em; font-weight: 700; text-align: center; margin-bottom: 5px; }
.card-body .change { font-size: 1.2em; font-weight: 500; text-align: center; }
.positive { color: var(--color-positive); }
.quote-card.positive-border { border-left-color: var(--color-positive); }
.negative { color: var(--color-negative); }
.quote-card.negative-border { border-left-color: var(--color-negative); }
.zero { color: var(--text-color-secondary); }
.quote-card.zero-border { border-left-color: var(--text-color-secondary); }
/* --- 新的全局页脚样式 --- */
.footer {
    /* 保留 style.css 原有的 .footer 属性 */
    position: fixed; 
    bottom: 0; 
    left: 0; 
    width: 100%; 
    height: 120px; 
    background-color: var(--header-bg-color); 
    box-shadow: 0 -2px 5px var(--shadow-color); 
    display: flex; 
    box-sizing: border-box; 
    color: var(--text-color-secondary);

    /* 应用 help.php 中的新属性 */
    justify-content: space-between; /* 替换 'center' */
    padding: 20px 25px;             /* 替换 '20px' */
    align-items: center;
}

.footer-left {
    text-align: left;
}

.footer-left p {
    margin: 5px 0;
}
.footer-left .footer-line1 {
    font-size: 0.9em;
    font-weight: 500;
    color: var(--text-color);
}
.footer-left .footer-line2 {
    font-size: 0.8em;
    color: var(--text-color-secondary);
}

.footer-right {
    display: flex;
    gap: 20px;
}
.footer-right .qr-code {
    text-align: center;
    color: var(--text-color-secondary);
}
.footer-right .qr-code img {
    display: block;
    width: 60px; 
    height: 60px;
    border-radius: 4px;
    margin-bottom: 5px;

}
.footer-right .qr-code span {
    font-size: 0.75em;
}
/* 新增：重置页脚二维码链接的样式 */
.footer-right .qr-code a {
    color: inherit; /* 让链接继承父级 (.qr-code) 设置的灰色文字 */
    text-decoration: none; /* 去掉下划线 */
}

/* (可选) 鼠标悬停在链接上时，给文字加下划线作为提示 */
.footer-right .qr-code a:hover span {
    text-decoration: underline;
}


/* --- 新增：详情弹窗样式 --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: none; /* 默认隐藏 */
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-overlay.show {
    display: flex; /* 显示 */
}

.modal-content {
    background-color: var(--card-bg-color);
    border-radius: 10px;
    padding: 25px;
    width: 90%;
    max-width: 1000px;
    height: 90%;
    max-height: 700px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
    margin-bottom: 15px;
}
.modal-header h2 { margin: 0; font-size: 1.8em; }
.modal-header .close-button { font-size: 2em; cursor: pointer; background: none; border: none; color: var(--text-color-secondary); }

.modal-body {
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* 占据剩余空间 */
    overflow: hidden;
}

.modal-quote-details {
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    background-color: var(--bg-color);
    border-radius: 5px;
    margin-bottom: 15px;
    text-align: center;
}
.modal-quote-details div { flex: 1; }
.modal-quote-details span { display: block; }
.detail-label { font-size: 0.8em; color: var(--text-color-secondary); }
.detail-value { font-size: 1.1em; font-weight: 500; }

.chart-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
}
.chart-controls button {
    background-color: var(--bg-color);
    color: var(--text-color-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 5px 15px;
    cursor: pointer;
    transition: all 0.2s;
}
.chart-controls button:hover {
    color: var(--text-color);
    border-color: var(--text-color);
}
.chart-controls button.active {
    background-color: var(--color-positive);
    border-color: var(--color-positive);
    color: #fff;
    font-weight: bold;
}

#chart-container {
    flex-grow: 1; /* 占据所有剩余的垂直空间 */
    width: 100%;
}


/* --- 新增：汉堡菜单按钮样式 --- */
.hamburger {
    display: none; /* 默认（电脑上）隐藏 */
    width: 30px;
    height: 24px;
    position: relative;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}
.hamburger-line {
    display: block;
    position: absolute;
    width: 100%;
    height: 3px;
    background-color: var(--text-color);
    border-radius: 3px;
    transition: all 0.3s ease-in-out;
}
.hamburger-line:nth-child(1) { top: 0; }
.hamburger-line:nth-child(2) { top: 50%; transform: translateY(-50%); }
.hamburger-line:nth-child(3) { bottom: 0; }

/* 汉堡按钮激活（点击后）变成 "X" 的动画 */
.hamburger.is-active .hamburger-line:nth-child(1) {
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
}
.hamburger.is-active .hamburger-line:nth-child(2) {
    opacity: 0;
}
.hamburger.is-active .hamburger-line:nth-child(3) {
    bottom: 50%;
    transform: translateY(50%) rotate(-45deg);
}

@media (max-width: 768px) {
	body {
        /*
         * 手机端的页脚(footer)是堆叠布局(height: auto)，
         * 它的实际高度大约有 160px ~ 180px。
         * 我们必须重写PC端的 padding-bottom: 120px，
         * 留出足够空间，防止正文被页脚遮挡。
        */
        padding-bottom: 180px; /* <--- 关键修复 */
    }
    .header {
        padding: 0 15px;
    }
    .header .logo {
        font-size: 1.2em;
    }

    /* --- 核心修改：将导航变为下拉菜单 --- */
    .nav-menu {
        position: absolute;
        top: 60px; /* 紧贴在header下方 */
        left: 0;
        width: 100%;
        background-color: var(--header-bg-color);
        box-shadow: 0 5px 10px var(--shadow-color);
        
        display: flex;
        flex-direction: column; /* 链接垂直排列 */
        align-items: center;

        max-height: 0; /* 默认高度为0，实现隐藏 */
        overflow: hidden;
        transition: max-height 0.4s ease-in-out;
    }

    /* 当菜单被激活时，展开高度 */
    .nav-menu.is-open {
        max-height: 300px; /* 设置一个足够大的高度 */
    }

    .nav-menu a {
        padding: 15px 0;
        width: 100%;
        text-align: center;
        border-bottom: 1px solid var(--border-color);
    }
    .nav-menu a:last-child {
        border-bottom: none;
    }

    /* 显示汉堡按钮 */
    .hamburger {
        display: block;
    }

    .quote-card {
        width: 100%;
        box-sizing: border-box;
    }
    .modal-content {
        padding: 15px;
    }
	/* --- 手机端页脚样式 --- */
    .footer {
        padding: 15px;
        flex-direction: column; /* 垂直堆叠 */
        gap: 15px;
        height: auto; /* 自动高度 */
        padding-bottom: 20px; 
    }
    .footer-left {
        text-align: center;
        order: 2; /* 文字在下 */
    }
    .footer-right {
        order: 1; /* 二维码在上 */
        gap: 30px;
    }

    /* 手机端 "很小" 的字体 */
    .footer-left .footer-line1 {
        font-size: 0.8em;
    }
    .footer-left .footer-line2 {
        font-size: 0.7em;
    }
    .footer-right .qr-code img {
        width: 50px;
        height: 50px;
    }
    .footer-right .qr-code span {
        font-size: 0.7em;
    }
}

/* --- 修正：弹窗主报价区域样式 (v2) --- */
.modal-primary-quote {
    text-align: center;
    margin-bottom: 20px;

    /* 新增：使用 Flexbox 实现水平布局 */
    display: flex;
    justify-content: center;  /* 水平居中 */
    align-items: baseline;    /* 垂直方向按文字基线对齐，看起来最专业 */
    gap: 20px;                /* 元素之间的间距 */
    flex-wrap: wrap;          /* 在极窄屏幕上(如果需要)允许换行 */
}

.modal-primary-quote .price {
    font-size: 2.4em;   /* 缩小字体 */
    font-weight: 700;
    margin: 0;          /* 移除垂直 margin */
}

.modal-primary-quote .change {
    font-size: 1.2em;   /* 缩小字体 */
    font-weight: 500;
    margin: 0;
}

.modal-primary-quote .short-name {
    font-size: 1em;
    color: var(--text-color-secondary);
    font-weight: bold;
    margin: 0;
}

/* --- 新增：弹窗内自动刷新开关样式 --- */
.modal-header-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}
.modal-auto-refresh {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8em;
    color: var(--text-color-secondary);
}
/* 开关按钮的纯CSS实现 */
.switch { position: relative; display: inline-block; width: 34px; height: 20px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; }
.slider:before { position: absolute; content: ""; height: 12px; width: 12px; left: 4px; bottom: 4px; background-color: white; transition: .4s; }
input:checked + .slider { background-color: var(--color-positive); }
input:checked + .slider:before { transform: translateX(14px); }
.slider.round { border-radius: 20px; }
.slider.round:before { border-radius: 50%; }

/* --- 新增：图表包裹容器与加载更多按钮样式 --- */

.chart-wrapper {
    position: relative; /* 关键：为“加载更多”按钮的绝对定位提供父级基准 */
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-height: 300px; /* 确保图表容器有最小高度 */
}

.load-more-button {
    position: absolute;
    left: 10px;
    top: 10px;
    z-index: 10; /* 确保按钮在图表上方 */
    background-color: rgba(128, 128, 128, 0.5);
    color: white;
    border: 1px solid #fff;
    border-radius: 5px;
    padding: 5px 10px;
    cursor: pointer;
    display: none; /* 默认隐藏，我们将在JS中控制其显示 */
}

.load-more-button:hover {
    background-color: rgba(128, 128, 128, 0.8);
}

/* =======================================================================
 * Analysis Card Styles (for analysis.php)
 * ======================================================================= */

.analysis-card {
    background-color: var(--card-bg-color);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 10px var(--shadow-color);
    border-left: 5px solid; /* 颜色由 positive-border/negative-border 控制 */
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: transform 0.2s;
}

.analysis-card:hover {
    transform: translateY(-3px);
}

.ana-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.ana-symbol {
    font-size: 1.4em;
    font-weight: bold;
    color: var(--text-color);
}

.ana-time {
    font-size: 0.9em;
    color: var(--text-color-secondary);
}

.ana-verdict {
    font-size: 1.5em;
    text-align: center;
    padding: 5px 0;
}

.ana-score {
    font-size: 0.6em;
    opacity: 0.8;
    font-weight: normal;
}

.ana-price-row {
    text-align: center;
    font-size: 1.1em;
}
.ana-label { color: var(--text-color-secondary); }
.ana-val { font-weight: bold; }

/* 策略网格 (Entry/TP/SL) */
.ana-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    background-color: var(--bg-color);
    padding: 10px;
    border-radius: 8px;
    margin: 5px 0;
}

.ana-box {
    text-align: center;
}

.ana-label-sm {
    font-size: 0.8em;
    color: var(--text-color-secondary);
    margin-bottom: 4px;
}

.ana-val-sm {
    font-size: 0.95em;
    font-weight: 600;
    word-break: break-word; /* 防止 entry text 太长 */
}

.ana-reason {
    font-size: 0.9em;
    line-height: 1.5;
    color: var(--text-color-secondary);
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
}
.ana-reason strong {
    color: var(--text-color);
}