/* 編輯器黑色遮罩 */
.img-editor-overlay {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.img-editor-container {
    background: #1e293b;
    border-radius: 20px;
    width: 95%;
    max-width: 1000px;
    height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

.img-editor-header {
    height: 52px;
    padding: 0 20px;
    background: #0f172a;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.img-editor-header h3 { margin: 0; font-size: 16px; }
.img-editor-close { background: none; border: none; color: #94a3b8; font-size: 24px; cursor: pointer; }

/* 舞台區 */
.img-editor-stage {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #090d16;
    overflow: hidden;
    padding: 20px;
}
#editorCanvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    box-shadow: 0 8px 30px rgba(0,0,0,0.6);
}

/* 工具列 */
.img-editor-toolbar {
    background: #0f172a;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    color: #e2e8f0;
}
.toolbar-group { display: flex; align-items: center; gap: 8px; }
.toolbar-divider { width: 1px; height: 24px; background: rgba(255,255,255,0.2); }
.tool-btn {
    background: #334155;
    border: none;
    color: #fff;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: 0.2s;
}
.tool-btn:hover:not(:disabled) { background: #475569; }
.tool-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.slider-group label {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.slider-group input[type="range"] {
    width: 90px;
    accent-color: #10b981;
}

.toolbar-actions-right {
    margin-left: auto;
    display: flex;
    gap: 10px;
}
.btn-editor-cancel {
    background: #475569;
    border: none;
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
}
.btn-editor-confirm {
    background: #10b981;
    border: none;
    color: #fff;
    padding: 8px 18px;
    border-radius: 20px;
    font-weight: bold;
    cursor: pointer;
}
.btn-editor-confirm:hover { background: #059669; }

/* 裁切容器與自適應畫布 */
.canvas-wrapper {
    position: relative;
    display: inline-block;
    max-width: 100%;
    max-height: 100%;
}

#editorCanvas {
    display: block;
    max-width: 100%;
    max-height: calc(88vh - 140px);
    object-fit: contain;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
}

/* 裁切覆蓋層 */
.crop-overlay {
    position: absolute;
    inset: 0;
    cursor: crosshair;
    user-select: none;
    z-index: 10;
}

/* 裁切框與半透明遮罩 */
.crop-box {
    position: absolute;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.6);
    border: 2px dashed #ffffff;
    cursor: move;
    box-sizing: border-box;
}

/* 四角定位點標記 */
.crop-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #38bdf8;
    border: 1px solid #fff;
}
.crop-handle.tl { top: -5px; left: -5px; }
.crop-handle.tr { top: -5px; right: -5px; }
.crop-handle.bl { bottom: -5px; left: -5px; }
.crop-handle.br { bottom: -5px; right: -5px; }

/* 即時尺寸提示小標籤 */
.crop-size-hint {
    position: absolute;
    bottom: -24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.75);
    color: #ffffff;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
    transition: background 0.2s ease;
}

/* 裁切按鈕啟用狀態樣式 */
.tool-btn.active {
    background: #0284c7 !important;
    color: #ffffff !important;
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.6);
}

.angle-display-fixed {
    display: inline-block;
    width: 44px;              /* 💡 剛好容納 "+45.0°" 或 "-45.0°" 的固定寬度 */
    text-align: right;        /* 數字靠右對齊，滑桿左側位置絕不變動 */
    font-variant-numeric: tabular-nums; /* 等寬數字字型，避免 1 比 8 窄產生微抖動 */
    margin-right: 6px;        /* 與滑桿保持固定間距 */
}