/* 移动端翻译标签显示修复 */

/* 确保消息容器有足够的空间显示翻译标签 */
@media (max-width: 768px) {
  .message-li {
    overflow: visible !important;
    position: relative !important;
  }
  
  .message-bubble-container {
    overflow: visible !important;
    position: relative !important;
  }
  
  .enhanced-message-text {
    overflow: visible !important;
    position: relative !important;
  }
  
  /* 右侧消息翻译标签 - 显示在消息气泡左上角外侧 */
  .message-li.out .translation-result-simple {
    position: absolute !important;
    top: -6px !important;
    left: -20px !important;
    right: auto !important;
    margin: 0 !important;
    z-index: 1000 !important;
    background: #007AFF !important;
    color: white !important;
    border-radius: 4px !important;
    padding: 1px 3px !important;
    font-size: 7px !important;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.4) !important;
    white-space: nowrap !important;
    transform: none !important;
  }
  
  /* 左侧消息翻译标签 - 显示在消息气泡右上角外侧 */
  .message-li.in .translation-result-simple {
    position: absolute !important;
    top: -6px !important;
    right: -20px !important;
    left: auto !important;
    margin: 0 !important;
    z-index: 1000 !important;
    background: #007AFF !important;
    color: white !important;
    border-radius: 4px !important;
    padding: 1px 3px !important;
    font-size: 7px !important;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.4) !important;
    white-space: nowrap !important;
    transform: none !important;
  }
  
  /* 右侧消息翻译指示器 */
  .message-li.out .translation-indicator {
    position: absolute !important;
    top: -6px !important;
    left: -20px !important;
    right: auto !important;
    margin: 0 !important;
    z-index: 1000 !important;
    background: #007AFF !important;
    color: white !important;
    border-radius: 4px !important;
    padding: 1px 3px !important;
    font-size: 7px !important;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.4) !important;
    white-space: nowrap !important;
    transform: none !important;
  }
  
  /* 左侧消息翻译指示器 */
  .message-li.in .translation-indicator {
    position: absolute !important;
    top: -6px !important;
    right: -20px !important;
    left: auto !important;
    margin: 0 !important;
    z-index: 1000 !important;
    background: #007AFF !important;
    color: white !important;
    border-radius: 4px !important;
    padding: 1px 3px !important;
    font-size: 7px !important;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.4) !important;
    white-space: nowrap !important;
    transform: none !important;
  }
  
  /* 确保翻译标签不会被父容器裁剪 */
  .tui-message-list {
    overflow: visible !important;
  }
  
  .message-item {
    overflow: visible !important;
  }
  
  /* 为翻译标签预留空间 */
  .message-li.out {
    padding-left: 25px !important;
  }
  
  .message-li.in {
    padding-right: 25px !important;
  }
  
  /* 翻译标签悬停效果 */
  .translation-result-simple:active,
  .translation-indicator:active {
    transform: scale(0.9) !important;
    background: #0056CC !important;
  }
}

/* 超小屏幕适配 */
@media (max-width: 375px) {
  .message-li.out .translation-result-simple,
  .message-li.out .translation-indicator {
    left: -18px !important;
    font-size: 6px !important;
    padding: 1px 2px !important;
  }
  
  .message-li.in .translation-result-simple,
  .message-li.in .translation-indicator {
    right: -18px !important;
    font-size: 6px !important;
    padding: 1px 2px !important;
  }
  
  .message-li.out {
    padding-left: 22px !important;
  }
  
  .message-li.in {
    padding-right: 22px !important;
  }
}

/* 确保翻译标签在所有情况下都可见 */
.translation-result-simple,
.translation-indicator,
.translation-indicator-direct {
  pointer-events: auto !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

/* 直接增强器的翻译指示器样式 */
.translation-indicator-direct {
  position: absolute !important;
  top: -6px !important;
  right: -20px !important;
  background: #007AFF !important;
  color: white !important;
  border-radius: 4px !important;
  padding: 1px 3px !important;
  font-size: 7px !important;
  font-weight: 500 !important;
  z-index: 1000 !important;
  cursor: pointer !important;
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.4) !important;
  white-space: nowrap !important;
  animation: fadeIn 0.3s ease-out !important;
}

.translation-indicator-direct:hover {
  background: #0056CC !important;
  transform: scale(1.05) !important;
}

.translation-indicator-direct:active {
  transform: scale(0.95) !important;
}

/* 左侧消息的直接翻译指示器 */
.message-li.in .translation-indicator-direct {
  right: -20px !important;
  left: auto !important;
}

/* 右侧消息的直接翻译指示器 */
.message-li.out .translation-indicator-direct {
  left: -20px !important;
  right: auto !important;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-5px) scale(0.8);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}