
/* 期货K线图表样式 - 完整功能版 */
.futures-kline-container {
    font-family: 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #1e2a3a 0%, #2c3e50 100%);
    border-radius: 12px;
    padding: 5px;
    margin: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    width: calc(100% - 20px);
    height: calc(100vh - 20px);
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
}

.futures-header {
    background: linear-gradient(90deg, #2c3e50 0%, #34495e 100%);
    color: #ecf0f1;
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 10px;
    text-align: center;
    font-size: 16px;
    font-weight: bold;
    border: 1px solid #4a6572;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.futures-chart-wrapper {
    position: relative;
    width: 100%;
    height: calc(100vh - 170px);
    min-height: 500px;
    background: #1a2530;
    border-radius: 8px;
    border: 1px solid #34495e;
    overflow: hidden;
    /* 修复：添加硬件加速 */
    transform: translateZ(0);
    will-change: transform;
}

/* 可拖动的浮动选择器 - 修复高清和拖动问题（尺寸缩小版） */
.futures-selector {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 10000;
    background: rgba(26, 37, 48, 0.95);
    border: 1px solid #4a6572;
    border-radius: 8px;
    padding: 6px 10px; /* 减小内边距 */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px); /* Safari 支持 */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    min-width: 180px; /* 显著缩小宽度 */
    max-width: 200px; /* 显著缩小宽度 */
    opacity: 0.25;
    transition: opacity 0.3s ease, border-color 0.3s ease;
    cursor: move;
    user-select: none;
    /* 修复：移除transform，改用直接定位 */
    left: var(--selector-left, auto);
    top: var(--selector-top, 15px);
    right: var(--selector-right, auto);
    /* 高清优化 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    /* 修复模糊：添加显式字体渲染设置 */
    font-smooth: always;
    -webkit-font-smoothing: subpixel-antialiased;
    backface-visibility: hidden;
    transform: translate3d(0, 0, 0);
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.futures-selector:hover {
    opacity: 0.95;
    border-color: #3498db;
}

.futures-selector.edge-hidden {
    opacity: 0.25;
}

.futures-selector.edge-hidden:hover {
    opacity: 0.95;
}

.futures-selector-title {
    color: #ecf0f1;
    font-size: 12px; /* 字体调小 */
    margin-bottom: 6px; /* 间距调小 */
    font-weight: 600;
    border-bottom: 1px solid #4a6572;
    padding-bottom: 4px; /* 内边距调小 */
    text-align: center;
    letter-spacing: 0.2px; /* 字间距调小 */
    /* 修复字体渲染 */
    text-shadow: 0 0 1px rgba(236, 240, 241, 0.1);
}

.futures-select-row {
    display: flex;
    gap: 5px; /* 间距调小 */
    align-items: center;
}

.futures-variety-select, .futures-contract-select {
    background: #2c3e50;
    color: #ecf0f1;
    border: 1px solid #4a6574;
    border-radius: 4px; /* 圆角调小 */
    padding: 5px 8px; /* 内边距调小 */
    font-size: 11px; /* 字体调小 */
    outline: none;
    min-width: 80px; /* 宽度调小 */
    cursor: pointer;
    flex: 1;
    /* 高清优化 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-weight: 500;
    /* 修复下拉选项清晰度 */
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ecf0f1'%3e%3cpath d='M7 10l5 5 5-5z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 6px center;
    background-size: 10px; /* 箭头调小 */
    padding-right: 22px; /* 右边距调小 */
}

.futures-variety-select:hover, .futures-contract-select:hover {
    border-color: #3498db;
}

.futures-variety-select:focus, .futures-contract-select:focus {
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.5);
}

.futures-footer {
    background: linear-gradient(90deg, #2c3e50 0%, #34495e 100%);
    color: #ecf0f1;
    padding: 10px 20px;
    border-radius: 8px;
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    border: 1px solid #4a6572;
}

.futures-copyright {
    text-align: center;
    flex: 1;
}

.futures-performance {
    text-align: right;
    color: #95a5a6;
    font-family: 'Courier New', monospace;
    font-size: 11px;
}

/* 加载遮罩 */
.futures-loading-mask {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 37, 48, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    color: #ecf0f1;
    font-size: 16px;
    border-radius: 8px;
    flex-direction: column;
}

.futures-loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255,255,255,.1);
    border-radius: 50%;
    border-top-color: #3498db;
    animation: futures-spin 1s ease-in-out infinite;
    margin-bottom: 15px;
}

.futures-loading-text {
    font-size: 14px;
    color: #bdc3c7;
}

@keyframes futures-spin {
    to { transform: rotate(360deg); }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .futures-kline-container {
        padding: 5px;
        margin: 4px;
        width: calc(100% - 8px);
        height: calc(100vh - 8px);
    }
    
    .futures-header {
        padding: 10px 15px;
        font-size: 14px;
        margin-bottom: 8px;
    }
    
    .futures-chart-wrapper {
        height: calc(100vh - 150px);
        min-height: 400px;
    }
    
    .futures-selector {
        max-width: 90%;
        padding: 6px 8px; /* 移动端也调小 */
        min-width: auto;
        right: 6px;
        top: 6px;
    }
    
    .futures-select-row {
        flex-direction: column;
        gap: 6px;
    }
    
    .futures-variety-select, .futures-contract-select {
        width: 100%;
        min-width: auto;
        font-size: 11px;
        padding: 6px 8px;
    }
    
    .futures-footer {
        padding: 8px 12px;
        margin-top: 8px;
        font-size: 11px;
        flex-direction: column;
        gap: 5px;
    }
}

/* 横屏模式 */
@media (max-height: 500px) and (orientation: landscape) {
    .futures-chart-wrapper {
        height: calc(100vh - 120px);
        min-height: 300px;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .futures-selector {
        opacity: 0.95; /* 触摸设备保持可见 */
        min-width: 200px; /* 触摸设备稍大 */
        max-width: 220px; /* 触摸设备稍大 */
        padding: 8px 10px;
    }
    
    .futures-variety-select, .futures-contract-select {
        padding: 7px 9px;
        font-size: 12px;
    }
}

/* 高清设备优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .futures-selector {
        border-width: 0.5px;
        /* 高清设备上更清晰的字体 */
        font-weight: 600;
    }
    
    .futures-variety-select, .futures-contract-select {
        border-width: 0.5px;
    }
    
    .futures-selector-title {
        text-shadow: 0 0 0.5px rgba(236, 240, 241, 0.2);
    }
}

/* 修复字体模糊的关键CSS */
@supports (-webkit-font-smoothing: antialiased) {
    .futures-selector,
    .futures-selector-title,
    .futures-variety-select,
    .futures-contract-select {
        -webkit-font-smoothing: antialiased !important;
    }
}
