/* ============================================================
   share.css - 星标分享卡片样式
   加载页面：/share/index.html
   ============================================================ */

/* ---------- 左侧栏 + 右侧内容 布局 ---------- */
.share-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  align-items: start;
}
.share-sidebar {
  position: sticky;
  top: 72px; /* 顶栏 56px + 间距 */
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}
.share-content { min-width: 0; }

.share-sidebar-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 16px 0 8px;
}
.share-sidebar-title:first-child { margin-top: 0; }

/* ---------- 分类切换条（软件 | 其他） ---------- */
.share-toggle {
  position: relative;
  display: flex;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
}
.share-toggle-indicator {
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc(50% - 3px);
  height: calc(100% - 6px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.22s ease;
  z-index: 0;
}
.share-toggle-indicator.right { transform: translateX(100%); }
.share-toggle-btn {
  position: relative;
  z-index: 1;
  flex: 1;
  padding: 7px 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 6px;
  transition: color 0.2s ease;
}
.share-toggle-btn:hover { color: var(--text); }
.share-toggle-btn.active { color: var(--text); font-weight: 700; }

/* ---------- 标签列表 ---------- */
.share-tags {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.share-tag-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 7px 12px;
  font-size: 13px;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.share-tag-btn:hover { background: var(--active-bg); color: var(--text); }
.share-tag-btn.active {
  background: var(--active-bg);
  color: var(--active-border);
  font-weight: 600;
  border-color: var(--active-border);
}
.share-tag-count {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--code-bg);
  border-radius: 999px;
  padding: 1px 7px;
  margin-left: 8px;
}
.share-tag-btn.active .share-tag-count { background: var(--surface); }
.share-tags-empty {
  padding: 10px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}

/* ---------- 分享卡片 ---------- */
.share-card {
  position: relative;
  display: flex;
  flex-direction: column;
}

/* 右上角状态 LED 圆灯 */
.share-card .sc-status {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border);
  z-index: 1;
}
.share-card .sc-status-active { background: #2ea043; }
.share-card .sc-status-unknown { background: #d29922; }
.share-card .sc-status-deprecated { background: #d1242f; }

/* 头部：图标 + 名称 */
.share-card .sc-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding-right: 24px; /* 给右上角 LED 留位 */
}
.share-card .sc-icon {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  border: 1px solid var(--border);
  object-fit: contain;
  padding: 4px;
  background: var(--code-bg);
  flex-shrink: 0;
}
.share-card .sc-icon-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  flex-shrink: 0;
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  background: var(--link);
}
.share-card .sc-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

/* 简介 */
.share-card .sc-desc {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 12px;
  min-height: 44px;
}

/* 标签 */
.share-card .sc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.share-card .sc-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
}

/* 底部按钮区：左下角主页+相关文档，右下角下载 */
.share-card .sc-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 14px;
}
.share-card .sc-actions-left {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------- 选择弹窗（相关文档 / 下载方式） ---------- */
.sc-dialog-mask {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  animation: sc-dialog-fade 0.18s ease;
}
@keyframes sc-dialog-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
.sc-dialog {
  position: relative;
  width: min(440px, 100%);
  max-height: 80vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 22px;
  animation: sc-dialog-pop 0.18s ease;
}
@keyframes sc-dialog-pop {
  from { transform: translateY(8px) scale(0.98); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
.sc-dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.sc-dialog-close:hover { background: var(--code-bg); color: var(--text); }
.sc-dialog-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  padding-right: 28px;
}
.sc-dialog-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sc-dialog-item {
  display: block;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.sc-dialog-item:hover {
  border-color: var(--link);
  background: var(--active-bg);
  transform: translateY(-1px);
}
.sc-dialog-item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.sc-dialog-item-url {
  font-size: 12px;
  color: var(--text-muted);
  word-break: break-all;
}

/* ---------- 响应式：窄屏侧边栏置顶，标签横向排列 ---------- */
@media (max-width: 900px) {
  .share-layout { grid-template-columns: 1fr; }
  .share-sidebar {
    position: static;
    max-height: none;
    overflow: visible;
  }
  .share-tags { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .share-tag-btn { width: auto; }
}
