/* Local image cropper */
.local-crop-tool-card {
    isolation: isolate;
    background: linear-gradient(145deg, rgba(245, 243, 255, .97), rgba(250, 245, 255, .93)) !important;
    border-color: rgba(167, 139, 250, .36) !important;
}

.local-crop-tool-card::after {
    background:
        radial-gradient(340px 150px at 92% 0%, rgba(167, 139, 250, .22), transparent 62%),
        radial-gradient(240px 130px at 0% 100%, rgba(216, 180, 254, .13), transparent 64%) !important;
}

.local-crop-free-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    height: 18px;
    padding: 0 7px;
    border: 1px solid rgba(167, 139, 250, .36);
    border-radius: 999px;
    color: #6d28d9;
    background: rgba(255, 255, 255, .80);
    font-size: 8px;
    font-weight: 900;
    letter-spacing: .04em;
    box-shadow: 0 5px 14px rgba(109, 40, 217, .08);
}

#localCropModal.hidden,
.local-crop-panel .hidden { display: none !important; }

.local-crop-panel {
    border: 1px solid rgba(255, 255, 255, .86);
    border-radius: 28px;
    background:
        radial-gradient(850px 420px at 6% -8%, rgba(196, 181, 253, .25), transparent 62%),
        radial-gradient(760px 440px at 100% 0%, rgba(221, 214, 254, .17), transparent 65%),
        rgba(250, 249, 253, .985);
    box-shadow: 0 38px 110px rgba(30, 24, 42, .34), inset 0 1px 0 rgba(255, 255, 255, .96);
    animation: localCropEnter .24s cubic-bezier(.2, .8, .2, 1) both;
}

@keyframes localCropEnter {
    from { opacity: 0; transform: translateY(10px) scale(.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.local-crop-header {
    min-height: 74px;
    padding: 14px 18px 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid rgba(221, 214, 238, .82);
    background: rgba(255, 255, 255, .72);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.local-crop-brand-icon {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(196, 181, 253, .42);
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(145deg, #a78bfa, #7c3aed 58%, #5b21b6);
    box-shadow: 0 10px 25px rgba(109, 40, 217, .24), inset 0 1px 0 rgba(255, 255, 255, .28);
}

.local-crop-private-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 21px;
    padding: 0 8px;
    border: 1px solid rgba(52, 211, 153, .28);
    border-radius: 999px;
    color: #047857;
    background: rgba(236, 253, 245, .88);
    font-size: 9px;
    font-weight: 800;
}

.local-crop-close,
.local-crop-mini-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(221, 214, 238, .92);
    color: #7b708e;
    background: rgba(255, 255, 255, .88);
    transition: color .18s ease, border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.local-crop-close {
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    border-radius: 999px;
    box-shadow: 0 8px 20px rgba(41, 34, 56, .07);
}

.local-crop-mini-btn {
    width: 29px;
    height: 29px;
    flex: 0 0 auto;
    border-radius: 9px;
    font-size: 9px;
}

.local-crop-close:hover,
.local-crop-mini-btn:hover {
    color: #5b21b6;
    border-color: rgba(139, 92, 246, .38);
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(76, 29, 149, .10);
}

.local-crop-mini-btn.is-delete { color: #a54b62; }
.local-crop-mini-btn.is-delete:hover { color: #be123c; border-color: rgba(244, 63, 94, .30); background: #fff1f2; }

.local-crop-body {
    min-height: 0;
    flex: 1;
    display: grid;
    grid-template-columns: 294px minmax(0, 1fr);
}

.local-crop-sidebar {
    min-height: 0;
    overflow-y: auto;
    padding: 17px;
    border-right: 1px solid rgba(221, 214, 238, .82);
    background: rgba(248, 246, 252, .78);
}

.local-crop-upload-zone {
    position: relative;
    width: 100%;
    min-height: 330px;
    padding: 26px 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px dashed rgba(139, 92, 246, .46);
    border-radius: 22px;
    background:
        radial-gradient(260px 140px at 50% 0%, rgba(196, 181, 253, .19), transparent 66%),
        rgba(255, 255, 255, .78);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .96), 0 15px 35px rgba(62, 48, 92, .05);
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.local-crop-upload-zone::before,
.local-crop-upload-zone::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.local-crop-upload-zone::before { width: 120px; height: 120px; left: -68px; bottom: -74px; background: rgba(167, 243, 208, .16); }
.local-crop-upload-zone::after { width: 84px; height: 84px; right: -44px; top: -42px; background: rgba(216, 180, 254, .18); }

.local-crop-upload-zone:hover,
.local-crop-upload-zone.is-dragging {
    transform: translateY(-2px);
    border-color: rgba(109, 40, 217, .72);
    background: rgba(255, 255, 255, .97);
    box-shadow: 0 18px 42px rgba(76, 29, 149, .11);
}

.local-crop-upload-icon {
    width: 62px;
    height: 62px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(196, 181, 253, .76);
    border-radius: 19px;
    color: #6d28d9;
    background: linear-gradient(145deg, #fff, #f4f0ff);
    font-size: 21px;
    box-shadow: 0 14px 30px rgba(109, 40, 217, .13);
}

.local-crop-upload-zone strong { margin-top: 18px; color: #302746; font-size: 14px; font-weight: 900; }
.local-crop-upload-zone small { margin-top: 8px; color: #938aa5; font-size: 9px; font-weight: 600; line-height: 1.7; }

.local-crop-upload-cta {
    min-height: 33px;
    margin-top: 18px;
    padding: 0 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border-radius: 999px;
    color: white;
    background: #17131f;
    font-size: 9px;
    font-weight: 900;
    box-shadow: 0 12px 25px rgba(23, 19, 31, .18);
}

.local-crop-file-card,
.local-crop-control-card,
.local-crop-info-card {
    border: 1px solid rgba(221, 214, 238, .86);
    border-radius: 16px;
    background: rgba(255, 255, 255, .82);
    box-shadow: 0 10px 26px rgba(43, 34, 62, .04);
}

.local-crop-file-card {
    min-height: 64px;
    padding: 8px;
    display: flex;
    align-items: center;
    gap: 7px;
}

.local-crop-file-thumb {
    width: 46px;
    height: 46px;
    flex: 0 0 auto;
    overflow: hidden;
    border-radius: 10px;
    background: #eeeaf5;
}

.local-crop-file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.local-crop-control-card { padding: 12px; }

.local-crop-control-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: #302746;
    font-size: 11px;
    font-weight: 900;
}

.local-crop-control-title b {
    min-height: 20px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    color: #6d28d9;
    background: #f1ecff;
    font-size: 8px;
}

.local-crop-ratio-options {
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
}

.local-crop-ratio-options button,
.local-crop-format-options button,
.local-crop-transform-grid button {
    border: 1px solid rgba(221, 214, 238, .88);
    color: #82788f;
    background: rgba(250, 249, 253, .86);
    font-weight: 800;
    transition: color .18s ease, border-color .18s ease, background .18s ease, transform .18s ease;
}

.local-crop-ratio-options button {
    min-height: 31px;
    border-radius: 9px;
    font-size: 8px;
}

.local-crop-ratio-options button:hover,
.local-crop-ratio-options button.is-active,
.local-crop-format-options button:hover,
.local-crop-format-options button.is-active {
    color: #5b21b6;
    border-color: rgba(139, 92, 246, .32);
    background: #f4f0ff;
}

.local-crop-range {
    --range-progress: 0%;
    width: 100%;
    height: 4px;
    border: none;
    border-radius: 999px;
    appearance: none;
    -webkit-appearance: none;
    background: linear-gradient(90deg, #8b5cf6 var(--range-progress), #e8e3ef var(--range-progress));
    cursor: pointer;
}

.local-crop-range::-webkit-slider-thumb {
    width: 16px;
    height: 16px;
    appearance: none;
    -webkit-appearance: none;
    border: 3px solid white;
    border-radius: 50%;
    background: #6d28d9;
    box-shadow: 0 3px 10px rgba(76, 29, 149, .30);
}

.local-crop-range::-moz-range-thumb { width: 12px; height: 12px; border: 3px solid white; border-radius: 50%; background: #6d28d9; }

.local-crop-transform-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.local-crop-transform-grid button { min-height: 47px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border-radius: 9px; font-size: 8px; }
.local-crop-transform-grid button i { color: #6d28d9; font-size: 10px; }
.local-crop-transform-grid button:hover { transform: translateY(-1px); color: #5b21b6; border-color: rgba(139, 92, 246, .28); background: #f7f4ff; }

.local-crop-format-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.local-crop-format-options button { min-height: 32px; border-radius: 9px; font-size: 8px; }

.local-crop-info-card {
    padding: 11px;
    display: flex;
    align-items: flex-start;
    gap: 9px;
    color: #82788f;
    background: linear-gradient(145deg, rgba(236, 253, 245, .84), rgba(255, 255, 255, .80));
    font-size: 8.5px;
    line-height: 1.55;
}

.local-crop-info-card > i { width: 26px; height: 26px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; border-radius: 9px; color: #059669; background: white; }
.local-crop-info-card strong { color: #246c56; font-size: 9px; }

.local-crop-workspace {
    min-width: 0;
    min-height: 0;
    padding: 17px 20px 16px;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, .45);
}

.local-crop-toolbar,
.local-crop-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.local-crop-toolbar { min-height: 36px; margin-bottom: 10px; }

.local-crop-gesture-hint {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 27px;
    padding: 0 10px;
    border: 1px solid rgba(196, 181, 253, .28);
    border-radius: 999px;
    color: #71657f;
    background: rgba(245, 243, 255, .82);
    font-size: 8px;
    font-weight: 800;
}

.local-crop-stage {
    position: relative;
    min-height: 0;
    flex: 1;
    overflow: hidden;
    border: 1px solid rgba(73, 64, 88, .74);
    border-radius: 22px;
    background-color: #201b2a;
    background-image:
        linear-gradient(45deg, rgba(255, 255, 255, .025) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(255, 255, 255, .025) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, .025) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, .025) 75%);
    background-size: 24px 24px;
    background-position: 0 0, 0 12px, 12px -12px, -12px 0;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 18px 46px rgba(35, 27, 49, .16);
    touch-action: none;
}

.local-crop-empty-state {
    position: absolute;
    inset: 0;
    z-index: 6;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    color: #c9c1d5;
    text-align: center;
    background: radial-gradient(480px 250px at 50% 46%, rgba(139, 92, 246, .13), transparent 66%);
}

.local-crop-empty-icon {
    width: 82px;
    height: 82px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(196, 181, 253, .26);
    border-radius: 26px;
    color: #c4b5fd;
    background: linear-gradient(145deg, rgba(139, 92, 246, .20), rgba(76, 29, 149, .14));
    font-size: 26px;
    box-shadow: 0 22px 50px rgba(0, 0, 0, .18), inset 0 1px 0 rgba(255, 255, 255, .08);
}

.local-crop-empty-state h3 { margin-top: 18px; color: #f4f0fa; font-size: 16px; font-weight: 900; }
.local-crop-empty-state p { margin-top: 7px; color: #a99fb7; font-size: 9px; font-weight: 600; }

.local-crop-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

.local-crop-frame {
    position: absolute;
    z-index: 4;
    border: 1.5px solid rgba(255, 255, 255, .96);
    box-shadow: 0 0 0 9999px rgba(10, 8, 14, .57), 0 0 0 1px rgba(124, 58, 237, .58), 0 10px 35px rgba(0, 0, 0, .20);
    cursor: grab;
    touch-action: none;
    outline: none;
}

.local-crop-frame.is-panning { cursor: grabbing; }
.local-crop-frame:focus-visible { box-shadow: 0 0 0 9999px rgba(10, 8, 14, .57), 0 0 0 3px rgba(167, 139, 250, .95), 0 10px 35px rgba(0, 0, 0, .20); }

.local-crop-grid-lines {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: .56;
    background-image:
        linear-gradient(90deg, transparent 33.1%, rgba(255, 255, 255, .58) 33.3%, rgba(255, 255, 255, .58) 33.6%, transparent 33.8%, transparent 66.3%, rgba(255, 255, 255, .58) 66.5%, rgba(255, 255, 255, .58) 66.8%, transparent 67%),
        linear-gradient(0deg, transparent 33.1%, rgba(255, 255, 255, .58) 33.3%, rgba(255, 255, 255, .58) 33.6%, transparent 33.8%, transparent 66.3%, rgba(255, 255, 255, .58) 66.5%, rgba(255, 255, 255, .58) 66.8%, transparent 67%);
}

.local-crop-frame > i {
    position: absolute;
    width: 18px;
    height: 18px;
    border-color: white;
    border-style: solid;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .35));
}

.local-crop-frame > i::after { content: ""; position: absolute; width: 34px; height: 34px; inset: -9px; }
.local-crop-frame > i.is-nw { left: -2px; top: -2px; border-width: 3px 0 0 3px; cursor: nwse-resize; }
.local-crop-frame > i.is-ne { right: -2px; top: -2px; border-width: 3px 3px 0 0; cursor: nesw-resize; }
.local-crop-frame > i.is-sw { left: -2px; bottom: -2px; border-width: 0 0 3px 3px; cursor: nesw-resize; }
.local-crop-frame > i.is-se { right: -2px; bottom: -2px; border-width: 0 3px 3px 0; cursor: nwse-resize; }

.local-crop-footer {
    min-height: 62px;
    padding-top: 12px;
    border-top: 1px solid rgba(221, 214, 238, .76);
}

.local-crop-secondary-button,
.local-crop-action-button {
    min-height: 42px;
    padding: 0 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 13px;
    font-size: 10px;
    font-weight: 900;
    transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}

.local-crop-secondary-button { border: 1px solid rgba(221, 214, 238, .90); color: #756a85; background: rgba(255, 255, 255, .84); }
.local-crop-action-button { min-width: 196px; color: white; background: linear-gradient(135deg, #7c3aed, #5b21b6); box-shadow: 0 14px 30px rgba(91, 33, 182, .24); }
.local-crop-secondary-button:hover:not(:disabled), .local-crop-action-button:hover:not(:disabled) { transform: translateY(-2px); }
.local-crop-action-button:hover:not(:disabled) { box-shadow: 0 18px 36px rgba(91, 33, 182, .30); }
.local-crop-secondary-button:disabled, .local-crop-action-button:disabled { opacity: .38; cursor: not-allowed; transform: none; box-shadow: none; }

@media (max-width: 900px) {
    .local-crop-body { grid-template-columns: 260px minmax(0, 1fr); }
    .local-crop-sidebar { padding: 14px; }
    .local-crop-workspace { padding: 14px; }
    .local-crop-gesture-hint { display: none; }
}

@media (max-width: 700px) {
    #localCropModal { overflow-y: auto; }
    .local-crop-panel { height: auto !important; min-height: calc(100vh - 24px); border-radius: 22px; }
    .local-crop-header { min-height: 64px; padding: 11px 12px; }
    .local-crop-brand-icon { width: 36px; height: 36px; border-radius: 12px; }
    .local-crop-private-pill { display: none; }
    .local-crop-body { display: flex; flex-direction: column; }
    .local-crop-sidebar { overflow: visible; border-right: none; border-bottom: 1px solid rgba(221, 214, 238, .82); }
    .local-crop-upload-zone { min-height: 190px; }
    .local-crop-workspace { min-height: 610px; }
    .local-crop-stage { min-height: 480px; }
    .local-crop-footer { gap: 8px; }
    .local-crop-secondary-button { padding: 0 12px; }
    .local-crop-action-button { min-width: 0; flex: 1; padding: 0 13px; }
}

@media (max-width: 420px) {
    .local-crop-workspace { min-height: 545px; }
    .local-crop-stage { min-height: 410px; border-radius: 18px; }
    .local-crop-secondary-button { font-size: 0; }
    .local-crop-secondary-button i { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
    .local-crop-panel { animation: none !important; }
}
