/* ============================================================
   OPC 社区 · AI 设计语言（工业级 · 高端 · 全站通用）
   依赖 main.css 的设计变量，可独立叠加在任何前台页面
   ============================================================ */
:root {
  --ai-c1: #0f4fd8;
  --ai-c2: #00b8d9;
  --ai-c3: #7c5cff;
  --ai-grad: linear-gradient(115deg, var(--ai-c1), var(--ai-c2) 55%, var(--ai-c3));
  --ai-grad-soft: linear-gradient(115deg, rgba(15,79,216,.09), rgba(0,184,217,.09) 55%, rgba(124,92,255,.10));
  --ai-dark: #0a1226;
  --ai-dark-2: #0e1a38;
  --ai-line: rgba(0, 184, 217, .35);
  --ai-mono: "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
}

/* ---------- 通用组件 ---------- */
.ai-chip-tag {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--ai-grad); color: #fff;
  font-size: 11px; font-weight: 700; letter-spacing: .5px;
  border-radius: 999px; padding: 4px 12px;
  box-shadow: 0 2px 10px rgba(31, 107, 244, .35);
}

/* 流光渐变文字 */
.ai-shimmer {
  background: var(--ai-grad);
  background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  animation: ai-shimmer-move 5.5s linear infinite;
}
@keyframes ai-shimmer-move {
  0% { background-position: 0% 0; }
  100% { background-position: 220% 0; }
}

/* 呼吸状态点 */
.ai-pulse {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--ai-c2); position: relative; flex-shrink: 0;
}
.ai-pulse::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 1.5px solid var(--ai-c2); opacity: 0;
  animation: ai-pulse-ring 2.2s ease-out infinite;
}
@keyframes ai-pulse-ring {
  0% { transform: scale(.55); opacity: .9; }
  70% { transform: scale(1.25); opacity: 0; }
  100% { opacity: 0; }
}

/* 工业级键帽 */
.ai-kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 5px;
  font-family: var(--ai-mono); font-size: 10.5px; font-weight: 600;
  color: var(--ink2); background: #fff;
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px;
}

/* ---------- 工业级 HUD 面板（四角括号标记） ---------- */
.ai-hud {
  position: relative; background: var(--ai-dark); color: #cfe3ff;
  border-radius: 12px; padding: 14px 18px; overflow: hidden;
}
.ai-hud::before, .ai-hud::after,
.ai-hud > .ai-hud-c::before, .ai-hud > .ai-hud-c::after {
  content: ""; position: absolute; width: 14px; height: 14px; pointer-events: none;
}
.ai-hud::before { top: 6px; left: 6px; border-top: 2px solid var(--ai-c2); border-left: 2px solid var(--ai-c2); border-top-left-radius: 4px; }
.ai-hud::after { top: 6px; right: 6px; border-top: 2px solid var(--ai-c2); border-right: 2px solid var(--ai-c2); border-top-right-radius: 4px; }
.ai-hud > .ai-hud-c::before { bottom: 6px; left: 6px; border-bottom: 2px solid var(--ai-c2); border-left: 2px solid var(--ai-c2); border-bottom-left-radius: 4px; }
.ai-hud > .ai-hud-c::after { bottom: 6px; right: 6px; border-bottom: 2px solid var(--ai-c2); border-right: 2px solid var(--ai-c2); border-bottom-right-radius: 4px; }
.ai-hud-tag {
  font-family: var(--ai-mono); font-size: 9.5px; font-weight: 600;
  letter-spacing: 1.6px; text-transform: uppercase; color: rgba(0, 184, 217, .85);
}
.ai-hud .grid-bg {
  position: absolute; inset: 0; opacity: .35; pointer-events: none;
  background-image:
    linear-gradient(rgba(0,184,217,.14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,184,217,.14) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: radial-gradient(ellipse 90% 130% at 50% -10%, #000 45%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 90% 130% at 50% -10%, #000 45%, transparent 100%);
}

/* ---------- AI 数据跑马灯（工业级状态带） ---------- */
.ai-ticker-wrap { margin-top: 16px; }
.ai-ticker {
  position: relative; overflow: hidden; border-radius: 10px;
  background: linear-gradient(90deg, var(--ai-dark), var(--ai-dark-2) 50%, var(--ai-dark));
  border: 1px solid rgba(0, 184, 217, .22);
  display: flex; align-items: center; height: 40px;
}
.ai-ticker::before, .ai-ticker::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 46px; z-index: 2; pointer-events: none;
}
.ai-ticker::before { left: 0; background: linear-gradient(90deg, var(--ai-dark), transparent); }
.ai-ticker::after { right: 0; background: linear-gradient(-90deg, var(--ai-dark), transparent); }
.ai-ticker-track {
  display: flex; align-items: center; gap: 0; white-space: nowrap;
  animation: ai-ticker-scroll 36s linear infinite; will-change: transform;
}
.ai-ticker:hover .ai-ticker-track { animation-play-state: paused; }
@keyframes ai-ticker-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
.ai-ticker-item {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--ai-mono); font-size: 11px; font-weight: 600;
  letter-spacing: 1.1px; text-transform: uppercase;
  color: rgba(207, 227, 255, .82); padding: 0 22px;
}
.ai-ticker-item b { color: #56e0ff; font-weight: 700; }
.ai-ticker-item .sep { color: rgba(124, 92, 255, .8); font-weight: 400; }
.ai-ticker-item .ok-ico { color: #35e0a1; font-size: 10px; }

/* ---------- ⌘K 智能命令面板 ---------- */
.cmdk-trigger {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 10px 0 12px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 9px;
  background: #fbfdff; color: var(--ink2); font-family: inherit;
  font-size: 12.5px; transition: .15s; flex-shrink: 0;
}
.cmdk-trigger:hover { border-color: var(--ai-c2); background: #fff; box-shadow: 0 2px 10px rgba(31, 107, 244, .18); color: var(--brand); }
.cmdk-trigger .ico { font-size: 13px; }
.cmdk-trigger .tt { font-weight: 600; }
.cmdk-trigger .ai-kbd { height: 18px; min-width: 18px; font-size: 9.5px; }

.ai-cmdk-mask {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(8, 16, 36, .45); backdrop-filter: blur(6px);
  display: none; align-items: flex-start; justify-content: center;
  padding: 14vh 16px 16px;
}
.ai-cmdk-mask.open { display: flex; }
.ai-cmdk {
  width: min(640px, 100%); max-height: min(560px, 70vh);
  display: flex; flex-direction: column;
  background: rgba(255, 255, 255, .97); backdrop-filter: blur(18px);
  border-radius: 16px; box-shadow: 0 24px 80px rgba(5, 14, 38, .35);
  overflow: hidden; animation: ai-cmdk-in .18s ease;
}
@keyframes ai-cmdk-in {
  from { transform: translateY(-10px) scale(.985); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.ai-cmdk-bar {
  position: relative; display: flex; align-items: center; gap: 10px;
  padding: 15px 18px; border-bottom: 1px solid var(--line);
}
.ai-cmdk-bar::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2.5px;
  background: var(--ai-grad);
}
.ai-cmdk-bar .ico { font-size: 16px; }
.ai-cmdk-bar input {
  flex: 1; border: none; outline: none; font-size: 15px; background: transparent;
  font-family: inherit; color: var(--ink); min-width: 0;
}
.ai-cmdk-bar input::placeholder { color: var(--faint); }
.ai-cmdk-bar .esc { flex-shrink: 0; }
.ai-cmdk-body { overflow-y: auto; flex: 1; padding: 8px 10px 12px; }
.ai-cmdk-group { margin-top: 6px; }
.ai-cmdk-group-h {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--ai-mono); font-size: 10px; font-weight: 600;
  letter-spacing: 1.6px; text-transform: uppercase; color: var(--faint);
  padding: 10px 12px 6px;
}
.ai-cmdk-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  border: none; background: transparent; text-align: left; cursor: pointer;
  padding: 10px 12px; border-radius: 10px; font-family: inherit; font-size: 13.5px;
  color: var(--ink); transition: background .12s;
}
.ai-cmdk-item .ci { font-size: 16px; width: 22px; text-align: center; flex-shrink: 0; }
.ai-cmdk-item .ct { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-cmdk-item .ct mark { background: none; color: var(--brand); font-weight: 700; padding: 0; }
.ai-cmdk-item .cs { font-size: 11.5px; color: var(--faint); flex-shrink: 0; }
.ai-cmdk-item.on, .ai-cmdk-item:hover { background: var(--ai-grad-soft); }
.ai-cmdk-item.on .ct mark, .ai-cmdk-item:hover .ct mark { color: var(--brand-dark); }
.ai-cmdk-item.ai-cta {
  background: var(--ai-grad); color: #fff; font-weight: 600;
  margin: 8px 12px 4px; border-radius: 11px; justify-content: center;
  box-shadow: 0 4px 14px rgba(31, 107, 244, .32);
}
.ai-cmdk-item.ai-cta:hover { filter: brightness(1.08); }
.ai-cmdk-item.ai-cta .ct, .ai-cmdk-item.ai-cta .ci { color: #fff; }
.ai-cmdk-empty { text-align: center; color: var(--muted); font-size: 13px; padding: 26px 0 18px; }
.ai-cmdk-foot {
  display: flex; align-items: center; gap: 14px; padding: 9px 16px;
  border-top: 1px solid var(--line); background: #fbfdff;
  font-size: 11px; color: var(--faint);
}
.ai-cmdk-foot .sp { flex: 1; }
.ai-cmdk-foot .fi { display: inline-flex; align-items: center; gap: 5px; }
.ai-cmdk-skel { padding: 4px 12px; }
.ai-cmdk-skel .sk {
  height: 38px; border-radius: 9px; margin-top: 8px;
  background: linear-gradient(90deg, #f0f4fa 25%, #f8fafd 45%, #f0f4fa 65%);
  background-size: 200% 100%; animation: ai-skel 1.1s linear infinite;
}
@keyframes ai-skel { 0% { background-position: 130% 0; } 100% { background-position: -70% 0; } }

/* ---------- 信息流 AI 速读 ---------- */
.ai-ask-btn {
  background: var(--ai-grad) !important; color: #fff !important;
  border: none !important; box-shadow: 0 3px 14px rgba(31, 107, 244, .35);
  white-space: nowrap;
}
.ai-ask-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }

.ai-sum-btn {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid transparent; border-radius: 999px; cursor: pointer;
  font-family: inherit; font-size: 11.5px; font-weight: 700; letter-spacing: .3px;
  padding: 3px 10px; color: var(--ai-c1);
  background: var(--ai-grad-soft);
  background-image: linear-gradient(#fff, #fff), var(--ai-grad);
  background-origin: border-box; background-clip: padding-box, border-box;
  transition: .15s;
}
.ai-sum-btn:hover { box-shadow: 0 2px 10px rgba(31, 107, 244, .25); transform: translateY(-1px); }
.ai-sum-btn:disabled { opacity: .55; cursor: wait; transform: none; }
.ai-sum-mask {
  position: fixed; inset: 0; z-index: 280; background: rgba(8, 16, 36, .5);
  backdrop-filter: blur(5px); display: flex; align-items: center; justify-content: center;
  padding: 16px; animation: ai-fade .16s ease;
}
@keyframes ai-fade { from { opacity: 0; } to { opacity: 1; } }
.ai-sum-pop {
  width: min(560px, 100%); max-height: min(72vh, 620px);
  background: var(--ai-dark); color: #dbe7ff; border-radius: 16px;
  box-shadow: 0 30px 90px rgba(4, 10, 28, .5);
  display: flex; flex-direction: column; overflow: hidden;
  animation: ai-pop-in .2s cubic-bezier(.2, .9, .3, 1.2);
}
@keyframes ai-pop-in {
  from { transform: translateY(14px) scale(.97); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.ai-sum-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px 12px; border-bottom: 1px solid rgba(0, 184, 217, .2);
}
.ai-sum-head .ai-orb-mini {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  background: var(--ai-grad); display: grid; place-items: center;
  font-size: 10.5px; font-weight: 800; color: #fff; letter-spacing: .5px;
  box-shadow: 0 2px 10px rgba(31, 107, 244, .4);
}
.ai-sum-head .tt { flex: 1; min-width: 0; }
.ai-sum-head .tt b { display: block; font-size: 13.5px; color: #fff; }
.ai-sum-head .tt span {
  display: block; font-family: var(--ai-mono); font-size: 9.5px;
  letter-spacing: 1.5px; color: rgba(0, 184, 217, .8); margin-top: 1px;
  text-transform: uppercase;
}
.ai-sum-head .x {
  border: none; background: rgba(255, 255, 255, .08); color: #9fb4d8;
  width: 28px; height: 28px; border-radius: 8px; cursor: pointer; font-size: 13px;
}
.ai-sum-head .x:hover { background: rgba(255, 255, 255, .16); color: #fff; }
.ai-sum-body {
  padding: 16px 18px; overflow-y: auto; flex: 1;
  font-size: 13.5px; line-height: 1.85; color: #c9d8f2;
}
.ai-sum-body p { margin: 0 0 8px; }
.ai-sum-body strong, .ai-sum-body b { color: #fff; }
.ai-sum-body code {
  font-family: var(--ai-mono); font-size: 12px; color: #56e0ff;
  background: rgba(0, 184, 217, .12); border-radius: 4px; padding: 1px 5px;
}
.ai-sum-body ul { margin: 0 0 8px; padding-left: 18px; }
.ai-sum-caret {
  display: inline-block; width: 7px; height: 14px; vertical-align: -2px;
  background: #56e0ff; margin-left: 2px; animation: ai-caret .8s steps(1) infinite;
}
@keyframes ai-caret { 0%, 55% { opacity: 1; } 56%, 100% { opacity: 0; } }
.ai-sum-foot {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 11px 18px; border-top: 1px solid rgba(0, 184, 217, .2);
  background: rgba(0, 184, 217, .05);
  font-family: var(--ai-mono); font-size: 10px; letter-spacing: 1px;
  color: rgba(159, 180, 216, .75); text-transform: uppercase;
}
.ai-sum-foot .tag-live { color: #35e0a1; }
.ai-sum-foot .tag-mock { color: #ffd166; }
.ai-sum-foot .go {
  margin-left: auto; font-family: inherit; letter-spacing: 0; text-transform: none;
  font-size: 12px; font-weight: 600; cursor: pointer;
  background: var(--ai-grad); color: #fff; border: none;
  border-radius: 8px; padding: 6px 14px;
}

/* ---------- 企业卡 AI 匹配度 ---------- */
.ai-match {
  display: flex; align-items: center; gap: 9px; margin-top: 10px;
  padding-top: 10px; border-top: 1px dashed var(--line);
}
.ai-match .mt {
  font-family: var(--ai-mono); font-size: 9px; font-weight: 700;
  letter-spacing: 1.2px; color: var(--ai-c1);
  background: var(--ai-grad-soft); border-radius: 4px; padding: 2.5px 7px;
  flex-shrink: 0;
}
.ai-match .bar {
  flex: 1; height: 5px; border-radius: 3px; background: var(--line-soft); overflow: hidden;
}
.ai-match .bar i {
  display: block; height: 100%; border-radius: 3px;
  background: var(--ai-grad); width: 0;
  animation: ai-bar-grow .9s cubic-bezier(.25, .8, .3, 1) forwards;
}
@keyframes ai-bar-grow { to { width: var(--w, 80%); } }
.ai-match .v {
  font-family: var(--ai-mono); font-size: 11.5px; font-weight: 700;
  color: var(--ai-c1); flex-shrink: 0;
}

/* ---------- AI 对话回复 · 渐显打字机 ---------- */
.ai-bubble.bot .md { animation: ai-reveal .45s ease; }
@keyframes ai-reveal {
  from { clip-path: inset(0 0 100% 0); opacity: .35; }
  to { clip-path: inset(0 0 -10% 0); opacity: 1; }
}
.ai-bubble.bot .md .ai-type-caret {
  display: inline-block; width: 6px; height: 13px; vertical-align: -2px;
  background: var(--ai-c2); margin-left: 2px; border-radius: 1px;
  animation: ai-caret .8s steps(1) infinite;
}

/* ---------- 悬浮 AI 助手 · 重设计（覆盖 main.css 基础样式） ---------- */
.ai-fab {
  background: var(--ai-grad) !important;
  border: none !important;
  box-shadow: 0 6px 22px rgba(31, 107, 244, .4), 0 0 0 0 rgba(31, 107, 244, .45) !important;
  animation: ai-fab-ring 3s ease-out infinite;
  position: relative;
}
@keyframes ai-fab-ring {
  0% { box-shadow: 0 6px 22px rgba(31, 107, 244, .4), 0 0 0 0 rgba(31, 107, 244, .35); }
  70% { box-shadow: 0 6px 22px rgba(31, 107, 244, .4), 0 0 0 12px rgba(31, 107, 244, 0); }
  100% { box-shadow: 0 6px 22px rgba(31, 107, 244, .4), 0 0 0 0 rgba(31, 107, 244, 0); }
}
.ai-fab:hover { filter: brightness(1.1); transform: translateY(-2px); }
.ai-fab .mark {
  background: rgba(255, 255, 255, .18) !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35);
}
.ai-fab .dot-live {
  position: absolute; top: 7px; right: 7px; width: 7px; height: 7px;
  border-radius: 50%; background: #35e0a1; border: 1.5px solid #fff;
}
.ai-drawer {
  border: 1px solid rgba(31, 107, 244, .22);
  box-shadow: 0 -6px 60px rgba(5, 14, 38, .28), 0 0 0 1px rgba(255, 255, 255, .6) inset;
}
.ai-drawer-head {
  background: linear-gradient(115deg, var(--ai-dark), var(--ai-dark-2));
  color: #fff; position: relative; overflow: hidden;
}
.ai-drawer-head .ai-avatar {
  background: var(--ai-grad) !important;
  box-shadow: 0 2px 10px rgba(0, 184, 217, .45);
}
.ai-drawer-head::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(0,184,217,.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,184,217,.12) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: radial-gradient(ellipse 80% 120% at 100% 0%, #000 40%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 80% 120% at 100% 0%, #000 40%, transparent 100%);
}
.ai-drawer-head .who b { color: #fff; }
.ai-drawer-head .who span { color: rgba(207, 227, 255, .7); }
.ai-drawer-head .close { color: #9fb4d8; background: rgba(255, 255, 255, .08); }
.ai-drawer-head .close:hover { background: rgba(255, 255, 255, .18); color: #fff; }

/* ---------- 导航兼容：⌘K 按钮加入后防挤压 ---------- */
.nav a { white-space: nowrap; flex-shrink: 0; }
.cmdk-trigger { flex: 0 0 auto; }
@media (max-width: 1240px) {
  /* 中窄屏：隐藏顶栏独立搜索框，检索统一走 ⌘K 面板 */
  .hsearch { display: none; }
}

/* ---------- 移动端适配 ---------- */
@media (max-width: 820px) {
  .cmdk-trigger .tt, .cmdk-trigger .ai-kbd { display: none; }
  .cmdk-trigger { padding: 0 9px; height: 32px; }
  .cmdk-trigger .ico { font-size: 14px; }
  .ai-cmdk-mask { padding: 8vh 12px 12px; }
  /* hero 搜索区三元素：窄屏换行，防「AI 一下」被裁切 */
  .hero-search { flex-wrap: wrap; gap: 8px; }
  .hero-search input { flex: 1 1 100%; height: 40px; background: transparent; border-radius: 10px; color: var(--ink); }
  .hero-search input::placeholder { color: var(--muted); }
  .hero-search .btn { flex: 1; }
  .ai-ticker-wrap { margin-top: 12px; }
  .ai-ticker { height: 36px; }
  .ai-ticker-item { font-size: 10px; padding: 0 16px; letter-spacing: .9px; }
  .ai-sum-pop { max-height: 80vh; border-radius: 14px; }
  .ai-sum-body { padding: 14px 16px; font-size: 13px; }
  .ai-sum-foot .go { width: 100%; text-align: center; padding: 8px; }
  .ai-match .mt { font-size: 8.5px; letter-spacing: .8px; }
  .ai-hud { padding: 12px 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .ai-shimmer, .ai-ticker-track, .ai-fab, .ai-pulse::after,
  .ai-bubble.bot .md, .ai-sum-btn, .ai-match .bar i { animation: none !important; }
  .ai-match .bar i { width: var(--w, 80%); }
}
