/* 最新预测结果模块样式 */

/* AI解读模块滚动条样式 */
#usStockAIAnalysisContent {
    scrollbar-width: thin;
    scrollbar-color: rgba(59, 130, 246, 0.5) rgba(59, 130, 246, 0.1);
}

#usStockAIAnalysisContent::-webkit-scrollbar {
    width: 6px;
}

#usStockAIAnalysisContent::-webkit-scrollbar-track {
    background: rgba(59, 130, 246, 0.1);
    border-radius: 3px;
}

#usStockAIAnalysisContent::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.5);
    border-radius: 3px;
}

#usStockAIAnalysisContent::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.7);
}

/* 全屏AI解读弹窗样式 */
#aiAnalysisFullscreenModal {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

#aiAnalysisFullscreenContent {
    scrollbar-width: thin;
    scrollbar-color: rgba(59, 130, 246, 0.5) rgba(59, 130, 246, 0.1);
}

#aiAnalysisFullscreenContent::-webkit-scrollbar {
    width: 8px;
}

#aiAnalysisFullscreenContent::-webkit-scrollbar-track {
    background: rgba(59, 130, 246, 0.1);
    border-radius: 4px;
}

#aiAnalysisFullscreenContent::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.5);
    border-radius: 4px;
}

#aiAnalysisFullscreenContent::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.7);
}

/* 最新预测卡片 */
#latestPredictionCard {
    margin-bottom: 16px;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(147, 51, 234, 0.15) 100%);
    border: 1px solid rgba(59, 130, 246, 0.4);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
}

/* 卡片头部容器 */
.latest-prediction-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

/* 标题区域 */
.latest-prediction-title-area {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.latest-prediction-icon {
    color: #3b82f6;
    font-size: 16px;
}

.latest-prediction-title {
    margin: 0;
    font-size: 1em;
    color: #3b82f6;
}

.latest-prediction-title-time {
    color: #9ca3af;
    font-size: 0.85em;
    font-weight: normal;
    margin-left: 8px;
}

/* 币种选择器 */
#latestPredictionSymbolSelect {
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid rgba(59, 130, 246, 0.4);
    border-radius: 6px;
    color: #fff;
    padding: 4px 8px;
    font-size: 0.85em;
    cursor: pointer;
    margin-left: 12px;
    min-width: 120px;
}

/* 价格显示 */
.latest-prediction-price {
    display: inline-flex;
    align-items: center;
    transition: all 0.2s;
}

.latest-prediction-price:hover {
    background: rgba(16, 185, 129, 0.3) !important;
    border-color: rgba(16, 185, 129, 0.6) !important;
}

/* 操作按钮区域 */
.latest-prediction-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* 刷新按钮 */
#latestPredictionRefreshBtn {
    background: rgba(59, 130, 246, 0.3);
    border: 1px solid rgba(59, 130, 246, 0.4);
    border-radius: 6px;
    color: #fff;
    padding: 4px 10px;
    font-size: 0.8em;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

#latestPredictionRefreshBtn:hover {
    background: rgba(59, 130, 246, 0.5);
}

/* 倒计时显示 */
#latestPredictionCountdown {
    color: #60a5fa;
    font-size: 0.75em;
    font-weight: 500;
    padding: 4px 8px;
    background: rgba(59, 130, 246, 0.2);
    border-radius: 4px;
    white-space: nowrap;
}

/* 会员提示 */
#latestPredictionMemberTip {
    color: #fbbf24;
    font-size: 0.75em;
    font-weight: normal;
    display: flex;
    align-items: center;
    gap: 4px;
}

#latestPredictionMemberTip i {
    font-size: 11px;
}

/* 内容区域 */
#latestPredictionContent {
    width: 100% !important;
    overflow: visible !important; /* 改为visible，确保grid布局正常显示 */
    display: block !important; /* 确保是块级元素 */
    position: relative !important;
}

/* 防止.card类干扰grid布局 */
#latestPredictionCard #latestPredictionContent {
    display: block !important;
    flex-direction: unset !important;
    flex-wrap: unset !important;
    flex: unset !important;
    flex-basis: unset !important;
    flex-grow: unset !important;
    flex-shrink: unset !important;
}

/* 桌面端：grid布局规则（仅在大屏幕生效） */
@media (min-width: 769px) {
    /* 确保latestPredictionContent的子元素（grid容器）不受父容器影响 */
    #latestPredictionContent > *:not(.prediction-mobile-tabs):not(.prediction-tab-buttons) {
        display: block !important;
        width: 100% !important;
    }
    
    #latestPredictionContent > div:not(.prediction-mobile-tabs) {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
    }
    
    /* 防止.card类的任何子元素规则干扰 */
    .card#latestPredictionCard > *,
    .card#latestPredictionCard #latestPredictionContent,
    .card#latestPredictionCard #latestPredictionContent > * {
        display: block !important;
        flex: unset !important;
        flex-basis: unset !important;
        flex-grow: unset !important;
        flex-shrink: unset !important;
    }
    
    .card#latestPredictionCard #latestPredictionContent > div,
    .card#latestPredictionCard #latestPredictionContent > div:first-child,
    .card#latestPredictionCard #latestPredictionContent > div.latest-prediction-modules-grid,
    .card#latestPredictionCard #latestPredictionContent > div#predictionModulesGrid {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 12px !important;
        align-items: stretch !important;
        width: 100% !important;
        box-sizing: border-box !important;
        grid-auto-flow: row !important;
        grid-auto-rows: 1fr !important;
        flex-direction: unset !important;
        flex-wrap: unset !important;
        flex: unset !important;
        position: relative !important;
    }
}

/* 小尺寸屏幕：tab布局规则 */
@media (max-width: 768px) {
    /* 手机端tab容器 */
    #latestPredictionContent > .prediction-mobile-tabs,
    #latestPredictionContent .prediction-mobile-tabs {
        display: block !important;
        width: 100% !important;
    }
    
    /* tab按钮容器必须是flex横向布局 */
    #latestPredictionContent .prediction-tab-buttons,
    .prediction-mobile-tabs .prediction-tab-buttons {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        width: 100% !important;
    }
}

/* 4模块横向布局 - 强制固定4列，不响应式（仅桌面端，使用最高优先级，覆盖所有可能的冲突） */
/* 使用最高优先级选择器，确保覆盖所有可能的冲突 */
@media (min-width: 769px) {
    #latestPredictionCard #latestPredictionContent > div.latest-prediction-modules-grid,
    #latestPredictionCard #latestPredictionContent > div:first-child:not(.prediction-mobile-tabs),
    #latestPredictionCard #latestPredictionContent > div:not(.prediction-mobile-tabs),
    #latestPredictionContent > div.latest-prediction-modules-grid,
    #latestPredictionContent > div:first-child:not(.prediction-mobile-tabs),
    #latestPredictionContent > div:not(.prediction-mobile-tabs),
    .latest-prediction-modules-grid,
    #predictionModulesGrid,
    div#predictionModulesGrid,
    div.latest-prediction-modules-grid,
    .card#latestPredictionCard #latestPredictionContent > div:not(.prediction-mobile-tabs),
    .card#latestPredictionCard #latestPredictionContent > div:first-child:not(.prediction-mobile-tabs),
    .card#latestPredictionCard #latestPredictionContent > div.latest-prediction-modules-grid,
    body #latestPredictionCard #latestPredictionContent > div:not(.prediction-mobile-tabs),
    body #latestPredictionCard #latestPredictionContent > div:first-child:not(.prediction-mobile-tabs),
    body #latestPredictionCard #latestPredictionContent > div.latest-prediction-modules-grid,
    html body #latestPredictionCard #latestPredictionContent > div:not(.prediction-mobile-tabs),
    html body #latestPredictionCard #latestPredictionContent > div:first-child:not(.prediction-mobile-tabs),
    html body #latestPredictionCard #latestPredictionContent > div.latest-prediction-modules-grid {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 12px !important;
        align-items: stretch !important;
        width: 100% !important;
        box-sizing: border-box !important;
        grid-auto-flow: row !important;
        grid-auto-rows: 1fr !important;
        flex-direction: unset !important;
        flex-wrap: unset !important;
        flex: unset !important;
        flex-basis: unset !important;
        flex-grow: unset !important;
        flex-shrink: unset !important;
        grid-column-gap: 12px !important;
        grid-row-gap: 12px !important;
        position: relative !important;
    }
}

/* 确保每个模块都是独立的grid item（仅桌面端） */
@media (min-width: 769px) {
    #latestPredictionContent > div > div,
    #predictionModulesGrid > div,
    .prediction-module-item,
    #latestPredictionContent > div > div.prediction-module-item,
    #predictionModulesGrid > div.prediction-module-item,
    .card#latestPredictionCard #latestPredictionContent > div > div {
        min-width: 0 !important;
        width: 100% !important;
        max-width: none !important;
        box-sizing: border-box !important;
        flex: unset !important;
        flex-basis: unset !important;
        flex-grow: unset !important;
        flex-shrink: unset !important;
        grid-column: auto !important;
        grid-row: auto !important;
        height: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        position: relative !important;
    }
}

/* 桌面端：保持4列布局 */
@media (min-width: 769px) {
    #latestPredictionContent > div,
    .latest-prediction-modules-grid {
        grid-template-columns: repeat(4, 1fr) !important; /* 保持4列 */
    }
    
    /* 隐藏手机端tab */
    .prediction-mobile-tabs {
        display: none !important;
    }
}

/* 手机端：使用tab切换 */
@media (max-width: 768px) {
    /* 强制隐藏所有桌面端grid布局（使用最高优先级选择器） */
    .latest-prediction-modules-grid,
    #predictionModulesGrid,
    div#predictionModulesGrid,
    div.latest-prediction-modules-grid,
    #latestPredictionContent > div.latest-prediction-modules-grid,
    #latestPredictionContent > div#predictionModulesGrid,
    #latestPredictionCard #latestPredictionContent > div.latest-prediction-modules-grid,
    #latestPredictionCard #latestPredictionContent > div#predictionModulesGrid,
    .card#latestPredictionCard #latestPredictionContent > div.latest-prediction-modules-grid,
    .card#latestPredictionCard #latestPredictionContent > div#predictionModulesGrid,
    body #latestPredictionCard #latestPredictionContent > div.latest-prediction-modules-grid,
    body #latestPredictionCard #latestPredictionContent > div#predictionModulesGrid,
    html body #latestPredictionCard #latestPredictionContent > div.latest-prediction-modules-grid,
    html body #latestPredictionCard #latestPredictionContent > div#predictionModulesGrid {
        display: none !important;
        grid-template-columns: unset !important;
        grid: unset !important;
    }
    
    /* 强制隐藏桌面端grid布局中的模块（防止它们单独显示） */
    #latestPredictionContent > div:not(.prediction-mobile-tabs),
    #latestPredictionContent > div.latest-prediction-modules-grid > div,
    #predictionModulesGrid > div {
        display: none !important;
    }
    
    /* 显示手机端tab（使用最高优先级） */
    .prediction-mobile-tabs,
    #predictionMobileTabs,
    #latestPredictionContent > .prediction-mobile-tabs,
    #latestPredictionContent .prediction-mobile-tabs,
    #latestPredictionCard #latestPredictionContent > .prediction-mobile-tabs,
    #latestPredictionCard #latestPredictionContent .prediction-mobile-tabs,
    .card#latestPredictionCard #latestPredictionContent > .prediction-mobile-tabs,
    .card#latestPredictionCard #latestPredictionContent .prediction-mobile-tabs,
    body #latestPredictionCard #latestPredictionContent > .prediction-mobile-tabs,
    body #latestPredictionCard #latestPredictionContent .prediction-mobile-tabs,
    html body #latestPredictionCard #latestPredictionContent > .prediction-mobile-tabs,
    html body #latestPredictionCard #latestPredictionContent .prediction-mobile-tabs {
        display: block !important;
        width: 100% !important;
    }
    
    /* Tab按钮样式 - 横向排列（强制横向，覆盖所有可能的冲突） */
    .prediction-tab-buttons,
    #latestPredictionContent .prediction-tab-buttons,
    .prediction-mobile-tabs .prediction-tab-buttons,
    #predictionMobileTabs .prediction-tab-buttons {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 6px !important;
        margin-bottom: 12px !important;
        overflow-x: auto !important;
        scrollbar-width: none !important;
        -ms-overflow-style: none !important;
        padding-bottom: 4px !important;
        width: 100% !important;
        align-items: stretch !important;
        justify-content: flex-start !important;
    }
    
    .prediction-tab-buttons::-webkit-scrollbar {
        display: none;
    }
    
    .prediction-tab-btn,
    #latestPredictionContent .prediction-tab-btn,
    .prediction-mobile-tabs .prediction-tab-btn,
    #predictionMobileTabs .prediction-tab-btn {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        padding: 10px 12px !important;
        border-radius: 8px !important;
        border: 2px solid !important;
        font-weight: 600 !important;
        font-size: 13px !important;
        cursor: pointer !important;
        transition: all 0.2s !important;
        white-space: nowrap !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        flex-shrink: 0 !important;
        width: auto !important;
        max-width: none !important;
    }
    
    .prediction-tab-btn.active {
        transform: scale(1.05);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }
    
    /* Tab内容面板 */
    .prediction-tab-content {
        position: relative;
        width: 100%;
        min-height: 400px;
    }
    
    .prediction-tab-pane {
        display: none;
        width: 100%;
        animation: fadeIn 0.3s ease-in-out;
    }
    
    .prediction-tab-pane.active {
        display: block;
    }
    
    @keyframes fadeIn {
        from {
            opacity: 0;
            transform: translateY(10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    /* 手机端tab pane显示控制 - 只有active的才显示 */
    .prediction-tab-pane {
        display: none !important;
    }
    
    .prediction-tab-pane.active {
        display: block !important;
    }
    
    /* 手机端模块样式调整 - 确保tab pane中的模块不受桌面端grid规则影响 */
    .prediction-tab-pane.active *,
    .prediction-tab-content .prediction-tab-pane.active * {
        display: block;
    }
    
    .prediction-tab-pane.active .prediction-module-item,
    #predictionTabContent .prediction-tab-pane.active .prediction-module-item,
    .prediction-mobile-tabs .prediction-tab-pane.active .prediction-module-item {
        padding: 14px !important;
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        box-sizing: border-box !important;
        /* 确保不受桌面端grid规则影响 */
        grid-column: unset !important;
        grid-row: unset !important;
        grid-area: unset !important;
        min-width: 0 !important;
    }
    
    /* 确保tab pane中的内容正常显示 */
    .prediction-tab-pane.active > * {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* 覆盖桌面端的grid规则，确保手机端tab pane不受影响 */
    #latestPredictionContent .prediction-mobile-tabs,
    #latestPredictionContent .prediction-tab-content {
        display: block !important;
        grid-template-columns: unset !important;
        grid-column: unset !important;
        grid-row: unset !important;
    }
    
    /* 确保tab pane中的模块不是grid item */
    .prediction-tab-pane.active .prediction-module-item,
    .prediction-tab-content .prediction-tab-pane.active .prediction-module-item {
        display: flex !important;
        flex-direction: column !important;
        grid-column: unset !important;
        grid-row: unset !important;
        grid-area: unset !important;
    }
}

/* 明亮模式 - 提高对比度 */
body:not(.dark-mode) #latestPredictionCard {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.3) 0%, rgba(147, 51, 234, 0.3) 100%) !important;
    border-color: rgba(59, 130, 246, 0.8) !important;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3) !important;
}

body:not(.dark-mode) #latestPredictionContent {
    color: #111827 !important;
}

/* 明亮模式下的模块背景 - 使用渐变色背景 */
body:not(.dark-mode) #latestPredictionContent > div > div {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(249, 250, 251, 0.95) 100%) !important;
    border-color: rgba(59, 130, 246, 0.7) !important;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2) !important;
}

/* 明亮模式下各模块的特定背景色 */
body:not(.dark-mode) #latestPredictionContent > div > div:nth-child(1) {
    background: linear-gradient(135deg, rgba(239, 246, 255, 0.95) 0%, rgba(219, 234, 254, 0.95) 100%) !important;
    border-color: rgba(59, 130, 246, 0.6) !important;
}

body:not(.dark-mode) #latestPredictionContent > div > div:nth-child(2) {
    background: linear-gradient(135deg, rgba(254, 242, 242, 0.95) 0%, rgba(254, 226, 226, 0.95) 100%) !important;
    border-color: rgba(239, 68, 68, 0.6) !important;
}

body:not(.dark-mode) #latestPredictionContent > div > div:nth-child(3) {
    background: linear-gradient(135deg, rgba(236, 253, 245, 0.95) 0%, rgba(209, 250, 229, 0.95) 100%) !important;
    border-color: rgba(16, 185, 129, 0.6) !important;
}

body:not(.dark-mode) #latestPredictionContent > div > div:nth-child(4) {
    background: linear-gradient(135deg, rgba(250, 245, 255, 0.95) 0%, rgba(243, 232, 255, 0.95) 100%) !important;
    border-color: rgba(168, 85, 247, 0.6) !important;
}

/* 明亮模式下的文字颜色 - 使用深色提高可读性 */
body:not(.dark-mode) #latestPredictionContent h4 {
    color: #1e3a8a !important;
    font-weight: 700 !important;
}

body:not(.dark-mode) #latestPredictionContent .fa-lightbulb {
    color: #2563eb !important;
}

body:not(.dark-mode) #latestPredictionContent .fa-exclamation-triangle {
    color: #dc2626 !important;
}

body:not(.dark-mode) #latestPredictionContent .fa-chart-line {
    color: #16a34a !important;
}

body:not(.dark-mode) #latestPredictionContent .fa-robot {
    color: #9333ea !important;
}

/* 明亮模式下的文字内容 */
body:not(.dark-mode) #latestPredictionContent [style*="color: #93c5fd"],
body:not(.dark-mode) #latestPredictionContent [style*="color: #60a5fa"],
body:not(.dark-mode) #latestPredictionContent [style*="color: #dbeafe"],
body:not(.dark-mode) #latestPredictionContent [style*="color: #bfdbfe"] {
    color: #1e40af !important;
}

body:not(.dark-mode) #latestPredictionContent [style*="color: #fca5a5"],
body:not(.dark-mode) #latestPredictionContent [style*="color: #fee2e2"] {
    color: #991b1b !important;
}

body:not(.dark-mode) #latestPredictionContent [style*="color: #6ee7b7"],
body:not(.dark-mode) #latestPredictionContent [style*="color: #d1fae5"] {
    color: #065f46 !important;
}

body:not(.dark-mode) #latestPredictionContent [style*="color: #c084fd"],
body:not(.dark-mode) #latestPredictionContent [style*="color: #e9d5ff"],
body:not(.dark-mode) #latestPredictionContent [style*="color: #c4b5fd"] {
    color: #6b21a8 !important;
}

/* 明亮模式下行情归纳的文字颜色 - 改为黑色提高对比度 */
body:not(.dark-mode) #latestPredictionContent [style*="color: #fef3c7"] {
    color: #000000 !important;
}

/* 明亮模式下单边行情指数"暂无信号"的文字颜色 - 确保可见 */
body:not(.dark-mode) #latestPredictionContent [style*="color: #1f2937"] {
    color: #111827 !important;
}

body:not(.dark-mode) #latestPredictionContent [style*="color: #374151"] {
    color: #111827 !important;
}

/* 黑色模式下单边行情指数的文字颜色 - 改为白色 */
body.dark-mode .unilateral-index-title {
    color: #ffffff !important;
}

body.dark-mode .unilateral-index-content {
    color: #ffffff !important;
}

body.dark-mode .unilateral-index-content i {
    color: #d1d5db !important;
}

/* 美股消息滚动动画 */
@keyframes scrollText {
    0% {
        transform: translateX(100%);
    }
    100% {
        transform: translateX(-100%);
    }
}

#usStockNewsScroll {
    position: relative;
    overflow: hidden;
}

#usStockNewsContent {
    display: inline-block;
    padding-left: 100%;
    animation: scrollText 30s linear infinite;
}

#usStockNewsContent:hover {
    animation-play-state: paused;
}

/* 渐变遮罩效果 */
#usStockNewsScroll::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 30px;
    height: 100%;
    background: linear-gradient(to right, rgba(16, 185, 129, 0.1), transparent);
    z-index: 1;
    pointer-events: none;
}

#usStockNewsScroll::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    width: 30px;
    height: 100%;
    background: linear-gradient(to left, rgba(16, 185, 129, 0.1), transparent);
    z-index: 1;
    pointer-events: none;
}

/* 暗夜模式 */
body.dark-mode #latestPredictionCard {
    background: rgba(17, 24, 39, 0.8) !important;
    border-color: rgba(55, 65, 81, 0.6) !important;
}

/* 隐藏滚动条但保持滚动功能 */
#latestPredictionContent * {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

#latestPredictionContent *::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}
