/* ===== 基础样式重置 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Manrope', system-ui, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f5f5;
    padding-top: 76px;
}

/* ===== 导航栏 - 完全统一风格 ===== */
.navbar {
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 50;
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.navbar.scrolled {
    background-color: rgba(255, 255, 255, 0.98);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.nav-container {
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    font-family: 'Manrope', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-weight: 700;
    font-size: 24px;
    letter-spacing: 0.02em;
    color: #00838f;
    transition: opacity 0.2s;
}

.nav-logo:hover {
    opacity: 0.85;
}

.nav-logo img {
    height: 48px;
    width: auto;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 32px;
    margin: 0;
    padding: 0;
}

.nav-menu a {
    color: #475569;
    text-decoration: none;
    font-weight: 500;
    font-size: 16px;
    padding: 8px 0;
    transition: all 0.2s ease;
    position: relative;
}

.nav-menu a:hover {
    color: #00838f;
}

.nav-menu a.active {
    color: #00838f;
    border-bottom: 2px solid #00838f;
}

.nav-menu a.active-bg {
    background: rgba(0, 131, 143, 0.1);
    color: #006064;
    border-radius: 5px;
    padding: 8px 15px;
}

/* ===== 下拉菜单样式 - 与导航栏风格统一 ===== */
.dropdown {
    position: relative;
}

.dropdown-toggle {
    cursor: pointer;
}

.dropdown-toggle .fa-chevron-down {
    transition: transform 0.25s ease;
    font-size: 0.7em;
    margin-left: 6px;
}

.dropdown:hover .fa-chevron-down {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(-5px);
    transform-origin: top center;
    background: rgba(233, 250, 253, 0.98);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 10px;
    padding: 8px 0;
    min-width: 190px;
    box-shadow: 0 8px 25px rgba(0, 131, 143, 0.15);
    list-style: none;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
    border: 1px solid rgba(0, 131, 143, 0.15);
    z-index: 1000;
    pointer-events: none;
}

.dropdown-menu::before {
    content: '';
    position: absolute;
    top: -7px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-bottom: 7px solid rgba(194, 239, 246, 0.98);
    filter: drop-shadow(0 -1px 2px rgba(0, 131, 143, 0.05));
}

.dropdown:hover .dropdown-menu,
.dropdown-menu:hover {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.dropdown-menu li {
    height: auto;
    display: block;
    padding: 2px 8px;
}

.dropdown-menu a {
    color: #00838f;
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 0.95rem;
    gap: 12px;
    white-space: nowrap;
    justify-content: flex-start;
    background: transparent;
    transition: all 0.2s ease;
    font-weight: 500;
}

.dropdown-menu a:hover {
    background: rgba(0, 131, 143, 0.08);
    color: #006064;
}

.dropdown-menu a i {
    width: 20px;
    text-align: center;
    color: #00838f;
    opacity: 0.8;
}

.dropdown-menu a:hover i {
    opacity: 1;
}

/* ===== 页面主体布局 ===== */
.page-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 24px 30px;
    display: flex;
    gap: 24px;
    min-height: calc(100vh - 76px);
}

/* ===== 左侧筛选面板 ===== */
.filter-panel {
    width: 320px;
    min-width: 320px;
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    height: fit-content;
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.filter-panel::-webkit-scrollbar {
    width: 4px;
}

.filter-panel::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.filter-panel::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.filter-panel h2 {
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-panel h2 i {
    color: #00838f;
}

.filter-group {
    margin-bottom: 16px;
}

.filter-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
}

.filter-group label i {
    margin-right: 6px;
    color: #00838f;
    width: 16px;
}

.filter-group select,
.filter-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: #fafafa;
    transition: all 0.2s ease;
    color: #1e293b;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: #00838f;
    box-shadow: 0 0 0 3px rgba(0, 131, 143, 0.1);
    background: white;
}

.filter-group select:hover,
.filter-group input:hover {
    border-color: #94a3b8;
}

.filter-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.filter-group select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.filter-group .range-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group .range-inputs input {
    width: calc(50% - 4px);
    padding: 8px 10px;
}

.filter-group .range-inputs span {
    color: #94a3b8;
    font-weight: 500;
}

.filter-divider {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 14px 0;
}

/* 搜索按钮 */
.search-btn {
    width: 100%;
    padding: 12px;
    background: #00838f;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.search-btn:hover {
    background: #006064;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 131, 143, 0.3);
}

.search-btn:active {
    transform: translateY(0);
}

.search-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.reset-btn {
    width: 100%;
    padding: 10px;
    background: transparent;
    color: #64748b;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
}

.reset-btn:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

/* 隐藏工具筛选 */
.tool-filter-hidden {
    display: none !important;
}

.tool-filter-visible {
    display: block !important;
}

/* ===== 右侧内容区域 ===== */
.content-panel {
    flex: 1;
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    min-height: 500px;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.content-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
}

.content-header .result-count {
    font-size: 14px;
    color: #64748b;
    background: #f1f5f9;
    padding: 4px 14px;
    border-radius: 20px;
}

.table-wrapper {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

/* ===== 表格样式 ===== */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

thead {
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
}

thead th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    white-space: nowrap;
    position: sticky;
    top: 0;
    background: #f8fafc;
    z-index: 2;
}

thead th i {
    margin-right: 4px;
}

thead th.sortable {
    cursor: pointer;
    user-select: none;
}

thead th.sortable:hover {
    color: #1e293b;
}

thead th.sortable::after {
    content: '↕';
    font-size: 10px;
    margin-left: 4px;
    opacity: 0.3;
}

thead th.sortable.asc::after {
    content: '↑';
    opacity: 1;
}

thead th.sortable.desc::after {
    content: '↓';
    opacity: 1;
}

tbody tr {
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s ease;
}

tbody tr:hover {
    background: #f8fafc;
}

tbody tr:last-child {
    border-bottom: none;
}

tbody td {
    padding: 12px 16px;
    color: #1e293b;
    vertical-align: middle;
}

/* ===== 操作按钮（表格内的按钮） ===== */
.action-btn {
    padding: 6px 14px;
    border: none;
    border-radius: 6px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.action-btn i {
    font-size: 12px;
}

.action-btn-exp {
    background: #dbeafe;
    color: #1d4ed8;
}

.action-btn-exp:hover {
    background: #bfdbfe;
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(29, 78, 216, 0.15);
}

.action-btn-motif {
    background: #fce7f3;
    color: #be185d;
}

.action-btn-motif:hover {
    background: #fbcfe8;
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(190, 24, 93, 0.15);
}

.action-btn.loading {
    opacity: 0.6;
    cursor: wait;
    pointer-events: none;
}

/* ===== 下载按钮 ===== */
.download-btn {
    padding: 8px 16px;
    background: #00838f;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    display: none;
    align-items: center;
    gap: 8px;
}

.download-btn.show {
    display: inline-flex;
}

.download-btn:hover {
    background: #006064;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 131, 143, 0.3);
}

.download-btn:active {
    transform: translateY(0);
}

.download-btn i {
    font-size: 14px;
}

/* ===== 详情面板（图片展示区域） ===== */
.detail-panel {
    margin-top: 20px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px 24px;
    display: none;
    min-height: 100px;
    transition: all 0.3s ease;
}

.detail-panel.active {
    display: block;
    animation: fadeSlide 0.35s ease;
}

@keyframes fadeSlide {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.detail-panel .detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.detail-panel .detail-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-panel .detail-header h3 i {
    color: #00838f;
}

.detail-panel .detail-header h3 span {
    font-weight: 400;
    color: #64748b;
    font-size: 14px;
}

.detail-panel .close-detail {
    background: none;
    border: none;
    font-size: 18px;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.detail-panel .close-detail:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.detail-panel .detail-image-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 120px;
    background: #ffffff;
    border-radius: 10px;
    border: 1px dashed #d1d9e6;
    padding: 20px;
}

.detail-panel .detail-image-container img {
    max-width: 100%;
    max-height: 500px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.detail-panel .detail-image-container .placeholder-text {
    color: #94a3b8;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-panel .detail-image-container .placeholder-text i {
    font-size: 18px;
}

.detail-panel .detail-image-container .loading-img {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: #94a3b8;
}

.detail-panel .detail-image-container .spinner-small {
    width: 28px;
    height: 28px;
    border: 3px solid #e2e8f0;
    border-top: 3px solid #00838f;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ===== 状态标签 ===== */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-up {
    background: #dcfce7;
    color: #166534;
}

.badge-down {
    background: #fef2f2;
    color: #991b1b;
}

.badge-neutral {
    background: #f1f5f9;
    color: #475569;
}

.badge-tool {
    background: #e0f2fe;
    color: #0369a1;
}

.badge-event {
    background: #e0f2fe;
    color: #0369a1;
}

/* ===== 分页 ===== */
.pagination {
    display: none;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
    flex-wrap: wrap;
    gap: 12px;
}

.pagination.show {
    display: flex;
}

.pagination-info {
    font-size: 14px;
    color: #64748b;
}

.pagination-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.pagination-buttons button {
    padding: 6px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: white;
    color: #475569;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s ease;
    min-width: 36px;
}

.pagination-buttons button:hover:not(:disabled) {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.pagination-buttons button.active {
    background: #00838f;
    border-color: #00838f;
    color: white;
}

.pagination-buttons button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ===== 空状态 ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 18px;
    color: #64748b;
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
}

/* ===== 加载状态 ===== */
.loading-state {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
}

.loading-state .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f1f5f9;
    border-top: 4px solid #00838f;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ===== 额外样式 ===== */
.stage-checkboxes {
    max-height: 120px;
    overflow-y: auto;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 10px;
    background: #fafafa;
}

.stage-checkboxes::-webkit-scrollbar {
    width: 4px;
}

.stage-checkboxes::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.stage-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
    font-size: 13px;
    color: #1e293b;
    cursor: pointer;
}

.stage-checkbox-item:hover {
    background: #f1f5f9;
}

.stage-checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #00838f;
    cursor: pointer;
    flex-shrink: 0;
}

.stage-select-all {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0 8px 0;
    font-size: 12px;
    font-weight: 600;
    color: #00838f;
    cursor: pointer;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 4px;
}

.stage-select-all input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #00838f;
    cursor: pointer;
}

.stage-select-all:hover {
    color: #006064;
}

.filter-group .selected-count {
    font-size: 12px;
    color: #94a3b8;
    margin-left: 4px;
}

/* 加载状态 */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
    z-index: 999;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 16px;
}

.loading-overlay.active {
    display: flex;
}

.loading-overlay .spinner-large {
    width: 50px;
    height: 50px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #00838f;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.loading-overlay p {
    color: #475569;
    font-weight: 500;
    font-size: 16px;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .stage-checkboxes {
        max-height: 100px;
    }
}

/* ===== 箱线图容器 - 自适应缩放 ===== */
.detail-panel .detail-image-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 120px;
    width: 100%;
    background: #ffffff;
    border-radius: 10px;
    border: 1px dashed #d1d9e6;
    padding: 20px;
    overflow: hidden;
    position: relative;
}

/* 箱线图容器自适应 */
.detail-panel .detail-image-container .plotly-container {
    width: 100% !important;
    height: auto !important;
    min-height: 300px;
    max-height: 500px;
}

.detail-panel .detail-image-container .plotly-container .js-plotly-plot {
    width: 100% !important;
    height: 100% !important;
}

/* 确保 SVG 自适应 */
.detail-panel .detail-image-container svg {
    width: 100% !important;
    height: auto !important;
    max-height: 500px;
}

/* 图片自适应 */
.detail-panel .detail-image-container img {
    max-width: 100%;
    max-height: 500px;
    width: auto;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    object-fit: contain;
}

/* 加载状态和占位文本 */
.detail-panel .detail-image-container .placeholder-text {
    color: #94a3b8;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-align: center;
    flex-wrap: wrap;
    justify-content: center;
}

.detail-panel .detail-image-container .loading-img {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: #94a3b8;
}

.detail-panel .detail-image-container .spinner-small {
    width: 28px;
    height: 28px;
    border: 3px solid #e2e8f0;
    border-top: 3px solid #00838f;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}



/* 移动端适配 */
@media (max-width: 768px) {
    .detail-panel .detail-image-container .modebar {
        top: 6px !important;
        right: 6px !important;
        padding: 4px !important;
        border-radius: 8px !important;
    }
    
    .detail-panel .detail-image-container .modebar .modebar-btn {
        padding: 2px 6px !important;
        min-width: 24px !important;
        min-height: 24px !important;
    }
    
    .detail-panel .detail-image-container .modebar .modebar-btn svg {
        width: 14px !important;
        height: 14px !important;
    }
}


/* ===== 响应式 ===== */
@media (max-width: 1024px) {
    .page-container {
        flex-direction: column;
        padding: 16px;
    }

    .filter-panel {
        width: 100%;
        min-width: unset;
        position: relative;
        top: 0;
        max-height: none;
    }
}

@media (max-width: 768px) {
    .nav-container {
        padding: 0.75rem 1rem;
    }

    .nav-logo span {
        font-size: 18px;
    }

    .nav-logo img {
        height: 36px;
    }

    .nav-menu {
        gap: 12px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .nav-menu a {
        font-size: 13px;
        padding: 6px 0;
    }

    body {
        padding-top: 60px;
    }

    .page-container {
        padding: 12px;
    }

    .filter-panel {
        padding: 16px;
    }

    .content-panel {
        padding: 16px;
    }

    table {
        font-size: 12px;
    }

    thead th,
    tbody td {
        padding: 8px 10px;
    }

    .pagination {
        flex-direction: column;
        align-items: center;
    }

    .detail-panel {
        padding: 14px 16px;
    }

    .detail-panel .detail-image-container {
        padding: 12px;
        min-height: 80px;
    }

    .action-btn {
        padding: 4px 10px;
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .dropdown-menu {
        left: 0;
        transform: translateX(0) translateY(-5px);
        min-width: 140px;
    }

    .dropdown:hover .dropdown-menu {
        transform: translateX(0) translateY(0);
    }

    .content-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .filter-group .range-inputs {
        flex-direction: row;
        flex-wrap: nowrap;
    }

    .filter-group .range-inputs input {
        width: calc(50% - 4px);
        min-width: 0;
    }
}