/* 
 * tissue_compare.css
 * 双组织搜索功能的模块化CSS样式
 */

/* ===== 基础布局 ===== */
.search-section {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    position: relative;
    z-index: 100;
}

/* 搜索表单样式 */
#searchForm .form-group {
    margin-bottom: 0;
}

#searchForm .btn-search {
    height: 50px;
    line-height: 50px;
    font-size: 1.6rem;
    padding: 0;
    margin-top: 0;
}

#searchForm .form-group label {
    margin-bottom: 0;
    height: 0;
    visibility: hidden;
}

/* 增加导航栏和主内容间距 */
.main-content {
    padding-top: 50px; /* 增加顶部内边距 */
    margin-top: 30px; /* 增加顶部外边距 */
}

.results-section {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

/* ===== 表格组件 ===== */
.table-responsive {
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 0;
    position: relative;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    display: block !important;
}

.table {
    margin-bottom: 0;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    display: table !important;
}

/* 表头样式 */
.table > thead > tr > th {
    display: table-cell !important;
    border-color: #e9ecef;
    padding: 12px 15px;
    vertical-align: middle;
    position: sticky !important;
    top: 0 !important;
    background-color: #2B4B6F !important;
    color: white !important;
    z-index: 10 !important;
    border-bottom: 2px solid #1a3253 !important;
    white-space: nowrap; /* 防止文本换行 */
    min-width: 100px; /* 设置最小宽度 */
    max-width: 200px; /* 设置最大宽度 */
    position: relative; /* 为绝对定位的排序按钮提供参考 */
    overflow: visible !important; /* 确保排序按钮不被截断 */
}

/* 调整特定列的宽度 */
.table > thead > tr > th:nth-child(5) {
    min-width: 180px; /* 增加第五列的最小宽度 */
    max-width: 250px;
    overflow: visible !important; /* 确保排序按钮不被截断 */
}

.table > thead > tr > th:nth-child(6) {
    min-width: 80px; /* 减少第六列的宽度 */
    max-width: 120px;
}

/* 表头文本样式 */
.table > thead > tr > th > span {
    display: inline-block;
    margin-right: 15px; /* 减少右侧边距，使文字和图标更靠近 */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: calc(100% - 25px); /* 为排序按钮留出空间 */
}

/* 排序按钮样式 */
.sort-btn {
    position: absolute;
    right: 8px; /* 调整右侧位置 */
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: color 0.2s ease;
    width: 16px; /* 减小宽度 */
    text-align: center;
    display: inline-block; /* 使用inline-block */
    vertical-align: middle; /* 确保垂直对齐 */
    line-height: 1; /* 重置行高 */
    padding: 0; /* 移除内边距 */
    margin: 0; /* 移除外边距 */
    z-index: 11; /* 确保按钮在最上层 */
}

.sort-btn:hover {
    color: white;
}

.sort-btn[data-order="asc"] i:before {
    content: "\f0de"; /* 升序图标 */
}

.sort-btn[data-order="desc"] i:before {
    content: "\f0dd"; /* 降序图标 */
}

/* 表体单元格样式 */
.table > tbody > tr > td {
    padding: 12px 15px;
    vertical-align: middle;
    border-top: 1px solid #e9ecef;
}

/* 表格行悬停效果 */
.table > tbody > tr:hover {
    background-color: rgba(0, 123, 255, 0.05);
}

/* ===== 表达值指示器 ===== */
.expression-value {
    display: inline-block;
    padding: 4px 10px !important;
    border-radius: 4px !important;
    color: black !important;
    font-weight: 500;
    min-width: 70px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.expression-value:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* ===== Select2下拉菜单 ===== */
.tissue-select-container .select2-container .select2-selection--single {
    height: 50px !important;
    border: 2px solid #e9ecef !important;
    border-radius: 10px !important;
    padding: 10px 15px !important;
    font-size: 1.6rem !important;
}

.tissue-select-container .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 28px !important;
    font-size: 1.6rem;
    color: #333;
}

.tissue-select-container .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 48px !important;
    right: 10px !important;
}

/* 修复下拉菜单类名 - Select2自动添加此类，不需要额外CSS类 */
.select2-dropdown {
    border: 2px solid #e9ecef !important;
    border-radius: 0 0 10px 10px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1) !important;
    z-index: 9999 !important;
    max-height: 600px !important;
    overflow: hidden !important;
    background-color: white !important;
}

/* 为下拉选项应用样式 */
.select2-results__option {
    padding: 10px 15px !important;
    font-size: 1.4rem !important;
    transition: all 0.2s ease;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #2B4B6F !important;
    color: white !important;
}

.select2-search--dropdown {
    padding: 10px !important;
}

.select2-search--dropdown .select2-search__field {
    border: 1px solid #e9ecef !important;
    border-radius: 5px !important;
    padding: 8px 12px !important;
    font-size: 1.4rem !important;
}

.select2-results {
    padding: 5px !important;
    max-height: 550px !important;
}

/* 设置Select2结果选项容器高度 */
.select2-results__options {
    max-height: 550px !important;
    overflow-y: auto !important;
    padding-bottom: 10px !important;
}

/* 组织选项样式 */
.tissue-option {
    display: block;
    padding: 5px 0;
    font-weight: 500;
}

/* 空选项样式 */
.select2-results__option[aria-disabled=true] {
    color: #999 !important;
    font-style: italic;
}

/* 改进选中项的样式 */
.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #2B4B6F !important;
    font-weight: 500 !important;
}

/* 改进清除按钮样式 */
.select2-container--default .select2-selection--single .select2-selection__clear {
    margin-right: 10px;
    font-size: 1.8rem;
    color: #dc3545;
    cursor: pointer;
}

/* 为Select2下拉菜单添加滚动条样式 */
.select2-results__options::-webkit-scrollbar {
    width: 8px;
}

.select2-results__options::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.select2-results__options::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}

.select2-results__options::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* ===== 火山图组件 ===== */
.volcano-plot-container {
    width: 100%; 
    height: 400px; 
    border: 1px solid #e9ecef; 
    border-radius: 8px; 
    background: white;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

/* 移除火山图悬停效果，防止鼠标悬停时面板上移 */
.volcano-plot-container:hover {
    box-shadow: none;
}

#volcanoPlot {
    width: 100%; 
    height: 100%;
}

/* ===== 结果计数样式 ===== */
.result-count {
    color: #666;
    margin-bottom: 15px;
    font-size: 1.4rem;
}

#resultCount {
    font-weight: bold;
    color: #2B4B6F;
}

/* ===== 加载动画 ===== */
#loadingOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255,255,255,0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #2B4B6F;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ===== 响应式设计 ===== */
@media (max-width: 768px) {
    .search-section, .results-section {
        padding: 1rem;
    }
    
    .table-responsive {
        max-height: 400px;
    }
    
    .volcano-plot-container {
        height: 300px;
    }
    
    .expression-value {
        min-width: 60px;
        padding: 3px 8px !important;
    }
    
    /* 调整表头在小屏幕上的显示 */
    .table > thead > tr > th {
        padding: 8px 10px;
        min-width: 80px;
        max-width: 150px;
        overflow: visible !important; /* 确保排序按钮不被截断 */
    }
    
    /* 调整特定列的宽度 */
    .table > thead > tr > th:nth-child(5) {
        min-width: 150px; /* 增加第五列的最小宽度 */
        max-width: 180px;
        overflow: visible !important; /* 确保排序按钮不被截断 */
    }
    
    .table > thead > tr > th:nth-child(6) {
        min-width: 70px; /* 减少第六列的宽度 */
        max-width: 100px;
    }
    
    .table > thead > tr > th > span {
        font-size: 0.9rem;
        margin-right: 12px; /* 减少右侧边距，使文字和图标更靠近 */
        max-width: calc(100% - 20px); /* 为排序按钮留出空间 */
    }
    
    .sort-btn {
        right: 6px;
        width: 14px;
    }
}

@media (max-width: 576px) {
    .search-section, .results-section {
        padding: 0.8rem;
    }
    
    .table > thead > tr > th,
    .table > tbody > tr > td {
        padding: 6px 8px;
        font-size: 0.85rem;
    }
    
    .volcano-plot-container {
        height: 250px;
    }
    
    /* 进一步调整表头在更小屏幕上的显示 */
    .table > thead > tr > th {
        min-width: 70px;
        max-width: 120px;
        overflow: visible !important; /* 确保排序按钮不被截断 */
    }
    
    /* 调整特定列的宽度 */
    .table > thead > tr > th:nth-child(5) {
        min-width: 120px; /* 增加第五列的最小宽度 */
        max-width: 150px;
        overflow: visible !important; /* 确保排序按钮不被截断 */
    }
    
    .table > thead > tr > th:nth-child(6) {
        min-width: 60px; /* 减少第六列的宽度 */
        max-width: 80px;
    }
    
    .table > thead > tr > th > span {
        font-size: 0.8rem;
        margin-right: 10px; /* 减少右侧边距，使文字和图标更靠近 */
        max-width: calc(100% - 18px); /* 为排序按钮留出空间 */
    }
    
    .sort-btn {
        right: 4px;
        width: 12px;
    }
} 