.abes-photo-editor[hidden],
.abes-photo-result[hidden] {
    display: none !important;
}

html.abes-photo-editor-open,
html.abes-photo-editor-open body {
    overflow: hidden !important;
}

.abes-photo-editor {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: grid;
    place-items: center;
    padding: 20px;
    box-sizing: border-box;
}

.abes-photo-editor__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(3, 20, 36, .78);
    backdrop-filter: blur(6px);
}

.abes-photo-editor__dialog {
    position: relative;
    width: min(1040px, 100%);
    max-height: calc(100vh - 40px);
    overflow: auto;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 30px 90px rgba(0, 0, 0, .34);
}

.abes-photo-editor__header {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 22px 26px;
    border-bottom: 1px solid #e5edf3;
}

.abes-photo-editor__header span {
    display: block;
    margin-bottom: 4px;
    color: #0786c8;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.3px;
    text-transform: uppercase;
}

.abes-photo-editor__header h3 {
    margin: 0;
    color: #082b45;
    font-size: 23px;
    line-height: 1.25;
}

.abes-photo-editor__header p {
    margin: 5px 0 0;
    color: #657789;
    font-size: 14px;
}

.abes-photo-editor__close {
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    border: 0;
    border-radius: 50%;
    background: #edf4f8;
    color: #274c65;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.abes-photo-editor__body {
    display: grid;
    grid-template-columns: minmax(300px, 530px) minmax(240px, 1fr);
    gap: 28px;
    padding: 26px;
    background: #f5f9fc;
}

.abes-photo-editor__stage {
    position: relative;
    width: min(100%, 500px);
    margin: 0 auto;
    overflow: hidden;
    border-radius: 12px;
    background: #dfe8ee;
    box-shadow: 0 12px 36px rgba(3, 38, 62, .18);
}

.abes-photo-editor__stage canvas {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 5;
    touch-action: none;
    cursor: grab;
}

.abes-photo-editor__stage canvas.is-dragging {
    cursor: grabbing;
}

.abes-photo-editor__drag-hint {
    position: absolute;
    left: 50%;
    bottom: 14px;
    transform: translateX(-50%);
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(0, 32, 55, .74);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    pointer-events: none;
}

.abes-photo-editor__controls {
    align-self: start;
    padding: 20px;
    background: #fff;
    border: 1px solid #dfe9f0;
    border-radius: 13px;
}

.abes-photo-editor__notice {
    margin-bottom: 20px;
    padding: 12px 14px;
    border-left: 3px solid #0786c8;
    border-radius: 6px;
    background: #eaf6fc;
    color: #264b62;
    font-size: 13px;
    line-height: 1.5;
}

.abes-photo-editor__controls label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    color: #173d56;
    font-size: 13px;
}

.abes-photo-editor__controls input[type="range"] {
    width: 100%;
    accent-color: #0786c8;
}

.abes-photo-editor__buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
    margin-top: 18px;
}

.abes-photo-editor__buttons button {
    min-height: 42px;
    padding: 7px;
    border: 1px solid #ccdae4;
    border-radius: 8px;
    background: #fff;
    color: #244c65;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}

.abes-photo-editor__controls ul {
    margin: 20px 0 0;
    padding: 16px 0 0 18px;
    border-top: 1px solid #e8eef2;
    color: #667888;
    font-size: 12px;
    line-height: 1.65;
}

.abes-photo-editor__footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 18px 26px;
    border-top: 1px solid #e5edf3;
}

.abes-photo-editor__footer button {
    min-height: 44px;
    padding: 10px 18px;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}

.abes-photo-editor__secondary {
    border: 1px solid #ccd9e2;
    background: #fff;
    color: #31546b;
}

.abes-photo-editor__primary {
    border: 1px solid #0786c8;
    background: #0786c8;
    color: #fff;
}

.abes-photo-editor__primary:disabled {
    opacity: .55;
    cursor: wait;
}

.abes-photo-result {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 14px;
    padding: 12px;
    border: 1px solid #b9dfca;
    border-radius: 10px;
    background: #f0fbf4;
}

.abes-photo-result img {
    width: 72px;
    height: 90px;
    flex: 0 0 auto;
    border-radius: 7px;
    object-fit: cover;
}

.abes-photo-result strong,
.abes-photo-result span {
    display: block;
}

.abes-photo-result strong {
    color: #145c32;
    font-size: 14px;
}

.abes-photo-result span {
    margin: 3px 0 7px;
    color: #51705e;
    font-size: 12px;
}

.abes-photo-result button {
    padding: 0;
    border: 0;
    background: transparent;
    color: #0879b4;
    font-size: 12px;
    font-weight: 800;
    text-decoration: underline;
    cursor: pointer;
}

@media (max-width: 760px) {
    .abes-photo-editor {
        padding: 0;
    }

    .abes-photo-editor__dialog {
        width: 100%;
        height: 100%;
        max-height: none;
        border-radius: 0;
    }

    .abes-photo-editor__header {
        padding: 16px 18px;
    }

    .abes-photo-editor__header h3 {
        font-size: 19px;
    }

    .abes-photo-editor__header p {
        font-size: 12px;
    }

    .abes-photo-editor__body {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 16px;
    }

    .abes-photo-editor__stage {
        width: min(100%, 390px);
    }

    .abes-photo-editor__controls {
        padding: 15px;
    }

    .abes-photo-editor__controls ul {
        display: none;
    }

    .abes-photo-editor__footer {
        position: sticky;
        bottom: 0;
        padding: 12px 16px;
        background: #fff;
    }

    .abes-photo-editor__footer button {
        flex: 1;
        padding: 8px;
    }
}
