/**
 * app_main_tab_v3 全局基础样式
 * 包含页面基础布局、表格通用样式、通用工具类
 */

/* 全局基础样式 */
html {
    overflow-x: scroll;
    overflow-y: auto;
    min-width: 0;
    box-sizing: border-box;
    height: 100%;
}

*, *::before, *::after {
    box-sizing: inherit;
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 10px;
    background-color: #f5f5f5;
    overflow-x: visible;
    overflow-y: visible;
    min-width: 0;
    width: auto;
    height: 100%;
}

/* 确保主要容器不创建水平滚动条，只有html/body创建 */
.container,
.tab-container,
.tab-content,
.table-container,
.content-section,
.horizontal-container {
    overflow-x: visible !important;
    overflow-y: visible;
}

.container {
    width: 100%;
    max-width: none;
    margin: 0 auto;
    background: white;
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: visible !important;
    min-width: max-content;
    display: block;
}

/* ── 手机适配(仅 ≤767px 生效，PC 端零回归)：容器不再被内容撑宽，尊重 viewport ── */
@media (max-width: 767px) {
    .container {
        min-width: auto;
        width: 100%;
        overflow-x: auto;
        padding: 8px;
    }
}


/* 表格响应式处理 - 自适应紧凑布局 */
table {
    width: auto;
    min-width: max-content;
    table-layout: auto;
    border-collapse: collapse;
    background-color: white;
    margin: 0;
}

/* 自适应列宽，确保内容完整显示 */
td, th {
    white-space: nowrap;
    padding: 4px 6px;
    text-align: center;
    border: 1px solid #ddd;
    background-color: white;
    font-size: 13px;
    width: auto;
    min-width: 0;
    max-width: none;
}

/* 表头样式 */
th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #333;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* 表格行交替背景色 */
tr:nth-child(even) {
    background-color: #f8f9fa;
}

tr:nth-child(odd) {
    background-color: white;
}

/* 表格容器滚动 */
.table-container {
    overflow-x: visible;
    overflow-y: visible;
    width: 100%;
    min-width: max-content;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: white;
}

/* 内容区域样式 */
.content-section {
    margin-bottom: 5px;
    padding: 5px;
    border: 1px solid #e0e0e0;
    background-color: #f8f9fa;
}

/* 横向排列容器 */
.horizontal-container {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    min-width: max-content;
    overflow-x: visible;
}

.horizontal-container .content-section {
    flex: none;
    margin-bottom: 0;
    flex-shrink: 0;
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 40px;
    color: #666;
    display: none; /* 默认隐藏，只有在首次加载时显示 */
}

/* 异动Tab交互控制面板 */
/* 已迁移到 hide_and_sort_btn_controls，保留此样式以兼容旧代码 */
.abn-pct-vs-index-controls {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 20px;
    margin-bottom: 15px;
}

/* 确保控制面板和表格容器在同一区域 */
#content-container-AbnPctVsIndex {
    display: flex;
    flex-direction: column;
}

/* K线预览图 - 鼠标悬停显示日K图 */
/* 用 > 直接子代选择器，避免嵌套表格中外层 td 误触发 */
td:has(> .kline-preview) {
    position: relative;
}
.kline-preview {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 100%;
    z-index: 9999;
    width: 720px;
    height: auto;
    border: 2px solid #333;
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    pointer-events: none;
}
td:has(> .kline-preview):hover > .kline-preview {
    display: block;
}
