/* Web版本特有样式补充 */

/* ========================================
   侧边栏样式
   ======================================== */
.sidebar {
  display: flex;
  flex-direction: column;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  flex-shrink: 0;
  transition: width 0.2s ease;
  position: relative;
}

.sidebar.collapsed {
  width: 48px !important;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  height: 48px;
  flex-shrink: 0;
}

.sidebar-content {
  flex: 1;
  overflow: visible;
  display: flex;
  flex-direction: column;
}

/* 文件树区域 */
.file-tree-section {
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
  position: relative;
  overflow: visible;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: relative;
  overflow: visible;
}

.section-title {
  flex: 1;
}

.timeline-count {
  font-size: 10px;
  color: var(--text-secondary);
}

.file-tree-container {
  padding: 0 8px;
  max-height: 200px;
  overflow-y: auto;
}

.tree-node {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.15s;
}

.tree-node:hover {
  background-color: var(--bg-hover);
}

.tree-node.active {
  background-color: var(--bg-active);
  color: var(--primary-color);
}

.node-icon {
  flex-shrink: 0;
  font-size: 16px;
}

.node-name {
  flex: 1;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 时间线区域 */
.timeline-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.timeline-section.full-height {
  flex: 1;
}

.timeline-container {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px;
}

.timeline-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.timeline-item {
  padding: 10px;
  border-radius: 6px;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.2s;
}

.timeline-item:hover {
  background: var(--bg-active);
  border-color: var(--primary-color);
}

.timeline-item-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.timeline-icon {
  font-size: 14px;
  color: var(--primary-color);
}

.timeline-type {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.timeline-item-summary {
  font-size: 12px;
  color: var(--text-primary);
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-item-time {
  font-size: 11px;
  color: var(--text-secondary);
}

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  color: var(--text-secondary);
  font-size: 12px;
}

/* ========================================
   Monaco编辑器波浪线样式
   ======================================== */
.squiggly-error {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 6 3' enable-background='new 0 0 6 3' height='3' width='6'%3E%3Cg fill='%23f48771'%3E%3Cpolygon points='5.5,0 2.5,3 1.1,3 4.1,0'/%3E%3Cpolygon points='4,0 6,2 6,0.6 5.4,0'/%3E%3Cpolygon points='0,2 1,3 2.4,3 0,0.6'/%3E%3C/g%3E%3C/svg%3E") repeat-x bottom left;
  padding-bottom: 3px;
}

.error-glyph {
  background: var(--danger-color);
  width: 4px !important;
  margin-left: 3px;
  border-radius: 2px;
}

/* Monaco Editor hover tooltip - 确保不被chat-drawer遮挡 */
.monaco-hover,
.monaco-editor .hover-row,
.monaco-editor-hover {
  z-index: 20000 !important;
}

/* ========================================
   Diff高亮样式
   ======================================== */
.diff-removed-sentence {
  background-color: var(--diff-removed-bg);
  padding: 2px 0;
}

.diff-added-sentence {
  background-color: var(--diff-added-bg);
  padding: 2px 0;
}

.compare-text-box {
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.6;
}

/* ========================================
   写作提示条样式
   ======================================== */
.hint-old-text {
  background-color: rgba(255, 100, 100, 0.2);
  padding: 2px 4px;
  border-radius: 3px;
}

.hint-new-text {
  background-color: rgba(100, 200, 100, 0.25);
  padding: 2px 4px;
  border-radius: 3px;
}

.hint-content {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* 工具栏Logo样式 */
.toolbar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 12px;
}

.toolbar-logo .logo-img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.toolbar-logo .logo-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Web版本的workspace移除顶部padding（没有自定义标题栏） */
.workspace.web-version {
  padding-top: 0;
}

/* 确保main-container占满剩余空间 */
.workspace.web-version .main-container {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* 编辑器占据剩余空间 */
.workspace.web-version .editor-container {
  flex: 1;
  overflow: hidden;
}

/* 聊天抽屉样式微调 */
.chat-drawer.open {
  border-left: 1px solid var(--border-color);
}

/* Toast提示在网页版中的位置调整 */
.custom-toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.custom-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 280px;
  max-width: 400px;
  pointer-events: auto;
  animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.custom-toast.toast-success {
  border-left: 4px solid var(--el-color-success);
}

.custom-toast.toast-error {
  border-left: 4px solid var(--el-color-danger);
}

.custom-toast.toast-warning {
  border-left: 4px solid var(--el-color-warning);
}

.custom-toast.toast-info {
  border-left: 4px solid var(--el-color-primary);
}

.toast-icon {
  flex-shrink: 0;
  font-size: 20px;
}

.toast-success .toast-icon { color: var(--el-color-success); }
.toast-error .toast-icon { color: var(--el-color-danger); }
.toast-warning .toast-icon { color: var(--el-color-warning); }
.toast-info .toast-icon { color: var(--el-color-primary); }

.toast-content {
  flex: 1;
  font-size: 14px;
  color: var(--text-primary);
  word-break: break-word;
}

.toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background-color 0.2s, color 0.2s;
}

.toast-close:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

/* Toast滑动退出动画 */
.toast-slide-leave-active {
  animation: slideOutRight 0.3s ease-out;
}

@keyframes slideOutRight {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

/* ========================================
   Toolbar 响应式样式优化
   ======================================== */
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-info-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 1;
  min-width: 0;
}

.toolbar-action-buttons {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0; /* 按钮不收缩 */
}

/* 当空间不足时，隐藏信息标签，优先保留按钮 */
@media (max-width: 1200px) {
  .toolbar-info-tags {
    display: none;
  }
}

/* ========================================
   Agent Mode 样式
   ======================================== */
.chat-agent-mode {
  display: flex;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid var(--border-color);
  margin-top: 8px;
  padding-top: 8px;
}

.chat-agent-mode .el-switch {
  flex: 0 0 auto;
}

/* ========================================
   范文示例设置样式
   ======================================== */
.reference-section {
  width: 100%;
}

.reference-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.reference-section .el-textarea .el-input__count {
  background: none;
}

.reference-section .el-scrollbar__view .el-select-dropdown__list {
  background: none;
}


/* ========================================
   AI Processing Log 样式
   ======================================== */
.processing-log-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.processing-log-section.full-height {
  flex: 1;
}

.processing-log-section .section-header {
  position: relative;
}

.processing-icon {
  font-size: 14px;
  color: var(--primary-color);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.processing-log-container {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.processing-log {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.log-item {
  padding: 12px;
  border-radius: 2px;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  animation: fadeIn 0.3s ease-out;
  margin-bottom: 0;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.log-operation {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.log-status {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  font-weight: 500;
}

.log-status.processing {
  background-color: rgba(64, 158, 255, 0.15);
  color: var(--el-color-primary);
}

.log-status.completed {
  background-color: rgba(103, 194, 58, 0.15);
  color: var(--el-color-success);
}

.log-status.error {
  background-color: rgba(245, 108, 108, 0.15);
  color: var(--el-color-danger);
}

.log-status.cancelled {
  background-color: rgba(230, 162, 60, 0.15);
  color: var(--el-color-warning);
}

.log-content {
  margin-bottom: 8px;
  background: var(--bg-primary);
}

.log-text {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 300px;
  overflow-y: auto;
  padding: 8px;
  background: var(--bg-primary);
  border-radius: 4px;
  border: 1px solid var(--border-color);
  position: relative;
  overflow-x: hidden;
}

/* 流光扫过动画 - 修复滚动时的覆盖问题 */
.log-text::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  /* 使用足够大的高度确保覆盖所有内容，即使滚动 */
  height: max(100%, 1000px);
  min-height: 100%;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(64, 158, 255, 0.15) 40%, 
    rgba(64, 158, 255, 0.25) 50%, 
    rgba(64, 158, 255, 0.15) 60%, 
    transparent 100%);
  animation: shimmer 2.5s infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes shimmer {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

/* 确保内容在伪元素上方 */
.log-text > * {
  position: relative;
  z-index: 2;
}

.log-time {
  font-size: 11px;
  color: var(--text-secondary);
  opacity: 0.7;
}

/* 空状态居中 */
.processing-log-container .empty-state {
  height: 100%;
  min-height: 150px;
}

/* ========================================
   Editor Settings 自定义样式
   ======================================== */
#monaco-editor {
  --editor-font-color: inherit;
  --editor-selection-color: rgba(64, 158, 255, 0.3);
}

/* 应用字体颜色（通过Monaco的CSS覆盖） */
#monaco-editor .view-line {
  color: var(--editor-font-color) !important;
}

/* 应用选择颜色 */
#monaco-editor .selected-text {
  background-color: var(--editor-selection-color) !important;
}

#monaco-editor .monaco-editor .margin-view-overlays .current-line {
  background-color: transparent !important;
}

/* Settings 对话框特定样式 */
.settings-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
  z-index: 10002;
}

.setting-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 10002;
}

.setting-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  z-index: 10002;
}

/* ColorPicker popper样式 - 确保在对话框上方显示 */
.color-picker-popper {
  z-index: 10000 !important;
}

/* ========================================
   Agent执行动画样式 (Enhanced)
   ======================================== */
.agent-execution-animation {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  padding: 4px;
}

/* Block 1: Status */
.agent-status-block {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.agent-loader {
  position: relative;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.agent-spinner {
  position: absolute;
  width: 100%;
  height: 100%;
  border: 2px solid transparent;
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: agentSpin 1s linear infinite;
}

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

.agent-icon-wrapper {
  font-size: 16px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: pulse 2s infinite;
}

.agent-status-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  background: linear-gradient(90deg, var(--text-primary) 0%, var(--primary-color) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmerText 3s infinite linear;
}

@keyframes shimmerText {
  0% { background-position: -100% 0; }
  100% { background-position: 100% 0; }
}

/* Block 2: Steps Timeline */
.agent-steps-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  background: var(--bg-primary);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.agent-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-hover);
  border: 1px solid transparent;
  transition: all 0.3s ease;
}

.agent-step.completed {
  color: var(--el-color-success);
  background: rgba(103, 194, 58, 0.1);
  border-color: rgba(103, 194, 58, 0.2);
}

.agent-step.processing {
  color: var(--el-color-primary);
  background: rgba(64, 158, 255, 0.1);
  border-color: rgba(64, 158, 255, 0.3);
  box-shadow: 0 0 10px rgba(64, 158, 255, 0.15);
  position: relative;
  overflow: hidden;
}

.agent-step.processing::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 200%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  animation: shimmer 2s infinite;
}

/* Block 3: Reasoning (Terminal style) */
.agent-reasoning-block {
  margin-top: 8px;
  border-radius: 8px;
  border: 1px solid #333;
  background: #1e1e1e;
  overflow: hidden;
}

.reasoning-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: #2d2d2d;
  cursor: pointer;
  font-size: 11px;
  color: #aaa;
  user-select: none;
  background: none;
}

.reasoning-header:hover {
  color: #fff;
}

.reasoning-content {
  padding: 10px;
  font-family: 'Consolas', monospace;
  font-size: 11px;
  line-height: 1.5;
  color: #d4d4d4;
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
}

/* Block 4: Log/Result */
.agent-result-block {
  margin-top: 8px;
  background: var(--bg-secondary);
  border-radius: 8px;
  border: 1px solid var(--border-color);
  padding: 12px;
}

.result-header {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.result-content {
  font-family: 'Consolas', monospace;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-primary);
  white-space: pre-wrap;
  max-height: 300px;
  overflow-y: auto;
  background: var(--bg-primary);
  padding: 8px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

/* ========================================
   模板管理样式
   ======================================== */
.template-management {
  width: 100%;
}

.template-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

/* ========================================
   模型选择器样式
   ======================================== */
.model-selector-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.model-option-btn {
  padding: 6px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  font-weight: 500;
  position: relative;
}

.model-option-btn:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--primary-color);
  box-shadow: 0 0 8px rgba(64, 158, 255, 0.2);
}

.model-option-btn.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  box-shadow: 0 2px 8px rgba(64, 158, 255, 0.3);
}

.model-option-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ========================================
   模板选择器样式
   ======================================== */
.template-selector-wrapper {
  position: relative;
}

.template-selector-btn {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 500;
}

.template-selector-btn:hover {
  background: var(--bg-hover);
  border-color: var(--primary-color);
}

.template-selector-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.template-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-top: none;
  border-radius: 0 0 6px 6px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.template-empty {
  padding: 12px;
  color: var(--text-secondary);
  font-size: 12px;
  text-align: center;
}

.template-option {
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 1px solid var(--border-color);
}

.template-option:last-child {
  border-bottom: none;
}

.template-option:hover {
  background: var(--bg-hover);
}

.template-option.active {
  background: rgba(64, 158, 255, 0.1);
  color: var(--primary-color);
}

.template-option-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: var(--text-primary);
}

.template-delete-btn {
  flex-shrink: 0;
  color: var(--el-color-danger);
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s ease;
  font-size: 16px;
}

.template-delete-btn:hover {
  opacity: 1;
}

/* ========================================
   模型下拉选择器样式
   ======================================== */
.model-selector-wrapper {
  position: relative;
}

.model-selector-btn {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 500;
  min-width: 150px;
}

.model-selector-btn:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--primary-color);
}

.model-selector-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.model-selector-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.model-dropdown {
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-top: none;
  border-radius: 0 0 6px 6px;
  max-height: 250px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.model-option {
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 1px solid var(--border-color);
}

.model-option:last-child {
  border-bottom: none;
}

.model-option:hover {
  background: var(--bg-hover);
}

.model-option.active {
  background: rgba(64, 158, 255, 0.1);
  color: var(--primary-color);
}

.model-option-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-option-desc {
  font-size: 11px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.8;
}

.model-option.active .model-option-name {
  color: var(--primary-color);
}

/* ========================================
   聊天文件上传区域样式
   ======================================== */
.chat-file-upload-area {
  padding: 8px 0;
  display: flex;
  gap: 8px;
  border-top: 1px solid var(--border-color);
  margin-top: 8px;
}

/* ========================================
   Monaco Editor Hover Widget z-index Fix
   ======================================== */
.monaco-editor .monaco-hover,
.monaco-editor .monaco-hover-content,
.monaco-editor .parameter-hints-widget,
.monaco-editor .suggest-widget {
  z-index: 10000 !important;
}

/* ========================================
   Settings Dialog Menu Styles
   ======================================== */
.settings-dialog-container {
  display: flex;
  height: 100%;
  min-height: 500px;
}

.settings-menu {
  width: 150px;
  flex-shrink: 0;
  border-right: 1px solid var(--border-color);
  padding: 12px 0;
  background: var(--bg-hover);
}

.settings-menu-item {
  padding: 10px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  border-left: 3px solid transparent;
}

.settings-menu-item:hover {
  background: var(--bg-active);
}

.settings-menu-item.active {
  background: var(--bg-active);
  border-left-color: var(--primary-color);
  color: var(--primary-color);
  font-weight: 600;
}

.settings-content {
  flex: 1;
  overflow: hidden;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.settings-panel {
  display: none;
  padding: 20px;
  animation: fadeInPanel 0.2s ease;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.settings-panel.active {
  display: block;
  overflow-y: auto;
  height: 100%;
}

@keyframes fadeInPanel {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 固定settings dialog尺寸 */
.account-overlay .account-modal {
  width: 800px;
  max-width: 90vw;
}

/* Settings Modal 特定样式 - 固定高度 */
.settings-modal {
  display: flex;
  flex-direction: column;
  height: 600px;
  max-height: 80vh;
}

.settings-modal .account-modal-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.settings-modal .settings-dialog-container {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.settings-modal .settings-content {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.settings-modal .settings-panel.active {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* ========================================
   Token不足Modal样式
   ======================================== */
.token-insufficient-modal {
  max-width: 600px;
  width: 90%;
}

.token-modal-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

.token-modal-card.usage-card {
  background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
  border-color: #ff9800;
}

.dark .token-modal-card.usage-card {
  background: linear-gradient(135deg, #2d2416 0%, #3d2f1a 100%);
  border-color: #ff9800;
}

.token-modal-card.comparison-card {
  background: var(--bg-secondary);
}

.usage-stats {
  margin-top: 12px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 14px;
}

.stat-label {
  color: var(--text-secondary);
  font-weight: 500;
}

.stat-value {
  color: var(--text-primary);
  font-weight: 600;
}

.stat-value.highlight {
  color: #1565c0;
  font-size: 16px;
}

.stat-value.text-danger {
  color: #d32f2f;
}

.progress-bar-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0;
}

.progress-bar-wrapper .progress {
  flex: 1;
}

.usage-percent-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 40px;
  text-align: right;
}

.purchased-row {
  background: rgba(21, 101, 192, 0.1);
  padding: 8px 12px;
  border-radius: 6px;
  margin-top: 12px;
}

.remaining-row {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
  font-size: 16px;
}

.plan-comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 12px;
}

.plan-column {
  border: 2px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.plan-column.highlighted {
  border-color: #4caf50;
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.2);
}

.plan-header {
  padding: 16px;
  text-align: center;
  color: white;
  position: relative;
}

.plan-header.free-plan {
  background: linear-gradient(135deg, #757575, #9e9e9e);
}

.plan-header.pro-plan {
  background: linear-gradient(135deg, #4caf50, #66bb6a);
}

.plan-header h5 {
  margin: 0 0 8px 0;
  font-size: 18px;
  font-weight: 700;
}

.plan-price {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
}

.plan-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255, 255, 255, 0.3);
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.plan-features {
  list-style: none;
  padding: 16px;
  margin: 0;
}

.plan-features li {
  padding: 8px 0;
  color: var(--text-primary);
  font-size: 14px;
  border-bottom: 1px solid var(--border-color);
}

.plan-features li:last-child {
  border-bottom: none;
}

.plan-features strong {
  color: #4caf50;
}

.token-modal-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.token-modal-actions .el-button {
  flex: 1;
}

.action-btn-primary {
  background: linear-gradient(135deg, #4caf50, #66bb6a) !important;
  border: none !important;
  font-weight: 600 !important;
  font-size: 16px !important;
  padding: 12px 24px !important;
}

.action-btn-primary:hover {
  background: linear-gradient(135deg, #388e3c, #4caf50) !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(76, 175, 80, 0.3) !important;
}

.action-btn-secondary {
  border-color: var(--border-color) !important;
  font-weight: 600 !important;
  font-size: 16px !important;
  padding: 12px 24px !important;
}

.action-btn-secondary:hover {
  background: var(--bg-secondary) !important;
  border-color: var(--text-primary) !important;
}

.token-modal-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: rgba(33, 150, 243, 0.1);
  border-left: 4px solid #2196f3;
  border-radius: 4px;
  color: var(--text-secondary);
  font-size: 13px;
}

.token-modal-hint i {
  color: #2196f3;
  font-size: 16px;
}

.dark .token-modal-hint {
  background: rgba(33, 150, 243, 0.15);
}

/* ========================================
   Markdown预览模式样式
   ======================================== */
.monaco-editor.preview-hidden {
  display: none !important;
}

.markdown-preview {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  padding: 20px 40px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.7;
}

/* Markdown预览中的各种元素样式 */
.markdown-preview h1,
.markdown-preview h2,
.markdown-preview h3,
.markdown-preview h4,
.markdown-preview h5,
.markdown-preview h6 {
  margin-top: 24px;
  margin-bottom: 16px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text-primary);
}

.markdown-preview h1 {
  font-size: 2em;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0.3em;
}

.markdown-preview h2 {
  font-size: 1.5em;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.3em;
}

.markdown-preview h3 {
  font-size: 1.25em;
}

.markdown-preview h4 {
  font-size: 1em;
}

.markdown-preview h5 {
  font-size: 0.875em;
}

.markdown-preview h6 {
  font-size: 0.85em;
  color: var(--text-secondary);
}

.markdown-preview p {
  margin-top: 0;
  margin-bottom: 16px;
}

.markdown-preview blockquote {
  margin: 0 0 16px 0;
  padding: 0 1em;
  color: var(--text-secondary);
  border-left: 4px solid var(--border-color);
  background: var(--bg-hover);
  border-radius: 0 4px 4px 0;
}

.markdown-preview blockquote > :first-child {
  margin-top: 0;
}

.markdown-preview blockquote > :last-child {
  margin-bottom: 0;
}

.markdown-preview code {
  padding: 0.2em 0.4em;
  margin: 0;
  font-size: 85%;
  background-color: var(--bg-hover);
  border-radius: 3px;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  color: var(--text-primary);
}

.markdown-preview pre {
  padding: 16px;
  overflow: auto;
  font-size: 85%;
  line-height: 1.45;
  background-color: var(--bg-secondary);
  border-radius: 6px;
  border: 1px solid var(--border-color);
  margin-bottom: 16px;
}

.markdown-preview pre code {
  display: inline;
  padding: 0;
  margin: 0;
  overflow: visible;
  line-height: inherit;
  word-wrap: normal;
  background-color: transparent;
  border: 0;
}

.markdown-preview ul,
.markdown-preview ol {
  margin-top: 0;
  margin-bottom: 16px;
  padding-left: 2em;
}

.markdown-preview li {
  margin-bottom: 4px;
}

.markdown-preview li > p {
  margin-bottom: 8px;
}

.markdown-preview table {
  border-spacing: 0;
  border-collapse: collapse;
  margin-bottom: 16px;
  width: 100%;
  overflow: auto;
}

.markdown-preview table th {
  font-weight: 600;
  padding: 6px 13px;
  border: 1px solid var(--border-color);
  background: var(--bg-hover);
}

.markdown-preview table td {
  padding: 6px 13px;
  border: 1px solid var(--border-color);
}

.markdown-preview table tr {
  background-color: var(--bg-primary);
  border-top: 1px solid var(--border-color);
}

.markdown-preview table tr:nth-child(2n) {
  background-color: var(--bg-hover);
}

.markdown-preview img {
  max-width: 100%;
  box-sizing: content-box;
  border-radius: 4px;
  margin: 12px 0;
}

.markdown-preview hr {
  height: 0.25em;
  padding: 0;
  margin: 24px 0;
  background-color: var(--border-color);
  border: 0;
}

.markdown-preview a {
  color: var(--primary-color);
  text-decoration: none;
}

.markdown-preview a:hover {
  text-decoration: underline;
}

.markdown-preview strong {
  font-weight: 600;
}

.markdown-preview em {
  font-style: italic;
}

/* 下划线样式 - 支持自定义颜色 */
.markdown-preview u {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
}

/* 文字颜色 - 保留内联样式的颜色（由内联样式定义） */

/* 下划线和颜色组合 */
.markdown-preview u[style*="color"] {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
  /* 颜色和下划线颜色由内联样式定义 */
}

/* 代码高亮（如果需要） */
.markdown-preview pre[class*="language-"] {
  background: var(--bg-secondary);
}

/* 响应式调整 */
@media (max-width: 768px) {
  .markdown-preview {
    padding: 16px 20px;
  }
}

/* ========================================
   API等待容器样式（独立于msg-bubble）
   ======================================== */
.waiting-for-api-container {
  position: relative;
  background: var(--bg-secondary);
  margin-bottom: 16px;
  animation: waitingContainerFadeIn 0.3s ease-out;
  overflow: hidden;
}

@keyframes waitingContainerFadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.api-waiting-content {
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  z-index: 2;
}

.api-waiting-loader {
  position: relative;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.api-waiting-spinner {
  position: absolute;
  width: 100%;
  height: 100%;
  border: 3px solid transparent;
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: apiWaitingSpin 1s linear infinite;
}

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

.api-waiting-icon-wrapper {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 20px;
  animation: pulse 2s infinite;
}

.api-waiting-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.api-waiting-status {
  flex: 1;
  position: relative;
  z-index: 2;
}

.api-waiting-status-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  background: linear-gradient(90deg, var(--primary-color) 0%, var(--el-color-success) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmerText 3s infinite linear;
  background-size: 200% 100%;
}

@keyframes shimmerText {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.api-timeout-warning {
  margin-top: 12px;
  padding: 10px 14px;
  background: rgba(230, 162, 60, 0.1);
  border: 1px solid rgba(230, 162, 60, 0.3);
  border-radius: 8px;
  color: var(--el-color-warning);
  font-size: 13px;
  line-height: 1.5;
  animation: warningPulse 2s ease-in-out infinite;
  position: relative;
  z-index: 2;
}

/* ========================================
   流光闪烁动画效果
   ======================================== */
.shimmer-container {
  position: relative;
  overflow: hidden;
}

.shimmer-effect {
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(64, 158, 255, 0.1) 25%,
    rgba(64, 158, 255, 0.3) 50%,
    rgba(64, 158, 255, 0.1) 75%,
    transparent 100%
  );
  animation: shimmerSlide 2.5s infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes shimmerSlide {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

/* Agent状态块中的子元素需要提高层级 */
.agent-status-block > *:not(.shimmer-effect),
.chat-waiting-animation > *:not(.shimmer-effect) {
  position: relative;
  z-index: 2;
}

/* 超时警告样式 */
.agent-timeout-warning,
.chat-timeout-warning {
  display: block;
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(230, 162, 60, 0.1);
  border: 1px solid rgba(230, 162, 60, 0.3);
  border-radius: 6px;
  color: var(--el-color-warning);
  font-size: 12px;
  line-height: 1.5;
  animation: warningPulse 2s ease-in-out infinite;
}

@keyframes warningPulse {
  0%, 100% {
    opacity: 0.8;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.02);
  }
}

/* ========================================
   编辑消息框样式
   ======================================== */
.editing-message-container {
  background: linear-gradient(135deg, rgba(64, 158, 255, 0.08) 0%, rgba(103, 194, 58, 0.08) 100%);
  border-radius: 2px;
  padding: 16px;
  margin-bottom: 16px;
  animation: editingBoxSlideIn 0.3s ease-out;
  box-shadow: 0 4px 12px rgba(64, 158, 255, 0.15);
}

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

.editing-message-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.editing-message-title {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.editing-message-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.editing-message-container .el-textarea__inner {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.6;
  transition: all 0.3s ease;
}

.editing-message-container .el-textarea__inner:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.1);
}

/* ========================================
   消息时间和复制按钮容器样式
   ======================================== */
.msg-meta-container {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.msg-meta-container .msg-meta {
  margin-top: 0;
}

.msg-meta-container .copy-btn {
  opacity: 0;
  transition: all 0.2s ease;
  font-size: 12px;
}

.msg-bubble:hover .msg-meta-container .copy-btn {
  opacity: 0.7;
}

.msg-meta-container .copy-btn:hover {
  opacity: 1 !important;
  color: var(--el-color-success);
  transform: scale(1.1);
}

.msg-meta-container .copy-btn:active {
  transform: scale(0.95);
}

/* ========================================
   复制按钮样式增强
   ======================================== */
.msg-action-btn.copy-btn {
  opacity: 0.7;
  transition: all 0.2s ease;
}

.msg-action-btn.copy-btn:hover {
  opacity: 1;
  color: var(--el-color-success);
  transform: scale(1.1);
}

.msg-action-btn.copy-btn:active {
  transform: scale(0.95);
}

/* 消息操作按钮容器在悬停时显示 */
.msg-bubble {
  position: relative;
}

.msg-actions {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.msg-bubble:hover .msg-actions {
  opacity: 1;
}

/* ========================================
   Section Header Actions 样式
   ======================================== */
.section-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  position: relative;
  overflow: visible;
}

/* ========================================
   History 按钮和下拉菜单样式
   ======================================== */
.history-btn-wrapper,
.newfile-btn-wrapper {
  position: relative;
}

.history-dropdown,
.newfile-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  z-index: 9999;
  overflow: hidden;
  overflow-y: auto;
  animation: dropdownFadeIn 0.15s ease-out;
}

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

.dropdown-header {
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-hover);
}

.dropdown-empty {
  padding: 20px 14px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 12px;
}

.history-file-list {
  max-height: 280px;
  overflow-y: auto;
}

.history-file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  border-bottom: 1px solid var(--border-color);
}

.history-file-item:last-child {
  border-bottom: none;
}

.history-file-item:hover {
  background: var(--bg-hover);
}

.history-file-item .file-icon {
  flex-shrink: 0;
  font-size: 16px;
  color: var(--text-secondary);
}

.history-file-item .file-name {
  flex: 1;
  font-size: 13px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-file-item .file-date {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--text-secondary);
  opacity: 0.8;
}

/* ========================================
   New File 下拉菜单样式
   ======================================== */
.newfile-dropdown {
  min-width: 120px;
}

.newfile-dropdown .dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
  color: var(--text-primary);
}

.newfile-dropdown .dropdown-item:last-child {
  border-bottom: none;
}

.newfile-dropdown .dropdown-item:hover {
  background: var(--bg-hover);
  color: var(--primary-color);
}

.newfile-dropdown .dropdown-item .el-icon {
  font-size: 16px;
  color: var(--text-secondary);
}
