/* ========================================= */
/* 1. 基础样式与CSS变量                       */
/* ========================================= */
* {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    white-space: nowrap;
}

:root {
    /* 基础颜色 */
    --bg-primary: #13253C;
    --bg-secondary: #0e1b2c;
    --bg-active: #224068;
    --text-color: #888888;
    --white: #d2d2d2;
    --black: #000000;
    --red: #DE292E;
    --green: #4ecdc4;
    --blue: #006eff;
    --yellow: #FFFF00;
    --gray: #929191;
    --light-gray: #888888;
    --orange: #ff7d03;
    --purple: #a002df;
    --lime: #7afa03;
    --cyan: #01bcdd;
    --dark-green: #006006;

    /* 尺寸和间距 */
    --radius: 1px;
    --radius-large: 2px;
    --fs-small: 9px;
    --fs-base: 12px;
    --pd-small: 0px 1px;
    --pd-small-2: 0px 2px;
    --pd-small-3: 0px 3px;
    --pd-large: 0px 2px;
    --mg-small: 3px;
    --mg-small-2: 2px 0;
    --mg-left: 5px;
    --h-date: 24px;

    /* 位置和偏移 */
    --base-offset: -25px;
    --buy-left: 249px;
    --sell-left: 329px;
    --net-left: 407px;
    --net-val-left: 404px;
    --amount-width: 60px;
    --total-buy-left: 239px;
    --total-sell-left: 315px;
    --total-left-adj: -2px;
    --val-margin: 20px;
}

html,
body {
    padding: 0;
    margin: 0;
    font-family: 'Microsoft YaHei', 'PingFang SC', Tahoma, Geneva, Verdana, sans-serif;
    font-size: var(--fs-base);
    background-color: var(--bg-primary);
    color: var(--text-color);
    white-space: nowrap;
}

/* 滚动条样式 */
html,
body,
.left,
.right,
.fixed-box,
#dateList,
#scrollableContent,
.modal-content {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar,
.left::-webkit-scrollbar,
.right::-webkit-scrollbar,
.fixed-box::-webkit-scrollbar,
#dateList::-webkit-scrollbar,
#scrollableContent::-webkit-scrollbar,
.modal-content::-webkit-scrollbar {
    width: 0px;
    height: 0px;
    display: none;
}

/* 基础元素样式 */
.fixed-box {
    padding: 0;
    background-color: var(--bg-primary);
    white-space: nowrap;
    color: var(--white);
    margin-top: 0;
}

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

.right a:hover {
    color: var(--white);
}

/* ========================================= */
/* 2. 布局组件                               */
/* ========================================= */
/* 容器组件 */
.container {
    position: relative;
    height: 100vh;
    overflow: hidden;
}

/* 左侧面板组件 */
.left {
    width: 60px;
    padding: 0;
    margin: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: absolute;
    left: 0;
    top: 0;
    z-index: 10;
    background-color: var(--bg-primary);
    transition: all 0.3s ease;
}

#stockNameContainer {
    flex-shrink: 0;
}

#dateList {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    list-style-type: none;
    padding: 0;
    margin: 0px 0 0 0;
    border-right: 1px solid #888888;
}

/* 右侧面板组件 */
.right {
    width: 100%;
    padding-left: 0px;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    overflow: hidden;
    transition: padding-left 0.3s ease;
}

#fixedHeader {
    flex-shrink: 0;
}

#scrollableContent {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

/* ========================================= */
/* 4. 日期选择器                             */
/* ========================================= */
/* 日期标签组件 */
.date-label {
    padding: 0 3px 0 2px;
    margin: 0;
    cursor: pointer;
    transition: all 0.1s ease;
    background-color: var(--bg-primary);
    color: var(--text-color);
    height: var(--h-date);
    line-height: var(--h-date);
    text-align: center;
}

.date-label:hover {
    background-color: var(--bg-secondary);
    color: var(--text-color);
}

.date-label.active {
    background-color: var(--bg-secondary);
    color: var(--white);
}

/* 股票名称头部 */
.stock-name-header {
    padding: 0;
    margin: 0;
    background-color: var(--bg-primary);
    color: var(--white);
    height: 26px;
    line-height: 25px;
    font-weight: bold;
    text-align: center;
    border-bottom: 1px solid var(--text-color);
}

/* ========================================= */
/* 5. 状态控制                               */
/* ========================================= */
/* 左侧面板显示状态 */
.left-panel--visible {
    display: flex !important;
}

.left-panel--hidden {
    display: none !important;
}

/* 右侧面板边距状态 */
.right-panel--with-left {
    padding-left: 60px !important;
}

.right-panel--without-left {
    padding-left: 0 !important;
}

/* 上下文菜单显示状态 */
.context-menu--visible {
    display: block !important;
}

.context-menu--hidden {
    display: none !important;
}

/* 弹出层显示状态 */
.overlay--visible {
    display: block !important;
}

.overlay--hidden {
    display: none !important;
}

/* ========================================= */
/* 6. 弹窗与模态框                           */
/* ========================================= */
/* 同花顺弹窗 */
#thsPopupOverlay {
    display: none;
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: #13253C;
    z-index: 100;
}

#thsPopup {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    margin: 0;
    width: 650px;
    height: 100vh;
    transform: scale(0.6);
    transform-origin: top left;
}

#thsIframe {
    width: 100%;
    height: 100%;
    border: none;
    background-color: #fff;
    overflow: hidden;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 101;
    padding-top: 35px;
    box-sizing: border-box;
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
}

/* Hide scrollbar for Chrome, Safari and Opera */
#thsIframe::-webkit-scrollbar {
    display: none;
}

/* 通达信弹窗 */
#tdxPopupOverlay {
    display: none;
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9998;
}

#tdxPopup {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    margin: 0;
    width: 650px;
    height: 600px;
    background-color: #031b2e;
    border-radius: 6px;
    overflow: hidden;
    transform: scale(0.85);
    transform-origin: top left;
}

#tdxIframe {
    width: 100%;
    height: 100%;
    border: none;
    background-color: #fff;
}

/* 模态框内容 */
.modal-content,
.modal-content * {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* ========================================= */
/* 7. 右键菜单                               */
/* ========================================= */
.custom-context-menu {
    position: fixed;
    color: rgb(255, 255, 255);
    z-index: 9999;
    font-size: 12px;
    display: none;
    background: transparent;
    border: 0px solid yellow;
    border-radius: 2px;
    padding: 2px 4px;
    margin: 0;
}

.context-menu-item {
    cursor: pointer;
    padding: 0;
    margin: 0;
    background: transparent;
    border: none;
    color: yellow;
}

/* ========================================= */
/* 9. 工具类                                */
/* ========================================= */
/* 关闭按钮样式 */
#closeTHSPopup {
    background: #f03036 !important;
    width: 100% !important;
}

#closeTHSPopup {
    position: absolute;
    right: 11px;
    top: 0;
    z-index: 102;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    height: 55px;
    text-align: center;
    padding: 0 10px;
    box-sizing: border-box;
    outline: none;
    text-indent: -10px;
}

/* ========================================= */
/* 10. 日记功能                               */
/* ========================================= */
.diary-container {
    position: relative;
    margin: 10px 10px 0 0;
    padding: 5px;
    background-color: var(--bg-secondary);
    border-radius: var(--radius-large);
}

/* 全局日记窗口样式 */
.diary-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #1c3352;
    z-index: 1000;
    display: flex;
    align-items: flex-start;
}

.diary-container.global {
    background-color: var(--bg-primary);
    border-radius: var(--radius-large);
    width: 100%;
    max-width: 100%;
    max-height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    margin: 0;
}

.diary-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 0;
    background-color: transparent;
}

.diary-close {
    background-color: transparent;
    color: var(--white);
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    margin: 0 15px 0 0;
    width: auto;
    height: auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

.diary-window {
    padding: 15px 15px 0 10px;
    background-color: var(--bg-primary);
    flex: 1;
    overflow-y: auto;
    scrollbar-width: none;
    /* Firefox */
}

.diary-window::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari, Edge */
}

.diary-input {
    width: 100%;
    min-height: 100px;
    padding: 10px;
    background-color: var(--bg-secondary);
    color: var(--white);
    border: 1px solid var(--bg-active);
    border-radius: var(--radius-large);
    font-size: var(--fs-base);
    resize: vertical;
    box-sizing: border-box;
    margin-bottom: 0;
}

.diary-actions {
    position: absolute;
    top: 4px;
    left: 10px;
    display: flex;
    justify-content: flex-start;
    margin-top: 0;
}

.diary-export,
.diary-import {
    padding: 5px 10px;
    background-color: var(--bg-active);
    color: var(--white);
    border: none;
    border-radius: var(--radius-large);
    font-size: var(--fs-base);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.diary-import {
    margin-left: 5px;
}

.diary-export:hover,
.diary-import:hover {
    background-color: var(--blue);
}

#closeTdxPopup {
    position: absolute;
    right: 15px;
    top: 10px;
    z-index: 102;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
}