/* Media Editor Styles */

.media-editor-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
}

.media-editor-modal.active {
  display: flex;
}

.media-editor-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
}

/* Header */
.media-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

.media-editor-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.media-editor-close-btn,
.media-editor-save-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.media-editor-close-btn {
  background: transparent;
  color: var(--text-secondary);
}

.media-editor-close-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.media-editor-save-btn {
  background: var(--accent-primary);
  color: white;
}

.media-editor-save-btn:hover {
  background: var(--accent-secondary);
}

/* Workspace */
.media-editor-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow: hidden;
  background: #000;
  position: relative;
}

.media-editor-canvas-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-height: calc(100% - 120px);
}

#mediaEditorCanvas {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  cursor: crosshair;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

#mediaEditorVideo {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* Toolbar */
.media-editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.toolbar-section {
  display: flex;
  align-items: center;
  gap: 4px;
}

.toolbar-divider {
  width: 1px;
  height: 32px;
  background: var(--border-color);
  margin: 0 8px;
}

.tool-btn,
.action-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.tool-btn:hover,
.action-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.tool-btn.active {
  background: var(--accent-primary);
  color: white;
}

.tool-btn:disabled,
.action-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Color picker */
.colors-section {
  gap: 8px;
}

#colorPicker {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  background: transparent;
}

#colorPicker::-webkit-color-swatch-wrapper {
  padding: 2px;
}

#colorPicker::-webkit-color-swatch {
  border-radius: 4px;
  border: none;
}

.color-presets {
  display: flex;
  gap: 4px;
}

.color-preset {
  width: 28px;
  height: 28px;
  border: 2px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
}

.color-preset:hover {
  transform: scale(1.1);
}

.color-preset.active {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px var(--bg-secondary), 0 0 0 4px var(--accent-primary);
}

/* Size slider */
.size-section label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
}

.size-section input[type="range"] {
  width: 80px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--bg-tertiary);
  border-radius: 2px;
  outline: none;
}

.size-section input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-primary);
  cursor: pointer;
}

/* Text input overlay */
.text-input-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10001;
}

.text-input-container {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 20px;
  width: 90%;
  max-width: 400px;
}

.text-input-container input[type="text"] {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 16px;
  outline: none;
  margin-bottom: 12px;
}

.text-input-container input[type="text"]:focus {
  border-color: var(--accent-primary);
}

.text-input-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.text-input-actions input[type="range"] {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--bg-tertiary);
  border-radius: 2px;
  outline: none;
}

.text-input-actions input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-primary);
  cursor: pointer;
}

#fontSizeLabel {
  color: var(--text-secondary);
  font-size: 13px;
  min-width: 40px;
}

.text-confirm-btn,
.text-cancel-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.text-confirm-btn {
  background: var(--accent-success);
  color: white;
}

.text-cancel-btn {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.text-confirm-btn:hover {
  background: #2bb54c;
}

.text-cancel-btn:hover {
  background: var(--bg-glass-light);
  color: var(--text-primary);
}

/* Video Trimmer */
.video-trimmer {
  width: 100%;
  max-width: 600px;
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: 12px;
  margin-top: 16px;
}

.video-timeline {
  position: relative;
  height: 60px;
  background: var(--bg-tertiary);
  border-radius: 8px;
  overflow: hidden;
}

.video-thumbnails {
  display: flex;
  height: 100%;
  gap: 1px;
  pointer-events: none;
  user-select: none;
}

.video-thumbnail {
  flex: 1;
  height: 100%;
  object-fit: cover;
}

.trim-handles {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

.trim-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 20px;
  background: var(--accent-primary);
  cursor: ew-resize;
  pointer-events: all;
  z-index: 10;
  touch-action: none;
}

.trim-handle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 4px;
  height: 20px;
  background: white;
  border-radius: 2px;
}

.trim-start {
  left: 0;
  border-radius: 8px 0 0 8px;
}

.trim-end {
  right: auto;
  left: 100%;
  transform: translateX(-100%);
  border-radius: 0 8px 8px 0;
}

.trim-selection {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(60, 110, 255, 0.2);
  border-top: 3px solid var(--accent-primary);
  border-bottom: 3px solid var(--accent-primary);
  pointer-events: none;
  z-index: 1;
}

.video-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: white;
  z-index: 3;
  pointer-events: none;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

.video-playhead::before {
  content: '';
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 10px;
  background: white;
  border-radius: 50%;
}

.video-time-display {
  display: flex;
  justify-content: space-between;
  padding: 8px 4px;
  color: var(--text-secondary);
  font-size: 12px;
  font-family: 'Monaco', 'Consolas', monospace;
}

.video-controls {
  display: flex;
  justify-content: center;
  padding-top: 8px;
}

.video-control-btn {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: var(--accent-primary);
  color: white;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.video-control-btn:hover {
  background: var(--accent-secondary);
  transform: scale(1.05);
}

/* Video trim progress overlay */
.video-trim-progress {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  border-radius: 8px;
}

.trim-progress-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 32px;
}

.trim-progress-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: trimSpin 0.8s linear infinite;
}

@keyframes trimSpin {
  to { transform: rotate(360deg); }
}

.trim-progress-text {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
}

.trim-progress-bar-bg {
  width: 200px;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  overflow: hidden;
}

.trim-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent-primary);
  border-radius: 2px;
  transition: width 0.15s ease;
}

/* Responsive */
@media (max-width: 768px) {
  .media-editor-toolbar {
    padding: 8px;
    gap: 4px;
  }
  
  .toolbar-divider {
    display: none;
  }
  
  .tool-btn,
  .action-btn {
    width: 36px;
    height: 36px;
  }
  
  .color-preset {
    width: 24px;
    height: 24px;
  }
  
  #colorPicker {
    width: 32px;
    height: 32px;
  }
  
  .size-section input[type="range"] {
    width: 60px;
  }
  
  .video-trimmer {
    padding: 12px;
  }
  
  .video-timeline {
    height: 50px;
  }
}

@media (max-width: 480px) {
  .media-editor-header {
    padding: 8px 12px;
  }
  
  .media-editor-header h3 {
    font-size: 14px;
  }
  
  .media-editor-save-btn span {
    display: none;
  }
  
  .color-presets {
    display: none;
  }
  
  .actions-section {
    flex-wrap: wrap;
    justify-content: center;
  }
}
