/* ============================================================
   P8 模块样式:产品 / 产品库 / 内容 / 内容分组 / 页面装修
   依赖 app.css 的设计变量(--primary / --border / --radius ...)
   ============================================================ */

/* ---------- 通用 ---------- */
.p8-filter { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.p8-filter input, .p8-filter select { width: auto; min-width: 138px; }
.p8-inline { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 13px; }
.p8-inline input { width: auto; }
.p8-span2 { grid-column: 1 / -1; }
.p8-warn { color: var(--danger); }
.p8-ok { color: var(--success); }
.p8-err { color: var(--danger); font-size: 13px; }
.p8-ul { margin: 6px 0 12px 18px; color: var(--text-2); font-size: 13px; }
.p8-ul li { margin-bottom: 2px; }

/* 列表里的图文单元格 */
.p8-media { display: flex; align-items: center; gap: 10px; }
.p8-media .hint { margin-top: 2px; }
.p8-thumb { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; background: #f1f2f4; flex: none; }
.p8-thumb-empty { display: inline-flex; align-items: center; justify-content: center; color: var(--text-3); font-size: 11px; }

/* 输入 + 上传按钮 */
.p8-pick { display: flex; gap: 8px; align-items: center; }
.p8-pick input { flex: 1; }
.p8-pick .btn { flex: none; }
.p8-color { display: flex; gap: 8px; align-items: center; }
.p8-color input[type=color] { width: 42px; height: 36px; padding: 2px; border: 1px solid var(--border); border-radius: 6px; background: var(--white); }

/* 长文本编辑器与预览 */
.p8-editor { min-height: 180px; font-family: ui-monospace, Menlo, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.7; }
.p8-editor-lg { min-height: 300px; }
.p8-summary { min-height: 60px; }
.p8-preview-wrap { margin-top: 6px; border-top: 1px dashed var(--border); padding-top: 14px; }
.p8-preview-title { font-size: 13px; color: var(--text-2); margin-bottom: 8px; }
.p8-preview {
    background: #fafbfc; border: 1px solid var(--border); border-radius: var(--radius);
    padding: 14px 16px; min-height: 90px; max-height: 460px; overflow: auto;
    white-space: pre-wrap; word-break: break-word; font-size: 13.5px; color: var(--text);
}
.p8-json {
    background: #1e2536; color: #d7e0f5; border-radius: var(--radius); padding: 14px 16px;
    max-height: 460px; overflow: auto; font-size: 12.5px; line-height: 1.6;
    font-family: ui-monospace, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-all;
}

/* ============================================================
   页面装修(可视化编辑器)
   ============================================================ */
.p8-diy-card .card-body { padding-top: 14px; }
.p8-diy-meta { margin-bottom: 12px; }
.p8-diy-meta .form-row { margin-bottom: 12px; }

.diy-wrap { display: grid; grid-template-columns: 176px minmax(0, 1fr) 300px; gap: 14px; align-items: start; }
@media (max-width: 1200px) { .diy-wrap { grid-template-columns: 1fr; } }

.diy-panel { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); }
.diy-panel-title { padding: 11px 14px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 13.5px; }
.diy-panel-body { padding: 12px 14px; max-height: 640px; overflow: auto; }

/* 左侧组件库 */
.diy-palette { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.diy-palette button {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 10px 4px; border: 1px dashed var(--border); border-radius: 6px;
    background: #fcfcfd; font-size: 12.5px; color: var(--text-2); cursor: pointer; font-family: inherit;
}
.diy-palette button:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.diy-p-ic { font-size: 15px; line-height: 1; }

/* 中间画布 */
.diy-center { min-width: 0; }
.diy-tip { font-size: 12px; color: var(--text-3); margin-bottom: 8px; }
.diy-phone { background: #f2f3f7; border: 1px solid var(--border); border-radius: 14px; padding: 10px; }
.diy-phone-bar { font-size: 12px; color: var(--text-2); padding: 0 4px 8px; }
.diy-canvas { background: var(--white); border-radius: 10px; min-height: 420px; padding: 10px; }
.diy-empty { text-align: center; color: var(--text-3); padding: 90px 0; font-size: 13px; }

.diy-item { border: 1px solid transparent; border-radius: 8px; margin-bottom: 8px; }
.diy-item:hover { border-color: #cfd8ff; }
.diy-item.active { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.diy-item-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 5px 8px; background: #f7f8fc; border-radius: 7px 7px 0 0; font-size: 12px;
}
.diy-item.active .diy-item-bar { background: var(--primary-light); }
.diy-item-name { font-weight: 600; color: var(--text); }
.diy-item-type { color: var(--text-3); font-weight: 400; margin-left: 6px; font-family: ui-monospace, Menlo, Consolas, monospace; }
.diy-item-ops a { margin-left: 8px; font-size: 12px; }
.diy-item-ops a.danger { color: var(--danger); }
.diy-item-body { padding: 8px; }

/* 画布内的组件外观 */
.diy-c { position: relative; overflow: hidden; background: #eef1f6; }
.diy-ph { display: flex; align-items: center; justify-content: center; height: 100%; min-height: 60px; color: var(--text-3); font-size: 12px; background: repeating-linear-gradient(45deg, #f4f5f8, #f4f5f8 8px, #eceef3 8px, #eceef3 16px); }
.diy-ph-sm { height: 62px; min-height: 62px; }
.diy-cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 6px 10px; color: #fff; font-size: 12.5px; background: linear-gradient(0deg, rgba(0, 0, 0, .55), transparent); }
.diy-dots { position: absolute; bottom: 6px; right: 10px; display: flex; gap: 4px; }
.diy-dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, .6); }
.diy-dots i.on { background: #fff; }
.diy-notice { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 6px; font-size: 13px; }
.diy-notice .diy-ico { width: 16px; height: 16px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 11px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.diy-ellipsis { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.diy-title { font-size: 13px; font-weight: 600; padding: 6px 2px; }
.diy-nav { display: grid; gap: 8px; }
.diy-nav-i { text-align: center; }
.diy-nav-ic { width: 40px; height: 40px; margin: 0 auto 4px; border-radius: 12px; background: var(--primary-light); color: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 700; overflow: hidden; }
.diy-nav-ic img { width: 100%; height: 100%; object-fit: cover; }
.diy-nav-t { font-size: 12px; color: var(--text-2); }
.diy-grid { display: grid; gap: 8px; }
.diy-card { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.diy-card img { width: 100%; height: 70px; object-fit: cover; display: block; }
.diy-card-t { font-size: 12.5px; padding: 6px 8px 0; }
.diy-price { color: var(--danger); font-weight: 600; font-size: 13px; padding: 0 8px 8px; }
.diy-card .hint { padding: 0 8px 8px; margin: 0; }
.diy-list2 { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.diy-art { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 10px; border-bottom: 1px solid var(--border); }
.diy-art:last-child { border-bottom: none; }
.diy-art-t { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.diy-art .hint { margin: 0; flex: none; }

/* 右侧属性面板 */
.diy-props .p8-prop-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.diy-props .form-row { margin-bottom: 12px; }
.diy-list { border: 1px dashed var(--border); border-radius: 8px; padding: 8px; }
.diy-li { border-bottom: 1px dashed var(--border); padding-bottom: 6px; margin-bottom: 8px; }
.diy-li:last-of-type { border-bottom: none; margin-bottom: 4px; }
.diy-li-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.diy-li-head a { margin-left: 8px; font-size: 12px; }
.diy-li-head a.danger { color: var(--danger); }
.diy-li .form-row { margin-bottom: 8px; }
