/**
 * video-editor.css — Manual Video Editor 布局样式
 * 全屏布局由 main.css 的 .editor-full-width 控制
 * 使用百分比/弹性布局自动适应页面，各板块保持合适大小
 */

/* 编辑器整体：填满 #main-console，使用 flex 自适应父容器高度 */
.video-editor-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-width: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-color);
  overflow: auto;
}

/* 阿里云 ICE Web 剪辑器挂载容器：撑满剩余空间，保证最小尺寸避免缩放后无法编辑 */
#aliyun-editor-holder {
  flex: 1;
  min-height: 400px;
  min-width: 680px;
  width: 100%;
  height: 100%;
  overflow: auto;
}

/* ICE 编辑器内部侧边面板最小尺寸：防止右上角属性面板等因缩放过小导致无法编辑 */
#aliyun-editor-holder [class*="right-panel"],
#aliyun-editor-holder [class*="RightPanel"],
#aliyun-editor-holder [class*="property-panel"],
#aliyun-editor-holder [class*="PropertyPanel"],
#aliyun-editor-holder [class*="attr-panel"],
#aliyun-editor-holder [class*="AttrPanel"] {
  min-width: 200px !important;
}

/* SDK 未加载时的占位提示 */
.editor-sdk-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  height: 100%;
  color: var(--text-secondary);
  text-align: center;
  padding: 40px;
}

.editor-sdk-placeholder .material-symbols-rounded {
  font-size: 56px;
  opacity: 0.35;
}

.editor-sdk-placeholder p {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.editor-sdk-placeholder span {
  font-size: 13px;
  line-height: 1.7;
  max-width: 420px;
}

.editor-license-placeholder code {
  background: var(--side-bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
}

.editor-license-note {
  display: block;
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-secondary);
  opacity: 0.9;
}

/* ═══ OSS 素材导入弹窗 ═══ */
.oss-import-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.oss-import-modal {
  background: var(--bg-color, #1a1a1a);
  color: var(--text-primary);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  max-width: 640px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.oss-import-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color, rgba(255,255,255,0.1));
}

.oss-import-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.oss-import-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}

.oss-import-close:hover {
  background: rgba(255,255,255,0.1);
}

.oss-import-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.oss-import-item {
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s;
}

.oss-import-item:hover {
  border-color: rgba(255,255,255,0.2);
}

.oss-import-item.selected {
  border-color: var(--primary-color, #3b82f6);
}

.oss-import-item-thumb {
  aspect-ratio: 16/9;
  background: var(--side-bg, #252525);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.oss-import-item-thumb img,
.oss-import-item-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.oss-import-item-thumb .material-symbols-rounded {
  font-size: 36px;
  opacity: 0.7;
  color: rgba(255, 255, 255, 0.9);
}

.oss-import-item-title {
  padding: 8px;
  font-size: 12px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.oss-import-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color, rgba(255,255,255,0.1));
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.oss-import-footer .btn-primary {
  background: var(--primary-color, #3b82f6);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

.oss-import-footer .btn-secondary {
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(255,255,255,0.2);
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

.oss-import-empty {
  padding: 40px;
  text-align: center;
  color: rgba(255, 255, 255, 0.75);
}

.oss-import-loading {
  padding: 40px;
  text-align: center;
  color: rgba(255, 255, 255, 0.75);
}

/* ═══ 工程选择器 ═══ */
.video-editor-project-selector {
  padding: 32px;
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.video-editor-project-selector h2 {
  margin: 0 0 24px;
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
}

.project-selector-actions {
  margin-bottom: 24px;
  display: flex;
  justify-content: center;
  width: 100%;
}

.btn-new-project {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--primary-color, #3b82f6);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}

.btn-new-project:hover {
  opacity: 0.9;
}

.project-selector-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  align-self: stretch;
}

.project-list-loading,
.project-list-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-secondary);
}

.project-list-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: var(--side-bg, #252525);
  border-radius: 8px;
}

.project-item-cover {
  width: 64px;
  height: 48px;
  background: rgba(0,0,0,0.3);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.project-item-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-item-cover .material-symbols-rounded {
  font-size: 28px;
  opacity: 0.5;
}

.project-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.project-item-name {
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-item-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

.btn-open-project {
  padding: 6px 14px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
}

.btn-open-project:hover {
  background: rgba(255,255,255,0.1);
}

/* ═══ 导出弹窗 ═══ */
.export-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.export-modal {
  background: var(--bg-color, #1a1a1a);
  color: var(--text-primary);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  min-width: 400px;
  max-width: 520px;
}

.export-modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color, rgba(255,255,255,0.1));
}

.export-modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.export-modal-body {
  padding: 24px;
  color: var(--text-primary);
}

.export-warning {
  color: #f59e0b;
  font-weight: 500;
  margin: 0 0 20px;
  font-size: 14px;
}

.export-progress-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.export-progress-bar {
  flex: 1;
  height: 8px;
  background: var(--side-bg, #252525);
  border-radius: 4px;
  overflow: hidden;
}

.export-progress-fill {
  height: 100%;
  background: var(--primary-color, #3b82f6);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.export-progress-text {
  font-size: 14px;
  font-weight: 500;
  min-width: 36px;
  color: var(--text-primary);
}

.export-status {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
  word-break: break-all;
}

.export-status code {
  background: rgba(255,255,255,0.1);
  color: var(--text-primary);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
}

.export-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color, rgba(255,255,255,0.1));
  display: flex;
  justify-content: flex-end;
}

.btn-export-close {
  padding: 8px 20px;
  background: var(--primary-color, #3b82f6);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
}

.btn-export-close:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-export-close:not(:disabled):hover {
  opacity: 0.9;
}

.btn-diagnose-ice {
  margin-left: 8px;
  padding: 4px 12px;
  background: rgba(255,255,255,0.15);
  color: var(--primary-color, #3b82f6);
  border: 1px solid var(--primary-color, #3b82f6);
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}
.btn-diagnose-ice:hover {
  background: rgba(255,255,255,0.25);
}
