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

/* 清空全部按钮 */
.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;
  }
}
