/* ===== AI聚变堆 — Agent PK 主题样式 ===== */

:root {
  --apk-accent: #a78bfa;
  --apk-glow: rgba(167, 139, 250, 0.4);
  --apk-fast: #22c55e;
}

/* ---- 背景 ---- */
.agent-pk-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: radial-gradient(ellipse at 50% 0%, rgba(167, 139, 250, 0.06), transparent 60%),
              linear-gradient(180deg, #0a0e1a 0%, #0f172a 50%, #181c2b 100%);
}

/* ---- 主容器 ---- */
.agent-pk-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 80px 24px 48px;
}

/* ---- Hero ---- */
.agent-pk-hero {
  text-align: center;
  margin-bottom: 32px;
}
.agent-pk-title {
  font-size: 2rem;
  font-weight: 800;
  color: #fff;
  margin: 0 0 8px;
  letter-spacing: 0.04em;
}
.agent-pk-title-icon {
  display: inline-block;
  animation: agentPkPulse 1.8s ease-in-out infinite;
}
@keyframes agentPkPulse {
  0%, 100% { filter: drop-shadow(0 0 6px var(--apk-glow)); }
  50% { filter: drop-shadow(0 0 18px rgba(167, 139, 250, 0.8)); }
}
.agent-pk-subtitle {
  color: #94a3b8;
  font-size: 0.95rem;
  margin: 0;
}

/* ---- 视图切换 & 对比表 ---- */
.apk-view-tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 28px;
}
.apk-view-tab {
  padding: 10px 28px;
  border: 1px solid rgba(148,163,184,0.3);
  border-radius: 999px;
  background: rgba(15,23,42,0.7);
  color: #94a3b8;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.apk-view-tab:hover { border-color: rgba(148,163,184,0.6); color: #e2e8f0; }
.apk-view-tab.active {
  background: rgba(167,139,250,0.12);
  border-color: #a78bfa;
  color: #a78bfa;
  box-shadow: 0 0 16px rgba(167,139,250,0.15);
}
.apk-view-panel { display: none; }
.apk-view-panel.active { display: block; }

.apk-compare-card {
  background: rgba(15,23,42,0.85);
  border: 1px solid rgba(148,163,184,0.25);
  border-radius: 16px;
  padding: 20px;
  backdrop-filter: blur(12px);
  margin-bottom: 24px;
}
.apk-table-wrap { overflow-x: auto; }
.apk-compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  min-width: 800px;
}
.apk-compare-table th {
  text-align: left;
  padding: 12px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #a78bfa;
  border-bottom: 2px solid rgba(167,139,250,0.3);
  white-space: nowrap;
}
.apk-compare-table td {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(148,163,184,0.1);
  color: #cbd5f5;
  vertical-align: top;
  line-height: 1.5;
}
.apk-compare-table tbody tr:hover { background: rgba(167,139,250,0.04); }
.apk-compare-table tbody tr:last-child td { border-bottom: none; }
.apk-compare-table td:first-child { white-space: nowrap; color: #fff; }
.apk-compare-table small { color: #64748b; font-size: 0.72rem; }
.apk-compare-foot {
  margin: 16px 0 0;
  padding: 12px 16px;
  background: rgba(167,139,250,0.06);
  border-radius: 10px;
  color: #94a3b8;
  font-size: 0.85rem;
  text-align: center;
}
@media (max-width: 768px) { .apk-hide-sm { display: none; } }

/* ---- 输入卡片 ---- */
.agent-pk-input-section {
  margin-bottom: 36px;
}
.agent-pk-input-card {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 16px;
  padding: 24px;
  backdrop-filter: blur(12px);
}

/* ---- Agent 选择行 ---- */
.agent-pk-model-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.agent-pk-check {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.3);
  font-size: 0.88rem;
  color: #cbd5f5;
  transition: all 0.2s ease;
  user-select: none;
}
.agent-pk-check:hover {
  border-color: rgba(148, 163, 184, 0.6);
  background: rgba(30, 41, 59, 0.95);
}
.agent-pk-check input[type="checkbox"] {
  accent-color: var(--apk-accent);
  width: 16px;
  height: 16px;
  cursor: pointer;
}
.agent-pk-check:has(input:checked) {
  border-color: var(--apk-accent);
  background: rgba(167, 139, 250, 0.08);
  color: #fff;
  box-shadow: 0 0 12px rgba(167, 139, 250, 0.15);
}

/* ---- 输入行 ---- */
.agent-pk-input-row {
  display: flex;
  gap: 12px;
  align-items: stretch;
}
.agent-pk-textarea {
  flex: 1;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 12px;
  padding: 14px 16px;
  color: #e2e8f0;
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
  min-height: 56px;
  max-height: 200px;
  transition: border-color 0.2s;
}
.agent-pk-textarea:focus {
  outline: none;
  border-color: var(--apk-accent);
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.1);
}
.agent-pk-textarea::placeholder {
  color: #64748b;
}

/* ---- 发送按钮 ---- */
.agent-pk-send-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 12px 28px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  min-width: 100px;
}
.agent-pk-send-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(139, 92, 246, 0.35);
}
.agent-pk-send-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.6);
}
.agent-pk-send-btn.loading {
  background: linear-gradient(135deg, #64748b, #475569);
  animation: agentPkLoading 0.8s ease-in-out infinite;
}
@keyframes agentPkLoading {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}
.agent-pk-send-icon {
  font-size: 1.2rem;
}

/* ---- 状态 ---- */
.agent-pk-status {
  text-align: center;
  margin-top: 12px;
  font-size: 0.85rem;
  color: #94a3b8;
  min-height: 20px;
}

/* ---- 结果区 ---- */
.agent-pk-results-section {
  margin-top: 8px;
}
.agent-pk-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  align-items: start;
}
@media (max-width: 1200px) {
  .agent-pk-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .agent-pk-grid { grid-template-columns: 1fr; }
}

/* ---- PK 结果卡片 ---- */
.agent-pk-card {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 14px;
  overflow: hidden;
  transition: all 0.3s ease;
}
.agent-pk-card.winner {
  border-color: var(--apk-fast);
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.2), 0 0 40px rgba(34, 197, 94, 0.06);
}
.agent-pk-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}
.agent-pk-card-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
}
.agent-pk-card-model {
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  flex: 1;
}
.agent-pk-card-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.agent-pk-card-badge.duration {
  background: rgba(100, 116, 139, 0.2);
  color: #94a3b8;
}
.agent-pk-card-badge.fastest {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  animation: fastestGlowAPK 1.5s ease-in-out infinite;
}
@keyframes fastestGlowAPK {
  0%, 100% { box-shadow: 0 0 6px rgba(34, 197, 94, 0.3); }
  50% { box-shadow: 0 0 14px rgba(34, 197, 94, 0.6); }
}
.agent-pk-card-body {
  padding: 16px;
  max-height: 500px;
  overflow-y: auto;
  font-size: 0.9rem;
  line-height: 1.7;
  color: #cbd5f5;
}

/* ---- 加载态骨架屏 ---- */
.agent-pk-card-skeleton {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.agent-pk-skel-bar {
  height: 14px;
  border-radius: 7px;
  background: linear-gradient(90deg, rgba(148,163,184,0.1), rgba(167,139,250,0.15), rgba(148,163,184,0.1));
  background-size: 200% 100%;
  animation: skelShimmer 1.6s ease-in-out infinite;
}
.agent-pk-skel-bar.short { width: 60%; }
.agent-pk-skel-bar.mid { width: 85%; }
.agent-pk-skel-bar.long { width: 100%; }
@keyframes skelShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---- 加载脉冲 ---- */
.agent-pk-card.loading .agent-pk-card-header {
  border-bottom-color: rgba(167, 139, 250, 0.2);
}
.agent-pk-card.loading .agent-pk-card-icon {
  animation: agentPkPulse 0.9s ease-in-out infinite;
}

/* ---- 完成动画 ---- */
.agent-pk-card.done {
  animation: cardRevealAPK 0.4s ease-out both;
}
@keyframes cardRevealAPK {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- 错误卡片 ---- */
.agent-pk-card.error .agent-pk-card-header {
  border-bottom-color: rgba(239, 68, 68, 0.3);
}
.agent-pk-card-error {
  color: #f87171;
  font-size: 0.85rem;
  padding: 8px 0;
}

/* ---- Markdown 内容 ---- */
.agent-pk-card-body pre {
  background: rgba(0, 0, 0, 0.4);
  border-radius: 8px;
  padding: 12px 16px;
  overflow-x: auto;
  font-size: 0.82rem;
  border: 1px solid rgba(148, 163, 184, 0.15);
}
.agent-pk-card-body code {
  font-family: 'Fira Code', 'JetBrains Mono', monospace;
}
.agent-pk-card-body p code {
  background: rgba(148, 163, 184, 0.15);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
}
.agent-pk-card-body h1, .agent-pk-card-body h2, .agent-pk-card-body h3 {
  color: #f1f5f9;
  margin-top: 1em;
}

/* ---- 导出区 ---- */
.agent-pk-export-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 24px;
}
.agent-pk-export-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.7);
  color: #94a3b8;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}
.agent-pk-export-btn:hover {
  border-color: rgba(148, 163, 184, 0.6);
  color: #e2e8f0;
  background: rgba(30, 41, 59, 0.8);
}

/* ---- Tab 切换 ---- */
.apk-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}
.apk-tab {
  flex: 1;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  text-align: center;
}
.apk-tab:hover {
  color: #e2e8f0;
  background: rgba(148, 163, 184, 0.05);
}
.apk-tab.active {
  color: #a78bfa;
  border-bottom-color: #a78bfa;
}
.apk-panel {
  display: none;
}
.apk-panel.active {
  display: block;
}

/* ---- 预览区 ---- */
.apk-preview-wrap {
  display: flex;
  flex-direction: column;
  min-height: 350px;
}
.apk-preview-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(30, 41, 59, 0.6);
  border-radius: 8px 8px 0 0;
  font-size: 0.8rem;
  color: #94a3b8;
}
.apk-preview-ext {
  color: #a78bfa;
  text-decoration: none;
  font-size: 0.78rem;
}
.apk-preview-ext:hover {
  text-decoration: underline;
}
.apk-iframe {
  width: 100%;
  min-height: 350px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 0 0 8px 8px;
  background: #fff;
}

/* ---- 运行输出区 ---- */
.apk-run-output pre {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 8px;
  padding: 12px;
  overflow-x: auto;
  font-size: 0.82rem;
  color: #22c55e;
  margin: 0;
}
.apk-run-label {
  font-size: 0.78rem;
  color: #94a3b8;
  margin-bottom: 6px;
}

/* ---- 空状态 ---- */
.agent-pk-empty {
  text-align: center;
  padding: 60px 20px;
  color: #64748b;
}
.agent-pk-empty-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 12px;
}
.agent-pk-empty p {
  font-size: 0.95rem;
  margin: 0;
}
