/* 模块：全局 Toast、通用模态框、全屏 Lightbox、评论抽屉与表单校验动效 (assets/modals-drawers.css) */
.btn-text-sm {
  background: none;
  border: none;
  padding: 2px 4px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}
.btn-text-sm:hover {
  background: var(--surface-muted);
}
.img-upload-trigger {
  min-height: 136px;
  border: 2px dashed var(--border-soft, rgba(0, 0, 0, 0.12));
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: var(--surface-muted);
  color: var(--ink3);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.img-upload-trigger:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
  background: rgba(45, 106, 79, 0.04);
  transform: translateY(-1px);
}

/* 9. 全局浮动 Toast (对应 InfoBar) */
.proto-toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.proto-toast {
  background: #1B211E;
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
}
.proto-toast.fade-out {
  opacity: 0;
  transform: translateY(6px);
  transition: all 0.3s;
}
.toast-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   第二阶段新增：通用弹窗模态框、Lightbox 大图预览、评论抽屉与分类树
   ========================================================================== */

/* 1. 通用模态框系统 */
.proto-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 20, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.proto-modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.proto-modal-card {
  background: #FFFFFF;
  border-radius: var(--radius-sheet);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  width: 100%;
  overflow: hidden;
  animation: modalScaleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes modalScaleIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.proto-modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.proto-modal-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}
.btn-close {
  background: transparent;
  border: none;
  font-size: 20px;
  color: var(--ink2);
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}
.btn-close:hover { color: var(--ink); }
.proto-modal-body {
  padding: 20px;
}
.proto-modal-foot {
  padding: 14px 20px;
  background: var(--card-subtle);
  border-top: 1px solid var(--border-soft);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* 2. 全屏大图 Lightbox 预览 */
.proto-lightbox {
  background: rgba(8, 10, 9, 0.88);
  backdrop-filter: blur(8px);
}
.lightbox-container {
  display: grid;
  grid-template-columns: 1fr 340px;
  width: 90vw;
  max-width: 1100px;
  height: 80vh;
  max-height: 720px;
  background: #141715;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
}
.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.2); }
.lightbox-main {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0D0F0E;
  padding: 24px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}
.lightbox-placeholder-img {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: rgba(255, 255, 255, 0.6);
}
.lightbox-sidebar {
  padding: 28px 24px;
  background: #1A1D1B;
  color: #E6E8E6;
  overflow-y: auto;
}
.lightbox-sidebar h4 {
  margin: 0 0 20px;
  font-size: 15px;
  font-weight: 700;
  color: #FFFFFF;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 10px;
}
.lightbox-meta-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
  padding: 0;
}
.lightbox-meta-list dt {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 4px;
}
.lightbox-meta-list dd {
  font-size: 13px;
  margin: 0;
  color: #FFFFFF;
}

/* 3. 移动端动态评论管理抽屉 */
.proto-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 20, 0.4);
  backdrop-filter: blur(2px);
  z-index: 1250;
  display: flex;
  justify-content: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.proto-drawer-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.proto-drawer-panel {
  width: 440px;
  max-width: 90vw;
  height: 100%;
  background: #FFFFFF;
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.proto-drawer-overlay.open .proto-drawer-panel {
  transform: translateX(0);
}
.proto-drawer-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.proto-drawer-head h3 { margin: 0; font-size: 16px; font-weight: 700; color: var(--ink); }
.proto-drawer-body {
  padding: 16px 20px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.drawer-comment-item {
  padding: 12px 14px;
  border-radius: var(--radius-nested);
  background: var(--card-subtle);
  border: 1px solid var(--border-soft);
}
.comment-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.comment-author {
  display: flex;
  align-items: center;
  gap: 8px;
}
.comment-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}
.comment-time {
  font-size: 11px;
  color: var(--ink2);
  display: block;
}
.comment-content {
  font-size: 13px;
  color: var(--ink);
  line-height: 1.5;
  margin: 0;
}
.btn-danger-ghost {
  background: transparent;
  color: var(--warn);
  border: 1px solid transparent;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 4px;
}
.btn-danger-ghost:hover {
  background: rgba(217, 119, 6, 0.1);
  border-color: rgba(217, 119, 6, 0.2);
}
.proto-drawer-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--border-soft);
  background: var(--card-subtle);
}

/* 6. 病虫害录入表单交互样式 (Finesse-UI 规范) */
.form-field-error {
  border-color: var(--danger) !important;
  background-color: #FEF2F2 !important;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2) !important;
  animation: shakeError 0.3s ease-in-out;
}
@keyframes shakeError {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
.field-error-hint {
  font-size: 11px;
  color: var(--danger);
  margin-top: 4px;
  display: none;
}
.field-error-hint.show {
  display: block;
}
.template-chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.template-chip {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--surface-muted);
  border: 1px solid var(--border-soft);
  color: var(--ink2);
  cursor: pointer;
  transition: all 0.15s ease;
}
.template-chip:hover {
  background: var(--primary-light);
  color: var(--primary-dark);
  border-color: var(--primary);
}
.btn-ai-analyze {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(62, 197, 131, 0.1);
  color: #15803d;
  border: 1px solid rgba(62, 197, 131, 0.38);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(62, 197, 131, 0.06);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.btn-ai-analyze:hover {
  background: rgba(62, 197, 131, 0.18);
  border-color: rgba(62, 197, 131, 0.6);
  color: #166534;
  transform: translateY(-0.5px);
  box-shadow: 0 2px 6px rgba(62, 197, 131, 0.18);
}
.btn-ai-analyze.is-stop-mode { background: #FEF2F2; color: #B91C1C; border-color: #FECACA; font-variant-numeric: tabular-nums; }
.btn-ai-analyze.is-stop-mode:hover { background: #FEE2E2; border-color: #FCA5A5; }

/* 9. 内联 AI 识图填单诊断舱 (In-Place AI Autofill Workbench) */
.ai-inline-wb { margin-top: 14px; border: 1px solid rgba(45, 106, 79, 0.24); border-radius: 10px; background: #F8FAF9; overflow: hidden; box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04); animation: fadeIn 0.2s ease-out; }
.ai-inline-wb.is-failed { border-color: #FCA5A5; background: #FEF2F2; }
.ai-inline-wb-head { padding: 10px 14px; background: rgba(45, 106, 79, 0.06); border-bottom: 1px solid rgba(45, 106, 79, 0.14); display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.ai-inline-wb-title { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; color: var(--ink1, #0f172a); }
.ai-liveness-dot { width: 8px; height: 8px; border-radius: 50%; background: #10B981; display: inline-block; }
.ai-liveness-dot.is-pulsing { animation: aiPulse 1.4s ease-in-out infinite; }
.ai-liveness-dot.is-warn { background: #F59E0B; }
.ai-liveness-dot.is-err { background: #EF4444; }
@keyframes aiPulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.35; transform: scale(0.85); } }
.ai-engine-pill { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.ai-engine-pill.is-agent { background: #DCFCE7; color: #166534; border: 1px solid #86EFAC; }
.ai-engine-pill.is-fallback { background: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; }
.ai-engine-pill.is-error { background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }
.ai-stream-rail { padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; border-bottom: 1px solid rgba(0, 0, 0, 0.06); background: #FFFFFF; }
.ai-rail-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; font-size: 12px; line-height: 1.45; color: var(--ink2, #334155); }
.ai-rail-row.is-active { color: #0F172A; font-weight: 600; }
.ai-rail-row.is-done { color: #475569; }
.ai-rail-row.is-err { color: #B91C1C; font-weight: 600; }
.ai-rail-time { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; font-variant-numeric: tabular-nums; color: var(--ink3, #64748b); white-space: nowrap; }
.ai-wb-toolbar { padding: 8px 14px; display: flex; justify-content: space-between; align-items: center; gap: 8px; background: #F1F5F9; border-bottom: 1px solid rgba(0, 0, 0, 0.06); flex-wrap: wrap; }
.ai-wb-tabs { display: inline-flex; gap: 4px; background: #E2E8F0; padding: 3px; border-radius: 7px; }
.ai-wb-tab { border: none; background: transparent; padding: 4px 10px; border-radius: 5px; font-size: 11.5px; font-weight: 600; color: #475569; cursor: pointer; }
.ai-wb-tab.active { background: #FFFFFF; color: #0F172A; box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
.ai-map-grid { padding: 12px 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; background: #FFFFFF; }
.ai-map-cell { border: 1px solid rgba(0, 0, 0, 0.08); border-radius: 8px; padding: 7px 10px; background: #F8FAFC; cursor: pointer; transition: all 0.15s; }
.ai-map-cell:hover { border-color: #10B981; background: #ECFDF5; transform: translateY(-1px); }
.ai-map-cell.is-empty { opacity: 0.65; background: #FFFBEB; border-color: #FDE68A; }
.ai-raw-box { margin: 0; padding: 12px 14px; background: #0F172A; color: #E2E8F0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; max-height: 240px; overflow: auto; white-space: pre-wrap; word-break: break-all; }
.ai-filled-field-badge { display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; padding: 1px 6px; border-radius: 4px; font-size: 10px; font-weight: 600; background: #DCFCE7; color: #15803D; vertical-align: middle; }

