/**
 * SketchUp 5d_library 内嵌「公开材质」页：对齐 com_library_a1 本地材质卡片（item-card / square-image / index-icon）。
 * 与 browse_materials.php 同用；依赖 body.mc-embed-com-library（由桥接脚本或页面写入）。
 */
.mc-embed-com-library {
  --lib-bg-body: #f5f6f8;
  --lib-bg-surface: #ffffff;
  --lib-text: #252a2e;
  --lib-text-muted: #888888;
  --lib-border: #e1e1e1;
  --lib-card-shadow: rgba(100, 100, 111, 0.2);
  --lib-scrollbar-track: #f1f1f1;
  --lib-folder-info-bg: rgba(255, 255, 255, 0.75);
}

.mc-embed-com-library.mc-body,
.mc-embed-com-library .mc-card {
  background: var(--lib-bg-body);
}

.mc-embed-com-library .mc-5d-embed-item-cards {
  margin-top: 0;
  padding-left: 0 !important;
  padding-right: 0 !important;
  background: transparent;
}

.mc-embed-com-library .mc-5d-embed-materials {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px 16px;
  width: 100%;
}

.mc-embed-com-library .mc-5d-embed-card.item-card {
  position: relative;
  display: flex;
  flex-direction: column;
  max-width: 256px;
  width: 100%;
  margin: 0 auto;
  border: 1px solid var(--lib-bg-surface);
  border-radius: 5px;
  box-shadow: var(--lib-card-shadow) 0px 3px 12px 0px;
  cursor: pointer;
}

.mc-embed-com-library .mc-5d-embed-card.item-card:hover {
  border: 1px solid var(--lib-text-muted);
}

.mc-embed-com-library .mc-5d-embed-card.selected-item {
  border: solid 1px #007ed1 !important;
}

.mc-embed-com-library .mc-5d-embed-card.selected-item:hover {
  border: solid 2px #007ed1 !important;
}

/* 占位：与本地 favorite-icon 相近区域，无收藏逻辑 */
.mc-embed-com-library .mc-5d-embed-favorite-spacer {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 28px;
  height: 28px;
  z-index: 2;
  pointer-events: none;
}

.mc-embed-com-library .square-image {
  width: 100%;
  padding-top: 100%;
  position: relative;
  overflow: hidden;
}

.mc-embed-com-library .square-material {
  border: 1px solid #e8e8e8;
}

.mc-embed-com-library .material-image {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  object-fit: cover;
  object-position: center;
}

.mc-embed-com-library .mc-5d-embed-no-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: #94a3b8;
  background: linear-gradient(145deg, #f8fafc 0%, #e2e8f0 100%);
}

/* 底栏：贴图（对齐 model-thumb-action-bar / 本地缩略图底栏） */
.mc-embed-com-library .model-thumb-action-bar.mc-browse-su-material-actions {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: row;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 4;
  overflow: hidden;
  border-radius: 0 0 1px 1px;
}

.mc-embed-com-library .item-card:hover .model-thumb-action-bar.mc-browse-su-material-actions,
.mc-embed-com-library .model-thumb-action-bar.mc-browse-su-material-actions:focus-within {
  opacity: 1;
  pointer-events: auto;
}
/* SketchUp HtmlDialog iframe：常显「给模型贴材质」底栏 */
.mc-embed-com-library .model-thumb-action-bar.mc-browse-su-material-actions {
  opacity: 1;
  pointer-events: auto;
}

.mc-embed-com-library .mc-browse-su-material-btn {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 3px 2px;
  font-size: 0.72rem;
  line-height: 1.25;
  font-weight: 500;
  border: none;
  border-top: 1px solid rgba(0, 0, 0, 0.35);
  border-radius: 0;
  color: rgba(255, 255, 255, 0.85);
  background-color: #3a3a3a;
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(0, 0, 0, 0.12) 100%);
  cursor: pointer;
}

.mc-embed-com-library .mc-browse-su-material-btn:hover {
  color: #fff;
  background-color: #6e6e6e;
}

.mc-embed-com-library .item-info {
  margin-top: auto !important;
  padding: 0 2px 26px;
  display: flex;
  flex-direction: column;
  flex: 1;
  width: 100%;
  box-sizing: border-box;
}

.mc-embed-com-library .item-name {
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  margin-top: 8px;
  color: var(--lib-text);
}

.mc-embed-com-library .item-size {
  margin-top: -5px;
  font-size: 0.7rem;
  color: var(--lib-text-muted);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.mc-embed-com-library .mc-5d-palette-icon {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #c084fc, #60a5fa, #34d399, #fbbf24, #f472b6, #c084fc);
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.mc-embed-com-library .mc-5d-embed-download-link {
  display: block;
  text-align: center;
  font-size: 0.72rem;
  margin-top: 6px;
  color: #0369a1;
  text-decoration: underline;
}

.mc-embed-com-library .mc-5d-embed-download-link:hover {
  color: #0c4a6e;
}

.mc-embed-com-library .index-icon {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  border-radius: 5px 5px 0 0;
  border: 1px solid #777;
  background-color: #555;
  color: #fff;
  z-index: 1;
  line-height: 1.2;
  pointer-events: none;
  user-select: none;
}
