/* ========== 第一层：CSS变量定义（基础变量） ========== */
:root {
    --font-size: 10px;
    --font-size-small: 9px;
    --font-size-modal-close: 14px;

    --col-time-width: 40px;
    --col-name-width: 60px;
    --col-tag-width: 60px;

    --color-positive: #D22222;
    --color-limit-down: #006006;
    --color-limit-down-text: #52ff52;
    --color-link: #01bcdd;
    --color-white: #FFF;
    --color-black: #000;
    --color-error: #FF8888;
    --color-purple: #8701e6;
    --color-pink: #FF03CB;
    --color-orange-export: #ff9900;
    --color-warning: yellow;
    --color-blue: #006eff;
    --color-scrollbar: #555555;
    --border-color: #333;

    --bg-body: #000000;
    --bg-primary: #1e232d;
    --bg-primary-dark: #0e1b2c;
    --bg-hover: #1a1a1a;
    --bg-selected: #1e3a5f;
    --text-primary: #dddddd;
    --text-gray: #dddddd;
    --text-light-gray: #c8c8c8;
    --text-link: #e0e0e0;
    --color-negative: #4eeeee;
    --color-refresh: #FFFF00;
    --color-gray-medium: #555555;
    --color-gray-light: #888888;
    --color-orange: #ff9800;
    --color-modal-bg: #191d25;
    --shadow-modal: rgba(0, 0, 0, 0.8);
    --header-bg-color: #0e1b2c;
    --color-two-board: #ffd900;
}

body.dark-theme {
    --bg-body: #000000;
    --bg-primary: #1e232d;
    --bg-primary-dark: #0e1b2c;
    --bg-hover: #1a1a1a;
    --bg-selected: #1e3a5f;
    --text-primary: #dddddd;
    --text-gray: #dddddd;
    --text-light-gray: #c8c8c8;
    --text-link: #e0e0e0;
    --color-negative: #4eeeee;
    --color-refresh: #FFFF00;
    --color-gray-medium: #555555;
    --color-gray-light: #888888;
    --color-orange: #ff9800;
    --color-modal-bg: #191d25;
    --shadow-modal: rgba(0, 0, 0, 0.8);
    --header-bg-color: #0e1b2c;
    --color-two-board: #ffd900;
}

body.light-theme {
    --bg-body: #ffffff;
    --bg-primary: #ffffff;
    --bg-primary-dark: #f5f7f9;
    --bg-hover: #999;
    --bg-selected: #e6f4ff;
    --text-primary: #1a1d23;
    --text-gray: #1a1d23;
    --text-light-gray: #64748b;
    --text-link: #0066ff;
    --color-negative: #008a00;
    --color-refresh: #0066ff;
    --color-gray-medium: #64748b;
    --color-gray-light: #94a3b8;
    --color-orange: #ed8936;
    --color-modal-bg: #ffffff;
    --shadow-modal: rgba(0, 0, 0, 0.15);
    --header-bg-color: #999999;
    --color-two-board: #0066ff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scrollbar-width: none;
}

::-webkit-scrollbar {
    width: 0;
    height: 0;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    font-size: var(--font-size);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.stock-monitor {
    width: 100%;
    background-color: var(--bg-primary);
    height: 100vh;
    display: flex;
    flex-direction: column;
    user-select: none;
    cursor: default;
}

.stock-container.dragging {
    cursor: grabbing;
    user-select: none;
}

.stock-container.dragging .stock-item {
    cursor: grabbing;
}

.stock-item {
    display: flex;
    align-items: center;
    padding: 1px 2px;
    height: 20px;
    line-height: 18px;
    cursor: default;
    background-color: var(--bg-primary);
    user-select: none;
}

.stock-item:hover {
    background-color: var(--bg-hover);
}

.loading-indicator {
    text-align: center;
    padding: 20px;
    color: var(--text-gray);
    font-size: var(--font-size-small);
}

.time-column {
    width: var(--col-time-width);
    flex-shrink: 0;
    text-align: left;
}

.name-column {
    width: var(--col-name-width);
    flex-shrink: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-left: 2px;
}

.tag-column {
    width: var(--col-tag-width);
    flex-shrink: 0;
    text-align: center;
}

.plate-column {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    text-align: left;
    padding: 0 3px;
}

.table-header {
    display: flex;
    align-items: center;
    padding: 2px 2px;
    line-height: 1.15;
    background-color: var(--header-bg-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.table-header-cell {
    display: flex;
    align-items: center;
    color: var(--text-gray);
    font-size: 12px;
}

.table-header .tag-column {
    padding-left: 20px;
}

.scrollable {
    scrollbar-width: thin;
    scrollbar-color: var(--color-scrollbar) var(--border-color);
    -ms-overflow-style: none;
}

.scrollable::-webkit-scrollbar {
    width: 3px !important;
    height: 3px !important;
    display: block !important;
}

.scrollable::-webkit-scrollbar-vertical {
    display: block !important;
}

.scrollable::-webkit-scrollbar:horizontal {
    display: block;
}

.scrollable::-webkit-scrollbar-thumb {
    border-radius: 10px;
    background: var(--color-scrollbar) !important;
}

.scrollable::-webkit-scrollbar-thumb:hover {
    background: var(--color-orange-export) !important;
}

.scrollable.dragging::-webkit-scrollbar-thumb {
    background: var(--color-orange-export) !important;
}

.scrollable::-webkit-scrollbar-track {
    background: var(--border-color) !important;
}

.stock-container {
    width: 100%;
    height: calc(100vh - 44px);
    overflow-y: auto;
    overflow-x: auto;
}

.control-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 2px 8px;
    background-color: var(--bg-primary);
    height: 22px;
}

.control-nav {
    display: flex;
    gap: 10px;
}

.control-btn {
    color: var(--color-gray-light);
    font-size: 12px;
    cursor: pointer;
    transition: color 0.2s ease;
    text-decoration: none;
    background: none;
    border: none;
    padding: 0;
    line-height: 1.15;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.control-btn:hover {
    color: var(--color-link) !important;
    text-decoration: none;
}

.voice-btn.muted {
    opacity: 0.4;
}

.help-btn {
    width: 30px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-gray-light);
    font-size: var(--font-size-modal-close);
    line-height: 1;
    font-weight: 400;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    cursor: pointer;
    transition: color 0.2s ease;
    text-decoration: none;
    margin-top: -8px;
}

.help-btn:hover {
    color: var(--color-link) !important;
    text-decoration: none;
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: var(--shadow-modal);
    z-index: 1000;
    overflow: hidden;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.modal-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: var(--color-modal-bg);
    overflow: hidden;
}

.modal-close-btn {
    position: absolute;
    top: 0;
    left: 0;
    width: 25px;
    height: 25px;
    background: var(--color-gray-light);
    border: none;
    font-size: var(--font-size-modal-close);
    color: var(--text-color);
    cursor: pointer;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.modal-close-btn:hover {
    background-color: var(--color-positive) !important;
}

.modal-content {
    height: calc(100vh - 25px);
    overflow-y: auto;
    padding: 30px;
    position: relative;
    box-sizing: border-box;
    line-height: 20px;
    user-select: none;
    cursor: default;
}

.modal-content.dragging {
    cursor: grabbing;
}

.tips-container {
    margin-bottom: 25px;
    background: var(--bg-primary-dark);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}
