/* ============================================================
   插件（Illustrator CEP）专用样式
   —— 只在这里写 html.xs-cep 作用域下的规则
   —— 不要再往 packspec-panel.css 追加插件样式
   ============================================================ */

/* ── 顶栏按钮（插件里替代「格式 / 导出 / 下载」）──────────────── */
.xs-insert-ai {
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 700;
  border: 1px solid #c9a45c;
  background: linear-gradient(180deg, rgba(201, 164, 92, .92), rgba(178, 142, 72, .95));
  color: #17130a;
}
.xs-insert-ai:hover { filter: brightness(1.06); }
.xs-insert-ai:disabled { opacity: .6; cursor: default; }

.xs-update-check {
  padding: 5px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  border: 1px solid #2a3241;
  background: #0e141d;
  color: #cfd6e4;
}
.xs-update-check:hover { border-color: #7f8ba0; color: #fff; }
.xs-update-check:disabled { opacity: .6; cursor: default; }

/* ── 账号区（与官网一致）──────────────────────────────────── */
.xs-account-box { display: flex; align-items: center; gap: 6px; }
.xs-account-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(201, 164, 92, .14);
  border: 1px solid rgba(201, 164, 92, .35);
  color: #f0d9a8;
  font-size: 12px;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.xs-account-dot { width: 7px; height: 7px; border-radius: 50%; background: #7ad19a; display: inline-block; }
.xs-account-btn {
  padding: 5px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  border: 1px solid #2a3241;
  background: #0e141d;
  color: #cfd6e4;
}
.xs-account-btn:hover { border-color: #7f8ba0; color: #fff; }
.xs-account-btn.primary {
  border-color: #c9a45c;
  background: linear-gradient(180deg, rgba(201, 164, 92, .92), rgba(178, 142, 72, .95));
  color: #17130a;
  font-weight: 700;
}

/* ── 授权徽标（试用 / 已登录 / 已激活 / 已到期）───────────── */
.xs-license-badge {
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 12px;
  border: 1px solid #7a3b3b;
  background: rgba(192, 80, 77, .14);
  color: #ffb3b1;
}
.xs-license-badge.is-on { border-color: #3f7a4f; background: rgba(63, 122, 79, .16); color: #a8e6b8; }
.xs-license-badge.is-trial { border-color: #8a6d2f; background: rgba(201, 164, 92, .16); color: #f0c987; }
.xs-license-badge.is-expired { border-color: #7a3b3b; background: rgba(192, 80, 77, .16); color: #ffb3b1; }
.xs-license-actions { display: flex; gap: 10px; margin-top: 16px; }
.xs-license-actions > * { flex: 1 1 0; }

/* ── 顶栏布局：单行、紧凑、不换行 ─────────────────────────── */
html.xs-cep .web-banner { padding: 8px 12px; }
html.xs-cep .web-banner-brand { font-size: 15px; }
html.xs-cep .web-banner-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding-bottom: 2px;
  overflow-x: auto;
  overflow-y: hidden;
}
html.xs-cep .web-banner-actions > * { flex: 0 0 auto; }
html.xs-cep .web-banner-actions::-webkit-scrollbar { height: 4px; }
html.xs-cep .web-banner-actions::-webkit-scrollbar-thumb { background: #2a3444; border-radius: 2px; }

/* 说明文字：插件里不需要，隐藏（也会把按钮挤到换行）*/
html.xs-cep .web-format-note { display: none !important; }

/* 工具标题行右侧那组（主题 / 账号 / 邀请 / 退出 / 语言 / 网页版）与顶栏重复 */
html.xs-cep .header-actions { display: none !important; }

/* ── 状态条：只占一行，避免盖住内容 ───────────────────────── */
html.xs-cep #status,
html.xs-cep #softStatus,
html.xs-cep #cupStatus {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-height: 34px;
  line-height: 1.4;
}

/* ── 页脚官网链接 ────────────────────────────────────────── */
.web-footer-site {
  color: #c9a45c;
  text-decoration: none;
  border-bottom: 1px dashed rgba(201, 164, 92, .5);
}
.web-footer-site:hover { color: #f0d9a8; border-bottom-color: #f0d9a8; }

/* ── 图层开关：当前盒型没有这一层时置灰 ───────────────────── */
.layer-chip.is-empty { opacity: .38; cursor: not-allowed; }
.layer-chip.is-empty:hover { border-color: inherit; }

/* ============================================================
   自适应布局：插件面板可以拉得很窄（~380px），以下规则保证不溢出
   ============================================================ */

/* ① 顶栏按钮：窄了就换行，不再横向溢出 */
@media (max-width: 620px) {
  html.xs-cep .web-banner-actions {
    flex-wrap: wrap;
    overflow-x: visible;
    row-gap: 6px;
  }
  html.xs-cep .xs-insert-ai { flex: 1 1 100%; text-align: center; }
  html.xs-cep .xs-account-box { order: -1; }
}

/* ② 盒型卡片：窄屏 2 列，卡片内容不挤压 */
@media (max-width: 620px) {
  html.xs-cep .type-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px 12px !important;
  }
  html.xs-cep .type-card { min-width: 0; }
  html.xs-cep .type-card .type-name { font-size: 13px; }
}

/* ③ 刀模形态缩略图：窄屏 2 列换行（不再一排挤出去） */
@media (max-width: 620px) {
  html.xs-cep #configurationLower .opening-shape-grid,
  html.xs-cep #configurationLower #openingShapeGrid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
    overflow-x: visible !important;
  }
  html.xs-cep #configurationLower .opening-shape-card,
  html.xs-cep #configurationLower #openingShapeGrid > button {
    flex: none !important;
    width: auto !important;
    min-width: 0 !important;
  }
  html.xs-cep #configurationLower .opening-shape-card svg {
    width: 100%;
    height: auto;
  }
}

/* ④ 结构参数数值：窄屏两列换行 */
@media (max-width: 620px) {
  html.xs-cep #configurationLower #structureControls,
  html.xs-cep #configurationLower .module-fields {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px 12px !important;
    overflow-x: visible !important;
  }
  html.xs-cep #configurationLower #structureControls > *,
  html.xs-cep #configurationLower .module-fields > * {
    flex: none !important;
    width: auto !important;
    min-width: 0 !important;
  }
  /* 「恢复默认」按钮不要再压在标题上 */
  html.xs-cep #configurationLower .xs-restore,
  html.xs-cep #configurationLower [data-xs-restore] {
    position: static !important;
    margin-left: auto;
  }
}

/* ⑤ 图层开关：允许换行 */
html.xs-cep .web-layer-bar { flex-wrap: wrap !important; row-gap: 6px; }

/* ⑥ 预览区高度自适应，避免撑破面板 */
html.xs-cep .web-carton-preview svg { max-width: 100%; height: auto; }


