/* ✅ 2025-08-12 板块资金流向样式 */
/* 板块资金流向和热门板块统一样式 */

.sectors-panel {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

/* 🔥 强制板块资金流向永远使用左右布局 - 永不上下排列 */
/* 使用多重选择器提高优先级 */
.sectors-panel .panel-body .flow-dashboard,
.flow-dashboard,
div.flow-dashboard,
#sector-funds-dashboard,
[id*="sector-funds-dashboard"] {
    display: flex !important;
    flex-direction: row !important;
    gap: 16px !important;
    width: 100% !important;
    min-height: 200px !important;
    /* 确保不被其他样式覆盖 */
    flex-wrap: nowrap !important;
    align-items: stretch !important;
}

/* 使用多重选择器提高优先级 */
.sectors-panel .flow-section,
.flow-dashboard .flow-section,
.flow-section,
div.flow-section {
    flex: 1 !important;
    min-width: 0 !important;
    max-width: 50% !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 150px !important;
    /* 确保内容可见 */
    overflow: visible !important;
    position: relative !important;
    padding: 8px;
}

.flow-section h3 {
    margin-bottom: 12px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    text-align: center !important;
    padding: 8px !important;
    border-radius: 6px !important;
    background: rgba(255, 255, 255, 0.05) !important;
}

.flow-list {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    flex: 1 !important;
    overflow-y: auto !important;
}

.flow-item {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 8px 10px !important;
    margin-bottom: 6px !important;
    background: rgba(255, 255, 255, 0.03) !important;
    border-radius: 4px !important;
    transition: all 0.3s ease !important;
    font-size: 12px !important;
}

.flow-item:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    transform: translateX(2px) !important;
}

.flow-item-info {
    flex: 1 !important;
    min-width: 0 !important;
}

.flow-item-name {
    color: var(--text-primary) !important;
    font-weight: 500 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.flow-item-change {
    font-weight: 600 !important;
    font-size: 11px !important;
    white-space: nowrap !important;
}

.flow-item-change.positive {
    color: #ff4757 !important;
}

.flow-item-change.negative {
    color: #2ed573 !important;
}

/* 🚫 禁用任何可能导致上下布局的媒体查询 */
@media (max-width: 768px) {
    .flow-dashboard {
        display: flex !important;
        flex-direction: row !important;
        gap: 12px !important;
    }
    
    .flow-section h3 {
        font-size: 13px !important;
        padding: 6px !important;
    }
    
    .flow-item {
        padding: 6px 8px !important;
        margin-bottom: 4px !important;
        font-size: 11px !important;
    }
    
    .flow-item-name {
        font-size: 11px !important;
    }
    
    .flow-item-change {
        font-size: 10px !important;
    }
}

@media (max-width: 480px) {
    .flow-dashboard {
        display: flex !important;
        flex-direction: row !important;
        gap: 8px !important;
    }
    
    .flow-section h3 {
        font-size: 12px !important;
        padding: 4px !important;
    }
    
    .flow-item {
        padding: 4px 6px !important;
        margin-bottom: 3px !important;
        font-size: 10px !important;
    }
    
    .flow-item-name {
        font-size: 10px !important;
    }
    
    .flow-item-change {
        font-size: 9px !important;
    }
}

/* 🔧 修正：板块资金流向面板的标题居中显示 */
.sectors-panel .panel-header {
    justify-content: center !important;
}

.sectors-panel .panel-header .panel-title,
.sectors-panel .panel-header .panel-subtitle {
    text-align: center !important;
    margin: 0 auto !important;
}
/* 如果 header 里没有左右控制按钮，这样即可；若存在按钮并保持居中标题，需要额外指定它们的布局类 */
.sectors-panel .panel-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sectors-panel .panel-body {
    padding: 16px;
    height: 280px;
    overflow-y: auto;
}

.sector-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    transition: all 0.3s ease;
}

.sector-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sector-name {
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.sector-flow {
    display: flex;
    align-items: center;
    gap: 8px;
}

.flow-value {
    font-weight: bold;
    min-width: 80px;
    text-align: right;
}

.flow-positive {
    color: #ff4757;
}

.flow-negative {
    color: #2ed573;
}

.flow-neutral {
    color: var(--text-secondary);
}

.sector-percentage {
    font-size: 12px;
    color: var(--text-secondary);
    min-width: 60px;
    text-align: right;
}

.hot-sectors-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hot-sector-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.hot-sector-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.hot-sector-info {
    flex: 1;
}

.hot-sector-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.hot-sector-desc {
    font-size: 12px;
    color: var(--text-secondary);
}

.hot-sector-metrics {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.sector-change {
    font-weight: bold;
    font-size: 14px;
}

.sector-volume {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Loading状态 */
.sectors-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    color: var(--text-secondary);
}

.sectors-loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid var(--text-secondary);
    border-top: 2px solid var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 无数据状态 */
.sectors-no-data {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 200px;
    color: var(--text-secondary);
}

.sectors-no-data::before {
    content: '📊';
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.6;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .sector-item {
        padding: 6px 10px;
        margin-bottom: 6px;
    }
    
    .sector-name {
        font-size: 14px;
    }
    
    .flow-value {
        font-size: 13px;
        min-width: 60px;
    }
    
    .sector-percentage {
        font-size: 11px;
        min-width: 45px;
    }
    
    .hot-sector-item {
        padding: 8px 10px;
    }
    
    .hot-sector-name {
        font-size: 14px;
    }
    
    .hot-sector-desc {
        font-size: 11px;
    }
}
/* 🚨 
最高优先级强制布局规则 - 放在文件最底部 */
/* 这些规则必须永远生效，不允许被任何其他样式覆盖 */
body .sectors-panel .panel-body .flow-dashboard,
html body .flow-dashboard,
html body div.flow-dashboard,
html body [id*="sector-funds-dashboard"] {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 16px !important;
    width: 100% !important;
    height: auto !important;
    min-height: 200px !important;
    max-height: none !important;
    overflow: visible !important;
    position: relative !important;
}

body .sectors-panel .flow-section,
html body .flow-dashboard .flow-section,
html body .flow-section,
html body div.flow-section {
    flex: 1 1 50% !important;
    min-width: 0 !important;
    max-width: 50% !important;
    width: 50% !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 150px !important;
    overflow: visible !important;
    position: relative !important;
}

/* 强制移动端也使用左右布局 */
@media screen and (max-width: 768px) {
    body .sectors-panel .panel-body .flow-dashboard,
    html body .flow-dashboard,
    html body div.flow-dashboard {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 8px !important;
    }
    
    body .sectors-panel .flow-section,
    html body .flow-section {
        flex: 1 1 50% !important;
        width: 50% !important;
        max-width: 50% !important;
    }
}

@media screen and (max-width: 480px) {
    body .sectors-panel .panel-body .flow-dashboard,
    html body .flow-dashboard {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 4px !important;
    }
    
    body .sectors-panel .flow-section,
    html body .flow-section {
        flex: 1 1 50% !important;
        width: 50% !important;
        max-width: 50% !important;
    }
}