/*
 * File: static/css/style.css
 * Description: QTBOT 完整样式表 (已修复 Tab、指标位置、和自选股布局冲突)
 */

/* ==================== 0. 全局设置 ==================== */
html, body { 
    height: 100%; margin: 0; padding: 0; 
    background-color: #121212; color: #e0e0e0; 
    font-family: "Microsoft YaHei", sans-serif; 
    overflow: hidden; user-select: none;
}

#app-container { 
    display: flex; height: 100vh; flex-direction: column; 
}

/* ==================== 1. 顶部栏 ==================== */
#top-bar {
    height: 48px; background-color: #2a2a2a; border-bottom: 1px solid #333; 
    display: flex; align-items: center; padding: 0 15px; 
    flex-shrink: 0; justify-content: space-between;
}
.bar-left, .bar-right { display: flex; align-items: center; gap: 15px; }
.logo { font-weight: bold; color: #2962ff; font-size: 18px; margin-right: 10px; }
.divider { width: 1px; height: 20px; background: #444; }

/* File: static/css/style.css (追加/修改部分) */

/* --- 1. 修改顶部栏信息区 (替代原来的 Tab) --- */
#stock-info-bar {
    display: flex;
    align-items: baseline;
    margin-left: 15px;
}

#info-ticker {
    font-size: 18px;
    font-weight: bold;
    color: #fff;
    margin-right: 10px;
}

#info-price {
    font-size: 20px;
    font-weight: bold;
    font-family: 'Consolas', 'Monaco', monospace; /* 数字等宽字体 */
}

/* 价格颜色 */
.price-up { color: #00da3c; }   /* 涨 - 绿 */
.price-down { color: #ec0000; } /* 跌 - 红 */
.price-neutral { color: #aaa; } /* 平 - 灰 */


/* --- 2. Toast 提示框样式 (替代 Alert) --- */
#toast-container {
    position: fixed;
    top: 60px; /* 避开顶部栏 */
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none; /* 让鼠标事件穿透容器 */
}

.toast {
    background: rgba(30, 30, 30, 0.9);
    color: #fff;
    padding: 10px 20px;
    border-radius: 4px;
    border: 1px solid #444;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    font-size: 14px;
    opacity: 0;
    transform: translateY(-20px);
    animation: toastIn 0.3s forwards;
    pointer-events: auto; /* 提示框本身可以交互 */
    display: flex;
    align-items: center;
}

/* 不同类型的 Toast */
.toast.success { border-left: 4px solid #00da3c; }
.toast.error { border-left: 4px solid #ff5252; }
.toast.info { border-left: 4px solid #2962ff; }

@keyframes toastIn {
    to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
    to { opacity: 0; transform: translateY(-20px); }
}

/* 删除 Tab 相关样式 (可选，保持 CSS 整洁) */
.stock-btn:first-child { border-top-left-radius: 4px; border-bottom-left-radius: 4px; }
.stock-btn:last-child { border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-right: none; }
.stock-btn:hover { background: #444; color: #fff; }
.stock-btn.active { 
    background: #1e1e1e; color: #fff; font-weight: bold;
    box-shadow: inset 0 -2px 0 #2962ff; 
}
.tab-close { margin-left: 8px; color: #888; font-size: 14px; padding: 0 3px; border-radius: 50%; }
.tab-close:hover { background: #555; color: #fff; }

/* 右侧按钮 */
.nav-btn, .save-btn {
    padding: 6px 12px; font-size: 13px; cursor: pointer; border-radius: 4px; border: 1px solid #333;
    background: #2c2c2c; color: #aaa; transition: 0.2s;
}
.nav-btn:hover { background: #383838; color: #fff; }
.save-btn { background: #2e7d32; color: white; border: none; font-weight: bold; }
.save-btn:hover { background: #388e3c; }


/* ==================== 2. 主体布局 ==================== */
#main-content {
    display: grid; 
    grid-template-columns: 52px 1fr 320px; 
    flex-grow: 1; overflow: hidden; 
}

/* 左侧工具栏 */
#toolbar {
    grid-column: 1; background: #1e1e1e; border-right: 1px solid #333; 
    display: flex; flex-direction: column; align-items: center; padding-top: 15px;
}
.tool-button { 
    width: 36px; height: 36px; margin-bottom: 10px; display: flex; 
    justify-content: center; align-items: center; border-radius: 4px; 
    color: #aaa; font-size: 16px; font-weight: bold; cursor: pointer; transition: 0.2s;
    user-select: none;
}
.tool-button:hover { background: #444; color: #fff; }
.tool-button.active { background: #2962ff; color: #fff; }
.tool-sep { width: 30px; height: 1px; background: #444; margin: 5px 0 10px; }
.clear-btn { color: #ef5350; margin-top: auto; margin-bottom: 20px; }

/* 中间图表区 */
#chart-wrapper {
    grid-column: 2; position: relative;
    background: #121212; display: flex; flex-direction: column;
}
#chart-dom { flex-grow: 1; width: 100%; min-height: 0; }

/* 指标控制区 (底部) */
#indicator-controls {
    height: 36px; background: #1a1a1a; border-top: 1px solid #333; 
    display: flex; align-items: center; padding: 0 15px; flex-shrink: 0;
}
.indicator-group { display: flex; gap: 15px; }
.indicator-btn {
    font-size: 12px; padding: 4px 10px; cursor: pointer; color: #888; border-radius: 3px;
    border: 1px solid transparent;
}
.indicator-btn:hover { color: #fff; background: #333; }
.indicator-btn.active { color: #2962ff; font-weight: bold; background: #1e1e1e; border-color: #333; }

/* 加载条 */
#loader {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(18,18,18,0.8); z-index: 999;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
}
#loader.hidden { display: none !important; }
.loading-text { margin-top: 10px; color: #2962ff; font-size: 14px; }

/* ==================== 3. 右侧边栏/自选股/搜索样式 ==================== */
#right-sidebar {
    grid-column: 3; background: #1e1e1e; border-left: 1px solid #333;
    display: flex; flex-direction: column; padding: 10px; gap: 10px; overflow-y: auto;
}
.sidebar-panel {
    background: #2a2a2a; border: 1px solid #333; border-radius: 4px; padding: 10px; flex-shrink: 0;
}
.sidebar-panel h4 { 
    margin: 0 0 10px 0; color: #fff; font-size: 14px; 
    border-bottom: 1px solid #333; padding-bottom: 5px; 
    display: flex; justify-content: space-between; align-items: center;
}
.icon-btn { cursor: pointer; font-size: 18px; color: #2962ff; font-weight: bold; padding: 0 5px; }
.icon-btn:hover { color: #fff; }

#watchlist-panel { flex-grow: 1; overflow-y: auto; }
#strategies-panel { flex-grow: 1; overflow-y: auto; }

/* 列表容器：确保 UL 元素干净 */
#watchlist-panel #watchlist-ul {
    list-style: none; /* 必须清除，防止列表点干扰 */
    padding: 0;
    margin: 0;
    width: 100%; /* 确保 UL 占据面板全部宽度 */
}

/* 列表项 Layout and Base Style (最关键的 Flex 布局和清除冲突) */
.watchlist-item {
    display: flex; /* 关键：强制 Flex 布局 */
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    width: 100%;
    
    /* 基础样式 */
    padding: 5px 10px; 
    color: #aaa; 
    border-bottom: 1px solid #333; 
    font-size: 13px; 
    transition: background-color 0.2s;
}

.watchlist-item:hover {
    background-color: #222; 
}

.watchlist-item.active {
    background-color: #2962ff; /* 选中高亮 */
    color: #fff;
    font-weight: bold;
}

.wl-remove {
    color: #666;
    font-size: 14px;
    padding: 0 5px; 
    margin-left: 10px;
    border-radius: 3px;
    transition: color 0.2s, background-color 0.2s;
}
.wl-remove:hover {
    color: #fff;
    background-color: #888;
}

/* 搜索模态框样式 */
.modal {
    position: fixed; 
    z-index: 1000; 
    left: 0; top: 0;
    width: 100%; height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
}
.modal.hidden { display: none; }
.modal-content {
    background-color: #1e1e1e;
    padding: 20px;
    border: 1px solid #333;
    border-radius: 8px;
    position: relative;
}
.close-modal {
    color: #aaa; font-size: 28px; font-weight: bold;
    position: absolute; top: 10px; right: 15px;
    cursor: pointer;
}
.close-modal:hover, .close-modal:focus { color: #fff; text-decoration: none; cursor: pointer; }

/* 搜索结果列表项 */
.stock-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 10px; border-bottom: 1px solid #2a2a2a; cursor: pointer; transition: 0.2s;
}
.stock-item:hover { background-color: #333; }
.stock-info { display: flex; flex-direction: column; }
.stock-ticker { font-weight: bold; color: #fff; font-size: 14px; }
.stock-name { font-size: 12px; color: #888; margin-top: 2px; }
.btn-add {
    background: #2962ff; color: #fff; border: none; border-radius: 3px;
    padding: 2px 8px; font-size: 12px; cursor: pointer;
}
.btn-add:hover { background: #1e4bd1; }
.btn-add.added { background: #333; color: #666; cursor: default; }
.stock-item-placeholder { padding: 20px; text-align: center; color: #555; font-size: 13px; }

/* File: static/css/style.css (追加样式) */

/* 周期选择器样式 */
.nav-select {
    background-color: #2c2c2c;
    color: #e0e0e0;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 2px 8px;
    margin-left: 15px;
    font-size: 13px;
    cursor: pointer;
    outline: none;
    height: 28px;
}

.nav-select:hover {
    background-color: #383838;
    border-color: #555;
}

.nav-select:focus {
    border-color: #2962ff;
}


/*登录框*/

/* File: static/css/style.css (追加到末尾) */

/* ==================== 4. 登录/注册弹窗样式 (适配 auth.js) ==================== */
.auth-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7); /* 深色半透明背景 */
    z-index: 9999;
    display: none; /* 默认隐藏，由 JS 控制显示 */
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
}

/* JS 添加 .show 类时显示 */
.auth-overlay.show {
    opacity: 1;
}

.auth-box {
    background: #2c2c2c;
    border: 1px solid #444;
    padding: 30px;
    border-radius: 8px;
    width: 360px;
    position: relative;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    color: #e0e0e0;
}

.auth-close {
    position: absolute;
    top: 10px; right: 15px;
    font-size: 28px;
    line-height: 20px;
    cursor: pointer;
    color: #888;
    transition: color 0.2s;
}
.auth-close:hover { color: #fff; }

.auth-title {
    font-size: 20px;
    margin-bottom: 25px;
    text-align: center;
    font-weight: bold;
    color: #fff;
    letter-spacing: 1px;
}

.auth-error {
    background: rgba(255, 82, 82, 0.1);
    border-left: 3px solid #ff5252;
    color: #ff5252;
    padding: 8px 12px;
    margin-bottom: 15px;
    font-size: 13px;
    display: none;
}

.form-group { margin-bottom: 20px; }

.form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    color: #aaa;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    background: #1e1e1e;
    border: 1px solid #444;
    border-radius: 4px;
    color: #fff;
    font-size: 14px;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s;
}

.form-input:focus {
    border-color: #2962ff;
}

.submit-btn {
    width: 100%;
    background: #2962ff;
    color: white;
    padding: 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 15px;
    font-weight: bold;
    transition: background 0.2s;
}
.submit-btn:hover { background: #1e4bd1; }
.submit-btn:disabled { background: #444; cursor: not-allowed; color: #888; }

.auth-switch {
    margin-top: 20px;
    text-align: center;
    font-size: 13px;
    color: #888;
}

.auth-switch span {
    color: #2962ff;
    cursor: pointer;
    margin-left: 5px;
}
.auth-switch span:hover { text-decoration: underline; }