.whattheduck-settings {
    padding: 0.5rem;
    max-width: 600px;
}

.whattheduck-actions {
    display: flex;
    justify-content: flex-start;
    padding: 0.5rem 0;
}

.whattheduck-status {
    min-height: 1.5rem;
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
}

.whattheduck-status:empty {
    display: none;
}

.whattheduck-status-success {
    display: block;
    background: color-mix(in srgb, var(--green) 20%, transparent);
    color: var(--green);
    border: 1px solid color-mix(in srgb, var(--green) 35%, transparent);
}

.whattheduck-status-error {
    display: block;
    background: color-mix(in srgb, var(--red) 20%, transparent);
    color: var(--red);
    border: 1px solid color-mix(in srgb, var(--red) 35%, transparent);
}

.image-block.wtd-compare-marked {
    position: relative;
    outline: 3px dashed var(--star);
    outline-offset: -3px;
    box-shadow: 0 0 6px 2px color-mix(in srgb, var(--star) 55%, transparent);
}

.image-block.wtd-compare-marked::after {
    content: "⇄";
    position: absolute;
    top: 0.15rem;
    left: 0.3rem;
    z-index: 5;
    font-size: 0.95rem;
    line-height: 1;
    padding: 0.1rem 0.25rem;
    border-radius: 4px;
    color: var(--white);
    background: color-mix(in srgb, var(--black) 60%, transparent);
    pointer-events: none;
}

/* Edit Prompt feature */
.wtd-prompt-edit-button {
    /* The copy button is float:right; floating this right too (while staying after
       it in DOM order) makes it land immediately to the left of the copy button. */
    float: right;
    margin-right: 0.25rem;
}

.wtd-prompt-edit-textarea {
    width: 100%;
    min-height: 8rem;
    box-sizing: border-box;
    resize: vertical;
    font-family: var(--font-monospace);
    font-size: 0.9rem;
}

/* The global rule sizes .modal-dialog/.modal-content to fit-content, which collapses
   when the only body content is a width:100% textarea. Pin a definite width (reusing
   SwarmUI's standard modal-width formula) so the content fills it, matching the
   #input_image_browser_modal pattern of overriding both dialog and content. */
#wtd_prompt_edit_modal .modal-dialog {
    width: calc(max(500px, 50vw));
    max-width: 90vw;
}
#wtd_prompt_edit_modal .modal-content {
    width: 100%;
}

/* Model Auto-Folders feature */
.whattheduck-arch-row {
    display: flex;
    gap: 0.4rem;
    /* The architecture multi-select is taller than the folder dropdowns; top
       alignment keeps the folder selects and remove button on the first line. */
    align-items: flex-start;
    margin-bottom: 0.35rem;
}

.whattheduck-arch-row .wtd-arch-picker {
    position: relative;
    flex: 1.4 1 0;
    min-width: 0;
}

/* Closed state: pills inside a control styled like SwarmUI's dropdowns. */
.wtd-arch-trigger {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    min-height: 2rem;
    padding: 0.2rem 0.5rem;
    background-color: var(--background);
    border: 1px solid var(--shadow);
    border-radius: 0.5rem;
    cursor: pointer;
    box-sizing: border-box;
}
.wtd-arch-trigger:focus-visible {
    outline: 1px solid var(--emphasis);
}
.wtd-arch-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    flex: 1 1 auto;
    min-width: 0;
}
.wtd-arch-placeholder {
    color: var(--text-soft);
}
.wtd-arch-caret {
    color: var(--text-soft);
    flex: none;
}
.wtd-arch-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.05rem 0.25rem 0.05rem 0.55rem;
    background-color: var(--box-selected-background);
    border: 1px solid var(--box-selected-border);
    border-radius: 1rem;
    font-size: 0.85em;
    white-space: nowrap;
}
.wtd-arch-pill-x {
    border: none;
    background: none;
    color: var(--text-soft);
    cursor: pointer;
    padding: 0 0.2rem;
    font-size: 1em;
    line-height: 1;
}
.wtd-arch-pill-x:hover {
    color: var(--text);
}

/* Open state: floating filter + checkbox panel; stays open during selection. */
.wtd-arch-panel {
    position: absolute;
    z-index: 100;
    top: calc(100% + 0.25rem);
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.5rem;
    background-color: var(--background);
    border: 1px solid var(--shadow);
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1.5rem rgb(0 0 0 / 45%);
    box-sizing: border-box;
}
.wtd-arch-panel[hidden] {
    display: none;
}
/* Flipped above the trigger when the viewport has no room below. */
.wtd-arch-panel.wtd-arch-panel-up {
    top: auto;
    bottom: calc(100% + 0.25rem);
}
.wtd-arch-filter {
    width: 100%;
    box-sizing: border-box;
}
.wtd-arch-list {
    display: flex;
    flex-direction: column;
    max-height: 14rem;
    overflow-y: auto;
}
.wtd-arch-option {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.15rem 0.25rem;
    margin: 0;
    border-radius: 0.3rem;
    cursor: pointer;
}
.wtd-arch-option:hover {
    background-color: var(--background-soft);
}
.wtd-arch-option.wtd-arch-option-taken {
    display: none;
}
.wtd-arch-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.wtd-arch-count {
    color: var(--text-soft);
    font-size: 0.85em;
}

.whattheduck-arch-row select {
    flex: 1 1 0;
    min-width: 0;
}

.whattheduck-arch-row .wtd-arch-remove {
    flex: 0 0 auto;
}

.whattheduck-arch-actions {
    margin-top: 0.5rem;
}

/* Comfy Workflow tab: the row holding the save button (the Quick Load block, or
   a row of our own if that's gone). It clears the button row above it, and
   contains its floats - both the save button and the Quick Load select - so the
   panel's collapse toggle, which sits at the bottom of the flow, lands below
   them instead of on top of the button. */
.wtd-comfy-save-row {
    clear: both;
    overflow: hidden;
}

/* Transient "…" / "✓" marker on the Comfy tab's save button. */
.wtd-comfy-save-mark {
    margin-left: 0.3rem;
    font-weight: bold;
    color: var(--success-text, #4caf50);
}
