/**
 * admin.css - 超级管理员后台 + 维管精灵样式
 */

/* ===== 节点监控网格 ===== */
.nodes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.node-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.node-card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-md);
}

.node-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
}

.node-card.status-online::before { background: var(--success); }
.node-card.status-warning::before { background: var(--warning); }
.node-card.status-offline::before { background: var(--danger); }
.node-card.status-maintenance::before { background: var(--info); }

.node-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.node-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.node-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  position: relative;
}

.node-status-dot.online { background: var(--success); box-shadow: 0 0 6px var(--success); }
.node-status-dot.warning { background: var(--warning); box-shadow: 0 0 6px var(--warning); }
.node-status-dot.offline { background: var(--danger); box-shadow: 0 0 6px var(--danger); }
.node-status-dot.maintenance { background: var(--info); box-shadow: 0 0 6px var(--info); }

.node-status-dot.online::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 50%;
  border: 1px solid var(--success);
  animation: pulse 2s infinite;
}

.node-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.node-metric {
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 10px;
}

.node-metric-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.node-metric-value {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.node-metric-bar {
  height: 4px;
  background: var(--bg-primary);
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}

.node-metric-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s ease;
}

.node-metric-bar-fill.low { background: var(--success); }
.node-metric-bar-fill.medium { background: var(--warning); }
.node-metric-bar-fill.high { background: var(--danger); }

.node-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(30, 58, 95, 0.4);
  font-size: 12px;
  color: var(--text-muted);
}

/* ===== Tab 切换 ===== */
.tab-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0;
}

.tab-item {
  padding: 10px 20px;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
}

.tab-item:hover {
  color: var(--text-primary);
}

.tab-item.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: rgba(24, 144, 255, 0.05);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease-out;
}

/* ===== 日志样式 ===== */
.log-entry {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(30, 58, 95, 0.3);
  font-size: 13px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

.log-entry:last-child {
  border-bottom: none;
}

.log-time {
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
  width: 160px;
}

.log-level {
  width: 50px;
  text-align: center;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

.log-level.info { background: rgba(24, 144, 255, 0.1); color: var(--primary); }
.log-level.warn { background: rgba(250, 173, 20, 0.1); color: var(--warning); }
.log-level.error { background: rgba(245, 34, 45, 0.1); color: var(--danger); }
.log-level.debug { background: rgba(139, 155, 180, 0.1); color: var(--text-muted); }

.log-message {
  color: var(--text-primary);
  flex: 1;
  word-break: break-all;
}

.log-meta {
  color: var(--text-muted);
  font-size: 11px;
  white-space: nowrap;
}

/* ===== 员工管理 ===== */
.employee-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1890ff, #722ed1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}

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

.employee-name {
  font-weight: 500;
  color: var(--text-primary);
}

.employee-dept {
  font-size: 12px;
  color: var(--text-muted);
}

/* ===== 维管精灵 ===== */
.weiguan-container {
  display: grid;
  grid-template-columns: 1fr 350px;
  gap: 20px;
}

/* AI 对话面板 */
.ai-chat-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 140px);
  overflow: hidden;
}

.ai-chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.ai-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1890ff, #722ed1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #fff;
  flex-shrink: 0;
}

.ai-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.ai-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2s infinite;
}

.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-message {
  display: flex;
  gap: 10px;
  max-width: 85%;
  animation: fadeIn 0.3s ease-out;
}

.ai-message.user {
  flex-direction: row-reverse;
  align-self: flex-end;
}

.ai-message.bot {
  align-self: flex-start;
}

.ai-message-content {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.5;
}

.ai-message.user .ai-message-content {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 2px;
}

.ai-message.bot .ai-message-content {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 2px;
}

.ai-message-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  text-align: right;
}

.ai-typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 14px;
}

.ai-typing-indicator span {
  width: 6px;
  height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out both;
}

.ai-typing-indicator span:nth-child(1) { animation-delay: 0s; }
.ai-typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

.ai-chat-input {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.ai-chat-input .form-input {
  flex: 1;
}

/* ===== 问题清单 ===== */
.issue-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  border: 1px solid transparent;
  transition: var(--transition);
}

.issue-card:hover {
  border-color: var(--border-color);
}

.issue-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.issue-details {
  flex: 1;
  min-width: 0;
}

.issue-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.issue-meta {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--text-muted);
}

/* ===== 修复面板 ===== */
.fix-script-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
  transition: var(--transition);
}

.fix-script-card:hover {
  border-color: var(--border-light);
}

.fix-script-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.fix-script-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.fix-script-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.5;
}

.fix-script-progress {
  margin-bottom: 12px;
}

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

.progress-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  transition: width 0.5s ease;
}

/* ===== 知识库 ===== */
.kb-search {
  margin-bottom: 16px;
}

.kb-list {
  max-height: 500px;
  overflow-y: auto;
}

.kb-item {
  padding: 14px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
}

.kb-item:hover {
  border-color: var(--border-color);
  background: var(--bg-card);
}

.kb-item-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.kb-item-title i {
  color: var(--primary);
  font-size: 12px;
}

.kb-item-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kb-item-meta {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-muted);
}

/* ===== 个人信息页 ===== */
.profile-container {
  max-width: 600px;
  margin: 0 auto;
}

.profile-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1890ff, #722ed1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 600;
  color: #fff;
  margin: 0 auto 16px;
  box-shadow: 0 4px 16px rgba(24, 144, 255, 0.3);
}

.profile-name {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.profile-role {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.profile-info-list {
  text-align: left;
  margin-top: 24px;
}

.profile-info-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid rgba(30, 58, 95, 0.3);
}

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

.profile-info-value {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
}

/* ===== 设置表单 ===== */
.settings-form {
  max-width: 500px;
}

/* ===== 响应式 ===== */
@media (max-width: 1024px) {
  .weiguan-container {
    grid-template-columns: 1fr;
  }

  .ai-chat-panel {
    height: 500px;
  }
}

@media (max-width: 768px) {
  .nodes-grid {
    grid-template-columns: 1fr;
  }

  .node-metrics {
    grid-template-columns: 1fr 1fr 1fr;
  }
}
