/* ============================================================
   聊天增强功能样式
   - 一键清空所有聊天按钮
   - 左滑删除单个会话
   ============================================================ */

/* 清空全部按钮 */
.clear-all-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 12px;
  margin: 0 8px;
  font-size: 13px;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  white-space: nowrap;
}

.clear-all-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
}

.clear-all-btn:active {
  transform: scale(0.96);
}

.clear-all-btn svg {
  width: 14px;
  height: 14px;
  margin-right: 4px;
}

/* 移动端适配 */
@media (max-width: 768px) {
  .clear-all-btn {
    padding: 3px 10px;
    font-size: 12px;
    margin: 0 6px;
  }

  .clear-all-btn span {
    display: none;
  }

  .clear-all-btn svg {
    margin-right: 0;
    width: 16px;
    height: 16px;
  }
}

/* 确认弹窗遮罩 */
.confirm-mask {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  animation: fadeIn 0.2s ease;
}

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

/* 确认弹窗 */
.confirm-dialog {
  background: #fff;
  border-radius: 14px;
  padding: 24px 20px;
  width: 280px;
  max-width: 90vw;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  animation: scaleIn 0.2s ease;
}

@keyframes scaleIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.confirm-title {
  font-size: 17px;
  font-weight: 600;
  color: #1f2937;
  text-align: center;
  margin-bottom: 10px;
}

.confirm-message {
  font-size: 14px;
  color: #6b7280;
  text-align: center;
  line-height: 1.6;
  margin-bottom: 24px;
}

.confirm-buttons {
  display: flex;
  gap: 10px;
}

.confirm-btn {
  flex: 1;
  padding: 12px 0;
  font-size: 15px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

.confirm-btn-cancel {
  background: #f3f4f6;
  color: #4b5563;
}

.confirm-btn-cancel:hover {
  background: #e5e7eb;
}

.confirm-btn-danger {
  background: #ef4444;
  color: #fff;
}

.confirm-btn-danger:hover {
  background: #dc2626;
}

/* Toast 提示 */
.toast-enhance {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 100000;
  animation: toastFade 0.3s ease;
  pointer-events: none;
}

@keyframes toastFade {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* ============================================================
   左滑删除功能样式
   ============================================================ */

.session-item-wrapper {
  position: relative;
  overflow: hidden;
}

.session-item {
  position: relative;
  z-index: 2;
  transition: transform 0.25s ease;
  background: #fff;
  touch-action: pan-y;
}

.session-item.swiped {
  /* 左滑后位移，露出删除按钮 */
}

.delete-action {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ef4444;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  z-index: 1;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s ease;
}

.delete-action:active {
  background: #dc2626;
}

.delete-action svg {
  width: 20px;
  height: 20px;
  margin-right: 4px;
}

/* 桌面端悬停显示删除按钮 */
@media (min-width: 769px) {
  .session-item-wrapper:hover .session-item {
    /* 桌面端也可以悬停时稍微位移 */
  }
}

/* ============================================================
   消息撤回功能样式
   ============================================================ */

/* Toast 提示(撤回专用) */
.toast-recall {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 100001;
  animation: toastFade 0.3s ease;
  pointer-events: none;
}

/* 确认弹窗遮罩(撤回专用) */
.recall-confirm-mask {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100002;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.recall-confirm-dialog {
  background: #fff;
  border-radius: 14px;
  padding: 24px 20px;
  width: 300px;
  max-width: 90vw;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  transform: scale(0.9);
  transition: transform 0.2s ease;
}

.recall-confirm-title {
  font-size: 17px;
  font-weight: 600;
  color: #1f2937;
  text-align: center;
  margin-bottom: 10px;
}

.recall-confirm-message {
  font-size: 14px;
  color: #6b7280;
  text-align: center;
  line-height: 1.6;
  margin-bottom: 24px;
}

.recall-confirm-buttons {
  display: flex;
  gap: 10px;
}

.recall-confirm-btn {
  flex: 1;
  padding: 12px 0;
  font-size: 15px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

.recall-confirm-btn-cancel {
  background: #f3f4f6;
  color: #4b5563;
}

.recall-confirm-btn-cancel:hover {
  background: #e5e7eb;
}

.recall-confirm-btn-danger {
  background: #ef4444;
  color: #fff;
}

.recall-confirm-btn-danger:hover {
  background: #dc2626;
}

/* 底部操作菜单(撤回) */
.recall-action-mask {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 100003;
  opacity: 0;
  transition: opacity 0.25s ease;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.recall-action-sheet {
  background: #fff;
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 420px;
  padding: 8px 0;
  transform: translateY(100%);
  transition: transform 0.25s ease;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
}

.recall-action-info {
  padding: 16px 20px 12px;
  border-bottom: 1px solid #f0f0f0;
  text-align: center;
}

.recall-action-info-title {
  font-size: 14px;
  color: #9ca3af;
  margin-bottom: 4px;
}

.recall-action-info-content {
  font-size: 13px;
  color: #6b7280;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recall-action-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 20px;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.15s ease;
  user-select: none;
}

.recall-action-item:active {
  background: #f3f4f6;
}

.recall-action-item-danger {
  color: #ef4444;
  font-weight: 500;
}

.recall-action-item-danger svg {
  flex-shrink: 0;
}

.recall-action-item-cancel {
  color: #6b7280;
  border-top: 8px solid #f5f5f5;
  margin-top: 4px;
}

/* 已撤回消息气泡样式 */
.message-recalled {
  opacity: 0.6;
  position: relative;
}

.message-recalled .recall-tip {
  font-size: 13px;
  color: #9ca3af;
  font-style: italic;
  padding: 4px 8px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.message-recalled .recall-tip svg {
  color: #9ca3af;
}

/* 长按时的视觉反馈 */
.message[data-recall-init="true"] {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.message[data-recall-init="true"]:active,
.message-bubble[data-recall-init="true"]:active,
.agent-message-bubble[data-recall-init="true"]:active,
.XE-message-bubble[data-recall-init="true"]:active,
.pz-message-bubble[data-recall-init="true"]:active,
.simple-user-message-bubble[data-recall-init="true"]:active {
  transition: transform 0.15s ease;
}

/* 移动端适配 */
@media (max-width: 768px) {
  .recall-action-sheet {
    max-width: 100%;
  }

  .recall-confirm-dialog {
    width: 90vw;
    max-width: 320px;
  }
}

/* ============================================================
   群聊交易进度快捷修改面板
   ============================================================ */

/* 注入的菜单项样式（匹配原生 func-row） */
.progress-func-row {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  cursor: pointer;
  transition: background .15s;
  gap: 12px;
}
.progress-func-row:active {
  background: rgba(0,0,0,0.05);
}
.progress-func-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(139, 92, 246, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.progress-func-row .func-row-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.progress-func-row .func-row-title {
  font-size: 15px;
  font-weight: 500;
  color: #1d1d1f;
  line-height: 1.3;
}
.progress-func-row .func-row-desc {
  font-size: 12px;
  color: #8e8e93;
  line-height: 1.3;
  margin-top: 1px;
}

/* 进度面板遮罩 */
.progress-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 9999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: progress-fade-in 0.2s ease;
}
@keyframes progress-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.progress-sheet {
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-radius: 16px 16px 0 0;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  animation: progress-slide-up 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.12);
}
@keyframes progress-slide-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.progress-header {
  position: relative;
  padding: 16px 20px 12px;
  border-bottom: 1px solid #f0f0f0;
}
.progress-header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: #1d1d1f;
}
.progress-subtitle {
  margin-top: 2px;
  font-size: 12px;
  color: #8e8e93;
}
.progress-close {
  position: absolute;
  top: 12px;
  right: 16px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #8e8e93;
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.15s;
  line-height: 1;
}
.progress-close:active {
  background: #f0f0f0;
}

.progress-body {
  padding: 8px 20px 16px;
  overflow-y: auto;
}

.progress-loading {
  text-align: center;
  padding: 40px 0;
  color: #8e8e93;
  font-size: 14px;
}

/* 进度行：左侧标签 + 右侧下拉选择 */
.progress-rows {
  display: flex;
  flex-direction: column;
}

.progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid #f0f0f0;
}
.progress-row:last-child {
  border-bottom: none;
}

.progress-row-label {
  font-size: 16px;
  font-weight: 500;
  color: #1d1d1f;
}

.progress-select-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.progress-select {
  appearance: none;
  -webkit-appearance: none;
  background: #f2f3f5;
  border: 1px solid #e5e6eb;
  border-radius: 8px;
  padding: 8px 36px 8px 14px;
  font-size: 14px;
  color: #4b5563;
  cursor: pointer;
  min-width: 110px;
  outline: none;
  transition: all 0.15s ease;
}
.progress-select:active,
.progress-select:focus {
  border-color: #3b82f6;
  background: #eef4ff;
  color: #1d1d1f;
}

.progress-select-arrow {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: #8e8e93;
  pointer-events: none;
}

/* 底部操作按钮 */
.progress-actions {
  display: flex;
  gap: 12px;
  padding: 12px 20px calc(16px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #f0f0f0;
}

.progress-btn {
  flex: 1;
  padding: 12px 0;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.progress-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.progress-btn-cancel {
  background: #f2f3f5;
  color: #4b5563;
}
.progress-btn-cancel:active {
  background: #e5e6eb;
}

.progress-btn-save {
  background: #3b82f6;
  color: #fff;
}
.progress-btn-save:active {
  background: #2563eb;
}
