.dixeo-imageeditor-wrap {
    position: relative;
    display: inline-block;
    max-width: 100%;
}

.dixeo-imageeditor-wrap img {
    display: block;
    max-width: 100%;
    height: auto;
}

.dixeo-imageeditor-editbtn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    opacity: 0;
    transition: opacity 0.15s ease;
    padding: 0.35rem 0.65rem;
    border: 0;
    border-radius: 999px;
    background: rgba(16, 27, 44, 0.82);
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
}

.dixeo-imageeditor-editbtn::before {
    content: "";
    flex: 0 0 auto;
    width: 0.875rem;
    height: 0.9375rem;
    background-image: url('pix/sparkle.svg');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.dixeo-imageeditor-wrap:hover .dixeo-imageeditor-editbtn,
.dixeo-imageeditor-wrap:focus-within .dixeo-imageeditor-editbtn {
    opacity: 1;
}

/* Shimmer overlay (::before) + @keyframes dixeo-shimmer live in local_dixeo/styles.css. */

.dixeo-imageeditor-wrap.is-generating::after {
    content: attr(data-dixeo-image-generating-label);
    position: absolute;
    left: 1rem;
    bottom: 1rem;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-radius: 999px;
    background: rgba(16, 27, 44, 0.72);
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.2;
    pointer-events: none;
}

.dixeo-imageeditor-toast {
    position: absolute;
    top: 0.5rem;
    left: 50%;
    z-index: 5;
    max-width: calc(100% - 1rem);
    padding: 0.5rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    opacity: 0;
    transform: translateX(-50%) translateY(-0.35rem);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
    box-shadow: 0 4px 14px rgba(16, 27, 44, 0.18);
}

.dixeo-imageeditor-toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.dixeo-imageeditor-toast.is-success {
    background: rgba(16, 27, 44, 0.88);
    color: #fff;
}

.dixeo-imageeditor-toast.is-error {
    background: rgba(176, 42, 55, 0.92);
    color: #fff;
}

.dixeo-imageeditor-modal__preview .dixeo-imageeditor-toast {
    top: 1rem;
}

.dixeo-imageeditor-modal-dialog.modal-xl {
    min-height: 30em;
}

.dixeo-imageeditor-modal__prompt-label {
    font-weight: 600;
    margin-bottom: 0;
}

.dixeo-imageeditor-modal__submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 2.6875rem;
    padding: 0.75rem 1rem;
    border: 0;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.2;
    background: rgb(var(--dixeo-accent-color, 15 119 191));
    color: rgb(var(--dixeo-hero-text, 254 254 254));
    cursor: pointer;
}

.dixeo-imageeditor-modal__submit::before {
    content: "";
    flex: 0 0 auto;
    width: 0.875rem;
    height: 0.9375rem;
    background-image: url('pix/sparkle.svg');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.dixeo-imageeditor-modal__submit:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.dixeo-imageeditor-modal__toggle-container,
.dixeo-imageeditor-modal__aspect-container {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.dixeo-imageeditor-modal__aspect-container {
    display: flex;
}

.dixeo-imageeditor-modal__preview {
    position: relative;
    max-height: 440px;
    border-radius: 15px;
    border: 2px dashed #bbb;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    min-height: 150px;
    margin-left: 0;
    margin-top: 0;
    overflow: hidden;
    isolation: isolate;
}

.dixeo-imageeditor-modal__preview.is-generating::after {
    content: attr(data-dixeo-image-generating-label);
    position: absolute;
    left: 1rem;
    bottom: 1rem;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-radius: 999px;
    background: rgba(16, 27, 44, 0.72);
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.2;
    pointer-events: none;
}

.dixeo-imageeditor-modal__image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.dixeo-imageeditor-modal__history {
    width: 100%;
    border-top: 1px solid #dee2e6;
    padding-top: 1rem;
}

.dixeo-imageeditor-modal__history-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.dixeo-imageeditor-modal__carousel {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 10px;
    width: 100%;
}

.dixeo-imageeditor-modal__history-item {
    position: relative;
    flex: 0 0 auto;
    border: 2px solid transparent;
    border-radius: 0.375rem;
    background: #f8f9fa;
}

.dixeo-imageeditor-modal__history-thumb-btn {
    display: block;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    border-radius: 0.25rem;
}

.dixeo-imageeditor-modal__history-item:hover:not(.is-current) {
    border-color: #0f6cbf;
}

.dixeo-imageeditor-modal__history-item.is-current {
    border: 4px solid #0f6cbf;
}

.dixeo-imageeditor-modal__history-thumb {
    display: block;
    width: 96px;
    height: 96px;
    object-fit: cover;
    border-radius: 0.25rem;
}

.dixeo-imageeditor-modal__history-menu {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
}

.dixeo-imageeditor-modal__history-menu-toggle {
    padding: 3px 1px;
    line-height: 1;
    border-radius: 0.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.dixeo-imageeditor-modal__history-menu-toggle .icon {
    margin: 0;
}

.dixeo-imageeditor-modal__history-menu-toggle::after {
    display: none;
}

.dixeo-imageeditor-history-preview__stage {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.dixeo-imageeditor-history-preview__image-wrap {
    flex: 1 1 auto;
    min-width: 0;
    text-align: center;
}

.dixeo-imageeditor-history-preview__image {
    max-width: 100%;
    max-height: 60vh;
    object-fit: contain;
}

.dixeo-imageeditor-history-preview__nav {
    flex: 0 0 auto;
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid #ced4da;
    border-radius: 999px;
    background: #fff;
    color: #333;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.dixeo-imageeditor-history-preview__nav:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.dixeo-imageeditor-history-preview__nav .icon {
    margin: 0;
}

.dixeo-imageeditor-history-preview__meta {
    margin: 0.75rem 0 0;
    text-align: center;
    color: #6c757d;
}

.dixeo-imageeditor-history-preview__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 1rem;
}

.dixeo-imageeditor-modal.is-manual-editing > .row > .col-xl-4,
.dixeo-imageeditor-modal.is-manual-editing > .row > .col-lg-5 {
    pointer-events: none;
    opacity: 0.5;
}

.dixeo-imageeditor-modal.is-manual-editing .dixeo-imageeditor-modal__history {
    pointer-events: none;
    opacity: 0.5;
}

.dixeo-imageeditor-modal__preview.is-manual-editing {
    padding-top: 2.75rem;
    padding-bottom: 3.25rem;
}

.dixeo-imageeditor-modal__preview-actions {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 11;
    display: flex;
    gap: 0.35rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: calc(100% - 1rem);
}

.dixeo-imageeditor-modal__upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.dixeo-imageeditor-modal__preview-stage.is-upload-dragover {
    outline: 3px dashed rgb(var(--dixeo-accent-color, 15 119 191));
    outline-offset: -6px;
    background: rgba(15, 119, 191, 0.06);
}

.dixeo-imageeditor-modal__manual-save-discard {
    display: flex;
    gap: 0.35rem;
}

.dixeo-imageeditor-modal__preview-toolbars {
    position: absolute;
    inset: 0;
    z-index: 9;
    pointer-events: none;
}

.dixeo-imageeditor-modal__preview-toolbars .dixeo-imageeditor-modal__toolbar,
.dixeo-imageeditor-modal__preview-toolbars .dixeo-imageeditor-modal__toolbar-row,
.dixeo-imageeditor-modal__preview-toolbars .dixeo-imageeditor-modal__tone-control {
    pointer-events: auto;
}

.dixeo-imageeditor-modal__toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    align-items: center;
}

.dixeo-imageeditor-modal__toolbar--top {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    right: 11rem;
}

.dixeo-imageeditor-modal__toolbar-row {
    position: absolute;
    left: 0.5rem;
    right: 0.5rem;
    bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 0.5rem;
}

.dixeo-imageeditor-modal__toolbar--left {
    flex: 1 1 auto;
    min-width: 0;
    align-items: center;
}

.dixeo-imageeditor-modal__toolbar--right {
    flex: 0 0 auto;
    justify-content: flex-end;
}

.dixeo-imageeditor-modal__toolbar-textbtn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.dixeo-imageeditor-modal__toolbar .btn.active {
    background-color: #0f6cbf;
    color: #fff;
    border-color: #0f6cbf;
}

.dixeo-imageeditor-modal__tone-control {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.dixeo-imageeditor-modal__tone-slider {
    width: 5.5rem;
    margin: 0;
    flex: 0 0 auto;
}

.dixeo-imageeditor-modal__preview-stage {
    width: 100%;
    max-height: 340px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.dixeo-imageeditor-modal__preview-stage .cropper-container {
    max-height: 340px;
}

.dixeo-imageeditor-modal__preview.is-manual-editing .dixeo-imageeditor-modal__image {
    max-height: none;
    max-width: 100%;
}

.dixeo-imageeditor-modal__preview.is-manual-editing .dixeo-imageeditor-modal__preview-stage {
    overflow: visible;
}

.dixeo-imageeditor-modal__preview.is-manual-editing .dixeo-imageeditor-modal__upload-btn {
    display: none;
}

.dixeo-imageeditor-modal__preview.is-generating .dixeo-imageeditor-modal__manual-start,
.dixeo-imageeditor-modal__preview.is-generating .dixeo-imageeditor-modal__upload-btn {
    display: none;
}

.dixeo-imageeditor-modal__canvas {
    display: none;
}

.format-tiles li.tile > .dixeo-tiles-imageeditor {
    position: absolute;
    top: 0.35rem;
    right: 0.35rem;
    z-index: 6;
    display: block;
    width: auto;
    max-width: calc(100% - 0.7rem);
}

.format-tiles li.tile > .dixeo-tiles-imageeditor .dixeo-imageeditor-editbtn {
    position: static;
}

.format-tiles li.tile > .dixeo-tiles-imageeditor.is-generating {
    /* Cover the tile, including the colour bar drawn as a top border. */
    top: -0.45em;
    right: 0;
    bottom: 0;
    left: 0;
    width: auto;
    max-width: none;
}

.format-tiles li.tile > .dixeo-tiles-imageeditor.is-generating .dixeo-imageeditor-editbtn {
    position: absolute;
    top: 0.35rem;
    right: 0.35rem;
}

.format-tiles li.tile:hover > .dixeo-tiles-imageeditor .dixeo-imageeditor-editbtn,
.format-tiles li.tile:focus-within > .dixeo-tiles-imageeditor .dixeo-imageeditor-editbtn {
    opacity: 1;
}
