/* 搜索表单样式 */
.search-section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    margin-bottom: 30px;
    position: relative;
    z-index: 1;
    max-width: 900px;
    width: 90%;
    margin: 0 auto;
}

.search-section h2 {
    font-size: 3.2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 25px;
}

.form-label {
    font-size: 2.2rem !important;
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 10px;
}

/* Select2 Customization */
.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;
}

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

.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #999 !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered[title]:not([title=""]) {
    color: #333 !important;
}

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

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--primary-color) !important;
}

.select2-dropdown {
    border: 2px solid #e9ecef !important;
    border-radius: 10px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1) !important;
    z-index: 9999 !important;
}

/* 设置下拉菜单的最大高度为原来的1.5倍 */
.select2-results__options {
    max-height: 525px !important;  /* Changed from 350px to 525px (350 * 1.5) */
    overflow-y: auto !important;
}

.select2-results {
    max-height: none !important;  /* 覆盖之前的设置 */
}

.select2-search--dropdown {
    display: block !important;
    padding: 8px;
}

.select2-search__field {
    width: 100% !important;
    padding: 8px !important;
    border: 1px solid #e9ecef !important;
    border-radius: 6px !important;
    font-size: 1.6rem !important;
}

/* 排序按钮样式 */
.sort-btn {
    background: none;
    border: none;
    cursor: pointer;
    margin-left: 5px;
    padding: 0;
    color: rgba(255,255,255,0.7);
    transition: color 0.3s;
}

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

.sort-btn .fa-sort-asc,
.sort-btn .fa-sort-desc {
    color: white;
}

/* Search form layout */
.search-form-container {
    position: relative;
    margin-bottom: 30px;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
}

.search-input-group {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
}

.select-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.search-button-container {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    height: 50px;
}

/* 搜索按钮位置调整 */
#searchForm .search-button-container .btn-primary {
    position: relative;
    top: 5px; /* 向下移动5像素 */
}

/* 确保Select2和按钮高度一致 */
.select2-container {
    width: 100% !important;
}

.select2-container .select2-selection--multiple {
    height: 50px !important;
    min-height: 50px !important;
    display: flex;
    align-items: center;
}

.select2-container--default .select2-selection--multiple .select2-selection__rendered {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    padding: 5px 10px;
}

/* 修改按钮样式，取消悬停动画 */
.btn-primary {
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 30px;
    background-color: var(--primary-color);
    border: none;
    font-size: 1.6rem;
    font-weight: 500;
    border-radius: 8px;
    transition: none; /* 取消所有过渡动画 */
}

.btn-primary:hover {
    background-color: #1a3b5c;
    transform: none; /* 取消悬停时的上移效果 */
    box-shadow: none; /* 取消悬停时的阴影效果 */
}

/* Results Section */
.results-section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: none;
    margin-top: 30px;
    display: none;
}

.results-section h3 {
    font-size: 2.8rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 25px;
}

.table {
    width: 100%;
    margin-bottom: 0;
}

.table th {
    font-size: 1.6rem;
    font-weight: 600;
    color: white;
    padding: 15px;
    border-bottom: 2px solid #e9ecef;
    background-color: var(--primary-color);
    height: 56px; /* 增加表头高度 */
}

.table td {
    font-size: 1.6rem;
    padding: 15px;
    vertical-align: middle;
    border-bottom: 1px solid #e9ecef;
    height: 56px; /* 确保数据行高度一致 */
}

.expression-value {
    padding: 8px 15px;
    border-radius: 6px;
    font-weight: 500;
    color: black;
    min-width: 100px;
    display: inline-block;
    text-align: center;
}

/* 多选标签和搜索框的布局优化 */
.select2-container--default .select2-selection--multiple {
    border: none !important;
    border-radius: 10px !important;
    min-height: 50px !important;
    padding: 5px !important;
    background-color: white !important;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.05) !important;
    position: relative !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__rendered {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 5px !important;
    padding-left: 5px !important;
    margin-left: 0px !important;
    line-height: 30px !important;
    min-height: 40px !important;
}

/* 搜索框布局优化 - 防止换行和跳动 */
.select2-search--inline {
    float: none !important;
    display: inline-block !important;
    flex: 1 !important;
    min-width: 150px !important;
    margin-left: 0px !important;
    order: 999 !important;
    position: relative !important;
    height: 30px !important;
}

.select2-search__field {
    width: 100% !important;
    min-width: auto !important;
    margin: 0 !important;
    padding: 0 8px !important;
    border: none !important;
    outline: none !important;
    background: transparent !important;
    line-height: 30px !important;
    height: 30px !important;
    position: relative !important;
}

/* 选择标签样式调整 */
.select2-container--default .select2-selection--multiple .select2-selection__choice {
    margin: 2px 5px 2px 0 !important;
    padding: 2px 10px !important;
    flex-shrink: 0 !important;
    position: relative !important;
    left: 10px !important;
    height: 30px !important;
    line-height: 26px !important;
    display: flex !important;
    align-items: center !important;
}

/* 清除按钮位置固定 */
.select2-selection__clear {
    position: absolute !important;
    left: 5px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    margin: 0 !important;
    padding: 0 5px !important;
    z-index: 10 !important;
}

/* 添加下拉三角图标 */
.select2-container--default .select2-selection--multiple:after {
    content: '\f0d7'; /* FontAwesome下拉三角形图标 */
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 1.4rem;
    pointer-events: none; /* 使点击能穿透到下面的元素 */
}

.select2-container--default.select2-container--focus .select2-selection--multiple {
    border: none !important;
    outline: none !important;
    box-shadow: inset 0 0 8px rgba(0,0,0,0.1) !important;
    background-color: white !important;
}

/* 基础样式 */
.select2-container--default .select2-selection--multiple .select2-selection__choice {
    color: white !important;
    border: none !important;
    background-color: #f39c12 !important;
    border-radius: 5px !important;
    font-size: 1.4rem !important;
    flex-shrink: 0 !important;
    height: 30px !important;
    line-height: 26px !important;
}

/* 不同gRNA标签的颜色 - 使用更具体的选择器 */
#searchForm .select2-container--default .select2-selection--multiple .select2-selection__choice:nth-child(2),
#searchForm .select2-container--default .select2-selection--multiple .select2-selection__choice:nth-child(2):hover {
    background-color: #3498db !important;
    color: white !important;
}

#searchForm .select2-container--default .select2-selection--multiple .select2-selection__choice:nth-child(3),
#searchForm .select2-container--default .select2-selection--multiple .select2-selection__choice:nth-child(3):hover {
    background-color: #e74c3c !important;
    color: white !important;
}

#searchForm .select2-container--default .select2-selection--multiple .select2-selection__choice:nth-child(4),
#searchForm .select2-container--default .select2-selection--multiple .select2-selection__choice:nth-child(4):hover {
    background-color: #31cc73 !important;
    color: white !important;
}

/* 确保移除按钮颜色正确 */
#searchForm .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: white !important;
    margin-right: 5px !important;
    font-weight: bold !important;
    display: flex !important;
    align-items: center !important;
    height: 26px !important;
}

#searchForm .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: rgba(255, 255, 255, 0.8) !important;
}

.select2-search__field::placeholder {
    color: #999 !important;
    opacity: 1 !important;
    font-size: 1.6rem !important;
}

/* 设置初始未选择状态的颜色 */
.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #999 !important;
}

/* 设置已选择状态的颜色 */
.select2-selection__rendered[title]:not([title="Type to search for a gene..."]) {
    color: #333 !important;
}

/* 确保下拉区域内的搜索框显示 */
.select2-search--dropdown {
    display: block !important;
}

.select2-results__option {
    padding: 10px 15px !important;
    font-size: 1.6rem !important;
}

.select2-container--default .select2-results__option {
    font-size: 1.6rem !important;
    padding: 12px 15px !important;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .search-section h2 {
        font-size: 2.4rem;
    }

    .results-section h3 {
        font-size: 2rem;
    }

    .form-label {
        font-size: 1.6rem;
    }

    .btn-primary {
        width: 100%;
    }
}

.table-responsive {
    max-height: 600px;
    overflow-y: auto;
}

:root {
    --bg-light: #F0F4F8;
    --bg-color: #F5F7FA;
}

body {
    font-family: 'Space Grotesk', sans-serif;
    color: var(--text-color);
    background: var(--bg-color);
    font-size: 10px;
    padding-top: 85px;
}

/* Search button adjustment for Line A */
.search-button-container {
    margin-top: 25px;
}

.main-content {
    padding-top: 40px;
}

/* 选项卡样式 - 更显眼的设计 */
.nav-tabs {
    border-bottom: none;
    margin-bottom: 30px;
    display: flex;
    justify-content: center;
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    justify-content: space-around;
    background: linear-gradient(to right, #E6EEF8, #EDF4FA, #E6EEF8);
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.nav-tabs:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: transparent;
    z-index: -1;
}

.nav-tabs > li {
    margin: 0 5px;
    float: none;
}

.nav-tabs > li > a {
    font-weight: 500;
    color: var(--tab-inactive);
    padding: 15px 20px;
    height: 60px;
    border: none;
    margin-right: 0;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.nav-tabs > li > a:hover {
    background-color: rgba(255, 255, 255, 0.8);
    color: var(--tab-hover);
    border: none;
}

.nav-tabs > li > a:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 3px;
    background-color: #4a90e2;
    transition: width 0.3s ease;
}

.nav-tabs > li > a:hover:after {
    width: 100%;
}

.nav-tabs > li.active > a,
.nav-tabs > li.active > a:hover,
.nav-tabs > li.active > a:focus {
    color: var(--primary-color);
    background: linear-gradient(to bottom, #ffffff, #f8fbff);
    border: none;
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

.nav-tabs > li.active > a:after {
    width: 100%;
    height: 3px;
    background-color: #4a90e2;
}

.nav-tabs > li > a i {
    margin-right: 8px;
    transition: transform 0.3s ease;
    color: var(--tab-inactive);
}

.nav-tabs > li > a:hover i {
    transform: translateY(-2px);
    color: var(--tab-hover);
}

.nav-tabs > li.active > a i {
    transform: translateY(-2px);
    color: #4a90e2;
}

/* 添加标签页高亮效果 */
.nav-tabs > li > a:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(74, 144, 226, 0.05);
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: -1;
    border-radius: 8px;
}

.nav-tabs > li > a:hover:before,
.nav-tabs > li.active > a:before {
    transform: translateY(0);
}

.tab-content {
    background: white;
    border-radius: 15px;
    padding: 35px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    min-height: 75vh;
    position: relative;
    transition: all 0.3s ease;
    border: 1px solid var(--border-light);
    margin-top: 10px;
}

.tab-content:hover {
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

.tab-pane {
    display: none;
    height: 100%;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.tab-pane.active {
    display: block;
}

/* 网络图容器样式 */
.network-container {
    width: 100%;  /* 使用全宽 */
    height: calc(75vh - 100px);
    position: relative;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);  /* 添加阴影效果 */
}

#grnaNetwork {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

/* Loading Overlay */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.25rem;
}

/* Adjust select2 selected item padding and prevent jumping */
.select2-container .select2-selection--single .select2-selection__rendered {
    padding-left: 15px;
}

/* Use flex layout for selection items */
.select2-container--default .select2-selection--multiple .select2-selection__rendered {
    display: flex !important;
    flex-wrap: wrap !important;
    padding-left: 25px !important;
    gap: 5px !important;
}

/* Remove the old margin styles */
.select2-container--default .select2-selection--multiple .select2-selection__choice {
    transition: none !important;
}

.select2-search--inline {
    transition: none !important;
}

.select2-container--default .select2-selection--multiple {
    padding-left: 0 !important;
}

/* Tab pane with more specific styling */
.tab-pane.active {
    display: block;
}

/* 调整各个功能视图的特定样式 */
/* Heatmap view */
#heatmap.tab-pane {
    padding: 0 10px;
}

/* Gene Search view specific */
#search.tab-pane .search-section {
    margin-top: 10px;
    transition: all 0.3s ease;
}

/* Network view specific */
#network.tab-pane .network-container {
    margin-top: 10px;
    transition: all 0.3s ease;
    border: 1px solid var(--border-light);
}

/* 为选项卡添加响应式调整 */
@media (max-width: 768px) {
    .nav-tabs {
        flex-wrap: wrap;
    }
    
    .nav-tabs > li {
        margin: 0 8px;
    }
    
    .nav-tabs > li > a {
        padding: 12px 15px;
        font-size: 1.6rem;
    }
    
    .nav-tabs > li > a i {
        font-size: 1.6rem;
    }
    
    .tab-content {
        padding: 25px;
    }
}

/* 优化表格外观，与标签页风格统一 */
.table th {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
    padding: 15px;
    border-top: none;
    border-bottom: 2px solid var(--border-light);
    transition: background-color 0.3s ease;
}

.table td {
    padding: 15px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-light);
    transition: background-color 0.3s ease;
}

.table tr:hover td {
    background-color: rgba(245, 247, 250, 0.5);
}

/* 优化标签页间距和比例 */
@media (min-width: 768px) {
    .nav-tabs > li {
        flex: 1;
        max-width: 200px;
        display: flex;
        justify-content: center;
    }
    
    .nav-tabs > li > a {
        width: 100%;
        justify-content: center;
    }
} 

/* 2nd gene - blue (for imap91) */
#searchForm91 .select2-container--default .select2-selection--multiple .select2-selection__choice:nth-child(2),
#searchForm91 .select2-container--default .select2-selection--multiple .select2-selection__choice:nth-child(2):hover {
    background-color: #3498db !important;
    border-color: #2563eb;
    color: white !important;
}

/* 3rd gene - red (for imap91) */
#searchForm91 .select2-container--default .select2-selection--multiple .select2-selection__choice:nth-child(3),
#searchForm91 .select2-container--default .select2-selection--multiple .select2-selection__choice:nth-child(3):hover {
    background-color: #e74c3c !important;
    border-color: #1d4ed8;
    color: white !important;
}

/* 4th gene - green (for imap91) */
#searchForm91 .select2-container--default .select2-selection--multiple .select2-selection__choice:nth-child(4),
#searchForm91 .select2-container--default .select2-selection--multiple .select2-selection__choice:nth-child(4):hover {
    background-color: #31cc73 !important;
    border-color: #059669;
    color: white !important;
}