/**
 * 视频编辑功能响应式样式
 */

/* 基础样式 */
.video-edit-overlay {
  position: absolute;
  inset: 0;
  z-index: 15;
  border-radius: 8px;
  overflow: hidden;
}

.video-edit-point {
  position: absolute;
  z-index: 20;
  cursor: pointer;
  user-select: none;
}

.video-edit-connection {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

.video-edit-input {
  position: absolute;
  z-index: 30;
  min-width: 280px;
  max-width: 400px;
}

/* 大屏幕样式 (桌面端) */
@media (min-width: 1024px) {
  .video-edit-input {
    min-width: 320px;
    max-width: 450px;
  }
  
  .video-edit-point {
    transform-origin: center;
  }
  
  .video-edit-point:hover {
    transform: scale(1.1);
  }
}

/* 中等屏幕样式 (平板端) */
@media (min-width: 768px) and (max-width: 1023px) {
  .video-edit-input {
    min-width: 260px;
    max-width: 350px;
  }
  
  .video-edit-point {
    /* 增大点击区域 */
    padding: 4px;
    margin: -4px;
  }
}

/* 小屏幕样式 (手机端) */
@media (max-width: 767px) {
  .video-edit-input {
    min-width: 240px;
    max-width: calc(100vw - 40px);
    font-size: 14px;
  }
  
  .video-edit-point {
    /* 进一步增大点击区域 */
    padding: 6px;
    margin: -6px;
    /* 增大编辑点尺寸 */
    transform: scale(1.2);
  }
  
  /* 输入框在小屏幕上的特殊处理 */
  .video-edit-input .input-container {
    padding: 12px;
  }
  
  .video-edit-input textarea {
    font-size: 14px;
    line-height: 1.4;
  }
  
  .video-edit-input .button-group {
    flex-direction: column;
    gap: 8px;
  }
  
  .video-edit-input .submit-button {
    width: 100%;
    justify-content: center;
  }
}

/* 超小屏幕样式 (小手机) */
@media (max-width: 480px) {
  .video-edit-input {
    min-width: 200px;
    max-width: calc(100vw - 20px);
    font-size: 13px;
  }
  
  .video-edit-point {
    /* 最大化点击区域 */
    padding: 8px;
    margin: -8px;
    transform: scale(1.3);
  }
  
  /* 连接线在小屏幕上的调整 */
  .video-edit-connection svg {
    stroke-width: 3;
  }
  
  /* 输入框头部简化 */
  .video-edit-input .header {
    padding: 8px 12px;
    font-size: 12px;
  }
  
  .video-edit-input .footer {
    padding: 8px 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  
  .video-edit-input .char-count {
    text-align: center;
    font-size: 11px;
  }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
  .video-edit-point {
    /* 触摸设备上增大点击区域 */
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .video-edit-point:hover {
    transform: none;
  }
  
  .video-edit-point:active {
    transform: scale(0.95);
  }
  
  /* 触摸设备上的输入框优化 */
  .video-edit-input textarea {
    font-size: 16px; /* 防止iOS缩放 */
  }
}

/* 高分辨率屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .video-edit-connection svg {
    /* 高分辨率屏幕上的线条优化 */
    shape-rendering: geometricPrecision;
  }
  
  .video-edit-point {
    /* 高分辨率屏幕上的边框优化 */
    border-width: 0.5px;
  }
}

/* 暗色模式适配 */
@media (prefers-color-scheme: dark) {
  .video-edit-input {
    --bg-color: rgba(0, 0, 0, 0.8);
    --border-color: rgba(255, 255, 255, 0.2);
    --text-color: rgba(255, 255, 255, 0.9);
    --text-secondary: rgba(255, 255, 255, 0.6);
  }
}

/* 亮色模式适配 */
@media (prefers-color-scheme: light) {
  .video-edit-input {
    --bg-color: rgba(255, 255, 255, 0.9);
    --border-color: rgba(0, 0, 0, 0.1);
    --text-color: rgba(0, 0, 0, 0.9);
    --text-secondary: rgba(0, 0, 0, 0.6);
  }
}

/* 减少动画的用户偏好 */
@media (prefers-reduced-motion: reduce) {
  .video-edit-point,
  .video-edit-input,
  .video-edit-connection {
    animation: none !important;
    transition: none !important;
  }
  
  .video-edit-point:hover {
    transform: none;
  }
}

/* 横屏模式优化 */
@media (orientation: landscape) and (max-height: 600px) {
  .video-edit-input {
    max-height: 80vh;
    overflow-y: auto;
  }
  
  .video-edit-input textarea {
    max-height: 100px;
  }
}

/* 竖屏模式优化 */
@media (orientation: portrait) and (max-width: 768px) {
  .video-edit-input {
    max-width: 90vw;
  }
  
  /* 确保输入框不会超出屏幕 */
  .video-edit-overlay {
    padding: 10px;
  }
}

/* 可访问性优化 */
@media (prefers-contrast: high) {
  .video-edit-point {
    border-width: 2px;
    border-color: currentColor;
  }
  
  .video-edit-connection svg {
    stroke-width: 3;
    stroke: currentColor;
  }
  
  .video-edit-input {
    border-width: 2px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  }
}

/* 打印样式 */
@media print {
  .video-edit-overlay,
  .video-edit-point,
  .video-edit-input,
  .video-edit-connection {
    display: none !important;
  }
}

/* 工具类 */
.video-edit-hidden {
  display: none !important;
}

.video-edit-visible {
  display: block !important;
}

.video-edit-fade-in {
  animation: videoEditFadeIn 0.3s ease-out;
}

.video-edit-fade-out {
  animation: videoEditFadeOut 0.3s ease-out;
}

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

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

/* 脉冲动画 */
@keyframes videoEditPulse {
  0%, 100% {
    opacity: 0.6;
    transform: scale(1);
  }
  50% {
    opacity: 0.2;
    transform: scale(1.5);
  }
}

.video-edit-pulse {
  animation: videoEditPulse 2s ease-in-out infinite;
}
