/* === Components === */

/* ==================== 导入弹窗 ==================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.modal-content {
  position: relative;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.import-modal-content {
  width: 480px;
}

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

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--neutral-500);
  cursor: pointer;
}

.modal-close:hover {
  background: var(--neutral-100);
  color: var(--neutral-900);
}

.modal-close svg {
  width: 18px;
  height: 18px;
}

.modal-body {
  flex: 1;
  overflow: auto;
  padding: 0;
  max-height: 400px;
}

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--neutral-200);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.import-target {
  display: flex;
  align-items: center;
  gap: 8px;
}

.import-target label {
  font-size: 13px;
  color: var(--neutral-600);
}

.import-target select {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--neutral-200);
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
}

.import-stats {
  font-size: 13px;
  color: var(--neutral-500);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* 导入文件树 */
.import-tree {
  padding: 8px;
}

.import-tree .tree-item {
  margin: 1px 4px;
}

.import-tree .tree-item.unsupported {
  color: #ef4444;
  opacity: 0.7;
}

.import-tree .tree-item.unsupported .icon {
  color: #ef4444;
}

.import-tree .tree-item.excluded {
  opacity: 0.4;
  text-decoration: line-through;
}

/* 加载状态 */
.import-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--neutral-500);
}

.import-loading .spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--neutral-200);
  border-top-color: var(--primary-500);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 导入结果 */
.import-result {
  padding: 20px;
}

.import-result h4 {
  margin: 0 0 12px;
  font-size: 14px;
}

.import-result ul {
  margin: 0;
  padding-left: 20px;
  font-size: 13px;
}

.import-result .success {
  color: #22c55e;
}

.import-result .failed {
  color: #ef4444;
}

/* 上传进度条 */
.upload-progress {
  margin-top: 12px;
}

.progress-bar {
  height: 6px;
  background: var(--neutral-200);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary-500);
  border-radius: 3px;
  transition: width 0.1s;
  width: 0%;
}

.progress-text {
  font-size: 12px;
  color: var(--neutral-500);
  margin-top: 6px;
  text-align: center;
}

/* ==================== Toast 通知 ==================== */
#toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--neutral-800);
  color: #fff;
  font-size: 13px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transform: translateX(120%);
  transition: transform 0.3s ease;
  pointer-events: auto;
  cursor: pointer;
  max-width: 360px;
}
.toast-show { transform: translateX(0); }
.toast-icon { flex-shrink: 0; display: flex; }
.toast-success .toast-icon { color: #4ade80; }
.toast-error .toast-icon { color: #f87171; }
.toast-warning .toast-icon { color: #fbbf24; }
.toast-info .toast-icon { color: #60a5fa; }

/* ==================== 快捷键帮助 ==================== */
.shortcuts-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.shortcuts-modal {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  max-width: 480px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.shortcuts-modal h3 { margin-bottom: 16px; font-size: 16px; }
.shortcuts-table { width: 100%; border-collapse: collapse; }
.shortcuts-table td { padding: 6px 8px; font-size: 13px; border-bottom: 1px solid var(--neutral-200); }
.shortcuts-table td:first-child { font-weight: 500; white-space: nowrap; }
.shortcuts-table kbd { padding: 2px 6px; border-radius: 4px; background: var(--neutral-100); border: 1px solid var(--neutral-300); font-size: 12px; font-family: monospace; }

/* ==================== 反向链接 ==================== */
.backlinks-panel {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--neutral-200);
}
.backlinks-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--neutral-500);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}
.backlinks-title svg { width: 14px; height: 14px; transition: transform 0.2s; }
.backlinks-title.collapsed svg { transform: rotate(-90deg); }
.backlinks-list { margin-top: 8px; }
.backlink-item {
  display: block;
  padding: 6px 8px;
  font-size: 13px;
  color: var(--primary-600);
  text-decoration: none;
  border-radius: 4px;
  cursor: pointer;
}
.backlink-item:hover { background: var(--primary-100); }
.backlink-snippet { font-size: 12px; color: var(--neutral-500); margin-top: 2px; }

/* ==================== 重命名校验 ==================== */
.name-input.invalid { border-color: #ef4444 !important; background: #fef2f2; }
