/* === History & Diff === */

/* 历史面板 */
.history-panel {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: 320px;
  background: #fff;
  border-left: 1px solid var(--neutral-200);
  z-index: 100;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 12px rgba(0,0,0,0.05);
}

.history-panel.hidden {
  display: none;
}

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

.history-header h3 {
  font-size: 14px;
  font-weight: 600;
}

.history-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;
}

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

.history-list {
  flex: 1;
  overflow: auto;
  padding: 8px;
}

.history-item {
  padding: 12px;
  border-radius: 6px;
  cursor: pointer;
  margin-bottom: 4px;
  font-size: 13px;
  color: var(--neutral-600);
}

.history-item:hover {
  background: var(--neutral-100);
}

/* ==================== 历史版本查看 ==================== */
.history-viewing { border-bottom: 2px solid #f59e0b; }
.history-badge {
  display: inline-block;
  background: #f59e0b;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  margin-right: 8px;
  vertical-align: middle;
}
.history-item.active { background: var(--primary-100); border-left: 3px solid var(--primary-500); }
.history-time { font-size: 13px; }

/* ==================== Diff 视图 ==================== */
.diff-full-view {
  padding: 16px;
  overflow-y: auto;
  height: 100%;
  font-family: monospace;
  font-size: 13px;
  line-height: 1.6;
}
.diff-view { font-family: monospace; font-size: 13px; line-height: 1.6; }
.diff-line { padding: 2px 12px; white-space: pre-wrap; word-break: break-all; }
.diff-line-add { background: #dcfce7; color: #166534; }
.diff-line-remove { background: #fee2e2; color: #991b1b; text-decoration: line-through; }
.diff-line-equal { color: var(--neutral-500); }
.diff-marker { display: inline-block; width: 18px; user-select: none; color: var(--neutral-400); font-weight: 600; }

/* ==================== 回收站面板 ==================== */
.trash-panel {
  position: fixed;
  right: 0;
  top: 0;
  width: 340px;
  height: 100vh;
  background: #fff;
  box-shadow: -4px 0 20px rgba(0,0,0,0.1);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s;
}
.trash-panel.hidden { display: none; }
.trash-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--neutral-200);
}
.trash-header h3 { font-size: 14px; font-weight: 600; }
.trash-header .panel-close,
.trash-header .history-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--neutral-500);
  cursor: pointer;
}
.trash-header .panel-close:hover,
.trash-header .history-close:hover {
  background: var(--neutral-100);
  color: var(--neutral-900);
}
.trash-list { flex: 1; overflow-y: auto; padding: 8px; }
.trash-item {
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--neutral-200);
  margin-bottom: 6px;
}
.trash-item-path { font-size: 13px; font-weight: 500; word-break: break-all; }
.trash-item-time { font-size: 11px; color: var(--neutral-500); margin-top: 2px; }
.trash-item-actions { display: flex; gap: 6px; margin-top: 6px; }
.trash-item-actions button {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 4px;
  border: 1px solid var(--neutral-300);
  background: #fff;
  cursor: pointer;
}
.trash-item-actions .restore-btn { color: var(--primary-600); border-color: var(--primary-400); }
.trash-item-actions .restore-btn:hover { background: var(--primary-100); }
.trash-item-actions .perm-delete-btn { color: #dc2626; border-color: #fca5a5; }
.trash-item-actions .perm-delete-btn:hover { background: #fee2e2; }
