.tool-image-cropper {
    background: linear-gradient(160deg, #f8fafc 0%, #f1f5f9 50%, #e2e8f0 100%);
}

.tool-image-cropper .image-cropper-wrapper {
    border: none;
    border-radius: 1rem;
    background: #ffffff;
    box-shadow: 0 4px 24px rgba(15, 23, 42, 0.08), 0 0 0 1px rgba(15, 23, 42, 0.04);
    overflow: hidden;
    border-left: 4px solid #22C55E;
}

.tool-image-cropper .image-cropper-icon-wrap {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: linear-gradient(135deg, #22C55E 0%, #1F2937 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(34, 197, 94, 0.35);
}

.tool-image-cropper .crop-dropzone {
    position: relative;
    border: 2px dashed #cbd5e1;
    border-radius: 0.85rem;
    background: #f8fafc;
    padding: 2rem 1.25rem;
    text-align: center;
    cursor: pointer;
}

.tool-image-cropper .crop-dropzone.is-over {
    border-color: #22C55E;
    background: rgba(34, 197, 94, 0.08);
}

.tool-image-cropper .crop-dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.tool-image-cropper .crop-dropzone-icon {
    font-size: 2rem;
    color: #22C55E;
    margin-bottom: 0.65rem;
    display: block;
}

.crop-stage-wrap {
    border-radius: 0.85rem;
    overflow: hidden;
    background: #111827;
}

.crop-stage {
    position: relative;
    width: 100%;
    min-height: 280px;
    max-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    touch-action: none;
}

.crop-stage img {
    max-width: 100%;
    max-height: 70vh;
    display: block;
    pointer-events: none;
}

.crop-layer {
    position: absolute;
    overflow: hidden;
    touch-action: none;
}

.crop-box {
    position: absolute;
    box-sizing: border-box;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
    cursor: move;
}

.crop-grid {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.4)) 33.333% 0 / 1px 100% no-repeat,
        linear-gradient(rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.4)) 66.666% 0 / 1px 100% no-repeat,
        linear-gradient(rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.4)) 0 33.333% / 100% 1px no-repeat,
        linear-gradient(rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.4)) 0 66.666% / 100% 1px no-repeat;
}

.crop-handle {
    position: absolute;
    z-index: 2;
    box-sizing: border-box;
}

.crop-handle-nw,
.crop-handle-ne,
.crop-handle-se,
.crop-handle-sw {
    width: 22px;
    height: 22px;
    border: 4px solid #ffffff;
}

.crop-handle-nw {
    top: -2px;
    left: -2px;
    border-right: 0;
    border-bottom: 0;
    cursor: nwse-resize;
}

.crop-handle-ne {
    top: -2px;
    right: -2px;
    border-left: 0;
    border-bottom: 0;
    cursor: nesw-resize;
}

.crop-handle-se {
    bottom: -2px;
    right: -2px;
    border-left: 0;
    border-top: 0;
    cursor: nwse-resize;
}

.crop-handle-sw {
    bottom: -2px;
    left: -2px;
    border-right: 0;
    border-top: 0;
    cursor: nesw-resize;
}

.crop-handle-n,
.crop-handle-s {
    left: 50%;
    width: 28px;
    height: 10px;
    margin-left: -14px;
    background: #ffffff;
    border-radius: 2px;
}

.crop-handle-n {
    top: -5px;
    cursor: ns-resize;
}

.crop-handle-s {
    bottom: -5px;
    cursor: ns-resize;
}

.crop-handle-e,
.crop-handle-w {
    top: 50%;
    width: 10px;
    height: 28px;
    margin-top: -14px;
    background: #ffffff;
    border-radius: 2px;
}

.crop-handle-e {
    right: -5px;
    cursor: ew-resize;
}

.crop-handle-w {
    left: -5px;
    cursor: ew-resize;
}

.crop-ratios {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.tool-image-cropper .btn-crop-ratio {
    border: 2px solid #e2e8f0;
    background: #fff;
    color: #1F2937 !important;
    font-weight: 600;
    border-radius: 0.5rem;
    padding: 0.45rem 0.8rem;
}

.tool-image-cropper .btn-crop-ratio:hover,
.tool-image-cropper .btn-crop-ratio:focus {
    border-color: #94a3b8;
    background: #f8fafc;
    color: #1F2937 !important;
}

.tool-image-cropper .btn-crop-ratio.is-on,
.tool-image-cropper .btn-crop-ratio.is-on:hover,
.tool-image-cropper .btn-crop-ratio.is-on:focus {
    border-color: #16a34a;
    background: #22C55E;
    color: #fff !important;
}

.tool-image-cropper .form-select {
    border: 2px solid #e2e8f0;
    border-radius: 0.5rem;
}

.tool-image-cropper .form-select:focus {
    border-color: #22C55E;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}

.tool-image-cropper .form-range::-webkit-slider-thumb {
    background: #22C55E;
}

.tool-image-cropper .btn-crop-go {
    background: #22C55E;
    border: none;
    color: #fff !important;
    font-weight: 600;
    border-radius: 0.5rem;
    padding: 0.6rem 1.15rem;
}

.tool-image-cropper .btn-crop-go:hover,
.tool-image-cropper .btn-crop-go:focus {
    background: #16a34a;
    color: #fff !important;
}

.tool-image-cropper .btn-crop-go:disabled {
    background: #cbd5e1;
    color: #64748b !important;
}

.tool-image-cropper .btn-crop-reset,
.tool-image-cropper .btn-crop-clear {
    border: 2px solid #e2e8f0;
    background: #fff;
    color: #1F2937 !important;
    font-weight: 600;
    border-radius: 0.5rem;
    padding: 0.55rem 1rem;
}

.tool-image-cropper .btn-crop-reset:hover,
.tool-image-cropper .btn-crop-reset:focus,
.tool-image-cropper .btn-crop-clear:hover,
.tool-image-cropper .btn-crop-clear:focus {
    border-color: #94a3b8;
    background: #f8fafc;
    color: #1F2937 !important;
}

@media (max-width: 575.98px) {
    .tool-image-cropper .btn-crop-go,
    .tool-image-cropper .btn-crop-reset,
    .tool-image-cropper .btn-crop-clear {
        width: 100%;
    }

    .crop-handle-nw,
    .crop-handle-ne,
    .crop-handle-se,
    .crop-handle-sw {
        width: 26px;
        height: 26px;
        border-width: 5px;
    }
}
