/* ============================================================
   多米生图 - 仅补充 matrix_style.css 未覆盖的专有组件样式
   通用外观（容器/header/按钮/弹窗/网格卡片）复用 matrix_style.css
   ============================================================ */

/* ---------- 多米矩阵页头部：橙金渐变，与原矩阵页青绿头部区分 ---------- */
.matrix_header {
  background: linear-gradient(135deg, #e08a2a 0%, #c25a1a 100%);
}

.matrix_header sup{
  font-size: 12px;
}

/* ---------- 生图引擎 header 背景配色 ----------
   gpt image 2 延用橙金原配色；nano banana 用酒红差异化配色区分调用源头 */
.matrix_header.engine_nano {
  background: linear-gradient(135deg, #6a1a3a 0%, #9a2a4a 100%);
}
.matrix_header.engine_nano h1 sup {
  color: #ffd76a;
}
.matrix_header.engine_nano .engine_select {
  border-color: #ffd76a;
  box-shadow: 0 0 0 1px rgba(255, 215, 106, 0.4);
}
.matrix_header.engine_gpt .engine_select {
  border-color: rgba(255, 255, 255, 0.3);
}

/* ---------- 顶部「查询」按钮（手工查询待生成任务） ---------- */
.query_btn {
  background: linear-gradient(135deg, #e08a2a 0%, #c25a1a 100%);
  color: #fff;
  box-shadow: 0 3px 10px rgba(224, 138, 42, 0.3);
}
.query_btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 5px 16px rgba(224, 138, 42, 0.45);
}

/* ---------- 网格单条「查询」按钮（pending 态） ---------- */
.btn_regen.btn_query {
  background: linear-gradient(135deg, #e08a2a 0%, #c25a1a 100%);
}
.btn_regen.btn_query:hover {
  background: #c25a1a;
}

/* ---------- 网格待查询态底色 ---------- */
.grid_item.pending .item_image {
  background: #fdf2e6;
}
.grid_item.pending .item_image:hover {
  background: #fbe6d2;
}

/* ---------- 通用表单控件（box 内的 select / number） ---------- */
.matrix_box select,
.matrix_box input[type="number"],
.matrix_box input[type="text"] {
  width: 100%;
  padding: 8px 10px;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  color: #333;
  outline: none;
  transition: border-color 0.3s ease;
  cursor: pointer;
}
.matrix_box select:focus,
.matrix_box input[type="number"]:focus,
.matrix_box input[type="text"]:focus {
  border-color: #7a9e1a;
}

/* ---------- 工具行（风格/文本框/提炼设置） ---------- */
.duomi_tool_row {
  display: flex;
  gap: 10px;
}
.duomi_tool_col {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}
.duomi_tool_col label {
  font-size: 12px;
  color: #666;
}

/* ---------- 参考图泊位（4 固定位，兼容 duomi 机制） ---------- */
.ref_images_grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.ref_slot {
  aspect-ratio: 1 / 1;
  border: 2px dashed #d0d0c0;
  border-radius: 8px;
  background: #fafaf5;
  position: relative;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.3s ease, background 0.3s ease;
}
.ref_slot:hover {
  border-color: #7a9e1a;
  background: #f0f5e8;
}
.ref_slot.has_image {
  border-style: solid;
  border-color: #7a9e1a;
  background: #fff;
}
.ref_slot.drag_over {
  border-color: #7a9e1a;
  background: #e8f0d8;
}
.ref_slot.dragging {
  opacity: 0.5;
  cursor: grabbing;
}
.ref_slot_img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}
.ref_slot_hint {
  color: #bbb;
  font-size: 20px;
  user-select: none;
}
.ref_slot_clear {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 5;
}
.ref_slot_clear:hover {
  background: #e05555;
}

.ref_toolbar {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.ref_tool_btn {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid #7a9e1a;
  border-radius: 4px;
  background: #fff;
  color: #5a7e0a;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.3s ease;
}
.ref_tool_btn:hover {
  background: #f0f5e8;
}
.ref_tool_btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* ---------- 右侧：模式标签 + 内容区 ---------- */
.right_body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.mode_tabs {
  display: flex;
  gap: 6px;
}
.mode_tab {
  padding: 6px 14px;
  border: 1px solid #d0d0c0;
  border-radius: 6px;
  background: #fff;
  color: #666;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.mode_tab:hover {
  border-color: #7a9e1a;
}
.mode_tab.active {
  border-color: #7a9e1a;
  color: #5a7e0a;
  background: #f0f5e8;
  font-weight: 600;
}

.duomi_mode_content {
  display: none;
}
.duomi_mode_content.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

/* ---------- 文字列表 ---------- */
.text_list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
}
.text_item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  background: #fff;
  border: 1px solid #d0d0c0;
  border-radius: 8px;
  padding: 10px;
  transition: box-shadow 0.3s ease;
}
.text_item:hover {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}
.text_item_index {
  font-size: 13px;
  font-weight: 600;
  color: #5a7e0a;
  min-width: 20px;
  padding-top: 6px;
}
.text_item_textarea {
  flex: 1;
  width: 100%;
  padding: 8px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  line-height: 1.5;
  resize: vertical;
  outline: none;
  transition: border-color 0.3s ease;
}
.text_item_textarea:focus {
  border-color: #7a9e1a;
  background: #fafef8;
}

/* ---------- 图片卡片：提示语编辑区（matrix 无此块） ---------- */
.item_index {
  position: absolute;
  top: 6px;
  left: 8px;
  font-size: 11px;
  font-weight: 600;
  color: rgba(90, 126, 10, 0.4);
  z-index: 2;
  pointer-events: none;
  user-select: none;
}
.item_prompt {
  border-top: 1px solid #d0d0c0;
  background: #fafaf5;
}
.item_prompt_textarea {
  width: 100%;
  padding: 8px 10px;
  border: none;
  font-size: 13px;
  font-family: inherit;
  line-height: 1.5;
  resize: vertical;
  outline: none;
  background: transparent;
  color: #333;
}
.item_prompt_textarea:focus {
  background: #fafef8;
}

/* ---------- 单图预览 ---------- */
.preview_area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f0e8;
  overflow: hidden;
  padding: 16px;
}
.preview_placeholder {
  color: #bbb;
}
.preview_image_wrap {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.preview_img {
  max-width: 100%;
  max-height: 72vh;
  object-fit: contain;
  border-radius: 4px;
}
.preview_nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  transition: background 0.2s ease;
}
.preview_nav:hover {
  background: rgba(0, 0, 0, 0.6);
}
.preview_nav.prev {
  left: 8px;
}
.preview_nav.next {
  right: 8px;
}
.preview_prompt {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.5;
  max-height: 120px;
  overflow-y: auto;
}
.preview_regen_btn {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 16px;
  background: rgba(122, 158, 26, 0.92);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  z-index: 5;
  transition: background 0.3s ease;
}
.preview_regen_btn:hover {
  background: #7a9e1a;
}
.preview_info {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  z-index: 5;
}

/* ---------- 根提示语：前导 / 结尾 左右分栏 ---------- */
.box1_split {
  display: flex;
  gap: 12px;
}
.box1_split_col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
/* 根提示语三列比例：前导 2 / 根参考图 2 / 结尾 1 */
.box1_col_lead { flex: 2; }
.box1_col_root { flex: 2; }
.box1_col_tail { flex: 1; }
/* 根参考图上传区：撑满列高，与左右 textarea 对齐 */
.box1_col_root .image_zone {
  min-height: 120px;
  flex: 1;
}
.box1_col_root .image_zone_hint {
  font-size: 12px;
}
.box1_sub_label {
  font-size: 12px;
  font-weight: 600;
  color: #5a7e0a;
}

/* ---------- Box2 头部：每组图片数选择框 ---------- */
.group_size_wrap {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #666;
}
.box_tit .group_size_wrap select {
  width: auto;
  padding: 3px 6px;
  border: 1px solid #d0d0c0;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}

/* ---------- 参考图分组显示 ---------- */
.image_slots.grouped {
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}
.image_group {
  border: 1px dashed #d0c8b0;
  border-radius: 8px;
  padding: 8px;
  background: #fffdf8;
}
.image_group.incomplete {
  border-color: #e0a040;
  background: #fef3e0;
}
.image_group_label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #a06a1a;
  margin-bottom: 6px;
}
.image_group.incomplete .image_group_label {
  color: #c0392b;
}
.image_group_slots {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.image_slot .slot_pos {
  position: absolute;
  top: 2px;
  left: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  border-radius: 8px;
  background: rgba(122, 158, 26, 0.85);
  color: #fff;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
  z-index: 4;
  user-select: none;
}
.image_slot_empty {
  width: 72px;
  height: 72px;
  border-radius: 6px;
  border: 2px dashed #e0a040;
  background: #fff8ee;
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.image_slot_empty .slot_pos {
  position: static;
  background: #e0a040;
}
/* 拖拽中：源槽半透明 */
.image_slot.dragging {
  opacity: 0.4;
  cursor: grabbing;
}
/* 拖拽落点：高亮目标槽 */
.image_slot.drag_target {
  outline: 2px solid #7a9e1a;
  outline-offset: 1px;
  background: #f3f8e6;
}
.image_slot_empty.drag_target {
  border-color: #7a9e1a;
  background: #f3f8e6;
}

/* ---------- 日志查看弹窗 ---------- */
.log_btn {
  background: #5b6b8c;
  color: #fff;
}
.log_modal {
  width: 80%;
  max-width: 80%;
  height: 78vh;
  display: flex;
  flex-direction: column;
}
.log_modal h2 {
  margin: 0 0 10px;
  font-size: 18px;
}
.log_body {
  flex: 1;
  display: flex;
  min-height: 0;
  gap: 12px;
}
.log_list_wrap {
  width: 280px;
  flex-shrink: 0;
  border: 1px solid #e2e2e2;
  border-radius: 8px;
  overflow-y: auto;
  background: #fafafa;
}
.log_list {
  padding: 6px;
}
.log_list_empty {
  padding: 20px 12px;
  color: #999;
  font-size: 13px;
  text-align: center;
}
.log_item {
  padding: 9px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.log_item:hover {
  background: #eef3fb;
}
.log_item.active {
  background: #d7e6ff;
}
.log_item_name {
  font-size: 13px;
  font-weight: 600;
  color: #333;
  word-break: break-all;
}
.log_item_meta {
  font-size: 11px;
  color: #999;
}
.log_detail {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid #e2e2e2;
  border-radius: 8px;
  overflow: hidden;
}
.log_balance {
  padding: 8px 12px;
  background: #e8f0e0;
  border-bottom: 1px solid #e2e2e2;
  font-size: 13px;
  font-weight: 600;
  color: #4a6b1a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.log_detail_head {
  padding: 10px 12px;
  background: #f0f3f7;
  border-bottom: 1px solid #e2e2e2;
  font-size: 13px;
  font-weight: 600;
  color: #444;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.log_detail_content {
  flex: 1;
  margin: 0;
  padding: 12px;
  overflow: auto;
  font-family: Consolas, Menlo, Monaco, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.6;
  color: #2b2b2b;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ---------- 智能对话弹窗（生成生图提示语） ---------- */
.chat_btn {
  background: #8a6db1;
  color: #fff;
}
.chat_btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 5px 16px rgba(138, 109, 177, 0.45);
}
.chat_modal {
  width: 760px;
  max-width: 92%;
  max-height: 88vh;
  padding: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat_modal h2 {
  margin: 0 0 6px;
  font-size: 18px;
}
.chat_tip {
  margin: 0 0 14px;
  font-size: 12px;
  color: #888;
  line-height: 1.5;
}
.chat_body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  overflow: hidden;
}
.chat_input_area {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chat_input_area textarea {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  transition: border-color 0.3s ease;
}
.chat_input_area textarea:focus {
  border-color: #8a6db1;
  background: #fbf9fe;
}
.chat_actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.chat_result_area {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}
.chat_result_placeholder {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #aaa;
  font-size: 13px;
  border: 1px dashed #e0e0e0;
  border-radius: 8px;
  padding: 20px;
}
#chatResult {
  flex: 1;
  width: 100%;
  min-height: 220px;
  padding: 12px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  line-height: 1.7;
  resize: none;
  outline: none;
  background: #fafaf5;
  overflow-y: auto;
}
#chatResult:focus {
  border-color: #8a6db1;
  background: #fbf9fe;
}
.chat_result_actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.chat_result_actions .v2_btn {
  flex: 1;
  min-width: 120px;
}

/* ---------- 移动端：保留折叠箭头可用 ---------- */
@media (max-width: 980px) {
  .toggle_arrow {
    display: flex;
    left: 50%;
    transform: translate(-50%, -50%);
  }
  .duomi_tool_row {
    flex-direction: column;
  }
  .ref_images_grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .box1_split {
    flex-direction: column;
  }
}

/* ---------- 批次模式面板 ---------- */
.batch_panel {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.batch_dialog {
  width: 560px;
  max-width: 92%;
  max-height: 86vh;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.batch_head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 2px solid #7a9e1a;
}
.batch_head h2 {
  margin: 0;
  font-size: 17px;
  color: #333;
}
.batch_close {
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: #999;
  cursor: pointer;
}
.batch_close:hover { color: #e05555; }
.batch_tip {
  margin: 0;
  padding: 12px 18px 0;
  font-size: 12px;
  color: #888;
  line-height: 1.6;
}
.batch_tip code {
  background: #f0f5e8;
  color: #5a7e0a;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11px;
}
.batch_row {
  display: flex;
  gap: 10px;
  padding: 12px 18px;
}
.batch_input {
  flex: 1;
  padding: 9px 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.3s ease;
}
.batch_input:focus { border-color: #7a9e1a; background: #fafef8; }
.batch_status {
  padding: 0 18px 8px;
  font-size: 12px;
  color: #666;
  min-height: 18px;
}
.batch_list {
  list-style: none;
  margin: 0;
  padding: 0 18px 18px;
  overflow-y: auto;
  flex: 1;
}
.batch_list li {
  border: 1px solid #e8e8dc;
  border-radius: 8px;
  margin-bottom: 8px;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.batch_list li:hover {
  border-color: #7a9e1a;
  box-shadow: 0 2px 12px rgba(122, 158, 26, 0.18);
}
.batch_list li a {
  display: block;
  padding: 10px 12px;
  text-decoration: none;
  color: inherit;
}
.batch_list .case_name {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #333;
}
.batch_list .case_meta {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  color: #999;
  word-break: break-all;
}
.batch_actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  border-bottom: 1px dashed #e0e0e0;
  flex-wrap: wrap;
}
.batch_selall {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: #555;
  cursor: pointer;
}
.batch_count {
  font-size: 12px;
  color: #7a9e1a;
}
.batch_item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
}
.batch_item input.batch_cb {
  margin-top: 3px;
  width: 15px;
  height: 15px;
  accent-color: #7a9e1a;
  flex: none;
}
