/* ============================================
   editor.css — 谱面编辑器专属样式
   ============================================ */

/* ============ 编辑器页面容器 ============ */
.page-editor {
  flex-direction: column;
  overflow: hidden;
}

/* ============ 启动页 ============ */
.editor-launch {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.editor-launch-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  width: min(460px, 92vw);
}

.editor-launch-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 1px;
}

.editor-launch-sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: -12px;
}

.editor-launch-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.editor-launch-actions .btn {
  padding: 16px;
  font-size: 16px;
  justify-content: center;
}

.editor-launch-actions .btn.disabled {
  opacity: 0.4;
  pointer-events: none;
}

.editor-clear-draft {
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  border: none;
  text-decoration: underline;
}

.editor-clear-draft:hover {
  color: var(--judge-miss);
}

/* ============ 编辑器主界面 ============ */
.editor-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* 顶部工具栏 */
.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-mid);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.editor-toolbar .tool-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.editor-toolbar .sep {
  width: 1px;
  height: 22px;
  background: var(--border-light);
}

.editor-title-block {
  display: flex;
  flex-direction: column;
  cursor: pointer;
  min-width: 120px;
}

.editor-title-block .ed-title {
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.editor-title-block .ed-diff {
  font-size: 12px;
  font-weight: 600;
}

.ed-bpm {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  white-space: nowrap;
}

.ed-zoom-label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  min-width: 42px;
  text-align: center;
}

.editor-toolbar select {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 13px;
  cursor: pointer;
}

/* 主编辑区 */
.editor-workspace {
  flex: 1;
  display: flex;
  min-height: 0;
}

.editor-canvas-wrap {
  flex: 1;
  position: relative;
  min-width: 0;
  background: var(--bg-deep);
}

#editor-canvas {
  display: block;
  cursor: crosshair;
}

/* 波形区（独立列，与谱面轨道区左右并排，不重叠） */
.editor-waveform {
  width: 120px;
  border-left: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
}

#editor-waveform-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.editor-waveform-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 11px;
  writing-mode: vertical-rl;
  letter-spacing: 2px;
  pointer-events: none;
}

/* 右侧侧栏 */
.editor-sidebar {
  width: 300px;
  border-left: 1px solid var(--border);
  background: var(--bg-mid);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

/* 侧栏 Tab */
.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-tab {
  flex: 1;
  padding: 12px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s var(--ease-out);
}

.sidebar-tab:hover {
  color: var(--text-secondary);
}

.sidebar-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  text-shadow: 0 0 10px var(--accent-glow);
}

.sidebar-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
}

.sidebar-page .field {
  margin-bottom: 14px;
}

/* 侧栏各页的输入框/下拉统一样式 */
.sidebar-page .field label {
  display: block;
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.sidebar-page .field input,
.sidebar-page .field select {
  width: 100%;
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 14px;
}

.sidebar-page .field input[type="range"] {
  padding: 0;
  border: none;
  background: linear-gradient(90deg, #7fdcff var(--fill, 50%), #4dc9ff var(--fill, 50%));
}

/* 双列字段行 */
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.side-hint {
  font-size: 12px;
  color: var(--text-muted);
  padding: 10px;
  border-radius: var(--radius-sm);
  background: rgba(0, 212, 255, 0.05);
  border: 1px dashed var(--border-light);
  line-height: 1.6;
}

.sidebar-form .field {
  margin-bottom: 14px;
}

.sidebar-empty {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 40px 0;
}

.sidebar-form .field {
  margin-bottom: 14px;
}

.sidebar-form .field label {
  display: block;
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.sidebar-form .field input,
.sidebar-form .field select {
  width: 100%;
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 14px;
}

.sidebar-form .field input:disabled {
  opacity: 0.4;
}

#sidebar-count {
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 14px;
}

.sidebar-actions {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.btn-danger {
  width: 100%;
  background: rgba(255, 84, 112, 0.1);
  color: var(--judge-miss);
  border: 1px solid rgba(255, 84, 112, 0.4);
}

.btn-danger:hover {
  background: rgba(255, 84, 112, 0.2);
  box-shadow: 0 0 14px rgba(255, 84, 112, 0.3);
  border-color: var(--judge-miss);
}

/* 底部播放控制栏 */
.editor-playback {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-mid);
  flex-shrink: 0;
}

.editor-playback .time-display {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.editor-playback input[type="range"] {
  flex: 1;
}

.editor-volume-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 160px;
}

.editor-volume-wrap .vol-label {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 36px;
}

/* ============ 弹窗（参数表单 / 显示全文） ============ */
.editor-overlay {
  position: absolute;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 4, 10, 0.65);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s var(--ease-out), visibility 0s 0.25s;
}

.editor-overlay.open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.25s var(--ease-out);
}

.editor-modal {
  width: min(520px, 92vw);
  max-height: 86vh;
  overflow-y: auto;
  background: var(--bg-mid);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  transform: translateY(16px) scale(0.97);
  transition: transform 0.28s var(--ease-spring);
}

.editor-overlay.open .editor-modal {
  transform: translateY(0) scale(1);
}

.editor-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.editor-modal-head h2 {
  font-size: 18px;
  letter-spacing: 1px;
}

.editor-modal-body .form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.editor-modal-body .field {
  margin-bottom: 2px;
}

.editor-modal-body .field.full {
  grid-column: 1 / -1;
}

.editor-modal-body .field label {
  display: block;
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 5px;
}

.editor-modal-body .field input,
.editor-modal-body .field select {
  width: 100%;
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 9px 10px;
  font-size: 14px;
}

.editor-modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* 显示全文弹窗 */
.fulltext-modal {
  width: min(720px, 94vw);
}

.fulltext-modal textarea {
  width: 100%;
  height: 420px;
  background: #0c0c16;
  color: #b8f5ff;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  resize: vertical;
  white-space: pre;
  overflow: auto;
}

/* ============ 导出下拉菜单 ============ */
.export-wrap {
  position: relative;
}

.export-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 160px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  padding: 6px;
  display: none;
  z-index: 50;
}

.export-menu.open {
  display: block;
}

.export-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text-primary);
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.export-menu button:hover {
  background: rgba(0, 212, 255, 0.1);
}

/* ============ 轻提示 ============ */
#editor-toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-elevated);
  border: 1px solid var(--accent);
  color: var(--text-primary);
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: 0 0 20px var(--accent-glow);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s var(--ease-out);
  z-index: 999;
}

#editor-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* 隐藏工具按钮 */
.hidden {
  display: none !important;
}
