/*
 * File Upload Components
 * 파일 업로드 관련 스타일
 */

/* Dropzone */
.upload-dropzone {
  border: 2px dashed var(--color-border, #d1d5db);
  border-radius: 12px;
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--color-bg-secondary, #f9fafb);
}

.upload-dropzone:hover {
  border-color: var(--color-primary, #2563eb);
  background: var(--color-bg-primary-light, #eff6ff);
}

.upload-dropzone.drag-over {
  border-color: var(--color-primary, #2563eb);
  background: var(--color-bg-primary-light, #eff6ff);
  transform: scale(1.01);
}

.upload-dropzone-icon {
  font-size: 48px;
  margin-bottom: 12px;
  color: var(--color-text-muted, #9ca3af);
}

.upload-dropzone-text {
  font-size: 14px;
  color: var(--color-text-secondary, #6b7280);
  margin: 0;
}

.upload-dropzone-hint {
  font-size: 12px;
  color: var(--color-text-muted, #9ca3af);
  margin-top: 8px;
}

/* File Preview Container */
.upload-preview-container {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

/* Preview Item */
.upload-preview-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: white;
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 8px;
  min-width: 200px;
  max-width: 300px;
}

.upload-preview-item.uploading {
  opacity: 0.7;
}

.upload-preview-item.uploaded {
  border-color: var(--color-success, #10b981);
}

.upload-preview-item.error {
  border-color: var(--color-danger, #ef4444);
  background: #fef2f2;
}

/* Thumbnail */
.upload-preview-thumb {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--color-bg-secondary, #f3f4f6);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.upload-preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.upload-file-icon {
  font-size: 24px;
}

/* Info */
.upload-preview-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.upload-preview-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-primary, #1f2937);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upload-preview-size {
  font-size: 12px;
  color: var(--color-text-muted, #9ca3af);
}

.upload-preview-error {
  font-size: 12px;
  color: var(--color-danger, #ef4444);
}

.upload-preview-badge {
  display: inline-block;
  font-size: 10px;
  padding: 2px 6px;
  background: var(--color-bg-success, #d1fae5);
  color: var(--color-success, #059669);
  border-radius: 4px;
}

/* Progress */
.upload-preview-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--color-border, #e5e7eb);
  border-radius: 0 0 8px 8px;
  overflow: hidden;
}

.upload-progress-bar {
  height: 100%;
  background: var(--color-primary, #2563eb);
  animation: progress-indeterminate 1.5s infinite linear;
}

@keyframes progress-indeterminate {
  0% {
    transform: translateX(-100%);
    width: 50%;
  }
  100% {
    transform: translateX(200%);
    width: 50%;
  }
}

/* Delete Button */
.upload-preview-delete {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-danger, #ef4444);
  color: white;
  border: 2px solid white;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.upload-preview-delete:hover {
  transform: scale(1.1);
}

/* Profile Image Upload */
.profile-image-upload {
  position: relative;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
  background: var(--color-bg-secondary, #f3f4f6);
}

.profile-image-upload:hover .profile-image-overlay {
  opacity: 1;
}

.profile-image-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: var(--color-text-muted, #9ca3af);
}

.profile-image-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.profile-image-overlay-icon {
  color: white;
  font-size: 24px;
}

.profile-image-loading {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
}

.profile-image-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--color-border, #e5e7eb);
  border-top-color: var(--color-primary, #2563eb);
  border-radius: 50%;
  animation: spinner 0.8s linear infinite;
}

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

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

/* Compact Upload Button */
.upload-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--color-bg-secondary, #f3f4f6);
  border: 1px solid var(--color-border, #d1d5db);
  border-radius: 8px;
  font-size: 14px;
  color: var(--color-text-secondary, #374151);
  cursor: pointer;
  transition: all 0.2s ease;
}

.upload-button:hover {
  background: var(--color-bg-primary-light, #eff6ff);
  border-color: var(--color-primary, #2563eb);
  color: var(--color-primary, #2563eb);
}

.upload-button-icon {
  font-size: 18px;
}

/* Hidden input */
.upload-input-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Video Preview in Trix Editor */
trix-editor .video-preview,
.trix-content .video-preview {
  max-width: 100%;
  margin: 12px 0;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
}

trix-editor .video-preview video,
.trix-content .video-preview video {
  width: 100%;
  display: block;
}

trix-editor figure[data-trix-attachment] .video-preview,
.trix-content figure[data-trix-attachment] .video-preview {
  margin: 0;
}

/* Video embed link style - for links that will become video players */
trix-editor a.video-embed,
trix-editor a.video-embed-link,
trix-editor a[href*=".mp4"],
trix-editor a[href*=".webm"],
trix-editor a[href*=".mov"],
trix-editor a[href*=".avi"] {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: white;
  border-radius: 12px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid #334155;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  margin: 12px 0;
  min-width: 200px;
  position: relative;
  overflow: hidden;
}

/* Play button circle */
trix-editor a.video-embed::before,
trix-editor a.video-embed-link::before,
trix-editor a[href*=".mp4"]::before,
trix-editor a[href*=".webm"]::before,
trix-editor a[href*=".mov"]::before,
trix-editor a[href*=".avi"]::before {
  content: "▶";
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.15);
  border-radius: 50%;
  font-size: 14px;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.3);
}

trix-editor a.video-embed:hover,
trix-editor a.video-embed-link:hover,
trix-editor a[href*=".mp4"]:hover,
trix-editor a[href*=".webm"]:hover,
trix-editor a[href*=".mov"]:hover,
trix-editor a[href*=".avi"]:hover {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  border-color: #475569;
}

trix-editor a.video-embed:hover::before,
trix-editor a.video-embed-link:hover::before,
trix-editor a[href*=".mp4"]:hover::before,
trix-editor a[href*=".webm"]:hover::before,
trix-editor a[href*=".mov"]:hover::before,
trix-editor a[href*=".avi"]:hover::before {
  background: rgba(59, 130, 246, 0.5);
  border-color: rgba(59, 130, 246, 0.7);
}

/* Video marker style in editor */
trix-editor {
  /* Style for [VIDEO:...] text markers */
}

/* Make video markers stand out */
trix-editor .trix-content {
  line-height: 1.6;
}

/* Video preview container - for rendered video players in post view */
.video-preview {
  max-width: 100%;
  margin: 12px 0;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
}

.video-preview video {
  width: 100%;
  display: block;
}
