/* ========== 板块详情页样式 - 参考自选股页面风格 ========== */

/* 页面整体布局 */
.block-page {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    min-height: calc(100vh - 70px);
    gap: 1px;
    background: #e5e7eb;
}

/* ===== 左侧：板块列表 ===== */
.block-sidebar {
    width: 260px;
    min-width: 220px;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    /* 关键：撑满屏幕高度，内容超出时内部滚动 */
    height: calc(100vh - 70px);
    position: sticky;
    top: 0;
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #374151;
}

.sidebar-count {
    font-size: 12px;
    color: #9CA3AF;
}

/* 刷新按钮 */
.sidebar-refresh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    background: #ffffff;
    color: #6B7280;
    cursor: pointer;
    padding: 0;
    transition: all 0.2s;
}

.sidebar-refresh-btn:hover:not(:disabled) {
    border-color: #4e71f2;
    color: #4e71f2;
    background: #eff6ff;
}

.sidebar-refresh-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.spin-icon {
    animation: spin 0.8s linear infinite;
}

.sidebar-search {
    padding: 10px 12px;
    border-bottom: 1px solid #F3F4F6;
    position: relative;
}

.sidebar-input {
    width: 100%;
    padding: 8px 30px 8px 12px;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.sidebar-input:focus {
    border-color: #4e71f2;
    box-shadow: 0 0 0 2px rgba(78,113,242,0.12);
}

.sidebar-clear {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: none;
    color: #9CA3AF;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 0 4px;
}

.sidebar-clear:hover { color: #6B7280; }

/* Tab切换 */
.sidebar-tabs {
    display: flex;
    padding: 0 12px;
    border-bottom: 1px solid #E5E7EB;
}

.tab-btn {
    flex: 1;
    padding: 8px 0;
    font-size: 13px;
    font-weight: 500;
    color: #6B7280;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn:hover { color: #4e71f2; }

.tab-btn.active {
    color: #4e71f2;
    border-bottom-color: #4e71f2;
    font-weight: 600;
}

.block-list-wrap {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    /* 确保最小高度撑满剩余空间 */
    min-height: 0;
    margin-bottom: 10px;
}

.sidebar-loading,
.sidebar-empty {
    text-align: center;
    color: #9CA3AF;
    padding: 40px 16px;
    font-size: 14px;
}

/* 板块列表项 */
.block-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 11px 16px;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: background-color 0.15s, border-color 0.15s;
}

.block-item:hover {
    background-color: #F9FAFB;
}

.block-item.active {
    background-color: #EFF6FF;
    border-left-color: #4e71f2;
}

.block-item-name {
    font-size: 14px;
    color: #374151;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 160px;
    font-weight: 400;
}

.block-item.active .block-item-name {
    color: #1d4ed8;
    font-weight: 500;
}

.block-item-pct {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: 8px;
}

.block-item-pct.up   { color: #DC2626; }
.block-item-pct.down { color: #059669; }

/* ===== 右侧：股票列表区 ===== */
.block-main {
    flex: 1;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.stock-area-header {
    padding: 20px 24px;
    border-bottom: 1px solid #E5E7EB;
    background: linear-gradient(to right, #F8FAFC, #FFFFFF);
}

.stock-area-header h2 {
    margin: 0 0 8px 0;
    font-size: 20px;
    font-weight: 600;
    color: #1F2937;
}

.header-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    color: #6B7280;
}

.header-pct {
    font-size: 16px;
    font-weight: 600;
}
.header-pct.up   { color: #DC2626; }
.header-pct.down { color: #059669; }

.header-count {
    color: #9CA3AF;
}

.stock-area-header.empty-state p {
    color: #9CA3AF;
    margin: 0;
    text-align: center;
    padding: 40px 0;
    font-size: 14px;
}

/* 股票表格 */
.stock-table-wrap {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.table-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 60px 0;
    color: #9CA3AF;
    font-size: 14px;
}

.spinner {
    width: 22px;
    height: 22px;
    border: 2.5px solid #E5E7EB;
    border-top-color: #4e71f2;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* 表头 */
.st-header {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    background: #F8FAFC;
    border-bottom: 1px solid #E5E7EB;
    position: sticky;
    top: 0;
    z-index: 1;
}

.st-col {
    font-size: 13px;
    color: #6B7280;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
}

.st-name-col { text-align: center !important; flex: 2; min-width: 0; }

/* 表行中股票名称列内容左对齐 */
.st-row .st-name-col { text-align: left !important; }
.st-price-col { flex: 1; min-width: 0; }
.st-pct-col   { flex: 1; min-width: 0; }
.st-action-col{ flex: 1; min-width: 0; }

.st-hide-sm { flex: 1; min-width: 0; }

/* 表体滚动容器 */
.st-body-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
}

/* 表行 */
.st-row {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid #F3F4F6;
    transition: background-color 0.12s;
}

.st-row:hover {
    background-color: #F9FAFB;
}

/* 自选股高亮：淡蓝色背景 */
.st-row.is-watchlist {
    background-color: #eff8ff !important;
}

.st-row.is-watchlist:hover {
    background-color: #e6f2ff !important;
}

.st-row .st-col {
    font-size: 13px;
    color: #374151;
    text-align: center;
    white-space: nowrap;
}

/* 排名序号 */
.st-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    font-size: 12px;
    color: #9CA3AF;
    background: #F3F4F6;
    margin-right: 10px;
    flex-shrink: 0;
}

.st-row:nth-child(-n+3) .st-rank {
    background: linear-gradient(135deg, #FEF3C7, #FDE68A);
    color: #92400E;
    font-weight: 600;
}

/* 股票名称信息 */
.st-name-info {
    display: inline-flex;
    flex-direction: row;
    align-items: baseline;
    gap: 6px;
}

.st-name {
    font-size: 14px;
    font-weight: 500;
    color: #1F2937;
    cursor: pointer;
}

.st-name:hover { color: #2563EB; }

.st-code {
    font-size: 12px;
    color: #9CA3AF;
    cursor: pointer;
}

/* 价格 */
.st-price {
    font-weight: 500;
}

/* 涨跌幅 */
.st-pct {
    font-weight: 500;
}

/* 颜色 */
.st-row .up   { color: #DC2626; }
.st-row .down { color: #059669; }

/* 星标图标 */
.star-icon {
    cursor: default;
    vertical-align: middle;
}

.star-filled {
    color: #F59E0B;
}

.star-outline {
    color: #D1D5DB;
}

/* 加载更多提示 */
.load-more-hint {
    text-align: center;
    padding: 12px;
    color: #9CA3AF;
    font-size: 13px;
}

.table-empty {
    text-align: center;
    color: #9CA3AF;
    padding: 60px 0;
    font-size: 14px;
}

/* 错误提示 */
.block-error-msg {
    margin: 8px 12px 4px;
    padding: 10px 14px;
    background: #FEF2F2;
    border: 1px solid #FECACA;
    border-radius: 8px;
    color: #DC2626;
    font-size: 12px;
    line-height: 1.5;
}

/* ===== 响应式设计 ===== */
@media (max-width: 1024px) {
    .block-sidebar {
        width: 200px;
        min-width: 170px;
    }
    .block-item-name {
        max-width: 110px;
        font-size: 13px;
    }
    .st-hide-sm { display: none; }
}

@media (max-width: 768px) {
    .block-page {
        flex-direction: column;
    }
    .block-sidebar {
        width: 100%;
        min-height: auto;
        max-height: 45vh;
        border-right: none;
        border-bottom: 1px solid #E5E7EB;
    }
    .block-list-wrap {
        max-height: calc(45vh - 90px);
    }
    .st-hide-sm { display: none; }
    .header-meta {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .sidebar-header { padding: 12px; }
    .stock-area-header { padding: 14px 12px; }
    .stock-area-header h2 { font-size: 17px; }
    .st-header, .st-row { padding: 9px 10px; }
    .st-name-col { min-width: 120px; }
    .st-name { font-size: 13px; }
    .st-price-col { width: 70px; }
    .st-pct-col { width: 75px; }
}
