/* 历史数据分析专页样式 - date.css */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    background: #f0f2f5;
    min-height: 100vh;
    overflow-x: hidden;
}

/* 全屏容器 */
.container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 0;
}

/* 顶部控制栏包装器 */
.top-bar-wrapper {
    position: relative;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 100;
    flex-shrink: 0;
}

/* 右侧按钮固定位置 */
.top-bar-right-btn {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 101;
}

/* 顶部全宽控制栏 */
.top-bar {
    background: white;
    padding: 10px 20px;
    padding-right: 120px;
    /* 为右侧固定按钮预留空间 */
    display: flex;
    align-items: center;
    gap: 25px;
    flex-shrink: 0;
}

.top-bar-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.top-bar-label {
    font-size: 14px;
    font-weight: 600;
    color: #4a5568;
    white-space: nowrap;
}

/* 输入框聚焦效果 */
.input-small {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
}

.input-small:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Custom Select Dropdown Styles */
.custom-select-wrapper {
    position: relative;
    display: inline-block;
}

.custom-select-trigger {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    gap: 8px;
    white-space: nowrap;
}

.custom-select-trigger:hover {
    border-color: #cbd5e0;
}

.custom-select-trigger.active {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.custom-select-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #2d3748;
}

.custom-select-text.placeholder {
    color: #a0aec0;
}

.custom-select-arrow {
    margin-left: 10px;
    transition: transform 0.3s;
    color: #718096;
    font-size: 10px;
}

.custom-select-trigger.active .custom-select-arrow {
    transform: rotate(180deg);
}

.custom-select-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    min-width: 100%;
    background: white;
    border: 2px solid #667eea;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: none;
    max-height: 90vh;
    overflow-y: auto;
}

.custom-select-dropdown.show {
    display: block;
    animation: dropdownFadeIn 0.2s ease-out;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.custom-select-option {
    padding: 6px 12px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #f7fafc;
    font-size: 13px;
    color: #2d3748;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.custom-select-option:last-child {
    border-bottom: none;
}

.custom-select-option:hover {
    background: #f7fafc;
}

.custom-select-option.selected {
    background: #edf2f7;
    color: #667eea;
    font-weight: 600;
}

.custom-select-option.selected::after {
    content: '✓';
    margin-left: 8px;
    color: #667eea;
}

.custom-select-dropdown::-webkit-scrollbar {
    width: 6px;
}

.custom-select-dropdown::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.custom-select-dropdown::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.custom-select-dropdown::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* 时段选择下拉面板 - 4行6列网格布局 */
[data-select-id="startHour"] .custom-select-dropdown,
[data-select-id="endHour"] .custom-select-dropdown {
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(4, auto);
    padding: 8px;
    gap: 4px;
    min-width: 280px;
    max-height: none;
    overflow: visible;
    left: auto;
    right: 0;
}

[data-select-id="startHour"] .custom-select-dropdown.show,
[data-select-id="endHour"] .custom-select-dropdown.show {
    display: grid;
}

[data-select-id="startHour"] .custom-select-option,
[data-select-id="endHour"] .custom-select-option {
    padding: 8px 4px;
    text-align: center;
    border: none;
    border-radius: 4px;
    font-size: 12px;
}

[data-select-id="startHour"] .custom-select-option.selected::after,
[data-select-id="endHour"] .custom-select-option.selected::after {
    content: '';
    margin-left: 0;
}

/* 按钮组样式 */
.btn-group {
    display: flex;
    gap: 10px;
    margin-left: auto;
}

.btn-action {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: #3b82f6;
    color: white;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.25);
}

.btn-primary:hover {
    background: #2563eb;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.35);
}

.btn-secondary {
    background: #f7fafc;
    color: #4a5568;
    border: 1px solid #e2e8f0;
}

.btn-secondary:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
}

/* 方案选择下拉框 */
#strategySelect {
    min-width: 180px;
    background-color: #fff;
}

/* 表格主体区域 */
.main-content {
    flex: 1;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* 双重表头标题 */
.table-title-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
    font-weight: 600;
    text-align: center;
    padding: 8px 0;
    font-size: 15px;
    letter-spacing: 1px;
}

.table-title-item {
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

/* 表格容器 - 全屏扩展 */
.table-container {
    flex: 1;
    overflow: auto;
    background: white;
}

.lottery-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 1800px;
    /* 确保列很多时不会挤压 */
    table-layout: fixed;
}

/* 表头吸顶 */
.lottery-table thead th {
    position: sticky;
    top: 0;
    background: #f7fafc;
    z-index: 50;
    border-bottom: 2px solid #e2e8f0;
    padding: 12px 5px;
    font-size: 13px;
    color: #4a5568;
}

/* 列宽分配 - 让两大部分更紧凑 */
.col-seq {
    width: 60px;
}

.col-time {
    width: 100px;
}

.col-period {
    width: 100px;
}

.col-num {
    width: 38px;
}

.col-sum {
    width: 100px;
}

.col-dt {
    width: 120px;
}

.col-result {
    width: 80px;
}

.col-profit {
    width: 60px;
}

.col-cumulative {
    width: 60px;
}

/* 单元格分割线 */
.lottery-table td {
    padding: 10px 2px;
    height: 38px;
    text-align: center;
    border-bottom: 1px solid #edf2f7;
    border-right: 1px solid #f2f5f8;
    font-size: 13px;
}

/* 交替行背景色 */
.lottery-table tbody tr:nth-child(even) {
    background-color: #f0f7ff;
}

.lottery-table tbody tr:nth-child(odd) {
    background-color: #ffffff;
}

.lottery-table tbody tr:hover {
    background-color: #e8f4fd;
}

/* 左右两侧的分隔加粗 */
.border-right-heavy {
    border-right: 2px solid #cbd5e0 !important;
}

/* 号码球样式优化 - 完全同步主页高级配色 */
.number-ball {
    display: inline-block;
    width: 32px;
    height: 32px;
    line-height: 32px;
    border-radius: 4px;
    color: white;
    font-weight: bold;
    font-size: 24px;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
    cursor: pointer;
}

.number-ball:hover {
    transform: scale(1.1);
}

.ball-1 {
    background: #FFD700;
}

.ball-2 {
    background: #1E90FF;
}

.ball-3 {
    background: #4A4A4A;
}

.ball-4 {
    background: #FF8C00;
}

.ball-5 {
    background: #00CED1;
}

.ball-6 {
    background: #8B00FF;
}

.ball-7 {
    background: #A9A9A9;
}

.ball-8 {
    background: #FF0000;
}

.ball-9 {
    background: #8B4513;
}

.ball-10 {
    background: #32CD32;
}

.ball-empty {
    background: #f1f5f9;
    color: #cbd5e0;
    font-size: 12px;
    text-shadow: none;
    box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.05);
    cursor: default;
}

.ball-empty:hover {
    transform: none;
}

/* 状态标签样式 */
.data-item {
    display: inline-block;
    width: 22px;
    height: 22px;
    line-height: 22px;
    border-radius: 4px;
    font-weight: bold;
    margin: 0;
    font-size: 14px;
    text-align: center;
}

.col-sum,
.col-dt {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.win-text,
.data-big,
.data-dragon {
    color: #FF4444;
}

.lose-text,
.data-small,
.data-tiger {
    color: #4169E1;
}

.data-odd {
    color: #FF8C00;
}

.data-even {
    color: #00CED1;
}

.data-value {
    color: #2d3748;
}

/* 侧边隔离带 */
.border-right-heavy {
    border-right: 2px solid #a0aec0 !important;
}

.border-left-heavy {
    border-left: 2px solid #a0aec0 !important;
}

/* 模拟记录单元格背景 */
.sim-row {
    background-color: #f0f7ff !important;
}

/* 盈亏样式 */
.win-text {
    color: #e53e3e;
    font-weight: bold;
}

.lose-text {
    color: #38a169;
}

/* 方案买入标记 */
.buy-item {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
}

/* 设置弹窗复用主页逻辑但独立样式 */
.settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.settings-modal.show {
    display: flex;
}

.settings-content {
    background: white;
    width: 600px;
    border-radius: 12px;
    padding: 30px;
    position: relative;
}

.settings-close-icon {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 24px;
    height: 24px;
    cursor: pointer;
}

/* 回测分析简报浮窗 - 完全同步主页模拟容器样式 */
.simulation-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 500px;
    max-height: calc(100vh - 40px);
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.simulation-header {
    padding: 12px 16px;
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    color: #2d3748;
    font-weight: 600;
    font-size: 15px;
    text-align: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
}

.simulation-list {
    padding: 4px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.simulation-footer {
    padding: 16px;
    background: #f8fafc;
    border-top: 1px solid #edf2f7;
    flex-shrink: 0;
}

.simulation-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

/* 复用主页统计卡片样式 */
.backtest-item-card {
    background: white;
    border-radius: 8px;
    padding: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.backtest-item-title {
    font-weight: 600;
    font-size: 14px;
    color: #2d3748;
    margin-bottom: 8px;
    text-align: center;
}

.backtest-summary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.backtest-summary-table th,
.backtest-summary-table td {
    border: 1px solid #e2e8f0;
    padding: 6px 4px;
    text-align: center;
}

.backtest-summary-table th {
    background-color: #f7fafc;
    color: #718096;
    font-weight: 600;
}

.backtest-summary-table .row-label {
    background-color: #f8fafc;
    font-weight: 600;
    color: #4a5568;
    width: 50px;
}