/* ============================================================
   句子语法分析组件样式（规则引擎版）
   ============================================================ */

/* 弹窗遮罩 */
.sa-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: saFadeIn 0.2s ease;
}

@keyframes saFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* 弹窗主体 */
.sa-modal {
  background: white;
  border-radius: 16px;
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  animation: saSlideUp 0.3s ease;
}

@keyframes saSlideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* 头部 */
.sa-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #f1f5f9;
  flex-shrink: 0;
}

.sa-modal-title {
  font-size: 18px;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sa-modal-icon {
  font-size: 22px;
}

.sa-close-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: #f1f5f9;
  border-radius: 8px;
  font-size: 16px;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.sa-close-btn:hover {
  background: #e2e8f0;
  color: #334155;
}

/* 原句展示 */
.sa-sentence-display {
  padding: 16px 24px;
  background: #f8fafc;
  border-bottom: 1px solid #f1f5f9;
  flex-shrink: 0;
}

.sa-sentence-label {
  font-size: 12px;
  color: #94a3b8;
  font-weight: 500;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sa-sentence-text {
  font-size: 16px;
  color: #1e293b;
  line-height: 1.6;
  font-weight: 500;
}

/* 视图切换 */
.sa-view-tabs {
  display: flex;
  gap: 4px;
  padding: 12px 24px;
  border-bottom: 1px solid #f1f5f9;
  background: white;
  flex-shrink: 0;
}

.sa-view-tab {
  padding: 8px 16px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s ease;
}
.sa-view-tab:hover {
  background: #f1f5f9;
  color: #334155;
}
.sa-view-tab.active {
  background: #eef2ff;
  color: #4f46e5;
  font-weight: 600;
}

/* 内容区 */
.sa-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* 加载状态 */
.sa-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 0;
  color: #64748b;
  font-size: 14px;
  gap: 16px;
}

.sa-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e2e8f0;
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: saSpin 0.8s linear infinite;
}

@keyframes saSpin {
  to { transform: rotate(360deg); }
}

/* 错误状态 */
.sa-error {
  text-align: center;
  padding: 40px;
  color: #ef4444;
  font-size: 14px;
}

/* 空状态 */
.sa-empty {
  text-align: center;
  padding: 40px;
  color: #94a3b8;
  font-size: 14px;
}

/* ==================== 完整标注视图 ==================== */

.sa-annotation-view {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.sa-annotation-sentence {
  font-size: 18px;
  line-height: 2.2;
  color: #1e293b;
  word-break: break-word;
}

.sa-chunk {
  display: inline-block;
  padding: 2px 6px;
  margin: 0 1px;
  border-radius: 4px;
  font-weight: 500;
  cursor: help;
  position: relative;
  transition: all 0.15s ease;
}
.sa-chunk:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 悬浮提示 */
.sa-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: white;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: normal;
  white-space: nowrap;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 100px;
}

.sa-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #1e293b;
}

.sa-tooltip-type {
  font-weight: 700;
  font-size: 13px;
}

.sa-tooltip-detail {
  color: #cbd5e1;
  font-size: 11px;
}

/* 图例 */
.sa-legend {
  background: #f8fafc;
  border-radius: 12px;
  padding: 16px 20px;
}

.sa-legend-title {
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 10px;
}

.sa-legend-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
}

.sa-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #64748b;
}

.sa-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.sa-legend-label {
  white-space: nowrap;
}

/* ==================== 主干提取视图 ==================== */

.sa-trunk-view {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sa-trunk-title {
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sa-trunk-icon {
  font-size: 20px;
}

.sa-trunk-clause {
  background: #f8fafc;
  border-radius: 12px;
  padding: 16px 20px;
}

.sa-trunk-conj {
  display: inline-block;
  background: #fef3c7;
  color: #92400e;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
}

.sa-trunk-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.sa-trunk-part {
  flex: 1;
  min-width: 120px;
  padding: 12px 16px;
  border-radius: 10px;
  text-align: center;
}

.sa-trunk-subject {
  background: #FEF3C7;
  border: 2px solid #F59E0B;
}

.sa-trunk-verb {
  background: #DBEAFE;
  border: 2px solid #3B82F6;
}

.sa-trunk-object {
  background: #FCE7F3;
  border: 2px solid #EC4899;
}

.sa-trunk-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
  opacity: 0.7;
}

.sa-trunk-text {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
}

.sa-trunk-arrow {
  font-size: 18px;
  color: #cbd5e1;
  flex-shrink: 0;
}

.sa-trunk-summary {
  background: linear-gradient(135deg, #eef2ff, #fdf4ff);
  border-radius: 10px;
  padding: 14px 18px;
  font-size: 14px;
  color: #4338ca;
  line-height: 1.6;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.sa-summary-icon {
  flex-shrink: 0;
  font-size: 18px;
}

/* ==================== 修饰层级视图 ==================== */

.sa-hierarchy-view {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sa-hierarchy-title {
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sa-hierarchy-icon {
  font-size: 20px;
}

.sa-hierarchy-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sa-mod-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sa-mod-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #f8fafc;
  border-radius: 8px;
  border-left: 3px solid #6366f1;
  flex-wrap: wrap;
}

.sa-mod-type-badge {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid;
}

.sa-mod-text {
  font-size: 14px;
  color: #1e293b;
  font-weight: 500;
  flex: 1;
}

.sa-mod-target {
  font-size: 12px;
  color: #64748b;
  flex-shrink: 0;
}

.sa-mod-target-word {
  font-weight: 600;
  color: #4f46e5;
}

/* ==================== AISentenceAnalyzer 组件动画 ==================== */

@keyframes ai-spin {
  to { transform: rotate(360deg); }
}

@keyframes ai-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes ai-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.3; }
}
