/**
 * BioCloud Platform - Enhanced Professional Styles
 * 生物云平台 - 增强专业样式
 * Version: 3.0
 * 设计理念: 科研专业、现代简洁、视觉舒适
 * 3.0 更新: 磨砂玻璃导航栏、柔和漫射阴影、品牌渐变主按钮、滚动渐显
 */

/* ========================================
   1. 全局样式与CSS变量
   ======================================== */

:root {
    /* 主色调 - 专业科研蓝（全局：导航 / 首页 / 指南 / 工具中心） */
    --primary-color: #1d4ed8;
    --primary-light: #3b82f6;
    --primary-dark: #1e3a8a;
    --primary-gradient: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 55%, #3b82f6 100%);
    --brand-indigo: #1d4ed8;   /* 兼容旧变量名：现为专业蓝 */
    --brand-violet: #2563eb;

    /* 工具工作台专属品牌红（仅分析工具页内使用） */
    --tool-red: #dc2626;
    --tool-red-dark: #b91c1c;
    --tool-gradient: linear-gradient(135deg, #d06458 0%, #e0393e 55%, #b91c1c 100%);

    /* 辅助色 - 生物科学绿 */
    --secondary-color: #10b981;
    --secondary-light: #34d399;
    --secondary-dark: #059669;

    /* 中性色 */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* 功能色 */
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --info-color: #3b82f6;

    /* 背景 */
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;

    /* 阴影 - 柔和漫射 */
    --shadow-sm: 0 1px 2px 0 rgba(16, 24, 40, 0.05);
    --shadow: 0 1px 3px 0 rgba(16, 24, 40, 0.08), 0 1px 2px -1px rgba(16, 24, 40, 0.04);
    --shadow-md: 0 1px 2px rgba(16, 24, 40, 0.06), 0 8px 24px -8px rgba(16, 24, 40, 0.10);
    --shadow-lg: 0 2px 4px rgba(16, 24, 40, 0.05), 0 16px 32px -12px rgba(16, 24, 40, 0.14);
    --shadow-xl: 0 4px 8px rgba(16, 24, 40, 0.04), 0 24px 48px -16px rgba(16, 24, 40, 0.18);

    /* 玻璃拟态与焦点环 */
    --glass-bg: rgba(255, 255, 255, 0.72);
    --ring: 0 0 0 4px rgba(29, 78, 216, 0.15);

    /* 圆角 */
    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;

    /* 动画 */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);

    /* 间距 */
    --spacing-xs: 0.5rem;
    --spacing-sm: 0.75rem;
    --spacing: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
}

/* ========================================
   2. 全局基础样式
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    color-scheme: light;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue',
                 'Arial', 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
    background: var(--bg-secondary);
    color: var(--gray-800);
    line-height: 1.6;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color-scheme: light;
}

/* 键盘导航焦点环（可访问性） */
:focus-visible {
    outline: 2px solid var(--primary-light);
    outline-offset: 2px;
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: var(--radius);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: var(--radius);
    transition: background var(--transition);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* ========================================
   3. 导航栏样式（磨砂玻璃）
   ======================================== */

.app-navbar {
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(14px) saturate(1.4);
    backdrop-filter: blur(14px) saturate(1.4);
    padding: 0.75rem 0;
    border-bottom: 1px solid transparent;
    transition: border-color var(--transition), box-shadow var(--transition);
    /* 高于页面内 sticky 元素（如指南目录 .sticky-top=1020），低于模态框(1050+)，
       保证「分析工具」下拉菜单始终在最上层 */
    z-index: 1040;
}

/* 页面滚动后显示细分隔线与轻阴影（由 main.js 添加 is-scrolled） */
.app-navbar.is-scrolled {
    border-bottom-color: var(--gray-200);
    box-shadow: var(--shadow-sm);
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900) !important;
    transition: transform var(--transition);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.navbar-brand:hover {
    transform: translateY(-2px);
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: auto;
    background: none;
    color: #e11d48;
    font-size: 1.6rem;
    transition: all var(--transition);
}

.brand-mark:hover {
    transform: rotate(5deg) scale(1.08);
}

.brand-logo-img {
    width: 30px;
    height: 30px;
    display: block;
    border-radius: 24%;
    box-shadow: 0 1px 4px rgba(185, 28, 28, 0.28);
}

.brand-logo-img-sm {
    width: 20px;
    height: 20px;
}

.brand-wordmark {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.brand-subtitle {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--gray-500);
    margin-top: -4px;
}

/* 导航栏链接（仅限顶部 navbar，避免污染页面内 pills/tabs） */
.app-navbar .nav-link {
    color: var(--gray-700) !important;
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    border-radius: var(--radius);
    transition: all var(--transition);
    position: relative;
}

.app-navbar .nav-link::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--brand-indigo);
    transform: translateX(-50%);
    transition: width var(--transition);
}

.app-navbar .nav-link:hover {
    background: var(--gray-100);
    color: var(--gray-900) !important;
}

.app-navbar .nav-link:hover::before {
    width: 80%;
}

.app-navbar .nav-link.active {
    background: rgba(220, 38, 38, 0.1);
    color: var(--brand-indigo) !important;
}

/* 移动端折叠按钮（浅色玻璃底上的深色图标由 Bootstrap 默认提供） */
.app-navbar .navbar-toggler {
    color: var(--gray-700);
    border-color: var(--gray-300);
}

.app-navbar .navbar-toggler:focus {
    box-shadow: var(--ring);
}

/* 下拉菜单 */
.dropdown-menu {
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-xl);
    border-radius: var(--radius-md);
    padding: 0.5rem;
    margin-top: 0.5rem;
    background: white;
    backdrop-filter: blur(10px);
}

/* 分析工具菜单过长时可上下滚动 */
.app-navbar .nav-item.dropdown > .dropdown-menu {
    max-height: min(75vh, 640px);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.app-navbar .dropdown-menu-tools {
    min-width: 280px;
}

.dropdown-item {
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.dropdown-item:hover {
    background: var(--gray-100);
    transform: translateX(4px);
}

.dropdown-item i {
    width: 20px;
    text-align: center;
}

/* 语言切换按钮 */
.btn-language {
    background: #fff;
    color: var(--gray-700) !important;
    border: 1px solid var(--gray-300);
    font-weight: 600;
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius-md);
    transition: all var(--transition);
}

.btn-language:hover {
    border-color: var(--brand-indigo);
    color: var(--brand-indigo) !important;
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.platform-tag {
    color: var(--gray-600);
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    background: var(--gray-100);
    border-radius: var(--radius-md);
}

/* ========================================
   4. 主内容区域
   ======================================== */

.app-main {
    min-height: calc(100vh - 120px);
    padding: 2rem 0;
}

.container {
    max-width: 1400px;
}

/* ========================================
   5. 页面标题区域
   ======================================== */

.page-header {
    background: var(--tool-gradient);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
    color: white;
    position: relative;
    overflow: hidden;
}

.page-header::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(30%, -30%);
}

.page-header h1 {
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
    z-index: 1;
}

.page-header h1 i {
    font-size: 2.5rem;
    opacity: 0.9;
}

.page-header p {
    font-size: 1.125rem;
    opacity: 0.95;
    margin: 0;
    position: relative;
    z-index: 1;
}

.page-header-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    position: relative;
    z-index: 1;
}

/* ========================================
   6. 卡片组件
   ======================================== */

/* Bootstrap 卡片与平台卡片统一：细边框 + 大圆角，悬浮时才浮现柔和阴影 */
.card,
.control-card,
.display-card {
    --bs-card-border-radius: var(--radius-lg);
    --bs-card-inner-border-radius: calc(var(--radius-lg) - 1px);
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: none;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.card:hover,
.control-card:hover,
.display-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.card-header {
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.analysis-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: none;
    border: 1px solid var(--gray-200);
    transition: all var(--transition);
}

.analysis-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--gray-100);
}

.section-title i {
    color: var(--primary-color);
    font-size: 1.5rem;
}

/* ========================================
   7. 表单控件
   ======================================== */

.form-label {
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-control,
.form-select,
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),
textarea,
select {
    color-scheme: light;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    font-size: 1rem;
    transition: border-color var(--transition), box-shadow var(--transition);
    background-color: #fff;
    color: var(--gray-800);
}

input[type="color"],
.form-control-color {
    color-scheme: light;
    background-color: #fff;
    padding: 0.15rem;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill {
    -webkit-text-fill-color: var(--gray-800);
    -webkit-box-shadow: 0 0 0 1000px #fff inset;
    box-shadow: 0 0 0 1000px #fff inset;
    caret-color: var(--gray-800);
    transition: background-color 99999s ease-out;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-light);
    box-shadow: var(--ring);
    outline: none;
}

.form-control:hover,
.form-select:hover {
    border-color: var(--gray-400);
}

.form-text {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

/* ========================================
   8. 按钮样式
   ======================================== */

.btn {
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    transition: all var(--transition);
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

/* 平台主行动按钮：品牌渐变（原 btn-danger） */
.btn-danger {
    background-color: #dc3545;
    color: #fff;
    border: none;
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
}

.btn-danger:hover,
.btn-danger:focus-visible {
    background-color: #bb2d3b;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-danger:active,
.btn-danger.active {
    background-color: #b02a37;
    color: #fff;
    transform: none;
}

.btn-danger:disabled,
.btn-danger.disabled {
    background-color: #dc3545;
    border: none;
    opacity: 0.55;
}

/* 次行动按钮：红色描边（下载示例数据等） */
.btn-outline-danger {
    border: 1.5px solid #dc3545;
    color: #dc3545;
    background: transparent;
    border-radius: 10px;
}

.btn-outline-danger:hover,
.btn-outline-danger:focus-visible {
    background: #dc3545;
    border-color: #dc3545;
    color: #fff;
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-success {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--secondary-dark) 100%);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning-color) 0%, #d97706 100%);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-outline-primary {
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    background: white;
}

.btn-outline-primary:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.btn-outline-secondary {
    border: 2px solid var(--gray-300);
    color: var(--gray-700);
    background: white;
}

.btn-outline-secondary:hover {
    border-color: var(--gray-400);
    background: var(--gray-50);
    transform: translateY(-2px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* 按钮组 */
.btn-group .btn {
    border-radius: 0;
}

.btn-group .btn:first-child {
    border-top-left-radius: var(--radius-md);
    border-bottom-left-radius: var(--radius-md);
}

.btn-group .btn:last-child {
    border-top-right-radius: var(--radius-md);
    border-bottom-right-radius: var(--radius-md);
}

/* ========================================
   9. 分析类型标签页
   ======================================== */

.analysis-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.analysis-tab {
    flex: 1;
    min-width: 110px;
    padding: 0.65rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    background: white;
    font-weight: 600;
    color: var(--gray-600);
    transition: all var(--transition);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
}

.analysis-tab::before {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--tool-gradient);
    transform: scaleX(0);
    transition: transform var(--transition);
}

.analysis-tab:hover {
    border-color: var(--tool-red);
    color: var(--tool-red);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.analysis-tab.active {
    background: var(--tool-gradient);
    color: white;
    border-color: var(--tool-red);
    box-shadow: var(--shadow-md);
}

.analysis-tab.active::before {
    transform: scaleX(1);
}

/* ========================================
   10. 数据集信息卡片
   ======================================== */

.dataset-info {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.08) 0%, rgba(224, 57, 62, 0.08) 100%);
    border: 1px solid rgba(220, 38, 38, 0.3);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.stat-item {
    background: white;
    padding: 1rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
}

.stat-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--gray-600);
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
}

/* ========================================
   11. 结果预览区域
   ======================================== */

.preview-box {
    background: var(--gray-50);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    min-height: 540px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.preview-box:has(img) {
    background: white;
    border-style: solid;
    padding: 0.75rem;
}

.preview-box img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}

.placeholder-content {
    text-align: center;
    color: var(--gray-400);
    max-width: 420px;
    padding: 1.5rem 1rem;
}

/* Only the hero icon — never inflate icons inside the example button */
.placeholder-content > i,
.placeholder-content > .suite-empty-icon {
    font-size: 3.2rem;
    margin-bottom: 0.35rem;
    opacity: 0.35;
    color: #dc2626;
    display: block;
    line-height: 1;
}

.placeholder-content h5 {
    margin: 0.75rem 0 0.35rem;
    font-size: 1.05rem;
    font-weight: 600;
    color: #374151;
}

.placeholder-content p {
    font-size: 0.875rem;
    margin: 0 0 1rem;
    line-height: 1.45;
    color: #6b7280;
}

.placeholder-content .btn {
    padding: 0.4rem 0.9rem;
    font-size: 0.875rem;
    line-height: 1.4;
    height: auto;
}

.placeholder-content .btn i {
    font-size: 0.875rem !important;
    opacity: 1 !important;
    margin: 0 0.25rem 0 0 !important;
    display: inline-block !important;
    color: inherit !important;
    line-height: 1;
}

/* ========================================
   12. 统计结果面板
   ======================================== */

.stats-panel {
    background: var(--info-color);
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-top: 1.5rem;
    box-shadow: var(--shadow-lg);
}

.stats-panel strong {
    font-weight: 700;
}

/* ========================================
   13. Toast 通知
   ======================================== */

.toast {
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    border: none;
    backdrop-filter: blur(10px);
}

.toast-success {
    background: linear-gradient(135deg, var(--success-color) 0%, var(--secondary-dark) 100%);
    color: white;
}

.toast-error {
    background: linear-gradient(135deg, var(--error-color) 0%, #dc2626 100%);
    color: white;
}

.toast-info {
    background: linear-gradient(135deg, var(--info-color) 0%, var(--primary-dark) 100%);
    color: white;
}

.toast-warning {
    background: linear-gradient(135deg, var(--warning-color) 0%, #d97706 100%);
    color: white;
}

/* ========================================
   14. 加载动画
   ======================================== */

.spinner-border {
    border-width: 3px;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
}

.loading-content {
    text-align: center;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--tool-red);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ========================================
   15. 页脚
   ======================================== */

.app-footer {
    background: var(--bg-primary);
    color: var(--gray-500);
    padding: 2.75rem 0;
    margin-top: 3rem;
    border-top: 1px solid var(--gray-200);
    font-size: 0.9rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

.footer-brand {
    min-width: 0;
}

.footer-brand-link {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--gray-900);
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: -0.02em;
    margin-bottom: 0.75rem;
    transition: color var(--transition);
}

.footer-brand-link:hover {
    color: var(--brand-indigo);
}

.footer-brand-mark {
    width: auto;
    height: auto;
    font-size: 1.3rem;
}

.footer-tagline {
    margin: 0;
    color: var(--gray-500);
    line-height: 1.6;
    max-width: 34ch;
}

.footer-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gray-400);
    margin-bottom: 0.85rem;
}

.footer-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.footer-links a {
    color: var(--gray-600);
    text-decoration: none;
    transition: color var(--transition);
}

.footer-links a:hover {
    color: var(--brand-indigo);
}

.footer-copy {
    margin: 0;
    color: var(--gray-500);
    line-height: 1.7;
}

/* ========================================
   16. 响应式设计
   ======================================== */

@media (max-width: 768px) {
    .page-header h1 {
        font-size: 1.75rem;
    }

    .page-header p {
        font-size: 1rem;
    }

    .analysis-tabs {
        flex-direction: column;
    }

    .analysis-tab {
        width: 100%;
    }

    .stat-grid {
        grid-template-columns: 1fr;
    }

    .page-header-actions {
        flex-direction: column;
    }

    .page-header-actions .btn {
        width: 100%;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* ========================================
   17. 工具提示
   ======================================== */

[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 1rem;
    background: var(--gray-800);
    color: white;
    border-radius: var(--radius);
    font-size: 0.875rem;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 0.5rem;
    box-shadow: var(--shadow-lg);
}

/* ========================================
   18. 动画效果
   ======================================== */

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

@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

.fade-in {
    animation: fadeIn var(--transition-slow) ease-out;
}

.slide-in {
    animation: slideIn var(--transition-slow) ease-out;
}

/* 减少动态偏好：关闭所有动画与过渡 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    html.bc-js .bc-reveal,
    .bc-reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* ========================================
   19. 辅助类
   ======================================== */

.text-gradient {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.badge-pro {
    background: var(--primary-gradient);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.divider {
    height: 1px;
    background: var(--gray-200);
    margin: 1.5rem 0;
}

/* 滚动渐显（由 main.js 的 IntersectionObserver 驱动） */
/* 仅在 JS 可用时隐藏待揭示元素（无 JS 时内容保持可见） */
html.bc-js .bc-reveal {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

html.bc-js .bc-reveal.is-visible {
    opacity: 1;
    transform: none;
}

/* ========================================
   Plot Area & Image Styles
   ======================================== */

.plot-area {
    min-height: 540px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px dashed var(--border, #dee2e6);
    border-radius: 10px;
    padding: .5rem;
    overflow: auto;
}

.plot-area .js-plotly-plot { width: 100% !important; }

.volcano-img { max-width: 100%; height: auto; border-radius: 6px; display: block; }

/* Heatmap: fill the card like Agent A, do not flex-shrink into a skinny strip. */
#hmPlotArea {
    align-items: stretch;
}
#hmPlotArea img.volcano-img {
    width: 100%;
    max-width: 100%;
    height: auto;
    flex-shrink: 0;
}

/* Data preview: light-gray labels + readable table text */
.bc-data-hint,
[id$="DataTableHint"],
#volcanoDataHint,
#m16OtuHint,
#m16MetaHint {
    color: #9ca3af !important;
    font-size: 0.8125rem;
    line-height: 1.45;
}
.bc-data-hint .bc-data-hint-label,
.bc-data-hint-label {
    color: #9ca3af !important;
}
.bc-data-hint code,
[id$="DataTableHint"] code,
#volcanoDataHint code,
#m16OtuHint code,
#m16MetaHint code {
    color: #9ca3af !important;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    font-size: 0.75rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    word-break: break-all;
}
.display-card .nav-pills .nav-link,
.analysis-card .nav-pills .nav-link,
#m16Tabs .nav-link,
#viewTabs .nav-link {
    color: #9ca3af !important;
    background: transparent;
}
.display-card .nav-pills .nav-link:hover,
.analysis-card .nav-pills .nav-link:hover,
#m16Tabs .nav-link:hover,
#viewTabs .nav-link:hover {
    color: #6b7280 !important;
    background: #f3f4f6;
}
.display-card .nav-pills .nav-link.active,
.analysis-card .nav-pills .nav-link.active,
#m16Tabs .nav-link.active,
#viewTabs .nav-link.active {
    color: #fff !important;
    background: var(--tool-gradient);
}
.data-preview {
    max-height: 560px;
    color: #4b5563;
}
.data-preview th {
    position: sticky;
    top: 0;
    background: #f9fafb;
    color: #9ca3af !important;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    z-index: 1;
}
.data-preview td {
    font-size: 0.78rem;
    color: #6b7280 !important;
}

#enPlotArea { overflow: auto; min-height: 540px; align-items: flex-start; }
#enPlotArea img.volcano-img {
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: none;
    flex-shrink: 0;
}

/* Stats bar chips */
.stats-bar { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: center; }
.stat-chip { font-size: .8rem; padding: .25rem .7rem; border-radius: 20px; background: #eef1f5; color: #2b2b2b; }
.stat-chip b { margin-left: .2rem; }
.stat-chip.c-up    { background: rgba(213,62,79,.14);   color: #9e1c2b; }
.stat-chip.c-down  { background: rgba(50,136,189,.14);  color: #256a97; }
.stat-chip.c-ns    { background: rgba(107,119,133,.14); color: #5a6270; }
.stat-chip.c-trend { background: rgba(244,162,97,.22);  color: #a85c1a; }
.stat-chip.c-fcup  { background: rgba(252,141,89,.18);  color: #b5561f; }
.stat-chip.c-fcdown{ background: rgba(153,213,148,.22); color: #3f7a45; }
.stat-chip.c-p     { background: rgba(254,224,139,.35); color: #937200; }
.stat-chip.c-total { background: #2b2b2b; color: #fff; }

@media (max-width: 768px) {
    .plot-area { min-height: 420px; }
}

/* ========================================
   20. 打印样式
   ======================================== */

@media print {
    .app-navbar,
    .app-footer,
    .btn,
    .analysis-tabs {
        display: none;
    }

    .analysis-card {
        box-shadow: none;
        border: 1px solid #000;
    }

    .preview-box img {
        max-width: 100%;
        page-break-inside: avoid;
    }
}

/* Data-loaded status chip (red frame for visibility) */
.data-status {
    font-size: .82rem;
    background: #fff5f5;
    border: 1.5px solid #dc3545;
    border-radius: 8px;
    padding: .4rem .65rem;
    color: #842029;
}
.data-status.is-error {
    background: #fdeeee;
    border-color: #b02a37;
}
.data-status .fa-circle-check { color: #dc3545; }

/* ── Unified data grid: visible cell borders + two-way scrolling ─────────── */
.bc-grid-scroll {
    overflow: auto;              /* horizontal + vertical scrolling */
    max-height: 65vh;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
}

.bc-grid-scroll .table {
    margin-bottom: 0;
}

/* Grid lines for every data table shown in the app */
.app-main .table {
    border-collapse: separate;
    border-spacing: 0;
}
.app-main .table > :not(caption) > * > th,
.app-main .table > :not(caption) > * > td {
    border: 1px solid #dfe5ee;
    padding: .4rem .6rem;
}
.app-main .table thead th {
    background: #f1f5f9;
    font-weight: 600;
    white-space: nowrap;
}

/* Sticky header inside scroll containers so wide/long tables stay readable */
.bc-grid-scroll .table thead th,
.table-responsive .table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f1f5f9;
    box-shadow: inset 0 -1px 0 #cbd5e1;
}

/* Allow vertical scrolling on responsive tables as well (Bootstrap only
   scrolls horizontally by default) */
.app-main .table-responsive {
    max-height: 70vh;
    overflow: auto;
}

/* ── Unified plot empty-state across all analysis modules ───────────── */
.app-main .bc-empty-state,
.bc-empty-state {
    min-height: 380px;
    width: 100%;
    max-width: none;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem 1rem;
}

.bc-empty-state > i.bc-empty-icon {
    font-size: 2.5rem;
    color: #cbd5e1;
    opacity: 1;
    margin-bottom: 0.9rem;
    display: block;
}

.bc-empty-title {
    font-weight: 600;
    color: #334155;
    font-size: 1rem;
    margin-bottom: 0.35rem;
}

.bc-empty-hint {
    color: #64748b;
    font-size: 0.88rem;
    margin-bottom: 1rem;
    max-width: 420px;
}

/* Below-plot color dock + current groups */
.plot-below-dock .plot-below-card {
    border: 1px solid #e2e8f0 !important;
}
#pbFontHost {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
    gap: 0.55rem 0.75rem;
    align-items: end;
}
#pbFontHost .pb-font-unit,
#pbFontHost .pb-moved-select {
    margin-bottom: 0 !important;
}
#pbFontHost .form-label,
#pbFontHost label {
    font-size: 0.78rem;
    margin-bottom: 0.2rem;
}
.plot-below-dock .card-header {
    background: transparent;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.92rem;
}
.pb-section-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 0.45rem;
}
.pb-swatches {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.5rem;
    margin: 0.1rem 0 0.15rem;
}
.pb-swatch {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
    padding: 0.22rem 0.65rem 0.22rem 0.28rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    cursor: pointer;
    min-height: 0;
    box-shadow: none;
}
.pb-swatch:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}
.pb-swatch-chip {
    position: relative;
    width: 1.15rem;
    height: 1.15rem;
    border-radius: 50%;
    border: 1px solid rgba(15, 23, 42, 0.16);
    flex: 0 0 auto;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}
.pb-swatch-color {
    position: absolute;
    inset: -40%;
    width: 180% !important;
    height: 180% !important;
    min-width: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    opacity: 0;
    cursor: pointer;
    background: transparent;
}
.pb-swatch-name {
    font-weight: 600;
    font-size: 0.82rem;
    color: #334155;
    line-height: 1.2;
    max-width: 9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.plot-below-dock .pb-host-swatches .row {
    --bs-gutter-x: 0.4rem;
    align-items: center;
    margin: 0;
}
.pb-group-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.pb-group {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    padding: 0;
    overflow: hidden;
}
.pb-group > summary {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    cursor: pointer;
    list-style: none;
    min-height: 3.15rem;
    padding: 0.45rem 0.75rem;
    user-select: none;
}
.pb-group > summary::-webkit-details-marker { display: none; }
.pb-group > summary::marker { content: ''; }
.pb-group > summary:hover {
    background: #f8fafc;
}
.pb-group[open] > summary {
    border-bottom: 1px solid #eef2f6;
    background: #f8fafc;
}
.pb-group-caret {
    width: 0.55rem;
    height: 0.55rem;
    border-right: 2px solid #64748b;
    border-bottom: 2px solid #64748b;
    transform: rotate(-45deg);
    margin: 0 0.4rem 0 0.2rem;
    flex: 0 0 auto;
    transition: transform 0.15s ease;
}
.pb-group[open] > summary .pb-group-caret {
    transform: rotate(45deg);
    margin-top: -0.12rem;
}
.pb-group-name {
    flex: 0 1 auto;
    width: auto !important;
    max-width: 42%;
    min-width: 4.5rem;
    border: 1px solid transparent;
    background: transparent;
    font-weight: 650;
    font-size: 0.95rem;
    padding: 0.15rem 0.3rem;
    box-shadow: none;
}
.pb-group-name:hover,
.pb-group-name:focus {
    border-color: #cbd5e1;
    background: #fff;
}
.pb-group-hit {
    flex: 1 1 auto;
    align-self: stretch;
    min-width: 2.5rem;
    min-height: 2.2rem;
}
.pb-group-count {
    font-size: 0.78rem;
    font-weight: 600;
    color: #64748b;
    white-space: nowrap;
    background: #f1f5f9;
    border-radius: 999px;
    padding: 0.18rem 0.55rem;
    flex: 0 0 auto;
}
.pb-sample-tools {
    padding: 0.35rem 0.75rem 0.1rem;
}
.pb-samples {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
    gap: 0.3rem;
    padding: 0.35rem 0.6rem 0.65rem;
    max-height: 18rem;
    overflow: auto;
}
.pb-sample {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 2.4rem;
    margin: 0;
    padding: 0.35rem 0.55rem;
    font-size: 0.86rem;
    border-radius: 8px;
    cursor: pointer;
}
.pb-sample:hover { background: #f1f5f9; }
.pb-group.is-plain .pb-group-color { display: none; }
.plot-below-dock .pb-unit.d-none { display: none !important; }
.pb-sample input {
    margin: 0;
    flex: 0 0 auto;
    width: 1.2rem;
    height: 1.2rem;
    accent-color: #dc2626;
}

/* ── Bilingual long-form content blocks ─────────────────────────────────────
   Render both languages; i18n.js sets <html lang> and these rules toggle. */
.bc-en { display: none !important; }
html[lang="en-US"] .bc-en { display: revert !important; }
html[lang="en-US"] .bc-zh { display: none !important; }
