.media-editor-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    font-family: 'Segoe UI', Arial, sans-serif;
    background-color: var(--neutral-900);
    color: var(--text-primary);
    user-select: none;
    position: relative;
    overflow: hidden;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--neutral-900);
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-muted);
    transition: opacity 0.2s;
    pointer-events: none;
}

.loading-overlay.hidden {
    opacity: 0;
}

/* Stage Area */
.media-stage-section {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    min-height: 0;
    background: var(--shade-black);
    overflow: hidden;
}

.media-display-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--shade-black);
    overflow: hidden;
    position: relative;
    cursor: grab;
}

.media-display-wrapper.panning {
    cursor: grabbing;
}

.media-layer {
    position: absolute;
    overflow: hidden;
    visibility: hidden;
    pointer-events: none;
}

.media-display {
    display: block;
    width: 100%;
    height: 100%;
    transform-origin: center center;
    object-fit: fill;
    will-change: transform;
}

/* Crop Box */
.crop-box {
    position: absolute;
    border: 2px solid var(--accent-main);
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
    cursor: move;
    z-index: 100;
    box-sizing: border-box;
    pointer-events: auto;
}

.crop-grid,
.crop-grid::before,
.crop-grid::after {
    position: absolute;
    content: '';
    pointer-events: none;
    box-sizing: border-box;
}

.crop-grid {
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.crop-grid::before {
    top: 33.33%;
    left: 0;
    width: 100%;
    height: 33.33%;
    border-top: 1px dotted rgba(255, 255, 255, 0.5);
    border-bottom: 1px dotted rgba(255, 255, 255, 0.5);
}

.crop-grid::after {
    top: 0;
    left: 33.33%;
    width: 33.33%;
    height: 100%;
    border-left: 1px dotted rgba(255, 255, 255, 0.5);
    border-right: 1px dotted rgba(255, 255, 255, 0.5);
}

.crop-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--accent-main);
    border-radius: 50%;
    z-index: 101;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.25);
    pointer-events: auto;
}

.handle-tl {
    top: -7px;
    left: -7px;
    cursor: nwse-resize;
}

.handle-tr {
    top: -7px;
    right: -7px;
    cursor: nesw-resize;
}

.handle-bl {
    bottom: -7px;
    left: -7px;
    cursor: nesw-resize;
}

.handle-br {
    bottom: -7px;
    right: -7px;
    cursor: nwse-resize;
}

.handle-tm {
    top: -7px;
    left: 50%;
    margin-left: -7px;
    cursor: ns-resize;
}

.handle-bm {
    bottom: -7px;
    left: 50%;
    margin-left: -7px;
    cursor: ns-resize;
}

.handle-lm {
    left: -7px;
    top: 50%;
    margin-top: -7px;
    cursor: ew-resize;
}

.handle-rm {
    right: -7px;
    top: 50%;
    margin-top: -7px;
    cursor: ew-resize;
}

/* Controls Area */
.controls-area {
    background: var(--neutral-800);
    border-top: 1px solid var(--border-default);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    padding: 10px;
}

.control-bar-top {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: var(--font-size-body-lg);
    cursor: pointer;
    padding: 5px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    color: var(--shade-white);
    transform: scale(1.1);
}

.play-btn {
    font-size: var(--font-size-h3);
}

.icon-btn.active {
    color: var(--accent-main);
}

.time-display {
    font-family: monospace;
    font-size: var(--font-size-ui-sm);
    color: var(--text-secondary);
    min-width: 80px;
    text-align: center;
}

.scrubber-container {
    flex-grow: 1;
    height: 6px;
    background: var(--neutral-700);
    border-radius: 3px;
    position: relative;
    cursor: pointer;
}

.scrubber-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--accent-main);
    border-radius: 3px;
    width: 0%;
    pointer-events: none;
}

.scrubber-thumb {
    position: absolute;
    top: 50%;
    width: 14px;
    height: 14px;
    background: var(--shade-white);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    left: 0%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.volume-slider {
    width: 60px;
    height: 4px;
    border-radius: 2px;
    cursor: pointer;
}

.param-section {
    display: flex;
    justify-content: center;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    background: var(--neutral-800);
    padding: 8px;
    border-radius: 4px;
}

.param-section .param-group {
    display: flex;
    flex-direction: row;
    align-items: center;
    font-size: var(--font-size-ui-md);
    color: var(--text-secondary);
    border: none;
    margin-bottom: 0;
    width: auto;
}

.param-input {
    width: 55px;
    margin-left: 5px;
    background: var(--neutral-900);
    color: var(--shade-white);
    border: 1px solid var(--border-default);
    text-align: center;
    border-radius: 3px;
    padding: 3px;
}

input[type=range] {
    vertical-align: middle;
    accent-color: var(--accent-main);
}