/* 动画编辑器样式 */
#animation-editor-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #1a1a1a;
    z-index: 9999;
    display: none; /* 默认隐藏 */
    color: #eee;
    font-family: 'Noto Sans SC', sans-serif;
    overflow: hidden;
    user-select: none;
}

#animation-editor-layer.active {
    display: flex;
    flex-direction: column;
}

/* 顶部工具栏 */
.ae-toolbar {
    height: 40px;
    background-color: #2a2a2a;
    border-bottom: 1px solid #444;
    display: flex;
    align-items: center;
    padding: 0 10px;
    gap: 10px;
}

.ae-btn {
    background-color: #333;
    border: 1px solid #555;
    color: #ccc;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 12px;
    border-radius: 2px;
}

.ae-btn:hover {
    background-color: #444;
    color: #fff;
}

.ae-btn.active {
    background-color: #555;
    border-color: #777;
}

.ae-separator {
    width: 1px;
    height: 20px;
    background-color: #444;
    margin: 0 5px;
}

/* 主体区域 */
.ae-main {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* 左侧面板 (图层) */
.ae-panel-left {
    width: 200px;
    background-color: #222;
    border-right: 1px solid #444;
    display: flex;
    flex-direction: column;
}

.ae-panel-header {
    padding: 8px;
    background-color: #2a2a2a;
    font-size: 12px;
    font-weight: bold;
    border-bottom: 1px solid #444;
}

.ae-layer-list {
    flex: 1;
    overflow-y: auto;
}

.ae-layer-item {
    padding: 8px 10px;
    border-bottom: 1px solid #333;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ae-layer-item:hover {
    background-color: #2a2a2a;
}

.ae-layer-item.selected {
    background-color: #3a4a5a;
    border-left: 3px solid #4a90e2;
}

.ae-layer-item.dragging {
    opacity: 0.5;
    background-color: #444;
}

.ae-layer-item.drag-over {
    border-top: 2px solid #4a90e2;
}

/* 拖拽句柄 */
.ae-drag-handle {
    width: 16px;
    height: 16px;
    margin-right: 5px;
    cursor: grab;
    background-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" fill="%23888" xmlns="http://www.w3.org/2000/svg"><path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"/></svg>');
    background-size: contain;
}

.ae-layer-visibility {
    width: 16px;
    height: 16px;
    cursor: pointer;
    opacity: 0.5;
}

.ae-layer-visibility.visible {
    opacity: 1;
}

/* 中间画布 */
.ae-canvas-area {
    flex: 1;
    background-color: #111;
    position: relative;
    overflow: hidden;
    display: block; /* 改为 block 以便绝对定位 canvas */
}

#ae-canvas-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

#ae-canvas-wrapper {
    /* 移除内联样式中的固定尺寸和 transform，改为由 JS 控制 */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform-origin: 0 0;
}

/* 画布层级 */
#ae-canvas-bg, #ae-canvas-img, #ae-canvas-vfx, #ae-canvas-ui {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#ae-canvas-bg { z-index: 1; }
#ae-canvas-img { z-index: 2; }
#ae-canvas-vfx { z-index: 3; pointer-events: none; }
#ae-canvas-ui { z-index: 4; } /* UI 层接收事件 */

/* 右侧面板 (属性) */
.ae-panel-right {
    width: 240px;
    background-color: #222;
    border-left: 1px solid #444;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.ae-property-group {
    padding: 10px;
    border-bottom: 1px solid #333;
}

.ae-property-row {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.ae-property-label {
    width: 70px;
    font-size: 12px;
    color: #aaa;
}

.ae-property-input {
    flex: 1;
    background-color: #333;
    border: 1px solid #444;
    color: #eee;
    padding: 4px;
    font-size: 12px;
    width: 100%;
}

.ae-property-input:focus {
    border-color: #4a90e2;
    outline: none;
}

/* 底部时间轴 */
.ae-timeline {
    height: 150px;
    background-color: #222;
    border-top: 1px solid #444;
    display: flex;
    flex-direction: column;
}

.ae-timeline-header {
    height: 30px;
    background-color: #2a2a2a;
    border-bottom: 1px solid #444;
    display: flex;
    align-items: center;
    padding: 0 10px;
}

.ae-timeline-tracks {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
}

.ae-timeline-ruler {
    height: 20px;
    background-color: #333;
    position: relative;
    cursor: pointer;
}

.ae-playhead {
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 100%;
    background-color: #e74c3c;
    z-index: 10;
    pointer-events: none;
}

.ae-playhead-handle {
    position: absolute;
    top: 0;
    left: -5px;
    width: 10px;
    height: 20px;
    background-color: #e74c3c;
    cursor: ew-resize;
    pointer-events: auto;
}

.ae-keyframe {
    position: absolute;
    width: 8px;
    height: 8px;
    background-color: #f1c40f;
    transform: rotate(45deg);
    margin-top: 6px;
    cursor: pointer;
    border: 1px solid #000;
}

.ae-keyframe.selected {
    background-color: #fff;
    border-color: #e74c3c;
}

.ae-track {
    height: 24px;
    border-bottom: 1px solid #333;
    position: relative;
}

.ae-track.selected {
    background-color: #2c3e50;
}

/* 提示信息 */
.ae-toast {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0,0,0,0.8);
    color: #fff;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 12px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.ae-toast.show {
    opacity: 1;
}