/* ==================== 全局样式 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* 深色主题配色 */
    --bg-primary: #1a1a1a;
    --bg-secondary: #2a2a2a;
    --bg-tertiary: #3a3a3a;
    --bg-hover: #4a4a4a;

    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-muted: #808080;

    --accent-primary: #4a9eff;
    --accent-secondary: #6cb4ff;
    --accent-success: #4caf50;
    --accent-warning: #ff9800;
    --accent-danger: #f44336;

    --border-color: #404040;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.5);

    --waveform-color: #4a9eff;
    --waveform-background: #0a0a0a;
    --selection-color: rgba(74, 158, 255, 0.3);
    --playhead-color: #ff4757;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
}

/* ==================== 应用容器 ==================== */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* ==================== 顶部工具栏 ==================== */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.toolbar-section {
    display: flex;
    gap: 10px;
    align-items: center;
}

.app-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ==================== 按钮样式 ==================== */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn:hover:not(:disabled) {
    background: var(--bg-hover);
    transform: translateY(-1px);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent-primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-secondary);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-success {
    background: var(--accent-success);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #45a049;
}

.icon {
    font-size: 16px;
}

/* ==================== 主内容区域 ==================== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* ==================== 拖拽区域 ==================== */
.drop-zone {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px dashed var(--border-color);
    border-radius: 12px;
    margin: 20px;
    background: var(--bg-secondary);
    transition: all 0.3s ease;
}

.drop-zone.drag-over {
    border-color: var(--accent-primary);
    background: rgba(74, 158, 255, 0.1);
}

.drop-zone-content {
    text-align: center;
    padding: 40px;
}

.drop-zone-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.drop-zone-text {
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 10px;
}

.drop-zone-subtext {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.drop-zone-formats {
    font-size: 12px;
    color: var(--text-muted);
}

/* ==================== 编辑器容器 ==================== */
.editor-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin: 20px;
    background: var(--bg-secondary);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
}

/* ==================== 播放控制栏 ==================== */
.playback-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.control-group {
    display: flex;
    gap: 8px;
}

.control-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:hover {
    background: var(--bg-hover);
    transform: scale(1.05);
}

.control-btn:active {
    transform: scale(0.95);
}

.control-btn.active {
    background: var(--accent-primary);
    color: white;
}

.time-display {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    color: var(--text-primary);
}

.time-separator {
    color: var(--text-muted);
}

.time {
    min-width: 80px;
    text-align: center;
}

/* ==================== 波形显示区域 ==================== */
.waveform-container {
    position: relative;
    height: 200px;
    background: var(--waveform-background);
    border-bottom: 1px solid var(--border-color);
    overflow: hidden;
}

.waveform-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.time-ruler {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 24px;
    background: rgba(0, 0, 0, 0.5);
    border-bottom: 1px solid var(--border-color);
}

.selection-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    background: transparent;
}

.selection-overlay.selecting {
    background: var(--selection-color);
}

/* ==================== 音轨容器 ==================== */
.tracks-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tracks-header {
    display: flex;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.track-info-header {
    width: 200px;
    padding: 8px 12px;
    border-right: 1px solid var(--border-color);
}

.track-timeline-header {
    flex: 1;
    padding: 8px 12px;
}

.tracks-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.track {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    min-height: 80px;
}

.track:hover {
    background: rgba(255, 255, 255, 0.02);
}

.track-info {
    width: 200px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.track-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.track-controls {
    display: flex;
    gap: 4px;
}

.track-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.track-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.track-btn.active {
    background: var(--accent-primary);
    color: white;
}

.track-btn.solo.active {
    background: var(--accent-warning);
}

.track-btn.mute.active {
    background: var(--accent-danger);
}

.track-volume {
    display: flex;
    align-items: center;
    gap: 8px;
}

.track-volume input {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-secondary);
    border-radius: 2px;
    outline: none;
}

.track-volume input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.track-volume input::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.track-timeline {
    flex: 1;
    position: relative;
    background: var(--bg-secondary);
    overflow: hidden;
}

.track-waveform {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--waveform-color);
    opacity: 0.7;
}

.clip {
    position: absolute;
    height: calc(100% - 12px);
    top: 6px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: move;
    overflow: hidden;
}

.clip:hover {
    border-color: var(--accent-primary);
}

.clip.selected {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.3);
}

.clip-waveform {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.6;
}

.clip-name {
    position: absolute;
    top: 4px;
    left: 8px;
    font-size: 11px;
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.5);
    padding: 2px 6px;
    border-radius: 3px;
    pointer-events: none;
}

.btn-add-track {
    margin: 12px;
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border: 1px dashed var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    align-self: flex-start;
}

.btn-add-track:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

/* ==================== 效果器面板 ==================== */
.effects-panel {
    width: 320px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    position: relative;
}

.effects-panel.collapsed {
    transform: translateX(100%);
    width: 0;
    border: none;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.panel-header h2 {
    font-size: 16px;
    font-weight: 600;
}

.btn-toggle {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-toggle:hover {
    background: var(--bg-hover);
}

.effects-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.effect-section {
    margin-bottom: 20px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    overflow: hidden;
}

.effect-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
}

.effect-header h3 {
    font-size: 14px;
    font-weight: 500;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-secondary);
    border-radius: 24px;
    transition: all 0.3s ease;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-secondary);
    border-radius: 50%;
    transition: all 0.3s ease;
}

input:checked + .slider {
    background-color: var(--accent-primary);
}

input:checked + .slider:before {
    transform: translateX(24px);
    background-color: white;
}

.effect-controls {
    padding: 12px;
    background: var(--bg-secondary);
}

.control-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.control-row:last-child {
    margin-bottom: 0;
}

.control-row label {
    min-width: 60px;
    font-size: 12px;
    color: var(--text-secondary);
}

.control-row input[type="range"] {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-tertiary);
    border-radius: 2px;
    outline: none;
}

.control-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.control-row input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.control-row .value {
    min-width: 50px;
    text-align: right;
    font-size: 11px;
    color: var(--text-muted);
    font-family: 'Courier New', monospace;
}

.control-row select {
    flex: 1;
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
}

.control-row select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.eq-bands {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.eq-band {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.eq-band label {
    font-size: 11px;
    color: var(--text-secondary);
}

.eq-band input {
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-tertiary);
    border-radius: 2px;
    outline: none;
}

.eq-band input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
}

.eq-band .value {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    font-family: 'Courier New', monospace;
}

/* ==================== 模态框 ==================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 12px;
    width: 90%;
    max-width: 480px;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.btn-close {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}

/* ==================== 右键菜单 ==================== */
.context-menu {
    position: fixed;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: var(--shadow-lg);
    min-width: 160px;
    z-index: 1001;
    animation: fadeIn 0.15s ease;
}

.menu-item {
    padding: 10px 16px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.menu-item:hover {
    background: var(--bg-hover);
}

.menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

/* ==================== 加载指示器 ==================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.2s ease;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--bg-tertiary);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    margin-top: 16px;
    font-size: 14px;
    color: var(--text-primary);
}

/* ==================== 状态栏 ==================== */
.status-bar {
    display: flex;
    justify-content: space-between;
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
    font-size: 11px;
    color: var(--text-muted);
}

.status-section {
    display: flex;
    gap: 16px;
}

/* ==================== 滚动条样式 ==================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-hover);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 1024px) {
    .effects-panel {
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        height: auto;
    }

    .toolbar {
        flex-wrap: wrap;
        gap: 10px;
    }
}

@media (max-width: 768px) {
    .track-info {
        width: 150px;
    }

    .playback-controls {
        flex-direction: column;
        gap: 10px;
    }

    .effects-panel {
        width: 280px;
    }
}
