/* ===== 图片加水印工具 - 2026 极致高密紧凑 UI 规范 ===== */

.image-watermark-page {
    background-color: var(--page-bg, #f8fafc);
}

/* 布局：左右双栏响应式 Splitting Workspace */
.wm-split-workspace {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    margin-top: 16px;
    margin-bottom: 24px;
}

/* 左侧：画布预览列 (55%) */
.wm-preview-col {
    flex: 1 1 55%;
    min-width: 0;
}

/* 右侧：参数配置列 (45%) */
.wm-config-col {
    flex: 0 0 45%;
    width: 45%;
    min-width: 0;
}

/* 响应式降级：窄屏/移动端改为单列流动布局 */
@media (max-width: 991px) {
    .wm-split-workspace {
        flex-direction: column;
        gap: 16px;
    }
    .wm-preview-col,
    .wm-config-col {
        width: 100%;
        flex: 1 1 100%;
    }
}

/* 桌面端 Sticky 置顶 Canvas 画布 */
.wm-sticky-stage {
    position: relative;
}

@media (min-width: 992px) {
    .wm-sticky-stage {
        position: sticky;
        top: 80px;
        z-index: 10;
    }
}

/* 左侧 Preview Stage 卡片 */
.wm-stage-card {
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
    padding: 16px;
    overflow: hidden;
}

.wm-stage-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f1f5f9;
}

.wm-stage-title {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 6px;
}

.wm-stage-title i {
    color: var(--brand, #2563eb);
}

.wm-stage-subtitle {
    font-size: 12px;
    font-weight: 400;
    color: #64748b;
    margin-left: 4px;
}

.wm-stage-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wm-quick-btn {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    color: #334155;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.wm-quick-btn:hover {
    background: #eff6ff;
    color: #2563eb;
    border-color: #93c5fd;
}

.wm-quick-btn-zip {
    background: #fffbebfb;
    border-color: #fde68a;
    color: #b45309;
}

.wm-quick-btn-zip:hover {
    background: #fef3c7;
    color: #92400e;
    border-color: #f59e0b;
}

/* Canvas 舞台容器：高雅浅色调棋盘格 */
.wm-preview-wrapper {
    background-color: #f8fafc;
    background-image: 
        linear-gradient(45deg, #e2e8f0 25%, transparent 25%), 
        linear-gradient(-45deg, #e2e8f0 25%, transparent 25%), 
        linear-gradient(45deg, transparent 75%, #e2e8f0 75%), 
        linear-gradient(-45deg, transparent 75%, #e2e8f0 75%);
    background-size: 18px 18px;
    background-position: 0 0, 0 9px, 9px -9px, -9px 0px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    min-height: 360px;
    max-height: 540px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding: 14px;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.03);
}

.wm-preview-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#previewCanvas {
    display: block;
    max-width: 100%;
    max-height: 480px;
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
    margin: 0 auto;
    object-fit: contain;
}

/* 舞台空状态引导 */
.wm-preview-placeholder {
    padding: 24px 16px;
    text-align: center;
    color: #475569;
    cursor: pointer;
}

.wm-upload-icon-circle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #eff6ff;
    border: 1.5px solid #bfdbfe;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
}

.wm-upload-icon-circle i {
    font-size: 24px;
    color: #2563eb;
}

.wm-upload-hero h3 {
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 6px 0;
}

.wm-upload-hero p {
    font-size: 12px;
    color: #64748b;
    margin: 0 0 14px 0;
}

.wm-upload-chips {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.wm-upload-chips span {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #475569;
    font-size: 11.5px;
    padding: 3px 10px;
    border-radius: 16px;
}

/* 舞台底部按钮工具条 */
.wm-stage-footer {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wm-run-main-btn {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    padding: 10px;
    letter-spacing: 0.5px;
    box-shadow: 0 3px 12px rgba(37, 99, 235, 0.25);
    transition: all 0.2s ease;
}

.wm-run-main-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 5px 16px rgba(37, 99, 235, 0.35);
}

.wm-sub-actions {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.wm-sub-actions button {
    flex: 1;
    border-radius: 6px;
    font-weight: 600;
    font-size: 12px;
    padding: 5px;
}

/* 右侧参数配置卡片 (极致紧凑高密度布局) */
.watermark-settings-card {
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
    padding: 14px 16px;
}

.wm-config-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f1f5f9;
}

.wm-config-header h2 {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.wm-config-tag {
    background: #dbeafe;
    color: #1e40af;
    font-size: 10.5px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
}

/* Segmented Pill Tab 导航 */
.wm-mode-switcher-wrap {
    margin-bottom: 10px;
    background: #f1f5f9;
    padding: 3px;
    border-radius: 8px;
}

.wm-nav-tabs {
    display: flex;
    border-bottom: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.wm-nav-tabs > li {
    flex: 1;
    text-align: center;
    margin: 0 !important;
}

.wm-nav-tabs > li > a {
    display: block;
    padding: 6px 10px !important;
    color: #64748b !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    border: none !important;
    border-radius: 6px !important;
    background: transparent !important;
    margin: 0 !important;
    transition: all 0.2s ease !important;
}

.wm-nav-tabs > li.active > a,
.wm-nav-tabs > li.active > a:hover {
    color: #2563eb !important;
    background: #ffffff !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08) !important;
}

/* 紧凑分组控件盒 */
.wm-compact-group {
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid #f1f5f9;
    padding: 10px 12px;
    margin-bottom: 10px;
}

.wm-compact-group.margin-bottom-0 {
    margin-bottom: 0;
}

.wm-group-title {
    font-size: 12px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.wm-group-title i {
    color: #2563eb;
}

/* 常用防伪预设标签胶囊 */
.wm-presets-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.wm-preset-tag {
    background: #ffffff;
    color: #475569;
    border: 1px solid #cbd5e1;
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 11.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.wm-preset-tag:hover {
    background: #eff6ff;
    color: #2563eb;
    border-color: #93c5fd;
}

/* 栅格排列：多参数同行排列 */
.wm-grid-3col {
    display: grid;
    grid-template-columns: 1.2fr 0.9fr 1fr;
    gap: 8px;
    align-items: end;
}

.wm-grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    align-items: end;
}

@media (max-width: 480px) {
    .wm-grid-3col,
    .wm-grid-2col {
        grid-template-columns: 1fr;
    }
}

.watermark-settings-card .form-group {
    margin-bottom: 8px;
}

.watermark-settings-card .form-group.margin-bottom-0 {
    margin-bottom: 0;
}

.watermark-settings-card .form-group.margin-bottom-8 {
    margin-bottom: 8px;
}

.margin-top-8 {
    margin-top: 8px;
}

.watermark-settings-card label:not(.wm-switch-label) {
    font-size: 11.5px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 4px;
    display: block;
}

.wm-label-between {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
}

.wm-badge-val {
    background: #eff6ff;
    color: #2563eb;
    padding: 0 5px;
    border-radius: 3px;
    font-size: 10.5px;
    font-weight: 700;
}

.wm-angle-badge {
    cursor: pointer;
    transition: all 0.15s ease;
}

.wm-angle-badge:hover {
    background: #dbeafe;
    color: #1d4ed8;
}

.watermark-settings-card .form-control {
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 12px;
    color: #1e293b;
    height: 32px;
    padding: 4px 8px;
    transition: all 0.2s ease;
}

.watermark-settings-card .form-control:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 2.5px rgba(37, 99, 235, 0.15);
    outline: none;
}

/* 颜色选择器组件 */
.wm-color-picker-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 32px;
}

.wm-color-picker {
    width: 32px;
    height: 32px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 1px;
    cursor: pointer;
    background: #ffffff;
    flex-shrink: 0;
}

.wm-color-hex {
    font-size: 11px;
    font-weight: 600;
    color: #475569;
    font-family: monospace;
}

/* 滑块 Range 包装 */
.wm-range-wrap {
    height: 28px;
    display: flex;
    align-items: center;
}

.wm-range-wrap input[type="range"],
.wm-step-range-wrap input[type="range"] {
    width: 100%;
    margin: 0;
    cursor: pointer;
    accent-color: #2563eb;
}

.wm-step-range-wrap {
    height: 28px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.wm-step-btn {
    width: 22px;
    height: 22px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 12px;
    border-radius: 4px;
    flex-shrink: 0;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #334155;
}

.wm-step-btn:hover {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #2563eb;
}

.wm-reset-angle-btn {
    width: 24px;
    height: 22px;
    padding: 0;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #93c5fd;
    flex-shrink: 0;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.wm-reset-angle-btn:hover {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

/* ===== 核心修复：高优先级防冲突 Switch 仿开关样式 ===== */
label.wm-switch-label {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    margin: 0 !important;
    padding: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    cursor: pointer !important;
    user-select: none !important;
    position: relative !important;
    float: none !important;
    width: auto !important;
    height: auto !important;
    background: transparent !important;
    border: none !important;
}

label.wm-switch-label input[type="checkbox"] {
    position: absolute !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    pointer-events: none !important;
    z-index: -1 !important;
    left: -9999px !important;
}

label.wm-switch-label .wm-switch-slider {
    display: inline-block !important;
    width: 36px !important;
    height: 20px !important;
    background: #cbd5e1 !important;
    border-radius: 20px !important;
    position: relative !important;
    flex-shrink: 0 !important;
    transition: background 0.2s ease !important;
    vertical-align: middle !important;
    margin: 0 !important;
}

label.wm-switch-label .wm-switch-slider::before {
    content: '' !important;
    display: block !important;
    width: 16px !important;
    height: 16px !important;
    background: #ffffff !important;
    border-radius: 50% !important;
    position: absolute !important;
    top: 2px !important;
    left: 2px !important;
    transition: transform 0.2s ease !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
}

label.wm-switch-label input[type="checkbox"]:checked + .wm-switch-slider {
    background: #2563eb !important;
}

label.wm-switch-label input[type="checkbox"]:checked + .wm-switch-slider::before {
    transform: translateX(16px) !important;
}

label.wm-switch-label .wm-switch-text {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #334155 !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1.4 !important;
}

/* 显目的全屏平铺开关卡片 */
.wm-tile-toggle-card {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 8px 12px;
    transition: all 0.2s ease;
}

.wm-tile-toggle-card:hover {
    background: #dbeafe;
    border-color: #93c5fd;
}

.wm-tile-switch {
    width: 100% !important;
    justify-content: flex-start !important;
}

.wm-tile-hint {
    font-size: 11px;
    color: #2563eb;
    background: #ffffff;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
    margin-left: 6px;
}

/* 动态条件展开/隐藏块 */
.wm-dynamic-block {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #e2e8f0;
}

/* 可视化 3x3 九宫格位置选择矩阵 */
.wm-pos-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.wm-pos-container label {
    align-self: flex-start;
}

.wm-pos-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    width: 120px;
    margin: 2px auto 0;
}

.wm-pos-btn {
    aspect-ratio: 1 / 1;
    height: 32px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    font-size: 13px;
    font-weight: bold;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    padding: 0;
}

.wm-pos-btn:hover {
    border-color: #2563eb;
    color: #2563eb;
    background: #eff6ff;
}

.wm-pos-btn.active {
    border-color: #2563eb;
    background: #2563eb;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

/* 图片 Logo 上传预览盒 */
.wm-logo-upload-box {
    border: 1.5px dashed #cbd5e1;
    border-radius: 6px;
    padding: 4px 8px;
    text-align: center;
    cursor: pointer;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    transition: all 0.2s ease;
}

.wm-logo-upload-box:hover {
    border-color: #2563eb;
    background: #eff6ff;
}

.wm-logo-placeholder {
    font-size: 11.5px;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 5px;
}

.wm-logo-placeholder i {
    color: #2563eb;
    font-size: 14px;
}

#watermarkPreviewImg {
    max-height: 26px;
    width: auto;
    object-fit: contain;
}
