/* ========================================================================
 * work-edit.css · 创作页 Shell 内核样式 · v0.2
 * 范围：work-edit-frame · work-topbar · work-tabbar · tab · tab-add-menu
 *      tam-* (tab-add-menu 子项) · work-stage · sub-iframe
 * 说明：当 body.page-work-edit 时由 site.css 控制：云球 opacity 0.35、main padding=0
 * ====================================================================== */

/* 整个创作页框架占满 main 视口（main 已由 site.css 处理 padding=0 / overflow:hidden） */
.work-edit-frame {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.35); /* 让云球淡淡透出来 */
  border-top: 1px solid rgba(212, 175, 55, 0.18);
}

/* ================== 顶部信息栏 ================== */
.work-topbar {
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 16px;
  background: rgba(10, 10, 14, 0.7);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(212, 175, 55, 0.18);
  font-size: 13px;
  color: var(--text);
  gap: 12px;
  flex-shrink: 0;
}
.work-topbar .back-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 12px;
  letter-spacing: 0.04em;
  padding: 4px 8px;
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 2px;
  transition: background 0.16s, border-color 0.16s;
}
.work-topbar .back-link:hover {
  background: rgba(212, 175, 55, 0.08);
  border-color: rgba(212, 175, 55, 0.5);
}
.work-topbar .work-title {
  color: var(--accent);
  font-family: var(--serif, "Source Han Serif SC", "Noto Serif CJK SC", serif);
  font-size: 14px;
  letter-spacing: 0.06em;
}
.work-topbar .work-spacer { flex: 1; }
.work-topbar .hb-status,
.work-topbar .save-status {
  font-size: 11px;
  color: var(--text-mute);
  letter-spacing: 0.04em;
}
.work-topbar .save-status.dirty { color: #c9a86b; }
.work-topbar .save-status.error { color: #c45d5d; }

/* ================== Tab 栏 ================== */
.work-tabbar {
  display: flex;
  align-items: center;
  height: 38px;
  padding: 0 8px;
  background: rgba(8, 8, 12, 0.85);
  border-bottom: 1px solid rgba(212, 175, 55, 0.12);
  gap: 2px;
  flex-shrink: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}
.work-tabbar::-webkit-scrollbar { height: 4px; }
.work-tabbar::-webkit-scrollbar-thumb { background: rgba(212, 175, 55, 0.25); }

.tab {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 10px;
  margin: 4px 0;
  font-size: 12px;
  color: var(--text-mute);
  background: rgba(20, 20, 26, 0.6);
  border: 1px solid rgba(212, 175, 55, 0.10);
  border-radius: 2px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: background 0.16s, border-color 0.16s, color 0.16s;
  gap: 6px;
}
.tab:hover {
  background: rgba(30, 30, 38, 0.7);
  border-color: rgba(212, 175, 55, 0.3);
  color: var(--text);
}
.tab.active {
  background: rgba(40, 32, 16, 0.65);
  border-color: rgba(212, 175, 55, 0.55);
  color: var(--accent);
}
.tab .tab-kind {
  font-size: 10px;
  font-family: var(--serif, "Source Han Serif SC", serif);
  color: var(--accent);
  opacity: 0.65;
  border-right: 1px solid rgba(212, 175, 55, 0.25);
  padding-right: 6px;
}
.tab .tab-title {
  max-width: 16em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tab .tab-close {
  font-size: 14px;
  color: var(--text-mute);
  opacity: 0.5;
  transition: opacity 0.16s, color 0.16s;
  padding: 0 2px;
}
.tab .tab-close:hover {
  opacity: 1;
  color: #c45d5d;
}

.tab-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 30px;
  margin: 4px 0 4px 6px;
  font-size: 16px;
  color: var(--accent);
  background: transparent;
  border: 1px dashed rgba(212, 175, 55, 0.3);
  border-radius: 2px;
  cursor: pointer;
  transition: background 0.16s, border-color 0.16s;
}
.tab-add:hover {
  background: rgba(212, 175, 55, 0.06);
  border-color: rgba(212, 175, 55, 0.6);
}

/* ================== tab-add-menu（inline 下拉，无遮罩） ================== */
.tab-add-menu {
  width: 240px;
  max-height: 60vh;
  overflow-y: auto;
  background: rgba(14, 14, 18, 0.96);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 3px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7),
              0 0 0 1px rgba(212, 175, 55, 0.08);
  padding: 6px 0;
  z-index: 1000;
  animation: tam-slide-in 200ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
@keyframes tam-slide-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.tam-section {
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--accent);
  opacity: 0.7;
  padding: 6px 14px 4px;
  text-transform: uppercase;
}
.tam-divider {
  height: 1px;
  background: rgba(212, 175, 55, 0.12);
  margin: 4px 8px;
}
.tam-item {
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tam-item:hover {
  background: rgba(212, 175, 55, 0.08);
  color: var(--accent);
}
.tam-inline {
  padding: 6px 10px 8px;
}
.tam-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 2px;
  padding: 7px 10px;
  font-size: 12px;
  color: var(--accent);
  font-family: var(--serif, "Source Han Serif SC", serif);
  outline: none;
  transition: border-color 0.16s, background 0.16s;
}
.tam-input::placeholder { color: var(--text-mute); opacity: 0.6; }
.tam-input:focus {
  border-color: rgba(212, 175, 55, 0.65);
  background: rgba(0, 0, 0, 0.55);
}
.tam-input:disabled { opacity: 0.5; }

/* ================== 子页舞台（iframe 层叠） ================== */
.work-stage {
  position: relative;
  flex: 1;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.2);
}

.sub-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  display: none;
}
.sub-iframe.active { display: block; }

/* ================== 移动端 ================== */
@media (max-width: 768px) {
  .work-topbar { padding: 0 10px; gap: 8px; }
  .work-topbar .work-title { font-size: 13px; }
  .work-topbar .hb-status { display: none; }
  .tab-add-menu { width: min(240px, calc(100vw - 16px)); }
}
