.viit-image-editor[hidden] { display: none !important; }

.viit-image-editor {
    --crop-accent: #a00038;
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: grid;
    place-items: center;
    padding: 18px;
    color: #172033;
    font-family: Inter, Manrope, Arial, sans-serif;
    isolation: isolate;
}

.viit-image-editor__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 8, 20, .82);
    backdrop-filter: blur(7px);
}

.viit-image-editor__panel {
    position: relative;
    z-index: 1;
    width: min(940px, 100%);
    max-height: calc(100dvh - 36px);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 20px;
    background: #f7f9fc;
    box-shadow: 0 32px 100px rgba(0, 0, 0, .48);
}

.viit-image-editor__header,
.viit-image-editor__footer {
    position: relative;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 18px;
    background: #fff;
}

.viit-image-editor__header { border-bottom: 1px solid #e3e8f0; }
.viit-image-editor__footer { justify-content: flex-end; border-top: 1px solid #e3e8f0; }
.viit-image-editor__header small { display: block; color: var(--crop-accent); font-size: 9px; font-weight: 900; letter-spacing: .15em; }
.viit-image-editor__header h2 { margin: 3px 0 0; color: #182236; font-size: 20px; font-weight: 900; }

.viit-image-editor button {
    border: 0;
    font: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.viit-image-editor__close {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    flex: 0 0 40px;
    border: 1px solid #d9e0ea !important;
    border-radius: 12px;
    color: #3b4659;
    background: #f5f7fa;
    font-size: 18px !important;
}

.viit-image-editor__body {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 14px 18px 16px;
}

.viit-image-editor__body > p {
    margin: 0 0 10px;
    color: #536075;
    text-align: center;
    font-size: 12px;
    font-weight: 650;
}

.viit-image-editor__workspace {
    position: relative;
    width: min(100%, 800px);
    aspect-ratio: 16 / 10;
    max-height: 58dvh;
    margin: 0 auto;
    overflow: hidden;
    border: 1px solid #263348;
    border-radius: 14px;
    background: #101827;
    box-shadow: 0 14px 36px rgba(9, 18, 34, .24);
}

.viit-image-editor__workspace canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.viit-image-editor__workspace canvas.is-dragging { cursor: grabbing; }

.viit-image-editor__ratio {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 6px 9px;
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 7px;
    color: #fff;
    background: rgba(8, 15, 29, .72);
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .08em;
    pointer-events: none;
}

.viit-image-editor__controls {
    width: min(100%, 720px);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    margin: 12px auto 0;
}

.viit-image-editor__controls button {
    min-width: 42px;
    height: 40px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid #d5dce7;
    border-radius: 10px;
    color: #344055;
    background: #fff;
    font-size: 12px;
    font-weight: 800;
}

.viit-image-editor__controls label {
    min-width: 230px;
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--crop-accent);
}

.viit-image-editor__controls input { width: 100%; accent-color: var(--crop-accent); }

.viit-image-editor__note {
    width: min(100%, 720px);
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 10px auto 0;
    padding: 8px 12px;
    border: 1px solid #bee6d0;
    border-radius: 9px;
    color: #12653d;
    background: #effaf4;
    font-size: 10px;
    font-weight: 700;
    text-align: center;
}

.viit-image-editor__footer button {
    min-height: 42px;
    padding: 9px 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 900;
}

.viit-image-editor__footer .is-cancel { border: 1px solid #ccd4df; color: #465267; background: #fff; }
.viit-image-editor__footer .is-save { min-width: 155px; color: #fff; background: linear-gradient(125deg, #710023, #b40042); box-shadow: 0 8px 20px rgba(143, 0, 48, .22); }
.viit-image-editor__footer button:disabled { opacity: .65; cursor: wait; }

html[data-bs-theme=dark] .viit-image-editor__panel,
[data-site-theme=dark] .viit-image-editor__panel { color: #ecf2fa; background: #091321; }
html[data-bs-theme=dark] .viit-image-editor__header,
html[data-bs-theme=dark] .viit-image-editor__footer,
[data-site-theme=dark] .viit-image-editor__header,
[data-site-theme=dark] .viit-image-editor__footer { border-color: #263346; background: #0d1827; }
html[data-bs-theme=dark] .viit-image-editor__header h2,
[data-site-theme=dark] .viit-image-editor__header h2 { color: #f4f7fb; }
html[data-bs-theme=dark] .viit-image-editor__body > p,
[data-site-theme=dark] .viit-image-editor__body > p { color: #b5c0d0; }
html[data-bs-theme=dark] .viit-image-editor__controls button,
[data-site-theme=dark] .viit-image-editor__controls button { border-color: #314157; color: #e3ebf6; background: #122033; }
html[data-bs-theme=dark] .viit-image-editor__note,
[data-site-theme=dark] .viit-image-editor__note { border-color: #22523d; color: #9ee3be; background: #0c251c; }

@media (max-width: 680px) {
    .viit-image-editor { padding: 6px; }
    .viit-image-editor__panel { width: 100%; max-height: calc(100dvh - 12px); border-radius: 15px; }
    .viit-image-editor__header { padding: 10px 12px; }
    .viit-image-editor__header h2 { font-size: 16px; }
    .viit-image-editor__close { width: 37px; height: 37px; flex-basis: 37px; }
    .viit-image-editor__body { padding: 10px 9px; }
    .viit-image-editor__body > p { margin-bottom: 8px; font-size: 10px; }
    .viit-image-editor__workspace { width: 100%; max-height: 53dvh; border-radius: 11px; }
    .viit-image-editor__controls { display: grid; grid-template-columns: 39px minmax(0, 1fr) 39px 48px 48px; gap: 6px; margin-top: 9px; }
    .viit-image-editor__controls label { min-width: 0; gap: 5px; }
    .viit-image-editor__controls label i { display: none; }
    .viit-image-editor__controls button { min-width: 0; width: 100%; height: 38px; padding: 0; }
    .viit-image-editor__controls button span { display: none; }
    .viit-image-editor__note { margin-top: 8px; padding: 7px 9px; font-size: 9px; }
    .viit-image-editor__footer { padding: 9px 11px; }
    .viit-image-editor__footer button { min-height: 40px; padding: 8px 13px; }
    .viit-image-editor__footer .is-save { min-width: 145px; }
}

@media (max-height: 620px) and (orientation: landscape) {
    .viit-image-editor { padding: 4px; }
    .viit-image-editor__panel { max-height: calc(100dvh - 8px); }
    .viit-image-editor__header { padding: 7px 12px; }
    .viit-image-editor__header small, .viit-image-editor__body > p, .viit-image-editor__note { display: none; }
    .viit-image-editor__body { padding: 7px 10px; }
    .viit-image-editor__workspace { max-height: 58dvh; width: min(76%, 720px); }
    .viit-image-editor__controls { margin-top: 6px; }
    .viit-image-editor__footer { padding: 6px 10px; }
}
