/* ============================================================
   展开编辑大面板 (参考 Lovart/即梦 节点展开样式)
   点击节点"展开编辑"入口后,弹出居中模态大面板
   ============================================================ */

/* ---------- 节点上的"展开编辑"入口条 ---------- */
.gen-expand-entry {
  width: 100%;
  height: 26px;
  margin-bottom: 8px;
  border-radius: var(--ai2-r-field);
  background: #f1f3f5;
  color: #9aa2a9;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  border: 1px dashed #ccd3d9;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
  padding: 0;
}

.gen-expand-entry:hover {
  background: #e3e7ea;
  color: #526df5;
  border-color: #c3ccfb;
}

.gen-expand-entry:active {
  transform: scale(0.98);
}

/* ---------- 遮罩 ---------- */
.gen-expand-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(23, 26, 29, .42);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  display: grid;
  place-items: center;
  padding: 24px;
  animation: gen-exp-fade 0.18s ease-out;
}

@keyframes gen-exp-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---------- 大面板本体 ---------- */
.gen-expand-panel {
  width: min(760px, 94vw);
  max-height: min(82vh, 720px);
  border-radius: var(--ai2-r-panel);
  background: #f7f8fa;
  border: 1px solid rgba(255, 255, 255, .8);
  box-shadow: 0 32px 100px rgba(82, 109, 245, .22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: gen-exp-rise 0.22s cubic-bezier(0.22, 0.9, 0.3, 1.1);
  position: relative;
}

@keyframes gen-exp-rise {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- 面板头 ---------- */
.gen-expand-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 8px;
  flex: 0 0 auto;
}

.gen-expand-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 700;
  color: #171a1d;
}

.gen-expand-close {
  width: 32px;
  height: 32px;
  border-radius: var(--ai2-r-field);
  background: #f7f8fa;
  color: #667078;
  font-size: 18px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease, transform 0.12s ease;
  padding: 0;
}

.gen-expand-close:hover {
  background: #e3e7ea;
  color: #171a1d;
  transform: scale(1.06);
}

/* ---------- 大提示词输入区 ---------- */
.gen-expand-textarea {
  flex: 1 1 auto;
  min-height: 180px;
  margin: 4px 20px 0;
  padding: 16px 18px;
  border-radius: var(--ai2-r-field);
  border: 1px solid #e3e7ea;
  background: #fff;
  color: #171a1d;
  font-size: 14px;
  line-height: 1.65;
  resize: none;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.gen-expand-textarea:focus {
  border-color: #8e9bf9;
  box-shadow: 0 0 0 3px rgba(82, 109, 245, .16);
}

/* 面板内的 @ 引用面板(跟随输入框,显示在上方) */
.mention-panel.in-expand {
  position: static;
  margin: 8px 20px 0;
  max-height: 180px;
  box-shadow: 0 10px 34px rgba(82, 109, 245, .14);
}

/* ---------- 底部工具条 ---------- */
.gen-expand-toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 20px 16px;
  flex-wrap: wrap;
}

.gen-expand-platform {
  flex: 0 1 200px;
  min-width: 160px;
}

/* 让 API 平台选择器在工具条里紧凑显示 */
.gen-expand-platform .node-api-select-row {
  margin-bottom: 0;
  padding: 5px 8px;
  border-radius: var(--ai2-r-field);
}

/* 参数小胶囊 */
.gen-tool-pill {
  height: 36px;
  border-radius: var(--ai2-r-field);
  padding: 0 13px;
  background: #f1f3f5;
  color: #667078;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease, transform 0.1s ease;
  white-space: nowrap;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gen-tool-pill:hover {
  background: #e3e7ea;
  color: #171a1d;
  transform: translateY(-1px);
}

.gen-tool-pill.active {
  background: #8e9bf9;
  color: #fff;
}

.gen-tool-pill:active {
  transform: translateY(0) scale(0.97);
}

/* 生成按钮(右侧高亮) */
.gen-tool-run {
  margin-left: auto;
  height: 40px;
  border-radius: var(--ai2-r-field);
  padding: 0 20px;
  background: #171a1d;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(24,32,38, .16);
  transition: background 0.14s ease, transform 0.12s ease, box-shadow 0.14s ease;
}

.gen-tool-run:hover:not(:disabled) {
  background: #526df5;
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(82, 109, 245, .22);
}

.gen-tool-run:active:not(:disabled) {
  transform: translateY(0) scale(0.97);
}

.gen-tool-run:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ---------- 面板内参数弹层(模型/比例等) ---------- */
.gen-expand-popovers {
  position: relative;
  flex: 0 0 auto;
  padding: 0 20px;
}

.gen-expand-popovers:empty {
  display: none;
}

/* 大面板里的 option-popover 保持内联、全宽、底部对齐 */
.gen-expand-popovers .option-popover {
  position: relative;
  left: auto;
  top: auto;
  transform: none;
  width: 100%;
  margin: 0 0 16px;
  max-height: 240px;
  overflow-y: auto;
}

/* ---------- 面板内的预览图(多角度/放大/反推) ---------- */
.gen-expand-preview {
  flex: 0 0 auto;
  margin: 4px 20px 0;
  border-radius: var(--ai2-r-field);
  overflow: hidden;
  background: #f7f8fa;
  border: 1px solid #e3e7ea;
  display: grid;
  place-items: center;
  max-height: 240px;
}

.gen-expand-preview img {
  width: 100%;
  max-height: 240px;
  object-fit: contain;
  display: block;
}

.gen-expand-preview.large {
  max-height: 320px;
}

.gen-expand-preview.large img {
  max-height: 320px;
}

.gen-expand-preview.empty {
  min-height: 90px;
  color: #9aa2a9;
  font-size: 12.5px;
  padding: 16px;
  text-align: center;
  border-style: dashed;
}

/* ---------- 多角度滑杆行 ---------- */
.gen-expand-angle-nums {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin: 12px 20px 0;
  flex: 0 0 auto;
}

.gen-expand-angle-nums label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
  color: #667078;
  min-width: 220px;
  flex: 1 1 220px;
}

.gen-expand-angle-nums input[type="range"] {
  flex: 1 1 auto;
  accent-color: #8e9bf9;
  cursor: pointer;
}

/* ---------- 工具条内的静态胶囊(含下拉) ---------- */
.gen-tool-pill.static {
  cursor: default;
  gap: 7px;
}

.gen-tool-pill.static:hover {
  transform: none;
  background: #f1f3f5;
  color: #667078;
}

.gen-tool-pill.static select {
  border: 0;
  background: transparent;
  color: #171a1d;
  font-size: 12px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  max-width: 110px;
}

/* ---------- 反推结果只读文本 ---------- */
.gen-expand-textarea.result {
  background: #f7f8fa;
  color: #33383d;
  font-size: 13px;
}

.gen-expand-textarea.result:focus {
  border-color: #e3e7ea;
  box-shadow: none;
}

/* ---------- 视频节点 URL 区 ---------- */
.gen-expand-urls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 20px 16px;
  flex: 0 0 auto;
}

.gen-expand-urls label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11.5px;
  color: #667078;
}

.gen-expand-urls textarea,
.gen-expand-urls input {
  border: 1px solid #e3e7ea;
  border-radius: var(--ai2-r-field);
  background: #fff;
  color: #171a1d;
  font-size: 12px;
  padding: 8px 12px;
  outline: none;
  min-height: 34px;
  font-family: inherit;
  resize: vertical;
}

.gen-expand-urls textarea:focus,
.gen-expand-urls input:focus {
  border-color: #8e9bf9;
}

/* ---------- 移动端适配 ---------- */
@media (max-width: 720px) {
  .gen-expand-panel {
    width: 96vw;
    max-height: 88vh;
    border-radius: var(--ai2-r-panel);
  }
  .gen-expand-platform {
    flex: 1 1 100%;
  }
  .gen-tool-run {
    margin-left: 0;
    flex: 1 1 100%;
    justify-content: center;
  }
}

/* ---------- 减少动效 ---------- */
@media (prefers-reduced-motion: reduce) {
  .gen-expand-overlay,
  .gen-expand-panel,
  .gen-expand-entry,
  .gen-tool-pill,
  .gen-tool-run,
  .gen-expand-close {
    animation: none !important;
    transition: none !important;
  }
}
