/* 消息气泡增强样式 */

/* 翻译指示器样式 */
.translation-indicator {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 2px;
  background: #007AFF;
  color: white;
  border-radius: 6px;
  padding: 1px 3px;
  cursor: pointer;
  transition: all 0.2s ease;
  animation: translateFadeIn 0.3s ease-out;
  z-index: 10;
  font-size: 8px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

.translation-indicator:hover {
  background: #0056CC;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.4);
}

.translation-indicator:active {
  transform: scale(0.95);
}

/* 左侧消息的翻译指示器 */
.message-li.in .translation-indicator {
  right: auto;
  left: 0;
}

/* 右侧消息的翻译指示器 */
.message-li.out .translation-indicator {
  right: 0;
}

/* 悬停效果 */
.message-bubble-container.hover-effect {
  background-color: rgba(0, 0, 0, 0.02) !important;
  transform: scale(1.01) !important;
  border-radius: 12px !important;
}

/* 长按效果增强 */
.message-bubble-container.long-pressing {
  transform: scale(0.96) !important;
  background-color: rgba(0, 0, 0, 0.08) !important;
  border-radius: 12px !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15) !important;
  transition: all 0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
}

/* 动画效果 */
@keyframes translateFadeIn {
  from {
    opacity: 0;
    transform: translateY(-5px) scale(0.8);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* 移动端适配 */
@media (max-width: 768px) {
  .translation-indicator {
    margin-top: 2px;
    padding: 1px 3px;
    border-radius: 4px;
    font-size: 7px;
  }
  
  /* 移动端右侧消息翻译指示器特殊定位 */
  .message-li.out .translation-indicator {
    position: fixed;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    margin: 0;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  }
  
  /* 移动端左侧消息翻译指示器 */
  .message-li.in .translation-indicator {
    position: fixed;
    left: 5px;
    top: 50%;
    transform: translateY(-50%);
    margin: 0;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  }
  
  /* 移动端长按反馈更明显 */
  .message-bubble-container.long-pressing {
    transform: scale(0.94) !important;
    background-color: rgba(0, 0, 0, 0.1) !important;
  }
  
  /* 触摸高亮优化 */
  .message-bubble-container {
    -webkit-tap-highlight-color: rgba(0, 123, 255, 0.1) !important;
  }
}

/* PC端特殊效果 */
@media (min-width: 769px) {
  .message-bubble-container {
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
  }
  
  .translation-indicator {
    font-size: 8px;
  }
  
  /* PC端右键提示 */
  .message-bubble-container::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -20px;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border: 4px solid transparent;
    border-left-color: rgba(0, 123, 255, 0.3);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
  }
  
  .message-bubble-container:hover::after {
    opacity: 1;
  }
}

/* 暗色模式适配 */
@media (prefers-color-scheme: dark) {
  .translation-indicator {
    background: #0A84FF;
    box-shadow: 0 2px 8px rgba(10, 132, 255, 0.3);
  }
  
  .translation-indicator:hover {
    background: #0066CC;
    box-shadow: 0 4px 12px rgba(10, 132, 255, 0.4);
  }
  
  .message-bubble-container.long-pressing {
    background-color: rgba(255, 255, 255, 0.08) !important;
  }
  
  .message-bubble-container.hover-effect {
    background-color: rgba(255, 255, 255, 0.02) !important;
  }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
  .translation-indicator {
    border: 2px solid currentColor;
    font-weight: 600;
  }
  
  .message-bubble-container.long-pressing {
    border: 2px solid #007AFF !important;
  }
}

/* 减少动画模式 */
@media (prefers-reduced-motion: reduce) {
  .translation-indicator,
  .message-bubble-container {
    animation: none !important;
    transition: none !important;
  }
}

/* 确保翻译指示器不会被遮挡 */
.message-li {
  position: relative;
  overflow: visible;
}

.message-bubble-container {
  position: relative;
  overflow: visible;
}

/* 防止翻译指示器影响布局 */
.translation-indicator {
  position: absolute;
  z-index: 1000;
}