/* 下拉框和多选框样式 */
.dropdown,
.multiselect-container {
    position: relative;
    width: 100%;
    margin-bottom: 4px; /* 进一步减少底部边距 */
}

label {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.85rem;
    height: 14px; /* 进一步减少label高度 */
}

.select-dropdown,
.multiselect-dropdown {
    width: 100%;
    padding: 8px 0;
    padding-right: 25px; /* 减少右侧内边距 */
    border: none;
    background-color: transparent;
    font-size: 0.95rem;
    color: var(--text-primary);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0 center;
    cursor: pointer;
    transition: color 0.2s;
}

.select-dropdown:focus,
.multiselect-dropdown:focus {
    outline: none;
    color: var(--primary-color);
}

/* 多选下拉框特有样式 */
.multiselect-container {
    position: relative;
    margin-bottom: 4px; /* 进一步减少底部边距 */
    width: 100%;
}

.multiselect-dropdown {
    height: auto;
    min-height: 42px;
    padding: 8px 12px;
    padding-right: 40px; /* 增加右侧内边距，避免箭头和文字重叠 */
    width: 100%; /* 确保宽度与容器一致 */
    opacity: 0; /* 初始隐藏，由JS控制显示 */
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    max-height: 200px; /* 限制下拉框最大高度 */
    overflow-y: auto; /* 添加滚动条 */
}

.multiselect-dropdown option {
    padding: 8px;
    font-size: 1rem;
    background-color: var(--background-primary);
    color: var(--text-primary);
}

.multiselect-dropdown option:hover,
.multiselect-dropdown option:focus {
    background-color: var(--primary-light);
    color: white;
}

/* 显示选定选项的容器 */
.selected-options {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 8px 0;
    min-height: 42px;
    border: none;
    background-color: transparent;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0 center;
    cursor: pointer;
    padding-right: 25px; /* 为下拉箭头留出空间 */
    position: relative;
    z-index: 2; /* 确保显示在下拉框上方 */
}

.selected-option {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    background-color: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    gap: 5px; /* 控制图标和文字之间的间距 */
}

.selected-option i.fa-times {
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.selected-option i.fa-times:hover {
    opacity: 1;
}

.placeholder {
    color: var(--text-light);
    font-style: italic;
}

/* 筛选部分样式 */
.filter-section {
    margin-top: 0.75rem;
    margin-bottom: 1rem;
}

.filter-dropdowns-row {
    display: flex;
    gap: 0.5rem; /* 进一步减少间距 */
    align-items: flex-start; /* 改为flex-start，让所有元素从顶部开始对齐 */
    width: 100%;
}

.filter-dropdown-group {
    min-width: 0; /* 允许缩小 */
}

.filter-dropdown-group.type-dropdown {
    flex: 1.5; /* 榜单领域占1.5份 */
    min-width: 0; /* 允许缩小 */
}

.reset-btn {
    flex: 0 0 auto; /* 不伸展，只占用内容宽度 */
    padding: 8px 0; /* 与下拉框padding匹配 */
    background-color: transparent;
    color: var(--text-secondary);
    border: none;
    cursor: pointer;
    transition: color 0.2s;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px; /* 进一步减少图标和文字间距 */
    height: 38px; /* 与新的下拉框高度对齐 */
    margin-top: 18px; /* 18px = label高度14px + margin-bottom 4px，与下拉框对齐 */
    white-space: nowrap; /* 防止文字换行 */
}

.reset-btn:hover {
    color: var(--primary-color);
}

/* 自定义下拉框选项样式 */
.dropdown-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--background-primary);
    border: 1px solid var(--border-light);
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
}

.dropdown-option {
    padding: 10px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background-color 0.2s;
    font-size: 0.9rem;
}

.dropdown-option:hover {
    background-color: var(--background-secondary);
}

.dropdown-option.active {
    background-color: var(--background-accent);
    color: var(--primary-color);
}

.dropdown-option i:first-child {
    margin-right: 8px;
    flex-shrink: 0;
}

.dropdown-option .fa-check {
    margin-left: auto;
    margin-right: 0;
    color: var(--primary-color);
    flex-shrink: 0;
}

.dropdown-option.active .fa-check {
    color: var(--primary-color);
}

/* 分组下拉美化 */
.dropdown-group.level1 > .dropdown-label {
    font-weight: bold;
    font-size: 1.08rem;
    margin-left: 0;
    margin-bottom: 4px;
    color: #1e40af;
}
.dropdown-group.level2 > .dropdown-label {
    font-weight: 600;
    font-size: 1rem;
    margin-left: 1em;
    margin-bottom: 2px;
    color: #374151;
}
.dropdown-group.level3 > .dropdown-label {
    font-weight: 500;
    font-size: 0.97rem;
    margin-left: 2em;
    color: #555;
}
.dropdown-group.level1 {
    margin-left: 0;
}
.dropdown-group.level2 {
    margin-left: 1em;
}
.dropdown-group.level3 {
    margin-left: 2em;
}
.dropdown-leaf {
    display: flex;
    align-items: center;
    font-size: 0.97rem;
    font-weight: 400;
    margin-left: 2.5em;
    margin-bottom: 2px;
    color: #222;
}
.dropdown-leaf input[type="checkbox"] {
    margin-right: 7px;
}

.dataset-detail-container {
    max-width: 1500px;
    margin: 0 auto;
    padding: 16px;
}

.back-to-leaderboard {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #1e40af;
    text-decoration: none;
    margin-bottom: 30px;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
    padding: 8px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #ffffff;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.back-to-leaderboard:hover {
    color: #1e40af;
    background: #f1f5f9;
    border-color: #cbd5e1;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    transform: translateY(-1px);
}

.dataset-header {
    background: #1e40af;
    color: #fff !important;
    padding: 10px 20px 10px 20px;
    border-radius: 14px;
    margin-bottom: 18px;
    box-shadow: 0 10px 18px -5px rgb(0 0 0 / 0.1),
        0 4px 8px -2px rgb(0 0 0 / 0.04);
    position: relative;
    overflow: hidden;
}
.dataset-header * {
    color: #fff !important;
    font-family: "Segoe UI", Arial, sans-serif;
}
.dataset-header::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: radial-gradient(
            circle at 1px 1px,
            rgba(255, 255, 255, 0.1) 1px,
            transparent 0
        ),
        linear-gradient(
            45deg,
            transparent 40%,
            rgba(255, 255, 255, 0.05) 50%,
            transparent 60%
        );
    background-size: 20px 20px, 40px 40px;
    animation: textureMove 20s linear infinite;
    pointer-events: none;
}

@keyframes textureMove {
    0% {
        transform: translateX(0) translateY(0);
    }
    100% {
        transform: translateX(20px) translateY(20px);
    }
}

.dataset-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    min-height: 1.2em;
    line-height: 1.1;
}

/* 恢复affiliation全局样式 */
.dataset-affiliation {
    font-size: 1.05rem;
    opacity: 0.95;
    margin-bottom: 10px;
    color: #222;
    font-weight: 500;
}
/* 只在comparison页面下的数据卡片内字体为白色 */
.comparison-page .dataset-header .dataset-affiliation,
.comparison-page .dataset-header * {
    color: #fff !important;
}

.dataset-basic-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.info-item {
    background: rgba(255, 255, 255, 0.15);
    padding: 20px 15px;
    border-radius: 12px;
    text-align: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.info-item:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.info-label {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 5px;
}

.info-value {
    font-size: 1.4rem;
    font-weight: 600;
}

.external-links {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 0;
    margin-left: 0;
}

.external-link {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.3);
    font-size: 0.9rem;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

.external-link:hover {
    background: rgba(255, 255, 255, 0.35);
    color: white;
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.content-section {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.08),
        0 10px 10px -5px rgb(0 0 0 / 0.04);
    margin-bottom: 38px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.content-section:hover {
    box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.12),
        0 15px 20px -5px rgb(0 0 0 / 0.08);
    transform: translateY(-2px);
}

.section-header {
    background: #f8fafc;
    padding: 25px 30px;
    border-bottom: 1px solid #e2e8f0;
    position: relative;
}

.section-header::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 2px,
        rgba(30, 64, 175, 0.03) 2px,
        rgba(30, 64, 175, 0.03) 4px
    );
    pointer-events: none;
}

.section-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: #111827;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tag-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    margin: 2px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
}

.tag-badge.small {
    padding: 2px 6px;
    font-size: 0.7rem;
}

.tag-badge i {
    font-size: 0.7rem;
}

/* 比较数据集列表中的标签颜色样式 */
.compare-dataset-item .tag-badge[data-type="general"] {
    background-color: #e3f2fd;
    color: #1976d2;
    border-color: #bbdefb;
}

.compare-dataset-item .tag-badge[data-type="math"] {
    background-color: #f3e5f5;
    color: #7b1fa2;
    border-color: #e1bee7;
}

.compare-dataset-item .tag-badge[data-type="code"] {
    background-color: #e8f5e8;
    color: #388e3c;
    border-color: #c8e6c9;
}

.compare-dataset-item .tag-badge[data-type="science"] {
    background-color: #fff3e0;
    color: #f57c00;
    border-color: #ffcc02;
}

.section-content {
    padding: 40px;
}

.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    flex-direction: column;
    gap: 20px;
}

.error-message {
    text-align: center;
    padding: 40px;
    color: #dc3545;
}

.dual-charts-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 44px;
    margin-bottom: 38px;
    margin-top: 15px;
}

.chart-container {
    margin-bottom: 0;
}

.chart-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1d4ed8;
    margin-bottom: 20px;
    text-align: center;
}

.chart-wrapper {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    position: relative;
    height: 520px;
}

.domain-selection {
    margin-bottom: 20px;
}

.domain-tabs {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.domain-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0.6rem 1rem;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #6b7280;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    font-size: 0.875rem;
    font-weight: 500;
}

.domain-tab:hover {
    border-color: #1e40af;
    color: #1e40af;
    background: #f1f5f9;
}

.domain-tab.active {
    background: #1e40af;
    color: #ffffff;
    border-color: #1e40af;
}

/* 领域选项卡特定类型颜色样式 */
.domain-tab[data-type="general"] {
    background-color: #e3f2fd;
    color: #1976d2;
    border-color: #bbdefb;
}

.domain-tab[data-type="general"]:hover {
    background-color: #bbdefb;
    color: #1565c0;
    border-color: #90caf9;
}

.domain-tab[data-type="general"].active {
    background-color: #1976d2;
    color: white;
    border-color: #1976d2;
}

.domain-tab[data-type="math"] {
    background-color: #f3e5f5;
    color: #7b1fa2;
    border-color: #e1bee7;
}

.domain-tab[data-type="math"]:hover {
    background-color: #e1bee7;
    color: #6a1b9a;
    border-color: #ce93d8;
}

.domain-tab[data-type="math"].active {
    background-color: #7b1fa2;
    color: white;
    border-color: #7b1fa2;
}

.domain-tab[data-type="code"] {
    background-color: #e8f5e8;
    color: #388e3c;
    border-color: #c8e6c9;
}

.domain-tab[data-type="code"]:hover {
    background-color: #c8e6c9;
    color: #2e7d32;
    border-color: #a5d6a7;
}

.domain-tab[data-type="code"].active {
    background-color: #388e3c;
    color: white;
    border-color: #388e3c;
}

.domain-tab[data-type="reasoning"] {
    background-color: #e8eaf6;
    color: #3f51b5;
    border-color: #c5cae9;
}

.domain-tab[data-type="reasoning"]:hover {
    background-color: #c5cae9;
    color: #303f9f;
    border-color: #9fa8da;
}

.domain-tab[data-type="reasoning"].active {
    background-color: #3f51b5;
    color: white;
    border-color: #3f51b5;
}

.domain-tab input[type="checkbox"] {
    display: none;
}

.dynamic-chart-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #1e40af;
    margin-top: 25px;
    margin-bottom: 5px;
    text-align: center;
    min-height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-btn .back-text {
    max-width: 0;
    opacity: 0;
    margin-left: 0;
    transition: max-width 0.3s, opacity 0.3s, margin-left 0.3s;
    display: inline-block;
    vertical-align: middle;
    font-size: 0.95rem;
}
.back-btn:hover {
    background: var(--primary-dark);
    color: #fff;
}
.back-btn:hover .back-text {
    max-width: 120px;
    opacity: 1;
    margin-left: 0.4rem;
}
.back-btn i {
    font-size: 1rem;
}

.chart-legend-wrap {
    max-width: 100%;
    white-space: normal !important;
    word-break: break-all;
    overflow-wrap: break-word;
}

@media (max-width: 768px) {
    .back-btn {
        position: static;
        margin-bottom: 1rem;
        right: auto;
        bottom: auto;
        width: auto;
        display: inline-flex;
        font-size: 1rem;
        padding: 0.6rem 1.2rem;
    }

    .dataset-title {
        font-size: 2rem;
    }

    .external-links {
        justify-content: center;
    }

    .section-content {
        padding: 20px;
    }

    .dual-charts-container {
        grid-template-columns: 1fr;
        gap: 20px;
        margin-top: 10px;
    }

    .chart-tabs {
        margin-bottom: 15px;
    }

    .chart-wrapper {
        height: 350px;
        max-width: 100%;
    }

    .chart-tabs {
        gap: 4px;
    }

    .chart-tab {
        font-size: 0.8rem;
        padding: 6px 12px;
    }
}
