/* 这是 index.html 的样式 */
body {
    font-family: sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #f8f8f8;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 20px;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
}

.model-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
}

.model-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s ease-in-out;
    background-color: #fff;
}

.model-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* 基础缩略图样式 */
.model-thumbnail {
    width: auto;
    height: 30vh; /* 设置高度为视口高度的30% */
    display: block; /* 移除图片底部的空白 */
    /* 确保在没有图片或背景色时，有空间显示 */
    background-color: transparent; /* 默认透明背景 */
}

/* --- 占位符样式 --- */
.model-thumbnail.placeholder-thumbnail {
    background-color: #e0e0e0; /* 使用浅灰色作为占位符背景 */
    /* 重要的属性来确保背景显示并隐藏破损图标 */
    object-fit: unset; /* 或 contain; 确保背景色覆盖整个元素，不会被object-fit裁剪 */
    content: none; /* 尝试移除img默认的content，包括破损图标 */
    /* 还可以添加一个中间的图标或文字，但这需要更复杂的CSS或在HTML中添加元素 */
    display: flex; /* 使其成为flex容器，方便居中内容（如果添加内容的话） */
    justify-content: center; /* 水平居中 */
    align-items: center; /* 垂直居中 */
    color: #666; /* 如果添加了文本，设置文本颜色 */
    font-size: 0.8em; /* 如果添加了文本，设置字体大小 */
}
/* --- 占位符样式 结束 --- */


/* 这是 detail.html 的样式 (保持不变，或者合并了 index 的 body 样式) */
/* ... detail.html 的样式 ... */
model-viewer {
    width: 100vw;
    height: 100vh;
}

.back-button {
    position: fixed;
    top: 10px;
    left: 10px;
    padding: 8px 15px;
    background-color: rgba(255, 255, 255, 0.8);
    border: 1px solid #ccc;
    border-radius: 5px;
    text-decoration: none;
    color: #333;
    z-index: 10;
}

/* 可选：详情页加载进度条样式 */
model-viewer > .progress-bar {
    display: block; /* 默认显示 */
    position: absolute; /* 绝对定位 */
    top: 0;
    left: 0;
    width: 100%;
    height: 5px; /* 进度条高度 */
    z-index: 10; /* 确保在模型上面 */
    background-color: rgba(0, 0, 0, 0.2); /* 进度条背景色 */
    transform-origin: left; /* 进度条从左边开始 */
    transition: opacity 0.3s ease-in-out; /* 透明度过渡 */
}

model-viewer > .progress-bar.hide {
  opacity: 0; /* 隐藏时设置透明度为0 */
  pointer-events: none; /* 隐藏时禁止鼠标事件 */
}

model-viewer > .progress-bar .update-bar {
  background-color: #007bff; /* 进度条填充颜色 */
  height: 100%; /* 占满父容器高度 */
  width: 0%; /* 初始宽度为0 */
  transition: width 0.3s ease-in-out; /* 宽度变化过渡动画 */
}

/* 加载前的封面文字样式 */
model-viewer > .poster {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #333;
    font-size: 1.2em;
    text-align: center;
}

/* 加载失败的提示文字样式 */
model-viewer > .failure {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #d9534f; /* 醒目的红色 */
    font-size: 1.2em;
    text-align: center;
}