/* =====================================================================
   天云港AI插件 · 自持 UI 样式（zibll 风格 · 精致 / 轻量）
   仅作用于插件自身输出的界面（审计页 / MetaBox / 评论徽章 / @ 弹层），
   不触碰前端 antd 组件与主题样式。
   ===================================================================== */

:root {
  --tyg-radius-sm: 8px;
  --tyg-radius: 12px;
  --tyg-radius-lg: 16px;
  --tyg-radius-pill: 999px;
  --tyg-border: rgba(100, 116, 139, .18);
  --tyg-border-strong: rgba(100, 116, 139, .28);
  --tyg-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .06);
  --tyg-shadow-lg: 0 8px 32px rgba(16, 24, 40, .18);
  --tyg-bg-soft: #f8fafc;
  --tyg-text-main: #1f2430;
  --tyg-text-muted: #64748b;
  --tyg-brand: #2c7be5;
  --tyg-brand-grad: linear-gradient(135deg, #2c7be5, #4f8ff7);
  --tyg-success: #16a34a;
  --tyg-success-bg: #f0fdf4;
  --tyg-success-border: #bbf7d0;
  --tyg-error: #dc2626;
  --tyg-error-bg: #fef2f2;
  --tyg-error-border: #fecaca;
  --tyg-warn: #d97706;
  --tyg-warn-bg: #fffbeb;
  --tyg-warn-border: #fde68a;
}

/* ---------- 通用 SVG 图标 ---------- */
.tyg-ico {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: -0.125em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

/* =====================================================================
   审计日志页
   ===================================================================== */
.tyg-audit-wrap { max-width: 1180px; }

.tyg-audit-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin: 0 0 20px;
}
.tyg-audit-head h1 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: .2px;
  color: var(--tyg-text-main);
}
.tyg-audit-head .tyg-ico {
  color: var(--tyg-brand);
  width: 22px;
  height: 22px;
}

.tyg-audit-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 14px;
}
.tyg-audit-toolbar .tyg-audit-select {
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--tyg-border);
  border-radius: var(--tyg-radius-sm);
  background: #fff;
  color: var(--tyg-text-main);
  font-size: 13px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.tyg-audit-toolbar .tyg-audit-select:focus {
  border-color: var(--tyg-brand);
  box-shadow: 0 0 0 3px rgba(44, 123, 229, .14);
}

.tyg-audit-card {
  background: #fff;
  border: 1px solid var(--tyg-border);
  border-radius: var(--tyg-radius-lg);
  box-shadow: var(--tyg-shadow);
  overflow: hidden;
}
.tyg-audit-card table { margin: 0; border: none; }
.tyg-audit-card .widefat { border: none; }
.tyg-audit-card thead th {
  background: var(--tyg-bg-soft);
  color: var(--tyg-text-muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .4px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--tyg-border);
}
.tyg-audit-card tbody td {
  padding: 11px 14px;
  font-size: 13px;
  color: var(--tyg-text-main);
  border-bottom: 1px solid rgba(100, 116, 139, .08);
  vertical-align: middle;
}
.tyg-audit-card tbody tr:last-child td { border-bottom: none; }
.tyg-audit-card tbody tr:hover td { background: #f6f8fb; }
.tyg-audit-detail {
  max-width: 420px;
  word-break: break-all;
  color: var(--tyg-text-muted);
  font-size: 12px;
}
.tyg-audit-mono { font-variant-numeric: tabular-nums; color: var(--tyg-text-muted); }

/* 状态徽章 */
.tyg-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--tyg-radius-pill);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.7;
  white-space: nowrap;
}
.tyg-badge .tyg-ico { width: 12px; height: 12px; }
.tyg-badge-success { background: var(--tyg-success-bg); color: var(--tyg-success); border: 1px solid var(--tyg-success-border); }
.tyg-badge-error   { background: var(--tyg-error-bg);   color: var(--tyg-error);   border: 1px solid var(--tyg-error-border); }
.tyg-badge-warn    { background: var(--tyg-warn-bg);    color: var(--tyg-warn);    border: 1px solid var(--tyg-warn-border); }

/* 空状态 */
.tyg-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 56px 20px;
  text-align: center;
  color: var(--tyg-text-muted);
}
.tyg-empty .tyg-ico {
  width: 40px;
  height: 40px;
  padding: 10px;
  border-radius: var(--tyg-radius);
  background: var(--tyg-bg-soft);
  color: #94a3b8;
  box-sizing: content-box;
}
.tyg-empty strong { font-size: 14px; color: var(--tyg-text-main); }
.tyg-empty span { font-size: 12.5px; }

/* 页脚操作行 */
.tyg-audit-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 16px;
  background: var(--tyg-bg-soft);
  border-top: 1px solid var(--tyg-border);
}
.tyg-audit-count { font-size: 12px; color: var(--tyg-text-muted); }

/* 危险按钮 */
.tyg-btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--tyg-error-border);
  border-radius: var(--tyg-radius-sm);
  background: #fff;
  color: var(--tyg-error);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s, box-shadow .2s;
}
.tyg-btn-danger:hover {
  background: var(--tyg-error-bg);
  border-color: var(--tyg-error);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, .12);
}
.tyg-btn-danger .tyg-ico { width: 14px; height: 14px; }

/* 确认对话框 */
.tyg-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, .42);
  backdrop-filter: blur(3px);
  animation: tyg-fade .18s ease;
}
.tyg-modal.is-open { display: flex; }
.tyg-modal-box {
  width: min(420px, 94vw);
  background: #fff;
  border-radius: var(--tyg-radius-lg);
  box-shadow: var(--tyg-shadow-lg);
  overflow: hidden;
  animation: tyg-pop .22s cubic-bezier(.2, .9, .3, 1.2);
}
.tyg-modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 22px 0;
}
.tyg-modal-head .tyg-ico {
  width: 22px;
  height: 22px;
  color: var(--tyg-error);
}
.tyg-modal-head h2 { margin: 0; font-size: 15px; font-weight: 650; color: var(--tyg-text-main); }
.tyg-modal-body { padding: 10px 22px 6px; font-size: 13.5px; line-height: 1.7; color: var(--tyg-text-muted); }
.tyg-modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 22px 20px;
}
.tyg-btn { height: 34px; padding: 0 16px; border-radius: var(--tyg-radius-sm); font-size: 13px; cursor: pointer; }
.tyg-btn-ghost {
  border: 1px solid var(--tyg-border-strong);
  background: #fff;
  color: var(--tyg-text-main);
  transition: background .2s;
}
.tyg-btn-ghost:hover { background: var(--tyg-bg-soft); }
.tyg-btn-primary-danger {
  border: 1px solid transparent;
  background: linear-gradient(135deg, #f04438, #dc2626);
  color: #fff;
  font-weight: 600;
  transition: filter .2s, box-shadow .2s;
}
.tyg-btn-primary-danger:hover {
  filter: brightness(1.06);
  box-shadow: 0 6px 16px rgba(220, 38, 38, .28);
}

@keyframes tyg-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes tyg-pop  { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }

/* =====================================================================
   MetaBox：摘要生成
   ===================================================================== */
.tyg-summary-meta .tyg-alert { margin: 10px 0 0; }
.tyg-alert {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--tyg-radius-sm);
  font-size: 12.5px;
  line-height: 1.6;
  border: 1px solid;
}
.tyg-alert .tyg-ico { width: 16px; height: 16px; margin-top: 1px; }
.tyg-alert strong { font-weight: 600; }
.tyg-alert-error { background: var(--tyg-error-bg); color: #b91c1c; border-color: var(--tyg-error-border); }
.tyg-alert-success { background: var(--tyg-success-bg); color: var(--tyg-success); border-color: var(--tyg-success-border); }
.tyg-alert-info { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }

.tyg-alert-dismiss {
  margin-left: auto;
  padding: 2px;
  border: none;
  background: none;
  color: inherit;
  opacity: .7;
  cursor: pointer;
  line-height: 1;
  transition: opacity .2s;
}
.tyg-alert-dismiss:hover { opacity: 1; }
.tyg-alert-dismiss .tyg-ico { width: 14px; height: 14px; margin: 0; }

.tyg-btn-brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--tyg-radius-sm);
  background: var(--tyg-brand-grad);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: filter .2s, box-shadow .2s;
}
.tyg-btn-brand:hover { filter: brightness(1.05); box-shadow: 0 6px 16px rgba(44, 123, 229, .3); }
.tyg-btn-brand:disabled { opacity: .6; cursor: not-allowed; }
.tyg-btn-brand .tyg-ico { width: 14px; height: 14px; }

/* =====================================================================
   评论 @ AI 徽章
   ===================================================================== */
.tyg-mention-ai {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0 2px;
  padding: 1px 9px;
  border-radius: var(--tyg-radius-pill);
  background: linear-gradient(135deg, rgba(44, 123, 229, .10), rgba(79, 143, 247, .08));
  border: 1px solid rgba(44, 123, 229, .22);
  color: var(--tyg-brand);
  font-weight: 600;
  font-size: .9em;
  vertical-align: baseline;
}
.tyg-mention-ai .tyg-ico { width: .95em; height: .95em; }

/* =====================================================================
   @ 弹层
   ===================================================================== */
.tyg-mention-popup {
  position: absolute;
  z-index: 99999;
  min-width: 230px;
  padding: 6px;
  border-radius: var(--tyg-radius);
  background: var(--main-bg-color, #fff);
  box-shadow: var(--main-shadow, 0 8px 28px rgba(15, 23, 42, .16));
  border: 1px solid var(--muted-border-color, rgba(100, 116, 139, .16));
}
.tyg-mention-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--tyg-radius-sm);
  cursor: pointer;
  transition: background .15s;
}
.tyg-mention-option.is-active { background: var(--muted-bg-color, rgba(100, 116, 139, .10)); }
.tyg-mention-avatar {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--tyg-radius-pill);
  background: linear-gradient(135deg, rgba(44, 123, 229, .14), rgba(79, 143, 247, .10));
  color: var(--tyg-brand);
}
.tyg-mention-avatar .tyg-ico { width: 16px; height: 16px; }
.tyg-mention-name { font-weight: 600; color: var(--theme-color, var(--tyg-brand)); font-size: 13px; }
.tyg-mention-hint { font-size: 12px; color: var(--muted-2-color, #94a3b8); margin-top: 1px; }

/* =====================================================================
   AI 生成内容免责标注（Apple/Google 极简脚注风格）
   —— 无警示底色、无边框，次级灰小字 + 细线信息图标，视觉上安静退后
   ===================================================================== */
.tyg-ai-disclaimer {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--tyg-border, rgba(100, 116, 139, .16));
  color: var(--tyg-text-muted, #64748b);
  font-size: 11.5px;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: .1px;
}
.tyg-ai-disclaimer .tyg-ico {
  color: var(--tyg-text-muted, #64748b);
  opacity: .85;
}
.tyg-ai-disclaimer span { opacity: .92; }

/* 评论内自动回复标注（更紧凑，贴评论正文，无分隔线） */
.tyg-comment-reply-disclaimer {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  color: var(--tyg-text-muted, #64748b);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.5;
  opacity: .9;
}
.tyg-comment-reply-disclaimer .tyg-ico { color: inherit; }

/* =====================================================================
   前台摘要卡片 · Apple 风覆盖
   覆盖 React 构建产物（tyg-summary.*.js）注入的辉光/极光/动画/渐变，
   还原为克制、安静、内容优先的 Apple 风格卡片。
   选择器加前缀提高优先级，抵消运行时后注入的 #tyg-ai-skin。
   ===================================================================== */

/* 去掉旋转渐变辉光边框 */
.tyg-ai-summary .tyg-glow {
  padding: 0;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 0;
}
.tyg-ai-summary .tyg-glow::before {
  display: none !important;
  animation: none !important;
}

/* 去掉极光渐变背景与呼吸动画，改为纯静态浅底卡片（含 dark 主题） */
.tyg-ai-summary .tyg-glow-inner {
  background: var(--tyg-summary-bg, #f7f8fa) !important;
  background-size: auto !important;
  border-radius: 16px;
  animation: none !important;
}
body.dark-theme .tyg-ai-summary .tyg-glow-inner {
  background: var(--tyg-summary-bg-dark, rgba(255, 255, 255, .045)) !important;
}

/* 卡片内边距更舒适 */
.tyg-ai-summary .ant-card-body {
  padding: 18px 22px !important;
}

/* 标题「AI」标签：去掉 antd 默认实心蓝填充（会被看成圆形头像），
   改成克制的浅色小标签。不打渐变、不做发光、不用圆形，
   仅品牌蓝细边 + 极淡蓝底 + 品牌蓝小字，视觉安静退后，避免「AI 味」。 */
.tyg-ai-summary .ant-tag {
  display: inline-flex;
  align-items: center;
  margin: 0 !important;
  padding: 1px 7px !important;
  border-radius: 6px !important;
  border: 1px solid var(--tyg-summary-tag-border, rgba(44, 123, 229, .16)) !important;
  background: var(--tyg-summary-tag-bg, rgba(44, 123, 229, .06)) !important;
  color: var(--tyg-brand, #2c7be5) !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  line-height: 1.7 !important;
  letter-spacing: .4px !important;
  box-shadow: none !important;
  text-transform: uppercase;
}
body.dark-theme .tyg-ai-summary .ant-tag {
  border-color: rgba(79, 143, 247, .22) !important;
  background: rgba(79, 143, 247, .10) !important;
  color: #7aa9f0 !important;
}

/* 摘要正文排版：行高、字色更贴近阅读 */
.tyg-ai-summary .ant-alert-content { font-size: 14px !important; line-height: 1.9 !important; }

@media (prefers-reduced-motion: reduce) {
  .tyg-ai-summary .tyg-glow::before,
  .tyg-ai-summary .tyg-glow-inner { animation: none !important; }
}
