* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #0b0f19;
    color: #f1f5f9;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 1rem;
}

.editor-wrapper {
    width: 100%;
    flex-grow: 1;
    background-color: #1e293b;
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    padding: 1.5rem;
    border: 1px solid #334155;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #818cf8;
    text-align: center;
}

.top-workspace {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1.5rem;
}

@media (max-width: 900px) {
    .top-workspace {
        grid-template-columns: 1fr;
    }
}

.media-library-panel {
    background-color: rgba(15, 23, 42, 0.6);
    border: 1px solid #334155;
    border-radius: 0.75rem;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 450px;
    overflow-y: auto;
}

.media-library-panel h3 {
    font-size: 0.95rem;
    color: #cbd5e1;
}

.upload-btn-label {
    background-color: #4f46e5;
    color: white;
    text-align: center;
    padding: 0.6rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.upload-btn-label:hover {
    background-color: #4338ca;
}

.hidden-input {
    display: none;
}

.media-pool {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.empty-pool-text {
    font-size: 0.75rem;
    color: #64748b;
    text-align: center;
    padding: 1rem 0;
}

.media-item {
    background-color: #334155;
    padding: 0.6rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid transparent;
}

.media-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 170px;
}

.media-item-btns {
    display: flex;
    gap: 6px;
}

.media-item button {
    background: #4f46e5;
    border: none;
    color: white;
    padding: 0.3rem 0.5rem;
    border-radius: 0.3rem;
    cursor: pointer;
    font-size: 0.75rem;
}

.preview-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.preview-area {
    position: relative;
    background-color: #000;
    border-radius: 0.75rem;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 400px;
    border: 1px solid #334155;
}

.preview-area canvas {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
}

.controls-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: rgba(15, 23, 42, 0.6);
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    border: 1px solid #334155;
    gap: 1rem;
}

.controls-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-grow: 1;
}

.controls-right-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-primary {
    background-color: #4f46e5;
    color: white;
    border: none;
    padding: 0.5rem 1.2rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.btn-primary:hover {
    background-color: #4338ca;
}

.seek-slider {
    flex-grow: 1;
    min-width: 150px;
    accent-color: #4f46e5;
    cursor: pointer;
}

.btn-secondary {
    background-color: #334155;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
}

.btn-secondary:hover {
    background-color: #475569;
}

.time-display {
    font-family: monospace;
    font-size: 0.9rem;
    color: #cbd5e1;
    white-space: nowrap;
}

.timeline-container {
    background-color: rgba(15, 23, 42, 0.7);
    border: 1px solid #334155;
    border-radius: 0.75rem;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.timeline-header h3 {
    font-size: 0.95rem;
    color: #cbd5e1;
}

.timeline-scroll-area {
    position: relative;
    background-color: #0f172a;
    border-radius: 0.5rem;
    border: 1px solid #334155;
    overflow-x: auto;
    overflow-y: auto;
    max-height: 300px;
    min-height: 180px;
    padding: 24px 0 10px 0;
}

.timeline-ruler {
    position: absolute;
    top: 0;
    left: 0;
    height: 22px;
    width: 4000px;
    background: #1e293b;
    border-bottom: 1px solid #334155;
    font-size: 10px;
    color: #64748b;
    display: flex;
    align-items: center;
    padding-left: 120px;
}

.tracks-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 4000px;
}

.track {
    position: relative;
    height: 48px;
    background: rgba(30, 41, 59, 0.4);
    border-bottom: 1px dashed rgba(51, 65, 85, 0.4);
    display: flex;
    align-items: center;
}

.track-header {
    position: sticky;
    left: 0;
    width: 120px;
    height: 100%;
    background: #1e293b;
    border-right: 1px solid #334155;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-left: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #94a3b8;
    z-index: 10;
    gap: 2px;
}

.track-header-actions {
    display: flex;
    gap: 6px;
}

.track-header-actions button {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    font-size: 0.75rem;
}

.track-header-actions button:hover {
    color: white;
}

.track-clips-area {
    position: relative;
    height: 100%;
    flex-grow: 1;
}

.clip {
    position: absolute;
    top: 6px;
    height: 36px;
    background: #4f46e5;
    border-radius: 4px;
    border: 1px solid #818cf8;
    color: white;
    font-size: 0.75rem;
    padding: 0 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    overflow: hidden;
    white-space: nowrap;
}

.clip.selected {
    border-color: #38bdf8;
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.6);
}

.clip-resize-handle {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 8px;
    background: rgba(255, 255, 255, 0.3);
    cursor: ew-resize;
}

.playhead {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 120px;
    width: 2px;
    background: #ef4444;
    z-index: 20;
    pointer-events: none;
}

.inspector-panel {
    background-color: rgba(15, 23, 42, 0.6);
    border: 1px solid #334155;
    border-radius: 0.75rem;
    padding: 1rem;
}

.inspector-panel h3 {
    font-size: 0.95rem;
    color: #cbd5e1;
    margin-bottom: 0.5rem;
}

.inspector-content {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.input-group label {
    font-size: 0.75rem;
    color: #94a3b8;
}

.input-group input,
.input-group select {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 0.4rem;
    padding: 0.4rem 0.6rem;
    color: white;
    font-size: 0.9rem;
    width: 120px;
}

.btn-danger {
    background-color: #dc2626;
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 0.4rem;
    cursor: pointer;
    font-size: 0.85rem;
}

.btn-success {
    background-color: #059669;
    color: white;
    border: none;
    padding: 0.7rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 700;
    cursor: pointer;
}

.btn-success:hover {
    background-color: #047857;
}

.export-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #334155;
    padding-top: 1rem;
}

.export-status {
    font-size: 0.875rem;
    color: #94a3b8;
}

.text-muted {
    color: #64748b;
    font-size: 0.8rem;
}

/* Контекстное меню */
.context-menu {
    position: absolute;
    background: #1e293b;
    border: 1px solid #475569;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    width: 170px;
    padding: 4px 0;
}

.context-menu.hidden {
    display: none;
}

.ctx-item {
    padding: 8px 14px;
    font-size: 0.85rem;
    color: #e2e8f0;
    cursor: pointer;
    user-select: none;
    position: relative;
}

.ctx-item:hover {
    background-color: #4f46e5;
    color: white;
}

.has-submenu {
    display: flex;
    justify-content: space-between;
}

.submenu {
    display: none;
    position: absolute;
    left: 100%;
    top: 0;
    background: #1e293b;
    border: 1px solid #475569;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    width: 140px;
    padding: 4px 0;
}

.ctx-item.has-submenu:hover .submenu {
    display: block;
}

.submenu div {
    padding: 8px 12px;
    font-size: 0.85rem;
    color: #e2e8f0;
    cursor: pointer;
}

.submenu div:hover {
    background-color: #4f46e5;
    color: white;
}