/* ==========================================================================
   Slidepane — 界面语言切换器
   --------------------------------------------------------------------------
   编辑器 / 用户中心 / 登录页 / 版式制作器 四处共用同一套结构和样式。
   之前在页脚是一个下划线小链接、在编辑器里藏在「更多导出」菜单里 ——
   默认改成英文之后，中文用户根本找不到入口，所以统一成顶栏上的显式下拉。

   颜色一律用 currentColor：编辑器顶栏、用户中心顶栏、登录卡片三种底色
   都是浅色，但深浅不一，写死颜色总有一处不搭。
   ========================================================================== */

.ui-lang { position: relative; display: inline-flex; flex: none; }

.ui-lang-btn {
  display: inline-flex; align-items: center; gap: 5px;
  height: 28px; padding: 0 9px;
  font-family: inherit; font-size: 12px; font-weight: 600; letter-spacing: .02em;
  line-height: 1;
  color: inherit; background: transparent;
  border: 1px solid currentColor; border-radius: 7px;
  opacity: .55; cursor: pointer;
  transition: opacity .15s, background .15s;
}
.ui-lang-btn:hover { opacity: 1; }
.ui-lang-btn[aria-expanded="true"] { opacity: 1; background: rgba(0, 0, 0, .04); }
.ui-lang-btn:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

/* 图标必须是描边的：app.css 里有一条全局 svg{width:16px;height:16px}，
   这里两样都要显式写回去，否则在编辑器里会变成 16px 的大地球 */
.ui-lang-btn svg {
  width: 13px; height: 13px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}

.ui-lang-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 90;
  min-width: 138px; padding: 5px;
  background: #fff; color: #1B2333;
  border: 1px solid #E3E7EF; border-radius: 10px;
  box-shadow: 0 12px 30px rgba(20, 30, 60, .16);
  /* 八档语言 + 分隔线约 270px 高，矮屏（笔记本 / 手机横屏）要能滚 */
  max-height: min(58vh, 320px); overflow-y: auto; overscroll-behavior: contain;
}
.ui-lang-pop[hidden] { display: none; }

/* 前两档（英文原文 / 内置中文词典）与后面六档机翻语言之间分组 */
.ui-lang-sep {
  height: 1px; margin: 5px 8px;
  background: #E9EDF5;
}

/* 编辑器顶栏这颗在品牌右侧，靠近视口左边：右对齐会往左溢出到 logo 上，
   改成左对齐、向下展开 */
.topbar .ui-lang-pop { left: 0; right: auto; }

.ui-lang-pop button {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; padding: 7px 9px;
  font-family: inherit; font-size: 12.5px; font-weight: 400; line-height: 1.4;
  color: inherit; background: none; border: 0; border-radius: 6px;
  text-align: left; cursor: pointer; white-space: nowrap;
}
.ui-lang-pop button:hover { background: #F2F5FB; }
.ui-lang-pop button[aria-checked="true"] { color: #3B5BDB; font-weight: 600; }
.ui-lang-pop button[aria-checked="true"]::after {
  content: ""; width: 11px; height: 6px; flex: none;
  border-left: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg) translateY(-1px);
}

/* 登录页页脚那种细排环境里，按钮跟着文字一起瘦下来 */
.auth-foot .ui-lang-btn,
.side-foot .ui-lang-btn { height: 24px; padding: 0 7px; font-size: 11.5px; }
.auth-foot .ui-lang-pop,
.side-foot .ui-lang-pop { right: auto; left: 0; }

/* 首次启用某档机翻语言时要批量翻界面词典，页面会先显示英文再重载一次。
   这条提示画在 body 上（绝不进 #canvas —— 画布内容会被当成正文导出），
   而且不遮住任何控件，用户该干嘛干嘛。 */
.ui-tl-loading {
  position: fixed; left: 50%; top: 10px; transform: translateX(-50%);
  z-index: 9999; padding: 7px 14px;
  font: 12px/1.4 -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: #3B5BDB; background: #fff;
  border: 1px solid #D9E1FB; border-radius: 8px;
  box-shadow: 0 6px 20px rgba(20, 30, 60, .14);
  pointer-events: none;
}

@media (max-width: 640px) {
  /* 窄屏顶栏寸土寸金：只留地球图标，语言名去掉 */
  .topbar .ui-lang-btn span,
  .dz-top .ui-lang-btn span { display: none; }
  .topbar .ui-lang-btn,
  .dz-top .ui-lang-btn { padding: 0 7px; }
}
