/* ===== 全局变量 ===== */
:root {
  --primary: #2563eb;
  --primary-light: #3b82f6;
  --primary-dark: #1d4ed8;
  --primary-bg: #eff6ff;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --purple: #8b5cf6;
  --orange: #f97316;

  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-hover: #f1f5f9;
  --bg-sidebar: #1e293b;
  --bg-sidebar-hover: #334155;

  --text: #1e293b;
  --text-secondary: #64748b;
  --text-light: #94a3b8;
  --text-white: #f8fafc;

  --border: #e2e8f0;
  --border-dark: #cbd5e1;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);

  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;

  --sidebar-width: 260px;
  --sidebar-collapsed: 60px;
}

/* ===== 重置 ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ===== 登录页面 ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px;
}

.login-card {
  background: white;
  border-radius: 16px;
  padding: 48px 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  text-align: center;
}

.login-logo {
  color: var(--primary);
  margin-bottom: 16px;
  display: flex;
  justify-content: center;
}

.login-card h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.login-subtitle {
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.login-form {
  text-align: left;
}

.login-hint {
  margin-top: 24px;
  padding: 12px;
  background: var(--primary-bg);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
}

/* ===== 表单组件 ===== */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 14px;
}

.form-group .required {
  color: var(--danger);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: white;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

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

.error-msg {
  color: var(--danger);
  font-size: 13px;
  margin-bottom: 12px;
  min-height: 18px;
}

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

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

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

.btn-secondary {
  background: white;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-dark);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-block {
  width: 100%;
  padding: 12px;
  font-size: 15px;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text);
}

/* ===== 主应用布局 ===== */
.app-page {
  display: flex;
  min-height: 100vh;
}

/* ===== 侧边栏 ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  color: var(--text-white);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: width 0.3s;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.sidebar.collapsed .sidebar-logo span,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-section-title span,
.sidebar.collapsed .user-details,
.sidebar.collapsed .category-tree {
  display: none;
}

.sidebar-header {
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  color: white;
}

.sidebar-logo svg {
  color: var(--primary-light);
  flex-shrink: 0;
}

.sidebar-header .btn-icon {
  color: var(--text-light);
}

.sidebar-header .btn-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
}

.nav-section {
  margin-bottom: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-light);
  font-size: 14px;
  transition: all 0.2s;
  user-select: none;
}

.nav-item:hover {
  background: var(--bg-sidebar-hover);
  color: white;
}

.nav-item.active {
  background: var(--primary);
  color: white;
}

.nav-item svg {
  flex-shrink: 0;
}

.nav-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 12px 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  font-weight: 600;
}

.nav-section-title .btn-icon {
  width: 24px;
  height: 24px;
}

.nav-section-title .btn-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

/* ===== 分类树 ===== */
.category-tree {
  padding: 0 4px;
}

.tree-node {
  margin-bottom: 2px;
}

.tree-node-content {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-light);
  font-size: 13px;
  transition: all 0.2s;
}

.tree-node-content:hover {
  background: var(--bg-sidebar-hover);
  color: white;
}

.tree-node-content.active {
  background: var(--primary);
  color: white;
}

.tree-toggle {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s;
}

.tree-toggle.expanded {
  transform: rotate(90deg);
}

.tree-toggle.empty {
  opacity: 0;
}

.tree-node-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-actions {
  display: none;
  gap: 2px;
}

.tree-node-content:hover .tree-actions {
  display: flex;
}

.tree-actions .btn-icon {
  width: 24px;
  height: 24px;
  color: var(--text-light);
}

.tree-actions .btn-icon:hover {
  background: rgba(255, 255, 255, 0.15);
  color: white;
}

.tree-children {
  margin-left: 16px;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s;
}

.tree-children.expanded {
  max-height: 2000px;
}

/* ===== 侧边栏底部 ===== */
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}

.user-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: white;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-role {
  font-size: 12px;
  color: var(--text-light);
}

.sidebar-footer .btn-icon {
  color: var(--text-light);
}

.sidebar-footer .btn-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

/* ===== 主内容区 ===== */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 0;
  transition: margin-left 0.3s;
  min-width: 0;
}

.sidebar.collollapsed ~ .main-content {
  margin-left: var(--sidebar-collapsed);
}

/* ===== 顶部栏 ===== */
.topbar {
  background: white;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.search-bar {
  flex: 1;
  max-width: 500px;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-light);
  pointer-events: none;
}

.search-bar input {
  width: 100%;
  padding: 10px 40px 10px 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--bg);
  transition: all 0.2s;
}

.search-bar input:focus {
  outline: none;
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

#clearSearch {
  position: absolute;
  right: 8px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: white;
  cursor: pointer;
}

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

/* ===== 面包屑 ===== */
.breadcrumb {
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.breadcrumb-item {
  color: var(--text-secondary);
}

.breadcrumb-item.active {
  color: var(--text);
  font-weight: 600;
}

.breadcrumb-separator {
  color: var(--text-light);
}

/* ===== 统计卡片 ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 0 24px 16px;
}

.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}

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

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon-blue { background: #dbeafe; color: #2563eb; }
.stat-icon-green { background: #d1fae5; color: #10b981; }
.stat-icon-orange { background: #ffedd5; color: #f97316; }
.stat-icon-purple { background: #ede9fe; color: #8b5cf6; }

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ===== 素材区域 ===== */
.materials-section {
  padding: 0 24px 24px;
}

.materials-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.materials-header h2 {
  font-size: 18px;
  font-weight: 700;
}

.materials-count {
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--bg-hover);
  padding: 2px 10px;
  border-radius: 12px;
}

.materials-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* ===== 素材卡片 ===== */
.material-card {
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
  position: relative;
}

.material-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.material-card-thumbnail {
  width: 100%;
  height: 160px;
  background: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.material-card-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.material-card-thumbnail .thumbnail-icon {
  color: var(--text-light);
}

.material-card-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  color: white;
}

.badge-image-text { background: var(--success); }
.badge-link { background: var(--orange); }
.badge-video { background: var(--purple); }

.material-card-body {
  padding: 16px;
}

.material-card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.material-card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 8px;
}

.material-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-light);
}

.material-card-category {
  color: var(--primary);
  font-weight: 500;
}

.material-card-actions {
  position: absolute;
  top: 8px;
  left: 8px;
  display: none;
  gap: 4px;
}

.material-card:hover .material-card-actions {
  display: flex;
}

.material-card-actions .btn-icon {
  width: 28px;
  height: 28px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(4px);
}

.material-card-actions .btn-icon:hover {
  background: white;
}

/* ===== 空状态 ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}

.empty-state svg {
  margin-bottom: 16px;
  color: var(--text-light);
}

.empty-state p {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.empty-state span {
  font-size: 13px;
}

/* ===== 弹窗 ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  backdrop-filter: blur(2px);
}

.modal {
  background: white;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.2s ease-out;
}

.modal-large {
  max-width: 700px;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ===== 类型选择器 ===== */
.type-selector {
  display: flex;
  gap: 12px;
}

.type-option {
  flex: 1;
  cursor: pointer;
}

.type-option input {
  display: none;
}

.type-option-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.2s;
  color: var(--text-secondary);
}

.type-option input:checked + .type-option-content {
  border-color: var(--primary);
  background: var(--primary-bg);
  color: var(--primary);
}

.type-option-content span {
  font-size: 13px;
  font-weight: 600;
}

/* ===== 上传区域 ===== */
.upload-area {
  border: 2px dashed var(--border-dark);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg);
}

.upload-area:hover,
.upload-area.dragover {
  border-color: var(--primary);
  background: var(--primary-bg);
}

.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
}

.upload-placeholder svg {
  color: var(--text-light);
}

.upload-placeholder small {
  font-size: 12px;
  color: var(--text-light);
}

.image-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.image-preview-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-hover);
}

.image-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-preview-item .remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.video-preview {
  margin-top: 12px;
}

.video-preview video {
  width: 100%;
  border-radius: var(--radius-sm);
}

.video-preview .video-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  margin-top: 8px;
}

.video-preview .video-info .remove-btn {
  background: var(--danger);
  color: white;
  border: none;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
}

/* ===== 分类管理 ===== */
.category-manage {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.add-category-form {
  display: flex;
  gap: 8px;
}

.add-category-form input,
.add-category-form select {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.category-manage-tree {
  max-height: 400px;
  overflow-y: auto;
}

.manage-tree-node {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}

.manage-tree-node:hover {
  background: var(--bg-hover);
}

.manage-tree-node .node-name {
  flex: 1;
  font-size: 13px;
}

.manage-tree-node .btn-icon {
  width: 28px;
  height: 28px;
}

.manage-tree-children {
  margin-left: 20px;
}

/* ===== 用户管理 ===== */
.add-user-form {
  margin-bottom: 20px;
  padding: 16px;
  background: var(--bg);
  border-radius: var(--radius);
}

.add-user-form h4 {
  margin-bottom: 12px;
  font-size: 14px;
}

.form-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.form-row input,
.form-row select {
  flex: 1;
  min-width: 120px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.user-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.user-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg);
  border-radius: var(--radius);
}

.user-list-item .user-avatar {
  width: 32px;
  height: 32px;
  font-size: 12px;
}

.user-list-item .user-info-text {
  flex: 1;
}

.user-list-item .user-info-text .name {
  font-weight: 600;
  font-size: 14px;
}

.user-list-item .user-info-text .meta {
  font-size: 12px;
  color: var(--text-secondary);
}

.user-list-item .role-badge {
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.role-badge.admin {
  background: var(--primary-bg);
  color: var(--primary);
}

.role-badge.user {
  background: #f1f5f9;
  color: var(--text-secondary);
}

/* ===== 管理下拉菜单 ===== */
.manage-dropdown {
  position: fixed;
  top: 64px;
  right: 24px;
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  z-index: 200;
  min-width: 160px;
  overflow: hidden;
}

.manage-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.2s;
  font-size: 14px;
}

.manage-dropdown-item:hover {
  background: var(--bg-hover);
}

.manage-dropdown-item svg {
  color: var(--text-secondary);
}

/* ===== 详情弹窗 ===== */
.detail-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.detail-section h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.detail-section .detail-value {
  font-size: 14px;
  line-height: 1.8;
}

.detail-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.detail-images img {
  width: 100%;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 0.2s;
}

.detail-images img:hover {
  transform: scale(1.02);
}

.detail-video video {
  width: 100%;
  border-radius: var(--radius);
}

.detail-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--primary-bg);
  border-radius: var(--radius);
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.detail-link:hover {
  text-decoration: underline;
}

.detail-meta {
  display: flex;
  gap: 20px;
  padding: 12px 16px;
  background: var(--bg);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-secondary);
}

/* ===== Toast 提示 ===== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: white;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 14px;
  z-index: 2000;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease-out;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translate(-50%, 20px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* ===== 汉堡菜单按钮 ===== */
.hamburger-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
}
.hamburger-btn:hover {
  background: var(--bg-hover);
}

/* ===== 侧边栏遮罩 ===== */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
}
.sidebar-overlay.active {
  display: block;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .hamburger-btn {
    display: flex;
  }

  /* 侧边栏改为滑出式 overlay */
  .sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    bottom: 0;
    width: 280px;
    z-index: 200;
    transition: left 0.3s ease;
  }

  .sidebar.open {
    left: 0;
    box-shadow: 4px 0 20px rgba(0,0,0,0.3);
  }

  .sidebar-overlay.active {
    display: block;
  }

  .main-content {
    margin-left: 0 !important;
  }

  /* 顶部栏 */
  .topbar {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 10px;
  }

  .search-bar {
    max-width: none;
    width: 100%;
    order: 3;
  }

  .topbar-actions {
    flex: 1;
    justify-content: flex-end;
    gap: 6px;
  }

  .topbar-actions .btn span {
    display: none;
  }

  .topbar-actions .btn {
    padding: 10px 14px;
  }

  .filter-select {
    max-width: 100px;
    font-size: 12px;
  }

  /* 统计卡片 */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 0 12px 12px;
    overflow-x: auto;
  }

  .stat-card {
    padding: 14px;
    gap: 10px;
  }

  .stat-icon {
    width: 40px;
    height: 40px;
  }

  .stat-value {
    font-size: 20px;
  }

  .stat-label {
    font-size: 12px;
  }

  /* 面包屑 */
  .breadcrumb {
    padding: 10px 16px;
    font-size: 12px;
  }

  /* 素材区 */
  .materials-section {
    padding: 0 12px 16px;
  }

  .materials-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .material-card-thumbnail {
    height: 180px;
  }

  /* 弹窗全屏 */
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .modal {
    max-width: 100%;
    max-height: 92vh;
    border-radius: 16px 16px 0 0;
    animation: modalInMobile 0.3s ease-out;
  }

  @keyframes modalInMobile {
    from {
      transform: translateY(100%);
    }
    to {
      transform: translateY(0);
    }
  }

  .modal-header {
    padding: 16px 18px;
  }

  .modal-body {
    padding: 16px 18px;
  }

  .modal-footer {
    padding: 12px 18px;
  }

  /* 上传表单 */
  .type-selector {
    flex-direction: row;
    gap: 8px;
  }

  .type-option-content {
    padding: 10px 8px;
    gap: 4px;
  }

  .type-option-content svg {
    width: 20px;
    height: 20px;
  }

  .type-option-content span {
    font-size: 11px;
  }

  .upload-area {
    padding: 20px;
  }

  .image-preview-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .form-row {
    flex-direction: column;
  }

  /* 分类管理 */
  .category-manage-tree {
    max-height: 300px;
  }

  /* 管理下拉 */
  .manage-dropdown {
    right: 12px;
    top: 56px;
  }

  /* 详情弹窗 */
  .detail-images {
    grid-template-columns: repeat(2, 1fr);
  }

  .detail-meta {
    flex-wrap: wrap;
    gap: 10px;
  }

  /* Toast */
  .toast {
    left: 16px;
    right: 16px;
    transform: none;
    text-align: center;
  }

  /* 登录页 */
  .login-card {
    padding: 32px 24px;
    margin: 0 12px;
  }
}
