/* ===== 页面构建器（Page Builder）区块样式 =====
   后台画布预览 与 前台页面展示 共用 */

.pb-page { width: 100%; min-height: 40px; }

/* 占位 / 骨架 */
.pb-empty-block {
  margin: 10px 12px; padding: 18px 12px; border: 1px dashed var(--border);
  border-radius: 10px; background: #fafbfc; color: var(--text-2);
  display: flex; align-items: center; gap: 10px;
}
.pb-empty-block b { display: block; font-size: 13px; color: var(--text); }
.pb-empty-block span { font-size: 12px; }

.pb-skel, .pb-skel-line {
  background: linear-gradient(90deg, #f0f1f3 25%, #e7e9ec 37%, #f0f1f3 63%);
  background-size: 400% 100%; animation: pbShine 1.3s ease infinite; border-radius: 8px;
}
.pb-skel { aspect-ratio: 1 / 1; }
.pb-skel-line { height: 46px; margin: 10px 12px; }
.pb-skel-grid { display: grid; gap: 10px; padding: 0 12px; }
.pb-skel-grid.cols-1 { grid-template-columns: 1fr; }
.pb-skel-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.pb-skel-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
@keyframes pbShine { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.pb-async-err { margin: 10px 12px; padding: 14px; text-align: center; color: var(--text-2); font-size: 13px; background: #fafbfc; border-radius: 10px; }

/* 轮播图 */
.pb-carousel { position: relative; overflow: hidden; background: #f0f1f3; }
.pb-car-track {
  display: flex; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory;
  scrollbar-width: none; -ms-overflow-style: none;
}
.pb-car-track::-webkit-scrollbar { display: none; }
.pb-car-item { flex: 0 0 100%; height: 100%; scroll-snap-align: start; }
.pb-car-item a, .pb-car-item img { display: block; width: 100%; height: 100%; }
.pb-car-item img { object-fit: cover; }
.pb-ph {
  width: 100%; height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px;
  color: var(--text-3); background: #f3f4f6;
}
.pb-ph span { font-size: 12px; }
.pb-car-dots {
  position: absolute; bottom: 8px; left: 0; right: 0;
  display: flex; justify-content: center; gap: 5px;
}
.pb-car-dots i {
  width: 6px; height: 6px; border-radius: 999px; background: rgba(255, 255, 255, .6);
  transition: width .2s, background .2s;
}
.pb-car-dots i.on { width: 14px; background: #fff; }

/* 图片广告 */
.pb-image-ad { line-height: 0; }
.pb-image-ad a { display: block; }
.pb-image-ad img { width: 100%; object-fit: cover; }

/* 视频 */
.pb-video { margin: 10px 12px; }
.pb-video-title { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.pb-video video { width: 100%; background: #000; border-radius: 10px; object-fit: cover; }

/* 商品网格 */
.pb-grid { display: grid; gap: 12px; padding: 0 12px; }
.pb-grid.cols-1 { grid-template-columns: 1fr; }
.pb-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.pb-grid.cols-3 { grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 0 8px; }
.pb-grid.cols-3 .card .name { font-size: 12px; -webkit-line-clamp: 1; }
.pb-grid.cols-3 .card .price { font-size: 14px; }
.pb-grid.cols-3 .card .body { padding: 7px; }

/* 分类导航 */
.pb-cat-scroll {
  display: flex; gap: 10px; overflow-x: auto; padding: 10px 12px;
  scrollbar-width: none;
}
.pb-cat-scroll::-webkit-scrollbar { display: none; }
.pb-cat-chip {
  flex: none; width: 62px; display: flex; flex-direction: column;
  align-items: center; gap: 5px; font-size: 12px; color: var(--text);
}
.pb-cat-chip .ic {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center;
  background: #fff2ed; color: var(--brand);
}
.pb-cat-chip .ic.fresh { background: #eaf7ef; color: var(--fresh); }

/* 宫格导航 */
.pb-nav { overflow: hidden; }
.pb-nav-grid { display: grid; }
.pb-nav-cell { padding: 12px 4px; }
.pb-nav-cell a { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.pb-nav-ic {
  width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center;
  background: currentColor;
}
.pb-nav-ic svg { color: #fff; }
.pb-nav-tx { font-size: 12px; color: var(--text); }

/* 标题栏 */
.pb-titlebar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 12px 10px;
}
.pb-titlebar.center { justify-content: center; }
.pb-titlebar.center .pb-title-main { text-align: center; justify-content: center; }
.pb-title-main { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pb-title-main .bar { width: 3px; height: 15px; border-radius: 2px; background: var(--brand); flex: none; }
.pb-titlebar.fresh .pb-title-main .bar { background: var(--fresh); }
.pb-title-main .t { font-size: 15px; font-weight: 700; }
.pb-title-main .s { font-size: 12px; color: var(--text-2); }
.pb-more { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; color: var(--text-2); }

/* 公告栏 */
.pb-notice { margin: 10px 12px; border-radius: 10px; padding: 9px 12px; }
.pb-notice-inner { display: flex; align-items: center; gap: 7px; overflow: hidden; }
.pb-notice-ic { display: flex; flex: none; }
.pb-notice-tx {
  font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pb-notice-tx.scroll { animation: pbMarquee 12s linear infinite; }
@keyframes pbMarquee {
  0% { transform: translateX(60%); }
  100% { transform: translateX(-100%); }
}

/* 图文说明 */
.pb-richtext { padding: 12px 14px; }
.pb-richtext.center { text-align: center; }
.pb-richtext h4 { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.pb-rt-body { font-size: 13px; line-height: 1.7; color: #4a505c; }
.pb-rt-body p { margin: 0 0 8px; }
.pb-rt-body img { max-width: 100%; border-radius: 8px; margin: 6px 0; }

/* 自定义代码 */
.pb-custom { width: 100%; }

/* 优惠券 */
.pb-coupon-list { display: flex; flex-direction: column; gap: 8px; padding: 0 12px 10px; }
.pb-coupon {
  display: flex; align-items: stretch; background: linear-gradient(90deg, #fff3ee, #ffffff);
  border: 1px solid #ffe0d3; border-radius: 10px; overflow: hidden;
}
.pb-coupon-l {
  width: 92px; flex: none; display: flex; flex-direction: column;
  align-items: center; justify-content: center; color: var(--price);
  border-right: 1px dashed #ffd4c2; padding: 8px 4px;
}
.pb-coupon-l .v { font-size: 19px; font-weight: 800; line-height: 1.1; }
.pb-coupon-l .m { font-size: 11px; color: var(--text-2); margin-top: 3px; }
.pb-coupon-r { flex: 1; min-width: 0; padding: 10px 12px; display: flex; flex-direction: column; justify-content: center; }
.pb-coupon-r .n { font-size: 14px; font-weight: 600; }
.pb-coupon-r .p { font-size: 12px; color: var(--text-2); margin-top: 3px; }

/* 布局 */
.pb-spacer { width: 100%; }
.pb-divider { width: 100%; }
.pb-divider i { display: block; height: 0; }

/* ===== 后台构建器界面 ===== */
.pb-builder { display: flex; gap: 12px; align-items: flex-start; }
.pb-panel {
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  display: flex; flex-direction: column; overflow: hidden;
}
.pb-panel-h {
  padding: 10px 12px; font-size: 13px; font-weight: 700;
  border-bottom: 1px solid var(--border); background: #fff; display: flex;
  align-items: center; justify-content: space-between; gap: 8px;
}
.pb-panel-b { padding: 10px; overflow: auto; }

/* 组件库 */
.pb-lib { width: 210px; flex: none; }
.pb-lib .pb-group-t { font-size: 12px; color: var(--text-2); margin: 10px 0 6px; font-weight: 600; }
.pb-lib .pb-group-t:first-child { margin-top: 0; }
.pb-lib-items { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.pb-lib-item {
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 6px;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  font-size: 12px; color: var(--text); cursor: grab; background: #fff;
  transition: border-color .15s, background .15s, transform .1s; user-select: none;
}
.pb-lib-item:hover { border-color: var(--brand); background: #fff8f5; color: var(--brand-dark); }
.pb-lib-item:active { transform: scale(.97); }
.pb-lib-item svg { color: var(--brand); }
.pb-lib-tip { font-size: 11px; color: var(--text-2); line-height: 1.6; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }

/* 画布 */
.pb-stage { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.pb-phone {
  width: 375px; flex: none; background: #fff; border: 1px solid #dfe2e6;
  border-radius: 22px; box-shadow: 0 8px 28px rgba(20, 24, 35, .12); overflow: hidden;
}
.pb-phone-bar {
  height: 34px; background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--text-2); gap: 6px;
}
.pb-canvas { min-height: 420px; background: #f7f8fa; }
.pb-canvas-empty {
  min-height: 320px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 8px; color: var(--text-2); font-size: 13px; padding: 20px; text-align: center;
}
.pb-canvas-empty svg { color: var(--text-3); }

/* 画布内的区块外壳（仅后台编辑态） */
.pb-edit {
  position: relative; cursor: pointer;
  outline: 1px dashed transparent; outline-offset: -1px;
}
.pb-edit:hover { outline-color: var(--brand); }
.pb-edit.sel { outline: 2px solid var(--brand); outline-offset: -2px; }
.pb-edit.dragging { opacity: .4; }
/* 编辑态下禁用区块内部链接跳转，避免误触 */
.pb-edit a { pointer-events: none; }
.pb-edit video { pointer-events: none; }
.pb-edit-tag {
  position: absolute; top: 0; right: 0; z-index: 5;
  background: var(--brand); color: #fff; font-size: 11px; padding: 3px 6px;
  border-radius: 0 0 0 8px; display: none; white-space: nowrap;
}
.pb-edit:hover .pb-edit-tag, .pb-edit.sel .pb-edit-tag { display: flex; align-items: center; gap: 6px; }
.pb-edit-tag button {
  background: rgba(255, 255, 255, .22); border: 0; color: #fff; cursor: pointer;
  width: 18px; height: 18px; border-radius: 4px; display: grid; place-items: center; padding: 0;
}
.pb-edit-tag button:hover { background: rgba(255, 255, 255, .4); }
.pb-drop-line { height: 3px; background: var(--brand); border-radius: 2px; margin: 2px 8px; }

/* 属性面板 */
.pb-props { width: 300px; flex: none; max-height: none; }
.pb-props .pb-panel-b { padding: 12px; }
.pb-prop-tip {
  background: #fff8f5; border: 1px solid #ffe0d3; color: #8a4a2a;
  font-size: 12px; padding: 8px 10px; border-radius: 8px; margin-bottom: 10px; line-height: 1.6;
}
.pb-list-item {
  border: 1px solid var(--border); border-radius: 10px; padding: 10px; margin-bottom: 8px; background: #fafbfc;
}
.pb-list-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.pb-list-head b { font-size: 12px; color: var(--text); }
.pb-list-head .ops { display: flex; gap: 4px; }
.pb-list-head .ops button {
  border: 1px solid var(--border); background: #fff; border-radius: 6px; cursor: pointer;
  width: 24px; height: 24px; display: grid; place-items: center; padding: 0; color: var(--text-2);
}
.pb-list-head .ops button:hover { color: var(--brand); border-color: var(--brand); }
.pb-img-pick { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pb-img-prev {
  width: 54px; height: 54px; border-radius: 8px; border: 1px solid var(--border);
  object-fit: cover; background: #f3f4f6;
}
.pb-img-url { font-size: 11px; color: var(--text-2); word-break: break-all; flex: 1; min-width: 100px; }

/* 页面设置 */
.pb-meta { display: grid; grid-template-columns: 88px 1fr; gap: 8px 10px; align-items: center; font-size: 13px; }
.pb-meta label { color: var(--text-2); }

/* 预览弹窗 */
.pb-mask {
  position: fixed; inset: 0; z-index: 999; background: rgba(20, 24, 35, .55);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.pb-prev {
  background: #fff; border-radius: 14px; overflow: hidden; max-height: 92vh;
  display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
}
.pb-prev-head {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 12px 14px; font-size: 14px; font-weight: 600; border-bottom: 1px solid var(--border);
}
.pb-prev-head button {
  border: 0; background: transparent; cursor: pointer; color: var(--text-2);
  display: grid; place-items: center; padding: 2px;
}
.pb-prev-head button:hover { color: var(--text); }
.pb-prev-body { overflow: auto; padding: 16px; background: #f0f1f3; display: flex; justify-content: center; }
.pb-prev-body .pb-phone { box-shadow: none; }

@media (max-width: 1180px) {
  .pb-builder { flex-wrap: wrap; }
  .pb-lib { width: 100%; }
  .pb-lib-items { grid-template-columns: repeat(4, 1fr); }
  .pb-props { width: 100%; }
}
