/* ============ AI COPILOT WIDGET — new-chat-6be 视觉层 ============ */
/* 设计语言：暗场玻璃 + 1px 细线 + 青色光晕；颜色只以光的形式存在，不使用实心色块 */

/* 浮动入口：一枚发光信号 */
.aic-launch {
  position: fixed; right: 24px; bottom: 24px; z-index: 9000;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 20px;
  border: 1px solid rgba(94, 106, 210, 0.28);
  background: rgba(8, 12, 18, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--text);
  font-family: var(--font-mono); font-size: 10px; font-weight: 500;
  letter-spacing: 0.2em; text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.35s, box-shadow 0.45s, transform 0.35s;
  box-shadow: 0 0 40px rgba(94, 106, 210, 0.12), 0 18px 48px rgba(0, 0, 0, 0.5);
}
.aic-launch::before {
  content: '◈';
  color: var(--accent-2);
  font-size: 14px;
  text-shadow: 0 0 14px rgba(94, 106, 210, 0.8);
}
.aic-launch .aic-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 10px var(--accent-2);
  animation: aicSignal 2.6s ease-in-out infinite;
}
.aic-launch.offline .aic-dot { background: var(--danger); box-shadow: 0 0 10px rgba(255, 65, 38, 0.8); animation: none; }
.aic-launch:hover {
  border-color: rgba(94, 106, 210, 0.6);
  box-shadow: 0 0 60px rgba(94, 106, 210, 0.2), 0 18px 48px rgba(0, 0, 0, 0.55);
  transform: translateY(-1px);
}
.aic-launch.hidden { display: none; }
@keyframes aicSignal { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* 面板：右侧玻璃翼 */
.aic-panel {
  position: fixed; z-index: 9100; top: 0; right: 0; bottom: 0;
  width: min(440px, 100vw);
  background: linear-gradient(180deg, rgba(8, 11, 18, 0.96), rgba(5, 7, 11, 0.98));
  border-left: 1px solid var(--line-hair);
  display: flex; flex-direction: column;
  transform: translateX(102%);
  transition: transform 0.42s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: -32px 0 80px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.aic-panel.open { transform: translateX(0); }
.aic-panel::before {
  content: '';
  position: absolute; top: 0; bottom: 0; left: -1px; width: 1px;
  background: linear-gradient(180deg, transparent, rgba(94, 106, 210, 0.5), transparent);
  pointer-events: none;
}

.aic-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line-hair);
  background: rgba(10, 14, 22, 0.6);
}
.aic-head-title {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-size: 13px; font-weight: 500;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--text);
}
.aic-head-title::before {
  content: '◈';
  color: var(--accent-2);
  text-shadow: 0 0 16px rgba(94, 106, 210, 0.85);
}
.aic-state {
  font-family: var(--font-mono); font-size: 8px; letter-spacing: 0.22em;
  padding: 4px 10px;
  border: 1px solid var(--line-hair);
  color: var(--text-mute);
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  background: transparent;
}
.aic-state::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.aic-state[data-state="READY"], .aic-state[data-state="RESULT"] { color: var(--accent-2); border-color: rgba(94, 106, 210, 0.32); }
.aic-state[data-state="THINKING"], .aic-state[data-state="VALIDATING"], .aic-state[data-state="QUERYING"] { color: var(--accent); border-color: rgba(94, 106, 210, 0.32); }
.aic-state[data-state="EMPTY"] { color: var(--lime); border-color: rgba(247, 191, 139, 0.34); }
.aic-state[data-state="ERROR"], .aic-state[data-state="OFFLINE"] { color: var(--danger); border-color: rgba(255, 65, 38, 0.34); }
.aic-close {
  width: 30px; height: 30px; border: 1px solid var(--line-hair);
  background: transparent; color: var(--text-mute); cursor: pointer;
  font-size: 13px; line-height: 1; border-radius: 0;
  transition: border-color 0.3s, color 0.3s;
}
.aic-close:hover { color: var(--text); border-color: var(--line-lit); }

/* 对话区 */
.aic-body { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.aic-empty {
  margin: auto; text-align: center; color: var(--text-mute);
  font-family: var(--font-mono); font-size: 11px; line-height: 2.1; letter-spacing: 0.06em;
  max-width: 280px;
}
.aic-empty .big {
  font-size: 30px; color: var(--accent-2); opacity: 0.7;
  text-shadow: 0 0 30px rgba(94, 106, 210, 0.5);
  margin-bottom: 10px;
}

/* 问答：左侧光轨，不用卡片底色 */
.aic-qa {
  border: 1px solid var(--line-hair);
  border-left: 1px solid rgba(94, 106, 210, 0.4);
  background: rgba(10, 14, 22, 0.5);
  border-radius: 0;
}
.aic-q {
  padding: 12px 14px; font-size: 13px; color: var(--text);
  border-bottom: 1px solid var(--line-hair);
  display: flex; gap: 8px; line-height: 1.7;
}
.aic-q .p { color: var(--accent-2); font-family: var(--font-mono); }
.aic-a { padding: 14px; font-size: 13px; color: var(--text-dim); line-height: 1.8; display: flex; flex-direction: column; gap: 12px; }
.aic-answer-summary { color: var(--text); font-size: 14px; line-height: 1.85; }
.aic-meta {
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  font-family: var(--font-mono); font-size: 9px; color: var(--text-mute); letter-spacing: 0.12em;
  text-transform: uppercase;
}
.aic-meta b { color: var(--text-dim); font-weight: 500; }

/* 结果表格：只留细线与冷光表头 */
.aic-table-wrap { overflow-x: auto; border: 1px solid var(--line-hair); }
.aic-table { width: 100%; border-collapse: collapse; font-size: 11.5px; font-family: var(--font-mono); }
.aic-table th, .aic-table td { padding: 8px 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); text-align: left; white-space: nowrap; }
.aic-table th {
  background: rgba(94, 106, 210, 0.04);
  color: var(--accent-2);
  font-weight: 500;
  letter-spacing: 0.1em;
  position: sticky; top: 0;
}
.aic-table tr:nth-child(even) td { background: rgba(94, 106, 210, 0.02); }
.aic-table tr:hover td { background: rgba(94, 106, 210, 0.05); }

/* SQL 区块：可展开的代码光带 */
.aic-sql { border: 1px solid var(--line-hair); background: rgba(5, 7, 11, 0.75); }
.aic-sql-toggle {
  width: 100%; display: flex; justify-content: space-between; align-items: center;
  padding: 9px 12px; background: transparent; border: none; cursor: pointer;
  font-family: var(--font-mono); font-size: 9px; color: var(--text-mute);
  letter-spacing: 0.2em; text-transform: uppercase;
}
.aic-sql-toggle:hover { color: var(--accent-2); }
.aic-sql pre {
  display: none; margin: 0; padding: 14px; overflow-x: auto;
  font-family: var(--font-mono); font-size: 11.5px; line-height: 1.7;
  color: #bfe6ff;
  border-top: 1px solid var(--line-hair);
  background: linear-gradient(180deg, rgba(94, 106, 210, 0.04), transparent);
}
.aic-sql.open pre { display: block; }
.aic-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.aic-btn {
  padding: 7px 14px; border: 1px solid var(--line-hair); background: transparent;
  color: var(--text-dim); font-family: var(--font-mono); font-size: 9px; cursor: pointer;
  transition: border-color 0.3s, color 0.3s, box-shadow 0.4s;
  letter-spacing: 0.18em; text-transform: uppercase; border-radius: 0;
}
.aic-btn:hover { border-color: rgba(94, 106, 210, 0.5); color: var(--text); box-shadow: 0 0 24px rgba(94, 106, 210, 0.16); }
/* 主操作同样只以光存在 */
.aic-btn.primary {
  background: rgba(94, 106, 210, 0.1);
  border-color: rgba(94, 106, 210, 0.5);
  color: var(--accent-2);
}
.aic-btn.primary:hover { box-shadow: 0 0 24px rgba(94, 106, 210, 0.2); color: var(--text); }

/* 错误 / 提示条 */
.aic-banner {
  padding: 12px 14px; border: 1px solid rgba(235, 87, 87, 0.4);
  background: rgba(235, 87, 87, 0.08); color: #ff8f7d;
  font-size: 12.5px; line-height: 1.75;
}
.aic-banner.warn { border-color: rgba(247, 191, 139, 0.4); background: rgba(247, 191, 139, 0.06); color: var(--lime); }

/* 输入区 */
.aic-input-row {
  display: flex; gap: 8px; padding: 12px;
  border-top: 1px solid var(--line-hair);
  background: rgba(10, 14, 22, 0.6);
}
.aic-input {
  flex: 1; padding: 11px 12px;
  background: rgba(5, 7, 11, 0.8);
  border: 1px solid var(--line-hair);
  color: var(--text);
  font-family: var(--font-mono); font-size: 12px; outline: none;
  transition: border-color 0.3s, box-shadow 0.4s;
  border-radius: 0;
}
.aic-input:focus { border-color: rgba(94, 106, 210, 0.5); box-shadow: 0 0 28px rgba(94, 106, 210, 0.14); }
.aic-input::placeholder { color: var(--text-mute); }
.aic-send {
  padding: 0 18px;
  background: transparent;
  border: 1px solid rgba(94, 106, 210, 0.45);
  color: var(--accent-2);
  cursor: pointer;
  font-weight: 500; font-size: 10px;
  font-family: var(--font-mono);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  transition: box-shadow 0.4s, border-color 0.3s, color 0.3s;
}
.aic-send:hover { box-shadow: 0 0 28px rgba(94, 106, 210, 0.22); color: #fff; border-color: rgba(94, 106, 210, 0.75); }
.aic-send:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }
.aic-quick {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 12px;
  background: rgba(10, 14, 22, 0.6);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}
.aic-quick button {
  padding: 5px 10px; background: transparent;
  border: 1px solid var(--line-hair);
  color: var(--text-mute);
  font-family: var(--font-mono); font-size: 9px;
  letter-spacing: 0.14em; text-transform: uppercase;
  cursor: pointer; border-radius: 0;
  transition: border-color 0.3s, color 0.3s;
}
.aic-quick button:hover { color: var(--accent-2); border-color: rgba(94, 106, 210, 0.5); }

/* 推理步骤：一条竖向光轨 */
.aic-steps {
  display: flex; flex-direction: column; gap: 8px;
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.1em;
  padding-left: 4px;
  position: relative;
}
.aic-step { display: flex; align-items: center; gap: 10px; color: var(--text-mute); position: relative; }
.aic-step .st-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  flex-shrink: 0;
}
.aic-step.active { color: var(--accent); }
.aic-step.active .st-dot {
  background: var(--accent);
  box-shadow: 0 0 12px rgba(94, 106, 210, 0.9);
  animation: aicPulse 1.1s infinite;
}
.aic-step.done { color: rgba(94, 106, 210, 0.85); }
.aic-step.done .st-dot { background: var(--accent-2); box-shadow: 0 0 10px rgba(94, 106, 210, 0.7); }
@keyframes aicPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* 移动端：底部抽屉 */
@media (max-width: 768px) {
  .aic-launch { right: 16px; bottom: 16px; padding: 11px 16px; font-size: 9px; }
  .aic-panel {
    top: auto; left: 0; width: 100vw; height: 82vh;
    border-left: none; border-top: 1px solid var(--line-hair);
    transform: translateY(103%);
  }
  .aic-panel.open { transform: translateY(0); }
  .aic-panel::before { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .aic-panel, .aic-launch { transition: none; }
  .aic-launch .aic-dot, .aic-step.active .st-dot { animation: none; }
}
