/* ============================================================
 * 金美城云匠 - 绘图工具 公用样式表
 * ============================================================
 * 适用范围：绘图工具页面 / 其他需要相同风格的管理页面
 * 作者：金美城云匠
 * 说明：所有样式按模块分区，便于统一维护和复用
 * ============================================================ */


/* ============================================================
 * 1. 全局重置与基础布局
 * ============================================================
 * 重置默认边距、字体、盒模型，确保跨浏览器一致
 * html/body 满屏显示，禁止滚动条，浅灰背景
 * ============================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Microsoft YaHei", sans-serif;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #f0f2f5;
}

body {
    display: flex;
    gap: 12px;
    padding: 12px;
}


/* ============================================================
 * 2. 左侧控制面板
 * ============================================================
 * 固定宽度 420px，白底圆角卡片，垂直滚动
 * 内部按 .group 分区，用虚线下划线分隔
 * ============================================================ */
.left {
    flex: 0 0 420px;
    background: #fff;
    padding: 14px;
    overflow-y: auto;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* 自定义滚动条：细窄灰色 */
.left::-webkit-scrollbar {
    width: 6px;
}

.left::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

/* 分组容器：底部虚线分隔 */
.group {
    border-bottom: 1px dashed #eee;
    padding-bottom: 10px;
}

.group:last-child {
    border-bottom: none;
}

/* 分组标题 */
.group h4 {
    font-size: 13px;
    margin-bottom: 6px;
    color: #222;
    font-weight: 600;
}

/* 表单标签 */
label {
    display: block;
    font-size: 12px;
    color: #555;
    margin: 4px 0 2px;
}

/* 输入框 / 下拉框 / 文本域 通用样式 */
input[type=number],
select,
textarea {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    background: #fff;
    outline: none;
}

/* 聚焦高亮 */
input[type=number]:focus,
select:focus,
textarea:focus {
    border-color: #4096ff;
}

/* 横向排列行（每行等分） */
.row {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}

.row > * {
    flex: 1;
    min-width: 0;
}

/* 三列网格 */
.row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
    margin-top: 6px;
}


/* ============================================================
 * 3. 计数器控件（内竖杆 / 内横杆 数量增减）
 * ============================================================
 * 浅灰底圆角容器，中间显示数值，左右为 +/- 按钮
 * ============================================================ */
.counter-box {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f5f7fa;
    border-radius: 6px;
    padding: 6px 8px;
    margin-top: 6px;
}

.counter-box span.label {
    font-size: 12px;
    color: #555;
    flex: 0 0 auto;
    min-width: 70px;
}

.counter-box .count-val {
    font-size: 16px;
    color: #222;
    font-weight: bold;
    min-width: 36px;
    text-align: center;
    background: #fff;
    border-radius: 4px;
    padding: 4px 0;
}

.counter-box button {
    width: 32px;
    height: 32px;
    padding: 0;
    font-size: 16px;
    background: #4096ff;
    border-radius: 4px;
}

.counter-box button.minus { background: #ef4444; }
.counter-box button.plus { background: #22c55e; }


/* ============================================================
 * 4. 通用按钮样式
 * ============================================================
 * 默认蓝色，可通过 class 切换颜色
 * ============================================================ */
button {
    padding: 8px 0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    background: #4096ff;
    color: #fff;
    transition: 0.2s;
}

button:hover {
    opacity: 0.88;
}

/* 颜色主题 */
button.green  { background: #22c55e; }
button.orange { background: #ff8c00; }
button.gray   { background: #999; }
button.red    { background: #ef4444; }
button.purple { background: #9b59b6; }
button.blue   { background: #4096ff; }


/* ============================================================
 * 5. 下料清单展示区
 * ============================================================
 * 等宽字体，浅灰底，多行文本
 * ============================================================ */
.material-list {
    background: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 4px;
    padding: 8px;
    font-size: 12px;
    line-height: 1.8;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 300px;
    overflow-y: auto;
    color: #333;
    font-family: "Consolas", "Microsoft YaHei", monospace;
}

/* 小提示文字 */
.tip {
    font-size: 11px;
    color: #888;
    line-height: 1.6;
    margin-top: 4px;
}


/* ============================================================
 * 6. 右侧工作区
 * ============================================================
 * 包含顶部工具栏 + 画布容器
 * ============================================================ */
.right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
    overflow: hidden;
}


/* ============================================================
 * 7. 顶部工具栏
 * ============================================================
 * 白底圆角卡片，内部按钮横排
 * ============================================================ */
.toolbar {
    background: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.toolbar button {
    padding: 6px 12px;
    height: 32px;
    font-size: 12px;
}


/* ============================================================
 * 8. 画布容器
 * ============================================================
 * 白底圆角卡片，居中展示 canvas
 * #overlay 为加载遮罩层（生成图片时使用）
 * ============================================================ */
.canvas-box {
    flex: 1;
    background: #fff;
    border-radius: 8px;
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

canvas {
    display: block;
    max-width: 100%;
    max-height: 100%;
}

/* 加载遮罩 */
#overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #333;
    font-weight: bold;
    z-index: 10;
}


/* ============================================================
 * 9. 水印状态提示（新增）
 * ============================================================
 * 用于显示水印图片加载状态：成功 / 失败 / 加载中
 * ============================================================ */
#wmStatus {
    font-size: 12px;
    padding: 6px 8px;
    border-radius: 4px;
    margin-top: 6px;
    line-height: 1.5;
}

#wmStatus.ok      { background: #e8f9ee; color: #166534; border: 1px solid #bbf7d0; }
#wmStatus.fail    { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
#wmStatus.loading { background: #fef9c3; color: #854d0e; border: 1px solid #fef08a; }

/* 水印缩略预览 */
#wmPreview {
    max-width: 100%;
    max-height: 60px;
    margin-top: 6px;
    display: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 2px;
    background: #fff;
}