/* MecreCat CapCut风格视频编辑器样式 */

:root {
    --editor-bg: #0a0a0a;
    --editor-surface: #141414;
    --editor-surface-hover: #1a1a1a;
    --editor-border: #2a2a2a;
    --editor-text: #ffffff;
    --editor-text-secondary: #a0a0a0;
    --editor-primary: #00d4ff;
    --editor-primary-hover: #00b8e6;
    --editor-accent: #ff0066;
    --editor-danger: #ff4444;
    --editor-success: #00ff88;
    --editor-warning: #ffaa00;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.editor-body {
    margin: 0;
    padding: 0;
    background: var(--editor-bg);
    color: var(--editor-text);
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    overflow: hidden;
    height: 100vh;
}

.editor-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* 顶部工具栏 */
.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    height: 56px;
    background: var(--editor-surface);
    border-bottom: 1px solid var(--editor-border);
    z-index: 100;
}

.editor-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-back {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--editor-text);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background 0.2s;
    font-size: 14px;
}

.btn-back:hover {
    background: var(--editor-surface-hover);
}

.editor-title {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    color: var(--editor-text);
}

.editor-header-right {
    display: flex;
    gap: 12px;
}

.btn-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--editor-surface-hover);
    border: 1px solid var(--editor-border);
    border-radius: 6px;
    color: var(--editor-text);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-header:hover {
    background: var(--editor-surface);
    border-color: var(--editor-primary);
}

.btn-header.btn-primary {
    background: var(--editor-primary);
    border-color: var(--editor-primary);
    color: #000;
}

.btn-header.btn-primary:hover {
    background: var(--editor-primary-hover);
}

/* 主编辑区域 */
.editor-main {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* 左侧素材库 */
.editor-sidebar-left {
    width: 280px;
    background: var(--editor-surface);
    border-right: 1px solid var(--editor-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-tabs {
    display: flex;
    border-bottom: 1px solid var(--editor-border);
    background: var(--editor-bg);
}

.tab-btn {
    flex: 1;
    padding: 12px 8px;
    background: none;
    border: none;
    color: var(--editor-text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
}

.tab-btn:hover {
    color: var(--editor-text);
    background: var(--editor-surface-hover);
}

.tab-btn.active {
    color: var(--editor-primary);
    border-bottom-color: var(--editor-primary);
    background: var(--editor-surface);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.panel-header h3 {
    font-size: 14px;
    font-weight: 500;
    color: var(--editor-text);
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    background: var(--editor-surface-hover);
    border: 1px solid var(--editor-border);
    border-radius: 6px;
    color: var(--editor-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--editor-surface);
    border-color: var(--editor-primary);
    color: var(--editor-primary);
}

/* 媒体网格 */
.media-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.media-item {
    aspect-ratio: 16/9;
    background: var(--editor-surface-hover);
    border: 1px solid var(--editor-border);
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.media-item:hover {
    border-color: var(--editor-primary);
    transform: scale(1.02);
}

.media-item img,
.media-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 特效列表 */
.effects-list,
.transitions-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.effect-item,
.transition-item {
    aspect-ratio: 16/9;
    background: var(--editor-surface-hover);
    border: 1px solid var(--editor-border);
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
}

.effect-item:hover,
.transition-item:hover {
    border-color: var(--editor-primary);
    transform: scale(1.02);
}

.effect-preview,
.transition-preview {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--editor-primary), var(--editor-accent));
    color: #000;
    font-size: 12px;
    font-weight: 500;
}

.effect-name,
.transition-name {
    padding: 8px;
    text-align: center;
    font-size: 12px;
    color: var(--editor-text);
}

/* 文字样式 */
.text-styles {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-text-style {
    padding: 12px;
    background: var(--editor-primary);
    border: none;
    border-radius: 6px;
    color: #000;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-text-style:hover {
    background: var(--editor-primary-hover);
}

.text-templates {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.text-template {
    padding: 16px;
    background: var(--editor-surface-hover);
    border: 1px solid var(--editor-border);
    border-radius: 6px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.text-template:hover {
    border-color: var(--editor-primary);
}

/* 中间编辑区 */
.editor-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--editor-bg);
    min-width: 0;
}

/* 预览区域 */
.preview-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    min-height: 0;
}

.preview-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding: 12px;
    background: var(--editor-surface);
    border-radius: 8px;
}

.preview-time {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: var(--editor-text);
}

.preview-controls {
    display: flex;
    gap: 8px;
}

.btn-control {
    width: 36px;
    height: 36px;
    padding: 0;
    background: var(--editor-surface-hover);
    border: 1px solid var(--editor-border);
    border-radius: 6px;
    color: var(--editor-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-control:hover {
    background: var(--editor-surface);
    border-color: var(--editor-primary);
    color: var(--editor-primary);
}

.preview-zoom {
    display: flex;
    align-items: center;
    gap: 8px;
}

.preview-zoom button {
    width: 28px;
    height: 28px;
}

.preview-zoom span {
    font-size: 12px;
    color: var(--editor-text-secondary);
    min-width: 50px;
    text-align: center;
}

.preview-window {
    flex: 1;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

#previewCanvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.preview-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--editor-text);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--editor-border);
    border-top-color: var(--editor-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 时间轴区域 */
.timeline-section {
    height: 300px;
    background: var(--editor-surface);
    border-top: 1px solid var(--editor-border);
    display: flex;
    flex-direction: column;
}

.timeline-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    border-bottom: 1px solid var(--editor-border);
}

.timeline-actions {
    display: flex;
    gap: 8px;
}

.btn-timeline {
    padding: 6px 12px;
    background: var(--editor-surface-hover);
    border: 1px solid var(--editor-border);
    border-radius: 4px;
    color: var(--editor-text);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-timeline:hover {
    background: var(--editor-surface);
    border-color: var(--editor-primary);
    color: var(--editor-primary);
}

.timeline-zoom-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--editor-text-secondary);
}

.timeline-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.timeline-header {
    display: flex;
    height: 40px;
    background: var(--editor-bg);
    border-bottom: 1px solid var(--editor-border);
}

.track-header {
    padding: 12px;
    background: var(--editor-surface);
    border-right: 1px solid var(--editor-border);
    font-size: 12px;
    color: var(--editor-text-secondary);
    display: flex;
    align-items: center;
}

.timeline-ruler {
    flex: 1;
    position: relative;
    overflow-x: auto;
    overflow-y: hidden;
    background: var(--editor-surface);
}

.timeline-ruler::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: var(--editor-border);
}

.timeline-mark {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--editor-border);
}

.timeline-mark-label {
    position: absolute;
    top: 4px;
    left: 4px;
    font-size: 10px;
    color: var(--editor-text-secondary);
    font-family: 'Courier New', monospace;
}

.timeline-tracks {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.timeline-track {
    display: flex;
    height: 60px;
    border-bottom: 1px solid var(--editor-border);
    position: relative;
}

.track-label {
    width: 150px;
    padding: 12px;
    background: var(--editor-surface);
    border-right: 1px solid var(--editor-border);
    font-size: 12px;
    color: var(--editor-text);
    display: flex;
    align-items: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.track-content {
    flex: 1;
    position: relative;
    overflow-x: auto;
    overflow-y: hidden;
    background: var(--editor-surface-hover);
}

.track-clip {
    position: absolute;
    top: 8px;
    bottom: 8px;
    background: var(--editor-primary);
    border: 1px solid var(--editor-primary-hover);
    border-radius: 4px;
    cursor: move;
    display: flex;
    align-items: center;
    padding: 0 8px;
    font-size: 11px;
    color: #000;
    min-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.track-clip:hover {
    background: var(--editor-primary-hover);
}

.track-clip.selected {
    border-color: var(--editor-accent);
    box-shadow: 0 0 0 2px var(--editor-accent);
}

.timeline-playhead-container {
    position: absolute;
    top: 40px;
    left: 150px;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 10;
}

.timeline-playhead {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--editor-accent);
    pointer-events: auto;
    cursor: ew-resize;
    box-shadow: 0 0 8px rgba(255, 0, 102, 0.5);
}

.timeline-playhead::before {
    content: '';
    position: absolute;
    top: -8px;
    left: -6px;
    width: 14px;
    height: 14px;
    background: var(--editor-accent);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* 右侧属性面板 */
.editor-sidebar-right {
    width: 320px;
    background: var(--editor-surface);
    border-left: 1px solid var(--editor-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.property-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.property-header {
    padding: 16px;
    border-bottom: 1px solid var(--editor-border);
}

.property-header h3 {
    font-size: 14px;
    font-weight: 500;
    color: var(--editor-text);
}

.property-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.property-section {
    margin-bottom: 24px;
}

.property-section h4 {
    font-size: 13px;
    font-weight: 500;
    color: var(--editor-text);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.property-item {
    margin-bottom: 16px;
}

.property-item label {
    display: block;
    font-size: 12px;
    color: var(--editor-text-secondary);
    margin-bottom: 6px;
}

.property-input {
    width: 100%;
    padding: 8px 12px;
    background: var(--editor-surface-hover);
    border: 1px solid var(--editor-border);
    border-radius: 6px;
    color: var(--editor-text);
    font-size: 13px;
    font-family: inherit;
    transition: all 0.2s;
}

.property-input:focus {
    outline: none;
    border-color: var(--editor-primary);
}

.property-input[type="range"] {
    padding: 0;
    height: 6px;
    background: var(--editor-surface-hover);
    -webkit-appearance: none;
}

.property-input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--editor-primary);
    cursor: pointer;
}

.property-input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--editor-primary);
    cursor: pointer;
    border: none;
}

/* 滚动条样式 */
.sidebar-content::-webkit-scrollbar,
.property-content::-webkit-scrollbar,
.timeline-ruler::-webkit-scrollbar,
.track-content::-webkit-scrollbar,
.timeline-tracks::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.sidebar-content::-webkit-scrollbar-track,
.property-content::-webkit-scrollbar-track,
.timeline-ruler::-webkit-scrollbar-track,
.track-content::-webkit-scrollbar-track,
.timeline-tracks::-webkit-scrollbar-track {
    background: var(--editor-bg);
}

.sidebar-content::-webkit-scrollbar-thumb,
.property-content::-webkit-scrollbar-thumb,
.timeline-ruler::-webkit-scrollbar-thumb,
.track-content::-webkit-scrollbar-thumb,
.timeline-tracks::-webkit-scrollbar-thumb {
    background: var(--editor-border);
    border-radius: 4px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover,
.property-content::-webkit-scrollbar-thumb:hover,
.timeline-ruler::-webkit-scrollbar-thumb:hover,
.track-content::-webkit-scrollbar-thumb:hover,
.timeline-tracks::-webkit-scrollbar-thumb:hover {
    background: var(--editor-primary);
}

/* 响应式 */
@media (max-width: 1400px) {
    .editor-sidebar-left {
        width: 240px;
    }
    
    .editor-sidebar-right {
        width: 280px;
    }
}

@media (max-width: 1200px) {
    .editor-main {
        flex-direction: column;
    }
    
    .editor-sidebar-left,
    .editor-sidebar-right {
        width: 100%;
        height: 200px;
    }
    
    .timeline-section {
        height: 250px;
    }
}
