/* ===== .goods 布局规则（与 spike-layout.css 中 .template 规则完全一致）=====
 * .goods 不能改为 .template（会与插件注入的子 Vue 实例冲突），
 * 所以在此手动复制相同的三条 layout 规则。
 */
.goods {
  min-height: 100vh;
  height: auto;
  overflow: visible;
}

/* 外层 el-container：侧边栏 fixed，主区用 padding-left 让位 */
.goods > .el-container {
  min-height: 100vh;
  height: auto;
  overflow: visible;
  display: flex !important;
  flex-direction: row !important;
  width: 100% !important;
  box-sizing: border-box !important;
  padding-left: calc(var(--sidebar-width) + 20px);
  transition: padding-left 0.25s ease;
}

/* 内层 el-container：flex 列方向，占满剩余宽度 */
.goods > .el-container > .el-container {
  min-height: 100vh;
  height: auto;
  overflow: visible;
  flex-direction: column !important;
  display: flex !important;
  flex: 1 !important;
  min-width: 0 !important;
  width: 0 !important;
}

/* 插件注入的 HTML 内层 .template / .main-card，限定在 .config-box 作用域内 */
.config-box .template {
  height: 100%;
}
.config-box .main-card {
  height: 100%;
}
.config-box {
  height: 100%;
  display: flex;
  flex-direction: column;
}
.content {
  flex: 1;
}
.goods-item-name {
  cursor: pointer;
  padding: 6px 12px;
  border: 1px solid var(--color-primary);
  color: var(--color-primary);
  border-radius: var(--spike-radius);
  margin-bottom: 30px;
  display: inline-block;
}
.goods-change-box {
  max-width: 100%;
}
.goods-change-box .goods-item-box {
  max-height: 500px;
  overflow-y: auto;
  padding: 0.2rem;
}
.goods-change-box .goods-item-box .goods-group-item {
  margin-bottom: 0.3rem;
}
.goods-change-box .goods-item-box .goods-group-item .goods-group-name {
  font-weight: 700;
  font-size: 0.18rem;
  margin-bottom: 0.15rem;
}
.goods-change-box .goods-item-box .goods-group-item .goods-group-info {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-column-gap: 15px;
  row-gap: 0.1rem;
}
.goods-change-box
  .goods-item-box
  .goods-group-item
  .goods-group-info
  .option-name {
  cursor: pointer;
  font-size: 0.14rem;
}
.goods-change-box
  .goods-item-box
  .goods-group-item
  .goods-group-info
  .option-name:hover {
  color: var(--color-primary);
}

/* ===== 手机端断点（≤767px）===== */
@media (max-width: 767px) {
  /* 根容器解除高度约束 */
  .goods {
    min-height: 0 !important;
    height: auto !important;
    overflow: visible !important;
  }

  /* 清零侧边栏占位 padding，内容区恢复全宽 */
  .goods > .el-container {
    padding-left: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    overflow: visible !important;
  }

  /* 内层容器也解除高度约束 */
  .goods > .el-container > .el-container {
    min-height: 0 !important;
    height: auto !important;
  }

  /* el-main：不创建滚动容器，仅用 clip 防横向溢出 */
  .goods .el-container:nth-child(2) > .el-main {
    margin: 0 !important;
    padding: 0 12px !important;
    border-radius: var(--spike-radius) !important;
    overflow-x: clip !important;
    overflow-y: visible !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    height: auto !important;
    min-height: 0 !important;
  }

  /* config-box：取消固定高度，内容自然流动 */
  .config-box {
    height: auto !important;
    overflow: visible !important;
  }
  .config-box .content {
    height: auto !important;
    overflow: visible !important;
  }
  .config-box .content > .template,
  .config-box .template {
    height: auto !important;
    overflow: visible !important;
  }
  .config-box,
  .config-box .content,
  .config-box .content > .template {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    padding: 0 !important;
    margin: 0 !important;
  }
}
