/* ==================== 全局样式 ==================== */
:root {
  --primary: #4f6ef7;
  --primary-light: #eef1ff;
  --primary-dark: #3b54d4;
  --bg: #f5f6fa;
  --bg-card: #ffffff;
  --text: #1a1a2e;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --border: #e5e7eb;
  --border-light: #f3f4f6;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.04);
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 8px rgba(0,0,0,.04);
  --shadow-lg: 0 4px 24px rgba(0,0,0,.08);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.2s cubic-bezier(.4,0,.2,1);
  --green: #10b981;
  --red: #ef4444;
  --orange: #f59e0b;
  --tag-bg: #f0f4ff;
  --tag-text: #4f6ef7;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ==================== 顶部导航 ==================== */
.header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  background: rgba(255,255,255,.85);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 32px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  user-select: none;
}
.logo-icon {
  font-size: 28px;
}
.nav-tabs {
  display: flex;
  gap: 4px;
  background: var(--border-light);
  padding: 4px;
  border-radius: 10px;
}
.nav-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
  transition: var(--transition);
}
.nav-tab:hover { color: var(--text); }
.nav-tab.active {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.header-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}
.btn-login {
  height: 36px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.btn-login:hover { background: var(--border-light); color: var(--primary); border-color: var(--primary); }
.btn-logout:hover { border-color: var(--red); color: var(--red); background: #fef2f2; }

.user-info {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}
.user-avatar { font-size: 20px; }
.user-name { max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.btn-icon {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}
.btn-icon:hover { background: var(--border-light); color: var(--primary); border-color: var(--primary); }

/* ==================== 搜索区域 ==================== */
.hero-search {
  background: linear-gradient(135deg, #4f6ef7 0%, #6366f1 50%, #8b5cf6 100%);
  padding: 32px 24px 40px;
}
.search-wrapper {
  max-width: 680px;
  margin: 0 auto;
  position: relative;
}
.search-icon {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.search-input {
  width: 100%;
  height: 56px;
  padding: 0 56px 0 56px;
  font-size: 16px;
  border: 2px solid transparent;
  border-radius: 28px;
  background: var(--bg-card);
  color: var(--text);
  outline: none;
  transition: var(--transition);
  box-shadow: 0 8px 30px rgba(0,0,0,.12);
}
.search-input:focus {
  box-shadow: 0 8px 40px rgba(0,0,0,.18);
  border-color: rgba(255,255,255,.3);
}
.search-input::placeholder { color: var(--text-muted); }
.search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}
.search-clear:hover { background: var(--border-light); color: var(--text); }

/* ==================== 主内容 ==================== */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ==================== 筛选栏 ==================== */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}
.filter-chip {
  padding: 7px 18px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-card);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}
.filter-chip:hover { border-color: var(--primary-light); color: var(--primary); }
.filter-chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ==================== 网址卡片网格 ==================== */
.links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.link-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  text-decoration: none;
  color: var(--text);
}
.link-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}
.link-card-icon {
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  border-radius: var(--radius-sm);
  background: var(--border-light);
  flex-shrink: 0;
}
.link-card-info { min-width: 0; }
.link-card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.link-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 6px;
}
.link-card-domain {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.link-card-category {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  background: var(--tag-bg);
  color: var(--tag-text);
  margin-top: 6px;
}
.link-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}
.link-card-creator {
  font-size: 11px;
  color: var(--text-muted);
}
.link-card-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: var(--transition);
}
.link-card:hover .link-card-actions { opacity: 1; }
.link-card-btn {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 6px;
  background: var(--border-light);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  transition: var(--transition);
}
.link-card-btn:hover { background: var(--red); color: #fff; }
.link-card-btn.edit-btn:hover { background: var(--primary); color: #fff; }

/* ==================== 文件表格 ==================== */
.files-table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.files-table {
  width: 100%;
  border-collapse: collapse;
}
.files-table th {
  padding: 14px 16px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--border-light);
  border-bottom: 1px solid var(--border);
}
.files-table td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
}
.files-table tbody tr {
  transition: var(--transition);
}
.files-table tbody tr:hover { background: var(--primary-light); }
.files-table tbody tr:last-child td { border-bottom: none; }
.file-name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.file-icon {
  font-size: 22px;
  flex-shrink: 0;
}
.file-name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 400px;
}
.file-type-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
}
.file-type-badge.pdf { background: #fee2e2; color: #dc2626; }
.file-type-badge.word { background: #dbeafe; color: #2563eb; }
.file-type-badge.excel { background: #d1fae5; color: #059669; }
.file-type-badge.ppt { background: #fef3c7; color: #d97706; }
.file-type-badge.img { background: #ede9fe; color: #7c3aed; }
.file-type-badge.archive { background: #fce7f3; color: #db2777; }
.file-type-badge.other { background: #f3f4f6; color: #6b7280; }

.file-source-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.file-source-tag.source-public { background: #d1fae5; color: #059669; }
.file-source-tag.source-upload { background: #ede9fe; color: #7c3aed; }

.file-actions { display: flex; gap: 6px; }
.btn-sm {
  padding: 6px 18px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-card);
  color: var(--text-secondary);
}
.btn-sm:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.btn-sm.danger:hover { border-color: var(--red); color: var(--red); background: #fef2f2; }

/* ==================== 空状态 ==================== */
.empty-state {
  text-align: center;
  padding: 80px 24px;
  color: var(--text-muted);
}
.empty-icon { font-size: 64px; margin-bottom: 16px; }
.empty-state h3 { font-size: 18px; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 14px; }

/* ==================== 模态层 ==================== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 200;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 480px;
  max-width: 92vw;
  max-height: 85vh;
  overflow-y: auto;
  animation: modalIn .25s ease;
}
.modal-sm { width: 420px; }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(24px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}
.modal-header h3 { font-size: 18px; font-weight: 600; }
.modal-close {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border: none; border-radius: 8px;
  background: var(--border-light);
  font-size: 18px; color: var(--text-muted);
  cursor: pointer; transition: var(--transition);
}
.modal-close:hover { background: var(--border); color: var(--text); }
.modal-body { padding: 20px 24px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 0 24px 20px;
}

/* 表单 */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.required { color: var(--red); }
.form-group input {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: var(--transition);
}
.form-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.form-row { display: flex; gap: 12px; }
.flex-1 { flex: 1; }

.btn {
  height: 40px;
  padding: 0 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-cancel {
  background: var(--border-light);
  color: var(--text-secondary);
}
.btn-cancel:hover { background: var(--border); }

/* 上传区域 */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}
.upload-text { font-size: 14px; color: var(--text-secondary); margin-top: 12px; }
.upload-link { color: var(--primary); font-weight: 500; cursor: pointer; }
.upload-hint { font-size: 12px; color: var(--text-muted); margin-top: 8px; }
.upload-progress { padding: 24px 0; text-align: center; }
.progress-bar {
  height: 6px;
  background: var(--border-light);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 12px;
}
.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width .3s;
  width: 0;
}
.progress-text { font-size: 13px; color: var(--text-secondary); }

/* ==================== Toast ==================== */
.toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn .3s ease;
  max-width: 360px;
}
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }
.toast.info { background: var(--primary); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
  .header-inner { padding: 0 16px; gap: 16px; }
  .nav-tab span { display: none; }
  .nav-tab { padding: 8px 12px; }
  .nav-tab svg { margin: 0; width: 22px; height: 22px; }
  .links-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
  .files-table th, .files-table td { padding: 10px 8px; font-size: 13px; }
  .hero-search { padding: 24px 16px 32px; }
  .main-content { padding: 16px; }
  .logo-text { display: none; }
}

/* ==================== 滚动条美化 ==================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* ==================== 图标选择器 ==================== */
.icon-picker { position: relative; }
.icon-picker-selected {
  width: 100%; height: 42px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; cursor: pointer;
  border: 1px solid #e5e7eb; border-radius: 8px;
  background: #f9fafb; user-select: none;
  transition: .2s;
}
.icon-picker-selected:hover { border-color: var(--primary); background: var(--primary-light); }
.icon-picker-dropdown {
  display: none; position: absolute; top: 48px; left: 0; z-index: 1000;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,.12);
  padding: 10px; width: 280px;
  grid-template-columns: repeat(8, 1fr); gap: 6px;
}
.icon-picker-dropdown.show { display: grid; }
.icon-picker-item {
  width: 30px; height: 30px; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px; cursor: pointer; transition: .15s;
}
.icon-picker-item:hover { background: var(--primary-light); transform: scale(1.2); }
.icon-picker-item.active { background: var(--primary); }

/* ==================== 分页 ==================== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 24px;
  flex-wrap: wrap;
}
.page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}
.page-btn:hover:not(:disabled):not(.active) {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}
.page-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.page-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.page-ellipsis {
  padding: 0 4px;
  color: var(--text-muted);
  font-size: 14px;
  user-select: none;
}
.page-info {
  margin-left: 12px;
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}
