/* === AI商品生成器 前台样式 === */
:root {
    --wooai-primary: #6366f1;
    --wooai-primary-hover: #4f46e5;
    --wooai-primary-light: rgba(99,102,241,.08);
    --wooai-success: #10b981;
    --wooai-danger: #ef4444;
    --wooai-warning: #f59e0b;
    --wooai-bg: #f1f5f9;
    --wooai-card: #ffffff;
    --wooai-text: #1e293b;
    --wooai-text-light: #64748b;
    --wooai-border: #e2e8f0;
    --wooai-radius: 12px;
    --wooai-radius-sm: 8px;
    --wooai-shadow: 0 2px 12px rgba(0,0,0,.06);
    --wooai-shadow-lg: 0 8px 30px rgba(0,0,0,.1);
}

/* 全局重置 - 仅作用域内 */
.wooai-app { max-width: 960px; margin: 0 auto; padding: 16px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif; color: var(--wooai-text); box-sizing: border-box; line-height: 1.6; }
.wooai-app *, .wooai-app *::before, .wooai-app *::after { box-sizing: border-box; }

/* Widget侧边栏窄宽度适配 - 让工作台撑满可用宽度 */
.widget .wooai-app { max-width: 100%; padding: 8px; }
.widget .wooai-topbar { flex-wrap: wrap; gap: 8px; }
.widget .wooai-topbar-right { width: 100%; justify-content: center; }
.widget .wooai-tabs { flex-wrap: wrap; }
.widget .wooai-upload-area { min-height: 120px; padding: 16px; }
.widget .wooai-edit-field { min-width: auto; }
.widget .wooai-panel-card { padding: 12px; }
.widget .wooai-store-card { padding: 12px; }

/* ===== 顶部栏 ===== */
.wooai-topbar { display: flex; justify-content: space-between; align-items: center; background: linear-gradient(135deg, #6366f1, #4f46e5); color: #fff; padding: 12px 20px; border-radius: var(--wooai-radius); margin-bottom: 16px; }
.wooai-topbar-left { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 700; }
.wooai-topbar-right { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.wooai-points-box { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.18); padding: 5px 14px; border-radius: 20px; cursor: pointer; transition: background .2s; }
.wooai-points-box:hover { background: rgba(255,255,255,.28); }
.wooai-points-value { font-weight: 700; font-size: 16px; }
.wooai-recharge-link { color: #fff; background: rgba(255,255,255,.25); padding: 2px 10px; border-radius: 10px; text-decoration: none; font-size: 12px; font-weight: 500; }
.wooai-recharge-link:hover { background: rgba(255,255,255,.4); }

/* ===== Tab导航 ===== */
.wooai-tabs { display: flex; gap: 4px; background: var(--wooai-card); padding: 6px; border-radius: var(--wooai-radius); box-shadow: var(--wooai-shadow); margin-bottom: 16px; overflow-x: auto; }
.wooai-tab { flex: 1; padding: 10px 8px; border: none; background: transparent; color: var(--wooai-text-light); font-size: 14px; font-weight: 600; cursor: pointer; border-radius: var(--wooai-radius-sm); transition: all .2s; white-space: nowrap; font-family: inherit; }
.wooai-tab:hover { background: var(--wooai-primary-light); color: var(--wooai-primary); }
.wooai-tab.active { background: var(--wooai-primary); color: #fff; }

.wooai-tab-panel { display: none; }
.wooai-tab-panel.active { display: block; }

/* ===== 通用卡片 ===== */
.wooai-panel-card { background: var(--wooai-card); border-radius: var(--wooai-radius); padding: 24px; box-shadow: var(--wooai-shadow); }
.wooai-panel-card h2 { margin: 0 0 8px; font-size: 20px; }
.wooai-panel-card h3 { margin: 20px 0 12px; font-size: 16px; }
.wooai-desc { color: var(--wooai-text-light); margin-bottom: 20px; font-size: 14px; }

/* ===== 步骤指示器 ===== */
.wooai-steps { display: flex; justify-content: space-between; background: var(--wooai-card); padding: 14px 16px; border-radius: var(--wooai-radius); box-shadow: var(--wooai-shadow); margin-bottom: 16px; }
.wooai-step { flex: 1; text-align: center; color: var(--wooai-text-light); font-size: 13px; position: relative; }
.wooai-step .num { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; background: var(--wooai-border); color: var(--wooai-text-light); border-radius: 50%; margin-right: 6px; font-weight: 700; font-size: 13px; transition: all .3s; }
.wooai-step.active .num, .wooai-step.done .num { background: var(--wooai-primary); color: #fff; }
.wooai-step.active, .wooai-step.done { color: var(--wooai-text); font-weight: 600; }
.wooai-step.done .num::after { content: '✓'; }

/* ===== 面板步骤控制 ===== */
.wooai-panel { display: none; }
.wooai-panel.active { display: block; }

/* ===== 上传区域 ===== */
.wooai-upload-area { border: 2px dashed var(--wooai-border); border-radius: var(--wooai-radius); padding: 36px 20px; text-align: center; cursor: pointer; transition: all .25s; background: var(--wooai-bg); margin-bottom: 20px; }
.wooai-upload-area:hover { border-color: var(--wooai-primary); background: var(--wooai-primary-light); }
.wooai-upload-icon { font-size: 44px; margin-bottom: 8px; }
.wooai-upload-text { font-size: 15px; color: var(--wooai-text); font-weight: 500; }
.wooai-upload-hint { font-size: 12px; color: var(--wooai-text-light); margin-top: 4px; }
.wooai-upload-preview { max-width: 100%; max-height: 280px; border-radius: 8px; display: block; margin: 0 auto; }

/* ===== 多图上传缩略图 ===== */
.wooai-upload-thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.wooai-thumb-item { position: relative; width: 80px; height: 80px; border-radius: 8px; overflow: hidden; border: 2px solid var(--wooai-border); background: var(--wooai-bg); display: flex; align-items: center; justify-content: center; }
.wooai-thumb-item img { width: 100%; height: 100%; object-fit: cover; }
.wooai-thumb-loading { background: var(--wooai-bg); }
.wooai-thumb-loader { width: 24px; height: 24px; border: 3px solid var(--wooai-border); border-top-color: var(--wooai-primary); border-radius: 50%; animation: wooai-spin .8s linear infinite; }
@keyframes wooai-spin { to { transform: rotate(360deg); } }
.wooai-thumb-done { border-color: var(--wooai-success); }
.wooai-thumb-error { border-color: var(--wooai-danger); }
.wooai-thumb-error-icon { font-size: 20px; }
.wooai-thumb-name { font-size: 10px; color: var(--wooai-text-light); padding: 4px; text-align: center; word-break: break-all; }
.wooai-thumb-del { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border: none; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; cursor: pointer; display: flex; align-items: center; justify-content: center; line-height: 1; padding: 0; }
.wooai-thumb-del:hover { background: var(--wooai-danger); }
.wooai-thumb-badge { position: absolute; top: 2px; left: 2px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--wooai-primary); color: #fff; font-size: 10px; font-weight: 600; display: flex; align-items: center; justify-content: center; padding: 0 4px; }

/* ===== HTML 可视化编辑器 ===== */
.wooai-editor-toolbar { display: flex; gap: 0; margin-bottom: 0; border: 1px solid var(--wooai-border); border-bottom: none; border-radius: var(--wooai-radius-sm) var(--wooai-radius-sm) 0 0; overflow: hidden; }
.wooai-editor-tab { padding: 6px 16px; font-size: 13px; border: none; background: var(--wooai-bg); color: var(--wooai-text-light); cursor: pointer; transition: all .2s; }
.wooai-editor-tab:hover { background: var(--wooai-primary-light); color: var(--wooai-primary); }
.wooai-editor-tab.active { background: #fff; color: var(--wooai-primary); font-weight: 600; border-bottom: 2px solid var(--wooai-primary); }
.wooai-editor-wrap .wooai-editor-visual { border-top-left-radius: 0; border-top-right-radius: 0; }
.wooai-editor-wrap textarea { border-top-left-radius: 0; border-top-right-radius: 0; }
.wooai-editor-visual:focus { outline: none; border-color: var(--wooai-primary) !important; box-shadow: 0 0 0 2px rgba(99,102,241,.15); }
.wooai-editor-visual img { max-width: 100%; height: auto; border-radius: 6px; margin: 8px 0; }
.wooai-editor-visual h1,.wooai-editor-visual h2,.wooai-editor-visual h3,.wooai-editor-visual h4 { margin: 8px 0 4px; }
.wooai-editor-visual p { margin: 4px 0; }
.wooai-editor-visual ul,.wooai-editor-visual ol { margin: 4px 0 4px 20px; }

/* ===== 高级设置 ===== */
.wooai-advanced { margin-bottom: 16px; border: 1px solid var(--wooai-border); border-radius: var(--wooai-radius-sm); overflow: hidden; }
.wooai-advanced summary { padding: 10px 14px; cursor: pointer; font-size: 14px; color: var(--wooai-text-light); background: var(--wooai-bg); transition: background .2s; }
.wooai-advanced summary:hover { background: var(--wooai-primary-light); }
.wooai-advanced-body { padding: 14px; }

/* ===== 表单 ===== */
.wooai-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.wooai-form-item { margin-bottom: 14px; }
.wooai-form-item label { display: block; margin-bottom: 5px; font-weight: 600; font-size: 14px; }
.wooai-form-item input, .wooai-form-item select, .wooai-form-item textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--wooai-border); border-radius: var(--wooai-radius-sm); font-size: 14px; font-family: inherit; transition: border-color .2s, box-shadow .2s; background: #fff; }
.wooai-form-item input:focus, .wooai-form-item select:focus, .wooai-form-item textarea:focus { outline: none; border-color: var(--wooai-primary); box-shadow: 0 0 0 3px var(--wooai-primary-light); }
.wooai-field-hint { font-size: 12px; color: var(--wooai-text-light); margin-top: 4px; }
.wooai-required { color: var(--wooai-danger); }

/* 高级设置折叠 */
.wooai-advanced { margin-bottom: 20px; }
.wooai-advanced summary { cursor: pointer; padding: 10px 0; color: var(--wooai-primary); font-weight: 500; font-size: 14px; user-select: none; }
.wooai-advanced-body { padding-top: 8px; }

/* ===== 按钮 ===== */
.wooai-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 20px; border: 1px solid var(--wooai-border); background: #fff; color: var(--wooai-text); border-radius: var(--wooai-radius-sm); cursor: pointer; font-size: 14px; font-weight: 500; transition: all .2s; font-family: inherit; text-decoration: none; }
.wooai-btn:hover { border-color: var(--wooai-primary); color: var(--wooai-primary); }
.wooai-btn-primary { background: var(--wooai-primary); color: #fff; border-color: var(--wooai-primary); }
.wooai-btn-primary:hover { background: var(--wooai-primary-hover); color: #fff; }
.wooai-btn-success { background: var(--wooai-success); color: #fff; border-color: var(--wooai-success); }
.wooai-btn-success:hover { opacity: .9; color: #fff; }
.wooai-btn-danger { background: var(--wooai-danger); color: #fff; border-color: var(--wooai-danger); }
.wooai-btn-danger:hover { opacity: .9; }
.wooai-btn-lg { padding: 12px 28px; font-size: 15px; }
.wooai-btn-sm { padding: 5px 12px; font-size: 12px; }
.wooai-btn:disabled { opacity: .5; cursor: not-allowed; }
.wooai-actions { display: flex; gap: 10px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.wooai-actions-col { flex-direction: column; align-items: stretch; }
.wooai-cost-hint { text-align: center; color: var(--wooai-text-light); font-size: 13px; margin-top: 10px; }

/* ===== AI标签 ===== */
.wooai-ai-tag { display: inline-block; background: linear-gradient(135deg, var(--wooai-primary), #8b5cf6); color: #fff; padding: 1px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.wooai-ai-btn { position: absolute; right: 0; top: 0; background: linear-gradient(135deg, var(--wooai-primary), #8b5cf6); color: #fff; border: none; border-radius: 6px; padding: 3px 10px; cursor: pointer; font-size: 12px; font-family: inherit; transition: opacity .2s; }
.wooai-ai-btn:hover { opacity: .85; }

/* ===== 加载动画 ===== */
.wooai-loader { width: 48px; height: 48px; border: 4px solid var(--wooai-border); border-top-color: var(--wooai-primary); border-radius: 50%; animation: wooai-spin .8s linear infinite; margin: 24px auto; }
@keyframes wooai-spin { to { transform: rotate(360deg); } }

.wooai-generating { text-align: center; padding: 30px 16px; }
.wooai-generating h2 { margin-bottom: 8px; }
.wooai-gen-status { font-size: 15px; color: var(--wooai-text); }

.wooai-progress-bar { width: 100%; max-width: 400px; margin: 16px auto; height: 8px; background: var(--wooai-border); border-radius: 4px; overflow: hidden; }
.wooai-progress-fill { height: 100%; background: linear-gradient(90deg, var(--wooai-primary), #8b5cf6); border-radius: 4px; transition: width .6s ease; }
.wooai-progress-text { color: var(--wooai-text-light); font-size: 13px; }
.wooai-progress-detail { color: var(--wooai-text-light); font-size: 12px; margin-top: 4px; min-height: 16px; }

/* ===== 图片网格 ===== */
.wooai-images, .wooai-images-edit { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-top: 16px; }
.wooai-img { background: var(--wooai-bg); border-radius: 8px; overflow: hidden; aspect-ratio: 1; }
.wooai-img img { width: 100%; height: 100%; object-fit: cover; }

/* ===== 编辑表单 ===== */
.wooai-edit-grid { display: grid; grid-template-columns: 240px 1fr; gap: 20px; margin-top: 16px; }
.wooai-edit-images h4, .wooai-edit-fields h4 { margin: 0 0 8px; }
.wooai-field { margin-bottom: 14px; position: relative; }
.wooai-field label { display: block; margin-bottom: 5px; font-weight: 600; font-size: 13px; }
.wooai-field input, .wooai-field textarea { width: 100%; padding: 9px 12px; border: 1px solid var(--wooai-border); border-radius: var(--wooai-radius-sm); font-family: inherit; font-size: 14px; transition: border-color .2s; }
.wooai-field input:focus, .wooai-field textarea:focus { outline: none; border-color: var(--wooai-primary); box-shadow: 0 0 0 3px var(--wooai-primary-light); }
.wooai-field-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.wooai-field-section { font-size: 14px; font-weight: 700; color: var(--wooai-primary); padding: 10px 0 6px; border-bottom: 2px solid var(--wooai-primary); margin: 16px 0 10px; }
.wooai-attrs-wrap { display: flex; flex-direction: column; gap: 8px; }
.wooai-attr-row { display: grid; grid-template-columns: 120px 1fr auto; gap: 8px; align-items: center; }
.wooai-attr-row input { width: 100%; }
.wooai-attr-del { background: #fee; border: 1px solid #fcc; color: #c00; border-radius: 6px; cursor: pointer; padding: 6px 10px; font-size: 12px; white-space: nowrap; }

/* ===== 积分板块 ===== */
.wooai-points-overview { display: flex; align-items: center; justify-content: space-between; background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; padding: 24px; border-radius: var(--wooai-radius); margin-bottom: 24px; }
.wooai-points-big { display: flex; flex-direction: column; }
.wooai-points-big-value { font-size: 42px; font-weight: 800; line-height: 1.2; }
.wooai-points-big-label { font-size: 14px; opacity: .85; }

/* ===== 表格 ===== */
.wooai-table-wrap { overflow-x: auto; }
.wooai-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.wooai-table th { background: var(--wooai-bg); padding: 10px 12px; text-align: left; font-weight: 600; border-bottom: 2px solid var(--wooai-border); }
.wooai-table td { padding: 10px 12px; border-bottom: 1px solid var(--wooai-border); vertical-align: middle; }
.wooai-table tr:hover td { background: var(--wooai-primary-light); }
.wooai-points-plus { color: var(--wooai-success); font-weight: 600; }
.wooai-points-minus { color: var(--wooai-danger); font-weight: 600; }

/* ===== 店铺板块 ===== */
.wooai-section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.wooai-section-header h2 { margin: 0; }
.wooai-store-list { display: grid; gap: 12px; margin-bottom: 20px; }
.wooai-store-item { display: flex; align-items: center; gap: 14px; background: var(--wooai-bg); border: 1px solid var(--wooai-border); border-radius: var(--wooai-radius-sm); padding: 14px 16px; transition: border-color .2s; }
.wooai-store-item:hover { border-color: var(--wooai-primary); }
.wooai-store-icon { font-size: 28px; flex-shrink: 0; }
.wooai-store-info { flex: 1; min-width: 0; }
.wooai-store-name { font-weight: 600; font-size: 15px; margin-bottom: 2px; }
.wooai-store-url { font-size: 12px; color: var(--wooai-text-light); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wooai-store-status { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.wooai-store-status-ok { background: rgba(16,185,129,.1); color: var(--wooai-success); }
.wooai-store-status-fail { background: rgba(239,68,68,.1); color: var(--wooai-danger); }
.wooai-store-status-unknown { background: rgba(100,116,139,.1); color: var(--wooai-text-light); }
.wooai-store-actions { display: flex; gap: 6px; flex-shrink: 0; }

.wooai-store-form { background: var(--wooai-bg); border: 1px solid var(--wooai-border); border-radius: var(--wooai-radius); padding: 20px; margin-top: 16px; }
.wooai-store-form h3 { margin-top: 0; }
.wooai-test-result { margin-top: 12px; padding: 10px 14px; border-radius: var(--wooai-radius-sm); font-size: 13px; display: none; }
.wooai-test-result.success { display: block; background: rgba(16,185,129,.08); color: var(--wooai-success); }
.wooai-test-result.error { display: block; background: rgba(239,68,68,.08); color: var(--wooai-danger); }

/* ===== 记录板块 ===== */
.wooai-filter-select { padding: 7px 12px; border: 1px solid var(--wooai-border); border-radius: var(--wooai-radius-sm); font-size: 13px; font-family: inherit; }
.wooai-record-list { display: grid; gap: 10px; }
.wooai-record-card { display: flex; gap: 14px; background: var(--wooai-bg); border: 1px solid var(--wooai-border); border-radius: var(--wooai-radius-sm); padding: 14px 16px; transition: border-color .2s; }
.wooai-record-card:hover { border-color: var(--wooai-primary); }
.wooai-record-thumb { width: 64px; height: 64px; border-radius: 6px; overflow: hidden; flex-shrink: 0; background: var(--wooai-border); }
.wooai-record-thumb img { width: 100%; height: 100%; object-fit: cover; }
.wooai-record-info { flex: 1; min-width: 0; }
.wooai-record-title { font-weight: 600; font-size: 15px; margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wooai-record-meta { font-size: 12px; color: var(--wooai-text-light); display: flex; gap: 12px; flex-wrap: wrap; }
.wooai-record-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.wooai-badge-draft { background: rgba(245,158,11,.1); color: var(--wooai-warning); }
.wooai-badge-published { background: rgba(16,185,129,.1); color: var(--wooai-success); }
.wooai-badge-failed { background: rgba(239,68,68,.1); color: var(--wooai-danger); }
.wooai-badge-generating { background: rgba(99,102,241,.1); color: var(--wooai-primary); }
.wooai-record-actions { display: flex; gap: 6px; align-items: flex-start; flex-shrink: 0; }

/* ===== 发布页店铺选择 ===== */
.wooai-publish-section { margin-bottom: 20px; }
.wooai-section-label { font-weight: 600; font-size: 14px; margin-bottom: 8px; }
.wooai-stores { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-bottom: 16px; }
.wooai-store-card { background: var(--wooai-bg); border: 2px solid var(--wooai-border); border-radius: var(--wooai-radius-sm); padding: 12px; cursor: pointer; transition: all .2s; }
.wooai-store-card:hover { border-color: var(--wooai-primary); }
.wooai-store-card.selected { border-color: var(--wooai-primary); background: var(--wooai-primary-light); }
.wooai-store-card .name { font-weight: 600; font-size: 14px; }
.wooai-store-card .url { font-size: 12px; color: var(--wooai-text-light); word-break: break-all; }
.wooai-store-card .status { display: inline-block; padding: 2px 6px; border-radius: 4px; font-size: 11px; margin-top: 4px; }

/* ===== 弹窗 ===== */
.wooai-modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 9999; animation: wooai-fadein .2s; }
@keyframes wooai-fadein { from { opacity: 0; } to { opacity: 1; } }
.wooai-modal-content { background: #fff; padding: 24px; border-radius: var(--wooai-radius); width: 90%; max-width: 460px; box-shadow: var(--wooai-shadow-lg); animation: wooai-scalein .2s; }
@keyframes wooai-scalein { from { transform: scale(.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.wooai-modal-content h3 { margin-top: 0; }
.wooai-modal-content textarea { width: 100%; min-height: 80px; padding: 10px; border: 1px solid var(--wooai-border); border-radius: var(--wooai-radius-sm); font-family: inherit; margin: 12px 0; font-size: 14px; }
.wooai-modal-sm { max-width: 380px; text-align: center; }

/* ===== 分页 ===== */
.wooai-pagination { display: flex; justify-content: center; gap: 6px; margin-top: 16px; }
.wooai-page-btn { padding: 6px 12px; border: 1px solid var(--wooai-border); background: #fff; border-radius: 6px; cursor: pointer; font-size: 13px; font-family: inherit; transition: all .2s; }
.wooai-page-btn:hover { border-color: var(--wooai-primary); color: var(--wooai-primary); }
.wooai-page-btn.active { background: var(--wooai-primary); color: #fff; border-color: var(--wooai-primary); }
.wooai-page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ===== 空状态 ===== */
.wooai-empty { text-align: center; color: var(--wooai-text-light); padding: 30px 16px; font-size: 14px; }
.wooai-empty a { color: var(--wooai-primary); }

/* ===== 登录拦截 ===== */
.wooai-login-required { display: flex; align-items: center; justify-content: center; min-height: 300px; }
.wooai-login-box { text-align: center; padding: 40px; background: #fff; border-radius: var(--wooai-radius); box-shadow: var(--wooai-shadow); max-width: 400px; }
.wooai-login-box h3 { margin-top: 0; }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .wooai-app { padding: 10px; }
    .wooai-topbar { flex-direction: column; gap: 8px; padding: 10px 14px; }
    .wooai-tabs { gap: 2px; padding: 4px; }
    .wooai-tab { padding: 8px 4px; font-size: 13px; }
    .wooai-panel-card { padding: 16px; }
    .wooai-edit-grid { grid-template-columns: 1fr; }
    .wooai-form-grid { grid-template-columns: 1fr; }
    .wooai-field-row { grid-template-columns: 1fr; }
    .wooai-actions { flex-direction: column; }
    .wooai-actions .wooai-btn { width: 100%; }
    .wooai-step .label { display: none; }
    .wooai-points-overview { flex-direction: column; gap: 12px; text-align: center; }
    .wooai-store-item { flex-direction: column; align-items: flex-start; }
    .wooai-record-card { flex-direction: column; }
}

/* ===== 内联错误提示（替代alert） ===== */
.wooai-error-box { background: rgba(239,68,68,.06); border: 1px solid rgba(239,68,68,.2); color: var(--wooai-danger); padding: 10px 16px; border-radius: var(--wooai-radius-sm); margin-bottom: 16px; font-size: 14px; line-height: 1.5; animation: wooai-shake .3s; }
@keyframes wooai-shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-4px)} 75%{transform:translateX(4px)} }

/* ===== 禁用按钮 ===== */
.wooai-btn-disabled { opacity: .45; cursor: not-allowed !important; }

/* ===== 拖拽状态 ===== */
.wooai-dragover { border-color: var(--wooai-primary) !important; background: var(--wooai-primary-light) !important; }

/* ===== 生成结果预览 ===== */
.wooai-result-preview { padding: 16px 0; }
.wooai-result-preview h3 { color: var(--wooai-success); display: flex; align-items: center; gap: 6px; }

/* ===== 店铺列表增强 ===== */
.wooai-store-name-row { font-size: 15px; margin-bottom: 2px; }
.wooai-store-meta { font-size: 12px; color: var(--wooai-text-light); margin-top: 4px; }

/* ===== 记录状态标签 ===== */
.wooai-record-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.wooai-record-status { padding: 2px 10px; border-radius: 4px; font-size: 12px; font-weight: 600; }
.wooai-status-ok { background: rgba(16,185,129,.1); color: var(--wooai-success); }
.wooai-status-err { background: rgba(239,68,68,.1); color: var(--wooai-danger); }
.wooai-status-pending { background: rgba(99,102,241,.1); color: var(--wooai-primary); }

/* ===== 默认徽章 ===== */
.wooai-badge { display: inline-block; padding: 1px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; }

/* ===== Widget小部件入口卡片 ===== */
.wooai-widget-box { text-align: center; padding: 20px 12px; }
.wooai-widget-icon { font-size: 36px; margin-bottom: 8px; }
.wooai-widget-box h4 { margin: 0 0 6px; font-size: 16px; color: #1e293b; }
.wooai-widget-box p { margin: 0 0 14px; font-size: 13px; color: #64748b; }

/* ===== 全屏弹窗Overlay（Widget入口打开） ===== */
.wooai-overlay { display: none; position: fixed; inset: 0; z-index: 999998; background: rgba(0,0,0,.5); backdrop-filter: blur(4px); }
.wooai-overlay.active { display: flex; justify-content: center; align-items: flex-start; padding: 20px; overflow-y: auto; }
.wooai-overlay-content { background: var(--wooai-card); border-radius: 16px; width: 100%; max-width: 1100px; min-height: 80vh; box-shadow: 0 25px 60px rgba(0,0,0,.25); display: flex; flex-direction: column; }
.wooai-overlay-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--wooai-border); flex-shrink: 0; }
.wooai-overlay-header h3 { margin: 0; font-size: 17px; color: #1e293b; }
.wooai-overlay-close { background: none; border: none; font-size: 28px; color: #64748b; cursor: pointer; padding: 0 4px; line-height: 1; }
.wooai-overlay-close:hover { color: #ef4444; }
.wooai-overlay-body { flex: 1; overflow-y: auto; padding: 0; }
.wooai-overlay-body .wooai-app { border: none; box-shadow: none; border-radius: 0; }

@media (max-width: 768px) {
    .wooai-overlay.active { padding: 0; }
    .wooai-overlay-content { max-width: 100%; min-height: 100vh; border-radius: 0; }
}

/* ========== 分步流程指示器 ========== */
.wooai-step-flow { display: none; margin-bottom: 20px; }
.wooai-step-flow-inner { display: flex; justify-content: space-between; align-items: center; }
.wooai-step-flow-item {
    flex: 1; text-align: center; padding: 8px 4px;
    border-bottom: 3px solid #e5e7eb; color: #9ca3af; font-size: 12px;
    transition: all .3s;
}
.wooai-step-flow-item .num {
    display: inline-block; width: 22px; height: 22px; line-height: 22px;
    border-radius: 50%; background: #e5e7eb; color: #9ca3af;
    font-size: 11px; margin-right: 4px; font-weight: 600;
}
.wooai-step-flow-item.done { border-color: #10b981; color: #10b981; }
.wooai-step-flow-item.done .num { background: #10b981; color: #fff; }
.wooai-step-flow-item.active { border-color: #4f46e5; color: #4f46e5; font-weight: 600; }
.wooai-step-flow-item.active .num { background: #4f46e5; color: #fff; }

/* ========== 步骤结果展示 ========== */
.wooai-step-result { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 12px; padding: 20px; margin-top: 12px; }
.wooai-step-result h3 { margin: 0 0 16px; font-size: 16px; color: #111827; }
.wooai-step-content { margin-bottom: 16px; }
.wooai-step-content h4 { margin: 0 0 12px; font-size: 14px; color: #374151; }
.wooai-step-info { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 12px; margin-bottom: 12px; font-size: 13px; line-height: 1.6; }
.wooai-step-info p { margin: 4px 0; }
.wooai-step-info ul { margin: 4px 0; padding-left: 20px; }
.wooai-step-images { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.wooai-step-edit-box { margin-top: 12px; }
.wooai-step-edit-box label { display: block; font-size: 12px; color: #6b7280; margin-bottom: 6px; }
.wooai-step-edit-box textarea {
    width: 100%; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 8px;
    font-size: 13px; font-family: monospace; line-height: 1.5; resize: vertical;
    background: #fff;
}
.wooai-step-actions { display: flex; gap: 10px; justify-content: center; margin-top: 16px; }
.wooai-step-actions .btn-secondary { background: #f3f4f6; color: #374151; border: 1px solid #d1d5db; }
.wooai-step-actions .btn-secondary:hover { background: #e5e7eb; }

/* 店铺测试结果 */
.wooai-test-result { margin: 12px 0; font-size: 14px; min-height: 20px; }
.wooai-test-ok { color: #16a34a; font-weight: 600; }
.wooai-test-fail { color: #dc2626; font-weight: 600; }

/* ===== 图片排序/放大/删除/重新生成 ===== */
.wooai-sortable { display: flex; flex-wrap: wrap; gap: 10px; min-height: 50px; }
.wooai-sortable-item {
    position: relative;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    cursor: grab;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
    width: 130px;
}
.wooai-sortable-item:hover {
    border-color: #6366f1;
    box-shadow: 0 2px 12px rgba(99,102,241,0.15);
}
.wooai-sortable-item img {
    width: 130px;
    height: 130px;
    object-fit: cover;
    display: block;
    cursor: zoom-in;
}
.wooai-sort-handle {
    position: absolute;
    top: 4px;
    left: 4px;
    background: rgba(0,0,0,0.5);
    color: #fff;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    font-size: 12px;
    line-height: 22px;
    text-align: center;
    cursor: grab;
    z-index: 2;
    user-select: none;
}
.wooai-img-actions {
    position: absolute;
    top: 4px;
    right: 4px;
    display: flex;
    gap: 2px;
    z-index: 2;
}
.wooai-img-actions button {
    background: rgba(0,0,0,0.5);
    color: #fff;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    line-height: 24px;
    text-align: center;
    padding: 0;
}
.wooai-img-actions button:hover {
    background: rgba(99,102,241,0.8);
}
.wooai-img-order {
    position: absolute;
    bottom: 4px;
    left: 4px;
    background: #6366f1;
    color: #fff;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 11px;
    line-height: 20px;
    text-align: center;
    font-weight: 600;
}
.wooai-sortable-item.wooai-dragging {
    opacity: 0.5;
}
.wooai-sortable-placeholder {
    width: 130px;
    height: 130px;
    border: 2px dashed #6366f1;
    border-radius: 10px;
    background: rgba(99,102,241,0.05);
}
.wooai-sortable-item.wooai-regen-loading {
    position: relative;
}
.wooai-regen-spinner {
    z-index: 5;
}
/* 描述编辑器中图片hover重新生成按钮 */
#wooai-f-desc-visual .wooai-desc-img-wrap {
    position: relative;
    display: inline-block;
    margin: 4px;
}
#wooai-f-desc-visual .wooai-desc-img-wrap img {
    transition: opacity 0.2s;
}
#wooai-f-desc-visual .wooai-desc-img-regen {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    line-height: 28px;
    text-align: center;
    z-index: 5;
    transition: background 0.2s;
}
#wooai-f-desc-visual .wooai-desc-img-regen:hover {
    background: rgba(99,102,241,0.9);
}
.wooai-test-pending { color: #d97706; }

/* ===== 素材库 ===== */
.wooai-assets-grid-inner {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
}
.wooai-asset-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: #f5f5f5;
    aspect-ratio: 1;
    cursor: pointer;
}
.wooai-asset-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.wooai-asset-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s;
}
.wooai-asset-item:hover .wooai-asset-overlay {
    opacity: 1;
}
.wooai-asset-overlay button {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    font-size: 14px;
    line-height: 32px;
    text-align: center;
}
.wooai-asset-use { background: #22c55e; color: #fff; }
.wooai-asset-del { background: #ef4444; color: #fff; }
.wooai-asset-meta {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: rgba(0,0,0,0.5);
    color: #fff;
    font-size: 11px;
    padding: 2px 6px;
    text-align: center;
}
.wooai-assets-pager {
    margin-top: 12px;
    text-align: center;
    font-size: 13px;
    color: #666;
}
.wooai-assets-pager button {
    margin: 0 8px;
    padding: 4px 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
}
.wooai-assets-pager button:hover { background: #f0f0f0; }

/* ===== 模型管理 ===== */
.wooai-model-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    margin-bottom: 6px;
}
.wooai-model-item .model-name { font-weight: 600; min-width: 100px; }
.wooai-model-item .model-info { color: #6b7280; font-size: 12px; flex: 1; }
.wooai-model-item button { padding: 2px 10px; border-radius: 4px; border: 1px solid #d1d5db; cursor: pointer; font-size: 12px; background: #fff; }
.wooai-model-item button:hover { background: #f3f4f6; }

/* ===== 素材选取弹窗 ===== */
.wooai-picker-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,.45); z-index: 99997; display: flex; align-items: center; justify-content: center; }
.wooai-picker-box { background: #fff; border-radius: 12px; width: 90%; max-width: 820px; max-height: 80vh; display: flex; flex-direction: column; }
.wooai-picker-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid #e5e7eb; }
.wooai-picker-header h3 { margin: 0; font-size: 16px; }
.wooai-picker-toolbar { display: flex; gap: 10px; padding: 10px 20px; border-bottom: 1px solid #f0f0f0; flex-wrap: wrap; }
.wooai-picker-toolbar input { flex: 1; min-width: 160px; padding: 6px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 13px; }
.wooai-picker-body { flex: 1; overflow-y: auto; padding: 12px 20px; }
.wooai-picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.wooai-picker-item { position: relative; border-radius: 6px; overflow: hidden; cursor: pointer; border: 2px solid transparent; transition: border-color .15s; }
.wooai-picker-item:hover { border-color: #3b82f6; }
.wooai-picker-item.selected { border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59,130,246,.25); }
.wooai-picker-item img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.wooai-picker-item .wooai-pick-check { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; background: #3b82f6; color: #fff; border-radius: 50%; font-size: 12px; line-height: 20px; text-align: center; display: none; }
.wooai-picker-item.selected .wooai-pick-check { display: block; }
.wooai-picker-footer { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; border-top: 1px solid #e5e7eb; }
.wooai-picker-footer .picked-count { color: #6b7280; font-size: 13px; }
.wooai-picker-footer button { padding: 6px 18px; border-radius: 6px; cursor: pointer; border: none; font-size: 13px; }
.wooai-picker-footer .btn-confirm { background: #3b82f6; color: #fff; }
.wooai-picker-footer .btn-confirm:hover { background: #2563eb; }
.wooai-picker-footer .btn-cancel { background: #f3f4f6; color: #374151; margin-right: 8px; }
.wooai-picker-footer .btn-cancel:hover { background: #e5e7eb; }
.wooai-picker-empty { text-align: center; padding: 40px; color: #9ca3af; }

/* ===== 素材库操作按钮 ===== */
.wooai-asset-actions { position: absolute; top: 4px; right: 4px; display: flex; gap: 2px; z-index: 2; opacity: 0; transition: opacity .15s; }
.wooai-asset-item:hover .wooai-asset-actions { opacity: 1; }
.wooai-asset-actions button { width: 22px; height: 22px; border-radius: 4px; border: none; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.wooai-asset-actions button:hover { background: rgba(0,0,0,.75); }
.wooai-asset-name { position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(transparent, rgba(0,0,0,.6)); color: #fff; font-size: 11px; padding: 4px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ===== 素材分类栏 ===== */
.wooai-asset-cats { display: flex; gap: 6px; padding: 8px 0; flex-wrap: wrap; align-items: center; }
.wooai-asset-cat { padding: 3px 12px; border-radius: 14px; border: 1px solid #d1d5db; font-size: 12px; cursor: pointer; background: #fff; transition: all .15s; }
.wooai-asset-cat:hover, .wooai-asset-cat.active { background: #3b82f6; color: #fff; border-color: #3b82f6; }
.wooai-asset-cat-add { background: none; border: 1px dashed #d1d5db; color: #9ca3af; }
.wooai-asset-cat-add:hover { color: #3b82f6; border-color: #3b82f6; background: #eff6ff; }
