/* Image Watermark — iwm- */
.iwm-upload-zone {
    border: 2px dashed rgba(139, 92, 246, 0.35);
    border-radius: 16px;
    background: rgba(139, 92, 246, 0.04);
    padding: 56px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    outline: none;
}

.iwm-upload-zone:hover,
.iwm-upload-zone:focus,
.iwm-upload-zone.iwm-drag-over {
    border-color: #8B5CF6;
    background: rgba(139, 92, 246, 0.08);
}

.iwm-upload-icon {
    font-size: 3rem;
    color: #8B5CF6;
    opacity: 0.7;
    margin-bottom: 14px;
    display: block;
}

.iwm-upload-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 6px;
}

.iwm-upload-sub {
    font-size: 1rem;
    color: var(--text-secondary);
    margin: 0;
}

.iwm-section {
    padding: 40px 0 60px;

}

.iwm-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem
}

.iwm-badge {
    width: 44px;
    height: 44px;
    background: rgba(139, 92, 246, .15);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #8B5CF6;
    flex-shrink: 0
}

.iwm-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #0F172A;
    margin: 0 0 .2rem
}

.iwm-subtitle {
    font-size: 0.9375rem;
    color: #64748B;
    margin: 0
}

.iwm-mode-tabs {
    display: flex;
    gap: .5rem;
    margin-bottom: 1rem
}

.iwm-mode-tab {
    padding: .45rem 1.1rem;
    border-radius: 6px;
    border: 1px solid #E2E8F0;
    background: none;
    color: #64748B;
    cursor: pointer;
    font-size: 0.9375rem;
    display: flex;
    align-items: center;
    gap: .4rem;
    transition: all .2s
}

.iwm-mode-tab.active {
    background: #8B5CF6;
    color: #fff;
    border-color: #8B5CF6
}

.iwm-controls {
    background: #F8FAFC;
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    border: 1px solid #E2E8F0;
    display: flex;
    flex-direction: column;
    gap: .75rem
}

.iwm-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem
}

.iwm-group {
    display: flex;
    flex-direction: column;
    gap: .4rem
}

.iwm-group--color {
    justify-content: flex-start
}

.iwm-label {
    font-size: 0.9375rem;
    color: #64748B;
    display: flex;
    align-items: center;
    gap: .5rem
}

.iwm-val-badge {
    background: #F1F5F9;
    border-radius: 4px;
    padding: .1rem .4rem;
    font-size: 0.8125rem;
    color: #8B5CF6;
    font-variant-numeric: tabular-nums;
    min-width: 2ch;
    text-align: center
}

.iwm-slider {
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: linear-gradient(to right, #8B5CF6 var(--val, 50%), #E2E8F0 var(--val, 50%));
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    width: 100%
}

.iwm-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #8B5CF6;
    cursor: pointer
}

.iwm-input {
    background: #F1F5F9;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    padding: .45rem .7rem;
    color: #0F172A;
    font-size: 0.9375rem;
    outline: none;
    width: 100%;
    box-sizing: border-box
}

.iwm-input:focus {
    border-color: #8B5CF6
}

.iwm-color-input {
    width: 48px;
    height: 36px;
    border: 2px solid #E2E8F0;
    border-radius: 6px;
    background: none;
    cursor: pointer;
    padding: 2px
}

.iwm-img-upload-zone {
    border: 2px dashed rgba(139, 92, 246, 0.35);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s
}

.iwm-img-upload-zone:hover {
    border-color: #8B5CF6
}

.iwm-pos-grid {
    display: grid;
    grid-template-columns: repeat(3, 36px);
    gap: 4px
}

.iwm-pos-btn {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    border: 1px solid #E2E8F0;
    background: #F1F5F9;
    color: #64748B;
    cursor: pointer;
    font-size: 0.9375rem;
    transition: all .2s
}

.iwm-pos-btn.active,
.iwm-pos-btn:hover {
    background: #8B5CF6;
    color: #fff;
    border-color: #8B5CF6
}

.iwm-check-label {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: 0.9375rem;
    color: #64748B;
    cursor: pointer
}

.iwm-check-label input {
    accent-color: #8B5CF6;
    width: 14px;
    height: 14px
}

.iwm-actions {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem
}

.iwm-btn {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .55rem 1.2rem;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: opacity .2s, transform .1s
}

.iwm-btn:active {
    transform: scale(.97)
}

.iwm-btn--primary {
    background: #8B5CF6;
    color: #fff
}

.iwm-btn--primary:hover {
    filter: brightness(1.1);
}

.iwm-btn--ghost {
    background: #F1F5F9;
    color: var(--text-secondary, #64748b);
    border: 1px solid rgba(100, 116, 139, 0.2);
}

.iwm-btn--ghost:hover {
    border-color: #8B5CF6;
    color: #8B5CF6;
}

.iwm-btn--success {
    background: transparent;
    border: 1px solid #8B5CF6;
    color: #8B5CF6;
}

.iwm-btn--success:hover {
    background: rgba(139, 92, 246, 0.08);
}

/* ── Side-by-side layout ─────────────────────────────────────────────── */
.iwm-layout {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 1.5rem;
    align-items: start;
    margin-bottom: 1.25rem;
}

.iwm-col-controls {
    min-width: 0;
}

.iwm-col-preview {
    position: sticky;
    top: 90px;
}

/* ── Single preview pane ─────────────────────────────────────────────── */
.iwm-preview-single {
    background: #F8FAFC;
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid #E2E8F0;
    text-align: center;
}

.iwm-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: .6rem;
}

.iwm-pane-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #64748B;
}

.iwm-preview-hint {
    font-size: 0.75rem;
    color: #8B5CF6;
    opacity: 0.8;
    display: flex;
    align-items: center;
    gap: 3px;
}

.iwm-preview-single canvas {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    display: block;
    margin: 0 auto;
}

/* ── Section labels & dividers ───────────────────────────────────────── */
.iwm-section-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94A3B8;
    margin: 0 0 .5rem;
}

.iwm-divider {
    border: none;
    border-top: 1px solid #E2E8F0;
    margin: .5rem 0;
}

/* ── Bold / Italic style buttons ─────────────────────────────────────── */
.iwm-style-btns {
    display: flex;
    gap: 6px;
}

.iwm-style-btn {
    width: 36px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid #E2E8F0;
    background: #F1F5F9;
    color: #64748b;
    cursor: pointer;
    font-size: 0.9375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.iwm-style-btn:hover {
    border-color: #8B5CF6;
    color: #8B5CF6;
}

.iwm-style-btn--active {
    background: #8B5CF6;
    border-color: #8B5CF6;
    color: #fff;
}

.iwm-style-btn--active:hover {
    color: #fff;
}

/* ── Format select ────────────────────────────────────────────────────────── */
.iwm-format-select {
    padding: 0.45rem 0.7rem;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    background: #F8FAFC;
    color: var(--text-secondary, #64748b);
    font-size: 0.875rem;
    cursor: pointer;
    outline: none;
}

@media(max-width:860px) {
    .iwm-layout {
        grid-template-columns: 1fr;
    }

    .iwm-col-preview {
        position: static;
        order: -1;
    }
}

@media(max-width:600px) {
    .iwm-row {
        grid-template-columns: 1fr;
    }
}

.iwm-select {
    background: #F1F5F9;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    padding: .45rem .7rem;
    color: #0F172A;
    font-size: 0.9375rem;
    outline: none;
    width: 100%;
    box-sizing: border-box;
    cursor: pointer;
}

.iwm-select:focus {
    border-color: #8B5CF6;
}

/* ── Font-size number input + quick chips ───────────────────────────── */
.iwm-size-input {
    max-width: 90px;
}

/* ── Drag-to-position ───────────────────────────────────────────────── */
.iwm-drag-hint {
    font-size: 0.8125rem;
    color: #8B5CF6;
    margin: 6px 0 0;
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0.8;
}

#iwm-canvas-out {
    cursor: crosshair;
}