/* === bios.css (D3.3 基础上集成 Viewer.js) - 最终版 === */

:root {
    /* 明亮主题变量 */
    --bg-primary: #f5f7fa;
    --bg-secondary: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --header-bg: #002654; /* DS 主头部背景 */
    --header-text: #ffffff;
    --table-header-bg: #002654; /* DS 表头背景 */
    --table-header-text: #ffffff;
    --table-row-even: #f9f9f9;
    --table-row-hover: #f1f7ff;
    --border-color: #e0e0e0;
    --accent-color: #3498db;
    --checkbox-bg: #f0f0f0; /* 虽然D1.0没有复选框，但保留以备DS其他元素使用 */

    /* 新增：搜索框和弹窗相关颜色变量 (基于亮色主题) */
    --search-widget-bg: rgba(250, 250, 250, 0.95);
    --search-widget-shadow: rgba(0, 0, 0, 0.15);
    --search-input-border: #ccc;
    /* popup-bg, popup-shadow, popup-thumb-border 现在由 viewer.css 控制，但保留变量以备自定义覆盖 */
    --popup-bg: rgba(255, 255, 255, 0.97);
    --popup-shadow: rgba(0,0,0,0.2);
    --popup-thumb-border: #000;
    --link-color: #333; /* D1.0 链接颜色 */
    --link-hover-decoration: underline;
    --popup-trigger-color: blue; /* D1.0 "图"链接颜色 */
}

th:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    height: 70%; /* 控制竖线高度 */
    width: 1px;
    background-color: white;
}

/* 暗黑主题下的竖线样式 */
.dark-theme th:not(:last-child)::after {
    background-color: white;
}

/* 明亮主题下的竖线样式 (这个选择器在您的文件中存在，但可能未被使用，因为您用的是 not(.dark-theme)) */
.light-theme th:not(:last-child)::after {
    background-color: #333;
}
/* 确保明亮主题下竖线颜色正确 */
body:not(.dark-theme) th:not(:last-child)::after {
    background-color: #bbb;
}


/* 调整表头单元格内边距 */
th {
    padding: 12px 15px;
}

/* 移动端适配 */
@media (max-width: 768px) {
    th:not(:last-child)::after {
        display: none; /* 移动端隐藏竖线 */
    }
}

.dark-theme {
    /* 暗黑主题变量 */
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --text-primary: #f0f0f0;
    --text-secondary: #cccccc;
    --header-bg: #0a1929;
    --header-text: #e0e0e0;
    --table-header-bg: #1a2a4a;
    --table-header-text: #ffffff;
    --table-row-even: #252525;
    --table-row-hover: #2a3a5a;
    --border-color: #444444;
    --accent-color: #4db6ac;
    --checkbox-bg: #333333;

    /* 新增：搜索框和弹窗相关颜色变量 (基于暗色主题) */
    --search-widget-bg: rgba(40, 40, 40, 0.95);
    --search-widget-shadow: rgba(0, 0, 0, 0.3);
    --search-input-border: #555;
    --popup-bg: rgba(30, 30, 30, 0.97);
    --popup-shadow: rgba(0,0,0,0.4);
    --popup-thumb-border: #aaa;
    --link-color: #ccc;
    --link-hover-decoration: underline;
    --popup-trigger-color: #66bfff; /* 亮蓝色 */
}

.icon {
	background-color: var(--accent-color);
	color: white;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	border-radius: 50%;
	font-size: 12px;
}


* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.3s, color 0.3s, border-color 0.3s; /* 添加border-color过渡 */
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
    line-height: 1.6;
    padding: 20px;
    min-height: 100vh;
    font-size: 0.85em; /* 全局文字放大1.25倍 */
}

a {
    color: var(--link-color);
    text-decoration: none;
}
a:hover {
    text-decoration: var(--link-hover-decoration);
}
/* 调整表格字体大小 */
.table-container table {
    /* font-size: 17.5px; */ /* 已被 body 的 font-size: 1.25em 放大，无需重复 */
}

/* 移动端适配 */
@media (max-width: 768px) {
    body {
        font-size: 1em; /* 移动端保持原始大小 */
    }
    
    .table-container, 
    header, 
    /* .search-toolbar, */ /* 这个类在您的D3.3 CSS中被引用，但HTML中没有，可以移除 */
    .footer {
        font-size: 1em;
    }
    
    th, td {
        padding: 10px 15px; /* 移动端保持原始内边距 */
    }
}

/* 2. 为所有单元格设置基础样式和强制换行 */
.table-container td,
.table-container th {
    padding: 12px 15px; /* 稍微增加垂直内边距，让换行后更好看 */
    border-bottom: 1px solid #444;
    text-align: left;
    vertical-align: middle; /* 垂直居中对齐 */
    
    /* 强制处理溢出内容 */
    overflow-wrap: break-word; 
    word-break: break-all;
}

/* 4. （可选）让小图标和短文本列尽可能窄 */
.table-container td[data-label="序号"],
.table-container th:nth-child(1) {
    width: 7%; /* 给一个固定的像素值 */
    text-align: center;
}
/* 3. ✨ 核心修正：只对“问题列”（型号列）进行特殊处理 ✨ */
.table-container td[data-label="型号"],
.table-container th:nth-child(2) { /* 第二个th，即“型号”表头 */
    /* 
     * 给它一个合理的宽度。这个宽度不是绝对的，
     * 而是告诉浏览器：“型号列”的理想宽度是这么多，
     * 剩下的空间你们其他列再去分。
     * 35% 到 45% 通常是一个比较好的起始值。
     */
    width: 35%; 
}
.table-container td[data-label="资料"],
.table-container th:nth-child(3) {
    width: 23%; /* 给一个固定的像素值 */
    text-align: center;
}

.table-container td[data-label="图"],
.table-container td[data-label="驱动"] {
    width: 80px;
    text-align: center;
}

.table-container td[data-label="说明书"] {
    width: 100px;
    text-align: center;
}

/* 表格单元格内边距微调 */
th, td {
    padding: 12px 18px; /* 原10px 15px × 1.2 */
}
.container { /* DS 美化版的主容器 */
    max-width: 1100px;
    margin: 0 auto;
    background-color: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden; /* 对于内部的 sticky header 可能需要调整 */
}

header { /* DS 美化版的页面头部 */
    background: var(--header-bg);
    color: var(--header-text);
    padding: 20px 30px;
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
	font-size: 1em; /* 相对于 body 的 1.25em */
}

h1 {
    font-size: 24px; /* 使用固定像素，不受父级 font-size 影响 */
    font-weight: 600;
}

.theme-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}
.theme-selector label { font-size: 1em; /* 相对于 header */ }
.theme-selector select {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 8px 15px;
    border-radius: 6px;
    font-size: 1em; /* 相对于 header */
    cursor: pointer;
}

.table-container {
    overflow-x: auto; /* 桌面端允许表格内容过多时滚动 */
    padding: 20px;
    /* font-size: 1.25em; */ /* 已由 body 设置 */
    line-height: 1.5; /* 调整行高 */
}
	

table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--bg-secondary);
    font-size: 1em; /* 相对于 .table-container 或 body */
}

th {
    padding: 10px 15px; /* 这个会被下面的 .table-container th, td 覆盖 */
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top; /* D1.0 习惯 */
    background-color: var(--table-header-bg);
    color: var(--table-header-text);
    font-weight: 600;
    position: relative;
    top: 0;
    z-index: 10; 
}

td {
    padding: 10px 15px; /* 这个会被下面的 .table-container th, td 覆盖 */
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top; /* D1.0 习惯 */
}

/* 这个选择器没有必要，因为 th 已经有背景色了 */
/* .table-container th::before { ... } */


/* 调整表格单元格内边距 */
.table-container th,
.table-container td {
    padding: 7.5px 18.75px; /* 原10px15px × 1.25 表格行高*/
}
/* 调整分组标题 */
.table-container .custom-group-title {
    font-size: 1.1em; /* 相对于表格字体 */
    padding: 0 8.75px; 
}

tbody tr:nth-child(even) {
    background-color: var(--table-row-even);
}
tbody tr:hover {
    background-color: var(--table-row-hover);
}

/* D1.0 分组标题样式 (整合到DS风格) */
.custom-group-title { /* 用于包裹分组标题的 div */
    padding: 0px 15px;
    font-size: 1.1em; /* 比普通表头稍大 */
    font-weight: bold;
    text-align: left; 
}
th.section-title-header { /* 应用于包裹 .custom-group-title 的 th */
    background-color: var(--table-header-bg); /* 使用表头背景 */
    color: var(--table-header-text);
    padding: 6px; 
    border-bottom: 1px solid var(--accent-color); /* 用强调色作为分隔 */
}


/* --- 浮动搜索框样式 (已主题化) --- */
#floating-search-widget {
    position: fixed;
    z-index: 1001;
    background-color: var(--search-widget-bg);
    padding: 10px 15px; 
    border-radius: 8px;
    box-shadow: 0 4px 12px var(--search-widget-shadow);
    cursor: grab;
    user-select: none;
    border: 1px solid var(--border-color); 
    font-size: 1rem; /* 让搜索框字体大小恢复到浏览器基础大小，不受body的1.25em影响 */
}
#search-container {
    margin-right: 45px; /* 为JS添加的清空按钮留空间 */
}
#search-container label {
    color: var(--text-secondary);
    font-size: 1em; /* 相对于 #floating-search-widget */
    margin-right: 5px;
}
#search {
    padding: 8px 10px;
    font-size: 1em; /* 相对于 #floating-search-widget */
    border: 1px solid var(--search-input-border);
    border-radius: 6px;
    background-color: var(--bg-secondary); 
    color: var(--text-primary); 
}
#search::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

/* --- 图片弹窗链接样式 --- */
.popup-trigger { /* "图" 链接 */
    text-decoration: underline;
    color: var(--popup-trigger-color);
    cursor: pointer;
    margin: 0 3px; 
}


/* === 响应式适配 (DS + D1.0 卡片式表格) === */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        border-radius: 0;
        /* JS会设置padding-top */
    }
    
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        padding: 15px;
    }
    .theme-selector {
        align-self: flex-end;
    }
    
    .table-container {
        padding: 0px; 
    }
    
    /* --- 浮动搜索框在移动端固定到顶部 --- */
    #floating-search-widget {
        top: 0 !important;  
        left: 0 !important; 
        right: auto !important; 
        width: 100% !important;
        min-width: 0 !important; 
        border-radius: 0;
        box-shadow: 0 2px 5px var(--search-widget-shadow);
        padding: 8px 10px; 
        z-index: 1005; 
    }
    #search-container {
        flex-grow: 1;
    }

    /* --- 表格转换为卡片式布局 --- */
    table, 
    table thead,
    table tbody,
    table th,
    table td,
    table tr {
        display: block;
    }

    table thead tr:not(:first-child) { 
        position: absolute;
        top: -9999px;
        left: -9999px;
        visibility: hidden;
    }

    th.section-title-header, 
    .custom-group-title {
        position: static;
        display: block;
        width: auto;
        margin-bottom: 10px;
        border-bottom: none;
        text-align: left; 
        padding: 10px;
    }
    .custom-group-title {
        border-radius: 0;
    }

    table tr { 
        border: 1px solid var(--border-color);
        border-radius: 6px;
        margin: 0 10px 15px 10px; 
        padding: 10px;
        background-color: var(--bg-secondary); 
    }
    table tbody tr:nth-child(even),
    table tbody tr:nth-child(odd) {
        background-color: transparent; 
    }

    table td {
        border: none;
        border-bottom: 1px dashed var(--border-color);
        position: relative;
        padding-left: 35% !important; /* 确保覆盖桌面端padding */
        padding-top: 8px;
        padding-bottom: 8px;
        text-align: right;
        white-space: normal;
        font-size: 13px; /* 固定移动端字体大小 */
        line-height: 1.5;
    }
    table td:last-child {
        border-bottom: none;
    }

    table td:before {
        content: attr(data-label);
        position: absolute;
        top: 8px;
        left: 10px;
        width: 30%; 
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: bold;
        color: var(--text-secondary); 
        font-size: 0.9em;
    }

    /* 特殊处理“型号”列和包含多个链接的列 */
    table td[data-label="型号"],
    table td[data-label="说明书"], 
    table td[data-label="驱动"],
    table td[data-label="图"] {
        padding-left: 10px !important; /* 确保覆盖 */
        text-align: left;
    }
    table td[data-label="型号"]:before,
    table td[data-label="说明书"]:before,
    table td[data-label="驱动"]:before,
    table td[data-label="图"]:before {
        position: static; 
        display: block;
        width: auto;
        margin-bottom: 4px;
        font-size: 0.85em;
    }
    table td[data-label="型号"] a,
    table td[data-label="型号"] span,
    table td[data-label="说明书"] a,
    table td[data-label="驱动"] a {
        display: inline-block;
        margin-right: 8px;
        margin-bottom: 4px;
    }
	/* 移除 .search-toolbar，因为 #floating-search-widget 已有样式 */
}

#popupContainer {
    position: absolute; /* 关键：用于定位在“图”按钮旁边 */
    z-index: 1010; 
    pointer-events: auto;
    background-color: var(--popup-bg); 
    border-radius: 5px;
    box-shadow: 0 2px 10px var(--popup-shadow);
    padding: 8px;
    max-width: 532px; /* 限制宽度 */
    display: flex; /* 用于排列缩略图 */
    flex-wrap: wrap; /* 允许换行 */
}

#popupContainer img.thumbnail-item { /* 给缩略图一个特定的类名 */
    pointer-events: auto;
    border: 1px solid var(--popup-thumb-border);
    width: 80px;  /* 明确尺寸 */
    height: 80px; /* 明确尺寸 */
    margin: 4px;  /* 明确间距 */
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.2s ease;
}
#popupContainer img.thumbnail-item:hover {
    transform: scale(1.1); /* 添加悬停效果 */
}

/* ======================================================= */
/* ✨ 自定义悬浮提示框 (Tooltip) 样式 ✨ */
/* ======================================================= */

/* ✨ 确保 ID 选择器与 JS 中的一致，我们统一使用 #custom-tooltip ✨ */
#custom-tooltip {
    display: none;
    opacity: 0;
    position: absolute;
    z-index: 1000;
    background-color: #2c3e50;
    color: #ecf0f1;
    border: 1px solid #7f8c8d;
    border-radius: 5px;
    padding: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    max-width: 450px;
    font-size: 14px;
    line-height: 1.6;
    transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out;
    visibility: hidden; /* 使用 visibility 配合 opacity 过渡效果更好 */
    user-select: text;
}

#custom-tooltip.visible {
    display: block; /* 或者 flex/grid，但 block 最简单 */
    opacity: 1;
    visibility: visible;
}

#custom-tooltip strong {
    color: #3498db;
    display: block;
    margin-bottom: 5px;
}

/* 2025-08-17 12:17 */
/* === Viewer.js 自定义覆盖样式 === */

/* 调整底部导航栏整体高度和背景 */
.viewer-footer .viewer-list {
    padding: 10px 0; /* 增加上下 padding */
    background-color: rgba(0, 0, 0, 0.6); /* 可以自定义背景色 */
}

/* 调整每个缩略图项 (li) 的尺寸 */
.viewer-list > li {
    width: 88px !important;  /* 80px 图片 + 4px*2 边框 + 一些额外空间 */
    height: 88px !important; /* 80px 图片 + 4px*2 边框 + 一些额外空间 */
    border-width: 4px !important; /* 加宽边框以突出显示 */
    border-color: #444 !important;
}

/* 调整缩略图图片 (img) 的尺寸 */
/* 通常不需要修改，因为它会适应父元素 li */
/* .viewer-list > li > img { ... } */

/* 调整当前选中的缩略图项的样式 */
.viewer-list > li.viewer-active {
    background-color: var(--accent-color, #3498db) !important; /* 使用主题的强调色 */
    border-color: var(--accent-color, #3498db) !important;
}

/* === Viewer.js 视觉优化 === */

/* Viewer.js 的主图片容器 */
.viewer-canvas > img {
    /* 
     * 在 JS 应用 transform 之前，预先设置这些属性。
     * 这会让图片在加载时就尝试适应其父容器，
     * 而不是先以原始尺寸闪现一下。
     * Viewer.js 之后会用 transform 来进一步精确定位和缩放。
     */
    width: 100%;
    height: 100%;
    object-fit: contain; /* 关键：保持宽高比并适应容器 */
}

/* 隐藏 Viewer.js 加载时可能出现的损坏的图片图标 */
.viewer-canvas > img:not([src]) {
    visibility: hidden; /* 如果 src 还未设置，先隐藏 */
}

/* --- 核心修正：用于替换strong的黄色高亮样式 --- */
.highlight_yellow {
    color: #F1C40F; /* 一个明亮的黄色 */
    font-weight: bold; /* 仍然保留字体加粗以增强强调效果 */
}