/* ==========================================================================
   集沣贸易 · 技能资产与经验沉淀库 (Skill Hub) 设计系统
   风格：东方雅致商务科技 · 霁蓝/晨霜白/琥珀金 · 拒绝廉价AI渐变
   ========================================================================== */

:root {
  --primary: #1e3a8a;          /* 霁蓝主色 */
  --primary-hover: #172554;
  --primary-light: #eff6ff;
  --primary-border: #bfdbfe;
  
  --secondary: #0f172a;        /* 墨黑 / 深岩色 */
  --secondary-muted: #64748b;  /* 钛灰副文字 */
  
  --bg-page: #f8fafc;          /* 页面底色 */
  --bg-surface: #ffffff;       /* 卡片/表面底色 */
  --bg-subtle: #f1f5f9;        /* 浅灰底 */
  
  --border-color: #e2e8f0;     /* 边框标准色 */
  --border-focus: #3b82f6;     /* 聚焦高亮 */
  
  --amber: #d97706;            /* 琥珀金 (核心资产) */
  --amber-bg: #fffbeb;
  --amber-border: #fde68a;
  
  --emerald: #059669;          /* 翡翠绿 (已验证标杆) */
  --emerald-bg: #ecfdf5;
  --emerald-border: #a7f3d0;
  
  --rose: #e11d48;             /* 玫瑰红 (高危/删除) */
  --rose-bg: #fff1f2;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.06);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-page);
  color: var(--secondary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* 布局骨架 */
.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 顶部导航 */
.navbar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: var(--shadow-sm);
}

.nav-content {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-logo {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  color: white;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.2rem;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--secondary);
  letter-spacing: -0.01em;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--secondary-muted);
  font-weight: 500;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* 按钮通用组件 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.5rem 0.95rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  border: 1px solid transparent;
  outline: none;
  white-space: nowrap;
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 1px 2px rgba(30, 58, 138, 0.2);
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-outline {
  background: #ffffff;
  color: var(--secondary);
  border-color: var(--border-color);
}

.btn-outline:hover {
  background: var(--bg-subtle);
  border-color: #cbd5e1;
}

.btn-subtle {
  background: var(--bg-subtle);
  color: var(--secondary);
}

.btn-subtle:hover {
  background: #e2e8f0;
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--radius-sm);
}

/* 主内容区域 */
.main-wrapper {
  max-width: 1360px;
  margin: 0 auto;
  width: 100%;
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* 顶部关键指标卡片 */
.stats-banner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

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

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.icon-blue { background: #dbeafe; color: #1e40af; }
.icon-amber { background: var(--amber-bg); color: var(--amber); }
.icon-emerald { background: var(--emerald-bg); color: var(--emerald); }
.icon-slate { background: #f1f5f9; color: #475569; }

.stat-info .stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--secondary);
}

.stat-info .stat-label {
  font-size: 0.8rem;
  color: var(--secondary-muted);
  font-weight: 500;
  margin-top: 0.15rem;
}

/* 筛选与搜索工具条 */
.toolbar-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.search-row {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.search-input-box {
  flex: 1;
  position: relative;
  min-width: 280px;
}

.search-input-box svg {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--secondary-muted);
}

.search-input {
  width: 100%;
  padding: 0.6rem 0.85rem 0.6rem 2.4rem;
  font-size: 0.9rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-page);
  color: var(--secondary);
  transition: all 0.15s;
}

.search-input:focus {
  outline: none;
  background: #ffffff;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.filter-select {
  padding: 0.6rem 0.85rem;
  font-size: 0.875rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-page);
  color: var(--secondary);
  outline: none;
  cursor: pointer;
}

.filter-select:focus {
  border-color: var(--border-focus);
}

.core-toggle-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--amber);
  cursor: pointer;
  user-select: none;
  background: var(--amber-bg);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--amber-border);
}

.core-toggle-label input {
  cursor: pointer;
}

/* 部门标签过滤器 */
.department-tags-bar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.dept-pill {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  color: var(--secondary-muted);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.dept-pill:hover {
  background: #e2e8f0;
  color: var(--secondary);
}

.dept-pill.active {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-border);
  font-weight: 600;
}

/* 技能卡片列表网格 */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 1.15rem;
}

.skill-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.9rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease-in-out;
  cursor: pointer;
  position: relative;
}

.skill-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.skill-card.is-core {
  border-left: 4px solid var(--amber);
}

.skill-card-top {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.badges-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.725rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.badge-core {
  background: var(--amber-bg);
  color: var(--amber);
  border: 1px solid var(--amber-border);
}

.badge-verified {
  background: var(--emerald-bg);
  color: var(--emerald);
  border: 1px solid var(--emerald-border);
}

.badge-dept {
  background: var(--bg-subtle);
  color: var(--secondary);
  border: 1px solid #cbd5e1;
}

.badge-cat {
  background: #f0fdf4;
  color: #166534;
}

.skill-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--secondary);
  line-height: 1.35;
}

.skill-summary {
  font-size: 0.85rem;
  color: var(--secondary-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tags-list {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.tag-item {
  font-size: 0.725rem;
  color: #475569;
  background: var(--bg-page);
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
  border: 1px solid #e2e8f0;
}

.skill-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--bg-subtle);
  padding-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--secondary-muted);
}

.author-info {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 500;
}

.avatar-badge {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.card-metrics {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.metric-item {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.like-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--secondary-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8rem;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  transition: all 0.15s;
}

.like-btn:hover {
  color: #e11d48;
  background: #ffe4e6;
}

/* 详情抽屉 (Slide-over Drawer) */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease-in-out;
}

.drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 680px;
  background: var(--bg-surface);
  box-shadow: var(--shadow-xl);
  z-index: 51;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease-in-out;
}

.drawer-backdrop.open .drawer {
  transform: translateX(0);
}

.drawer-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-page);
}

.drawer-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.drawer-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-page);
}

/* Markdown 与正文渲染样式 */
.rendered-markdown {
  font-size: 0.925rem;
  line-height: 1.7;
  color: #1e293b;
}

.rendered-markdown h1,
.rendered-markdown h2,
.rendered-markdown h3,
.rendered-markdown h4 {
  color: #0f172a;
  margin-top: 1.25rem;
  margin-bottom: 0.6rem;
  font-weight: 700;
}

.rendered-markdown h2 {
  font-size: 1.2rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.4rem;
}

.rendered-markdown h3 {
  font-size: 1.05rem;
}

.rendered-markdown p {
  margin-bottom: 0.85rem;
}

.rendered-markdown ul,
.rendered-markdown ol {
  padding-left: 1.5rem;
  margin-bottom: 0.85rem;
}

.rendered-markdown li {
  margin-bottom: 0.35rem;
}

.rendered-markdown pre {
  background: #0f172a;
  color: #f8fafc;
  padding: 1rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-family: Consolas, "SF Mono", Monaco, monospace;
  font-size: 0.85rem;
  margin: 0.85rem 0;
  position: relative;
}

.rendered-markdown code:not(pre code) {
  background: #f1f5f9;
  color: #0f172a;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85em;
  font-family: Consolas, monospace;
  border: 1px solid #e2e8f0;
}

.rendered-markdown blockquote {
  border-left: 4px solid var(--primary);
  background: var(--primary-light);
  padding: 0.6rem 1rem;
  margin: 0.85rem 0;
  border-radius: 0 4px 4px 0;
  color: #1e3a8a;
  font-size: 0.9rem;
}

/* 模态弹窗 (Modal) */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-in-out;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 760px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.96);
  transition: transform 0.2s ease-in-out;
}

.modal-backdrop.open .modal {
  transform: scale(1);
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-page);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  background: var(--bg-page);
}

/* 表单输入组 */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--secondary);
}

.form-label .required {
  color: var(--rose);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  font-size: 0.875rem;
  font-family: var(--font-family);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--secondary);
  transition: border-color 0.15s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
}

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

/* 模板快捷选用栏 */
.template-helper-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
}

.template-pill {
  padding: 0.2rem 0.55rem;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  transition: all 0.15s;
}

.template-pill:hover {
  background: var(--primary-light);
  border-color: var(--primary-border);
}

/* 上传拖拽区域 */
.dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 1.25rem;
  text-align: center;
  background: var(--bg-page);
  cursor: pointer;
  transition: all 0.2s;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.dropzone-text {
  font-size: 0.85rem;
  color: var(--secondary-muted);
  margin-top: 0.35rem;
}

.uploaded-files-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.uploaded-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.65rem;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
}

/* 大盘与榜单表格 */
.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.stats-table th,
.stats-table td {
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.stats-table th {
  background: var(--bg-page);
  font-weight: 600;
  color: var(--secondary-muted);
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
}

.rank-1 { background: #fef08a; color: #854d0e; }
.rank-2 { background: #e2e8f0; color: #475569; }
.rank-3 { background: #fed7aa; color: #9a3412; }

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--secondary-muted);
}

.empty-state-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

/* 响应式调整 */
@media (max-width: 900px) {
  .stats-banner {
    grid-template-columns: repeat(2, 1fr);
  }
  .skills-grid {
    grid-template-columns: 1fr;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .nav-content {
    flex-direction: column;
    align-items: flex-start;
  }
  .stats-banner {
    grid-template-columns: 1fr;
  }
  .search-row {
    flex-direction: column;
    align-items: stretch;
  }
}
