/* ============================================
   Audio Editor Module - Professional UI
   WaveSurfer.js Edition
   ============================================ */

/* Container */
.audio-editor-container {
    padding: 20px 0;
}

/* Upload Zone */
.editor-upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: 16px;
    padding: 48px 24px;
    text-align: center;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.03) 0%, rgba(139, 92, 246, 0.03) 100%);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    margin-bottom: 16px;
}

.editor-upload-zone:hover {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(139, 92, 246, 0.08) 100%);
    transform: translateY(-2px);
}

.editor-upload-zone.dragover {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
    transform: scale(1.01);
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.2);
}

.editor-upload-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.editor-upload-icon {
    font-size: 56px;
    margin-bottom: 16px;
    display: block;
    filter: drop-shadow(0 4px 8px rgba(99, 102, 241, 0.3));
}

.editor-upload-text {
    font-size: 17px;
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 8px;
}

.editor-upload-hint {
    font-size: 13px;
    color: var(--text-muted);
}

/* File Info */
.editor-file-info {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(5, 150, 105, 0.08) 100%);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 12px;
    margin-bottom: 20px;
}

.editor-file-icon {
    font-size: 36px;
}

.editor-file-details {
    flex: 1;
}

.editor-file-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    font-size: 15px;
}

.editor-file-meta {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    gap: 20px;
}

.editor-file-remove {
    width: 32px;
    height: 32px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--error);
    display: flex;
    align-items: center;
    justify-content: center;
}

.editor-file-remove:hover {
    background: var(--error);
    color: white;
    border-color: var(--error);
}

/* Waveform Container - Professional Style */
.waveform-container {
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.waveform-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.waveform-title {
    font-size: 14px;
    font-weight: 600;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 8px;
}

.waveform-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.waveform-zoom-btn {
    width: 32px;
    height: 32px;
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 8px;
    color: #a5b4fc;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.waveform-zoom-btn:hover {
    background: rgba(99, 102, 241, 0.4);
    color: white;
}

.waveform-zoom-level {
    font-size: 12px;
    color: #64748b;
    min-width: 40px;
    text-align: center;
}

/* WaveSurfer Waveform */
#editorWaveform {
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 12px;
}

/* Playback Controls - CapCut Style */
.playback-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: rgba(15, 23, 42, 0.8);
    border-radius: 12px;
    margin-bottom: 20px;
}

.play-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    border: none;
    color: white;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.play-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 25px rgba(99, 102, 241, 0.5);
}

.play-btn.playing {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.4);
}

.playback-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 15px;
    color: #e2e8f0;
    min-width: 60px;
}

.playback-divider {
    color: #475569;
}

/* Trim Info Display */
.trim-info {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-left: auto;
}

.trim-badge {
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    color: #a5b4fc;
    font-weight: 500;
}

/* Editor Sections */
.editor-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    margin-bottom: 16px;
    overflow: hidden;
}

.editor-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    cursor: pointer;
    background: rgba(99, 102, 241, 0.03);
    border-bottom: 1px solid var(--border-color);
    transition: all 0.2s;
}

.editor-section-header:hover {
    background: rgba(99, 102, 241, 0.08);
}

.editor-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.editor-section-title .icon {
    font-size: 20px;
}

.editor-section-toggle {
    font-size: 12px;
    color: var(--text-muted);
    transition: transform 0.3s;
}

.editor-section.collapsed .editor-section-toggle {
    transform: rotate(-90deg);
}

.editor-section.collapsed .editor-section-body {
    display: none;
}

.editor-section-body {
    padding: 20px;
}

/* Trim Section - Simplified */
.trim-section-note {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.trim-section-note .icon {
    font-size: 20px;
}

/* Volume Controls */
.volume-control {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: var(--bg-input);
    border-radius: 10px;
}

.volume-label {
    min-width: 110px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.volume-slider {
    flex: 1;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, var(--primary) 0%, var(--border-color) 0%);
    border-radius: 4px;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: white;
    border: 3px solid var(--primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.volume-value {
    min-width: 50px;
    text-align: right;
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
}

/* Merge List */
.merge-list {
    max-height: 320px;
    overflow-y: auto;
    margin-bottom: 16px;
}

.merge-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 10px;
    transition: all 0.2s;
}

.merge-item:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.merge-item-number {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    font-weight: 700;
    font-size: 13px;
    border-radius: 8px;
}

.merge-item-info {
    flex: 1;
}

.merge-item-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.merge-item-duration {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.merge-item-actions {
    display: flex;
    gap: 6px;
}

.merge-item-actions button {
    width: 30px;
    height: 30px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    color: var(--text-secondary);
}

.merge-item-actions button:hover:not(:disabled) {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.merge-item-actions button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Background Music Upload */
.bg-upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 16px;
    font-size: 14px;
    color: var(--text-secondary);
}

.bg-upload-zone:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.bg-upload-zone.has-file {
    border-style: solid;
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.08);
    color: var(--success);
}

/* Result Section */
.editor-result {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(5, 150, 105, 0.1) 100%);
    border: 2px solid rgba(16, 185, 129, 0.4);
    border-radius: 16px;
    padding: 28px;
    text-align: center;
    margin-top: 24px;
}

.editor-result-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--success);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.editor-result-audio {
    width: 100%;
    max-width: 500px;
    margin: 0 auto 20px;
    border-radius: 8px;
}

.editor-result-actions {
    display: flex;
    gap: 14px;
    justify-content: center;
}

/* Empty State */
.editor-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

/* History Selection Modal */
.editor-history-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.editor-history-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.editor-history-item:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
    transform: translateX(4px);
}

.editor-history-item-icon {
    font-size: 26px;
}

.editor-history-item-info {
    flex: 1;
    min-width: 0;
}

.editor-history-item-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.editor-history-item-meta {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    gap: 10px;
    margin-top: 4px;
}

.editor-history-item-select {
    padding: 8px 16px;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.editor-history-item-select:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.editor-history-empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
    .playback-controls {
        flex-wrap: wrap;
        gap: 12px;
    }

    .trim-info {
        width: 100%;
        margin-left: 0;
        margin-top: 12px;
    }

    .volume-label {
        min-width: 90px;
    }

    .editor-result-actions {
        flex-direction: column;
    }
}