/* ========== 音频处理器 - audioProcessor.js ========== */

body.audio-tool-active {
    background: linear-gradient(135deg, #0F0F23 0%, #1A1A2E 50%, #16213E 100%);
}

#audio-tool {
    background: linear-gradient(135deg, #0F0F23 0%, #1A1A2E 50%, #16213E 100%);
    min-height: 100vh;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #F8FAFC;
}

#audio-tool .footer {
    display: none;
}

.audio-tool-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px 20px;
}

.audio-tool-description {
    text-align: center;
    padding: 0 0 20px;
}

.audio-tool-description p {
    color: #94A3B8;
    font-size: 14px;
    margin: 0;
}

.audio-drop-zone {
    border: 2px dashed #475569;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 20px;
    background: rgba(30, 30, 46, 0.5);
}

.audio-drop-zone:hover {
    border-color: #6366F1;
    background: rgba(99, 102, 241, 0.1);
}

.audio-drop-zone.dragover {
    border-color: #6366F1;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

.audio-drop-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.audio-drop-text {
    font-size: 16px;
    color: #94A3B8;
    margin-bottom: 8px;
}

.audio-drop-hint {
    font-size: 12px;
    color: #64748B;
}

#audioFileInput {
    display: none;
}

.audio-tools-panel {
    display: none;
}

.audio-tools-panel.visible {
    display: block;
}

.audio-tool-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    background: rgba(30, 30, 46, 0.5);
    padding: 6px;
    border-radius: 10px;
}

.audio-tool-tab {
    flex: 1;
    padding: 14px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    background: transparent;
    color: #94A3B8;
}

.audio-tool-tab.active {
    background: #6366F1;
    color: #F8FAFC;
}

.audio-tool-tab:hover:not(.active) {
    background: rgba(255, 255, 255, 0.1);
}

.audio-panel {
    background: rgba(30, 30, 46, 0.8);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    backdrop-filter: blur(10px);
}

.audio-panel-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 16px;
}

.audio-file-info .info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.audio-file-info .info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.audio-file-info .info-label {
    font-size: 12px;
    color: #64748B;
}

.audio-file-info .info-value {
    font-size: 14px;
    color: #F8FAFC;
    font-weight: 500;
}

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

.audio-form-label {
    display: block;
    font-size: 14px;
    color: #94A3B8;
    margin-bottom: 8px;
}

.audio-form-select, .audio-form-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #334155;
    border-radius: 8px;
    background: #1E1E2E;
    color: #F8FAFC;
    font-size: 14px;
    box-sizing: border-box;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
}

#audio-tool .audio-form-select, 
#audio-tool .audio-form-input {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

#audio-tool .audio-form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394A3B8' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.audio-form-select:focus, .audio-form-input:focus {
    border-color: #6366F1;
    outline: none;
}

.audio-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #334155;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.audio-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #6366F1;
    cursor: pointer;
}

.audio-slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 12px;
    color: #64748B;
}

.audio-size-hint {
    margin-top: 8px;
    font-size: 12px;
    color: #10B981;
    padding: 8px 12px;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 6px;
    border-left: 3px solid #10B981;
}

.audio-size-hint.warning {
    color: #F59E0B;
    background: rgba(245, 158, 11, 0.1);
    border-left-color: #F59E0B;
}

.audio-btn {
    width: 100%;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.audio-btn-primary {
    background: #6366F1;
    color: #F8FAFC;
}

.audio-btn-primary:hover {
    background: #818CF8;
}

.audio-btn-secondary {
    background: #334155;
    color: #F8FAFC;
}

.audio-btn-secondary:hover {
    background: #475569;
}

.audio-progress-container {
    display: none;
    margin-bottom: 16px;
}

.audio-progress-container.visible {
    display: block;
}

.audio-progress-bar {
    height: 8px;
    background: #334155;
    border-radius: 4px;
    overflow: hidden;
}

.audio-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366F1, #8B5CF6);
    border-radius: 4px;
}

.audio-error-message {
    display: none;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid #EF4444;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    color: #EF4444;
}

.audio-error-message.visible {
    display: block;
}

.audio-export-section {
    display: none;
}

.audio-export-section.visible {
    display: block;
}

.audio-size-comparison {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 16px;
}

.audio-size-item {
    text-align: center;
}

.audio-size-label {
    font-size: 12px;
    color: #64748B;
}

.audio-size-value {
    font-size: 24px;
    font-weight: bold;
}

.audio-size-value.original {
    color: #94A3B8;
}

.audio-size-value.compressed {
    color: #10B981;
}

.audio-compression-ratio {
    text-align: center;
    margin-bottom: 16px;
    color: #10B981;
}

.audio-export-buttons {
    display: flex;
    gap: 12px;
}

.audio-export-buttons .audio-btn {
    flex: 1;
}

.audio-editor-settings, .audio-compressor-settings {
    display: none;
}

.audio-editor-settings.visible, .audio-compressor-settings.visible {
    display: block;
}

.audio-trim-track {
    position: relative;
    height: 60px;
    background: #1E1E2E;
    border-radius: 8px;
    display: flex;
    overflow: hidden;
    margin-bottom: 16px;
}

.audio-trim-cropped {
    background: rgba(239, 68, 68, 0.3);
    transition: width 0.1s ease;
}

.audio-trim-selected {
    flex: 1;
    background: rgba(99, 102, 241, 0.3);
    border-top: 2px solid #6366F1;
    border-bottom: 2px solid #6366F1;
}

.audio-trim-handle {
    position: absolute;
    top: 0;
    height: 100%;
    width: 6px;
    background: #fff;
    cursor: ew-resize;
    z-index: 10;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
}

.audio-trim-handle-left {
    left: 0%;
    border-radius: 3px 0 0 3px;
}

.audio-trim-handle-right {
    right: 0%;
    border-radius: 0 3px 3px 0;
}

.audio-handle-flag {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 20px;
    background: #fff;
    border-radius: 2px;
}

.audio-trim-handle-left .audio-handle-flag {
    right: 0;
}

.audio-trim-handle-right .audio-handle-flag {
    left: 0;
}

.audio-playhead {
    position: absolute;
    top: 0;
    height: 100%;
    width: 3px;
    background: #FFFFFF;
    cursor: pointer;
    z-index: 15;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
}

.audio-trim-info {
    display: flex;
    gap: 24px;
    margin-bottom: 16px;
    font-size: 14px;
    color: #94A3B8;
}

.audio-trim-info span {
    color: #F8FAFC;
}

.audio-trim-inputs-row {
    display: flex;
    gap: 16px;
}

.audio-trim-input-item {
    flex: 1;
}

.audio-trim-input-item label {
    display: block;
    font-size: 12px;
    color: #94A3B8;
    margin-bottom: 6px;
}

.audio-trim-input-small {
    width: 100%;
    padding: 8px;
    text-align: center;
}

.audio-trim-time-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 12px;
    color: #64748B;
}

.audio-tool-footer {
    text-align: center;
    padding: 20px 0;
    color: #64748B;
    font-size: 12px;
}

/* 音频处理器响应式 */
@media (max-width: 768px) {
    .audio-drop-zone {
        padding: 25px 15px;
    }

    .audio-drop-icon {
        font-size: 36px;
    }

    .audio-file-info .info-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .audio-trim-info {
        flex-direction: column;
        gap: 8px;
    }

    .audio-trim-inputs-row {
        flex-direction: column;
        gap: 10px;
    }

    .audio-export-buttons {
        flex-direction: column;
    }

    .audio-btn {
        padding: 12px 16px;
        font-size: 14px;
    }
}

/* 退出确认对话框 */
.audio-exit-confirm-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: 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; }
}

.audio-exit-confirm-content {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-radius: 12px;
    padding: 24px;
    min-width: 320px;
    max-width: 400px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    text-align: center;
    animation: slideUp 0.2s ease;
}

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

.audio-exit-confirm-content h3 {
    color: #F8FAFC;
    margin: 0 0 12px 0;
    font-size: 18px;
}

.audio-exit-confirm-content p {
    color: #94A3B8;
    margin: 0 0 20px 0;
    font-size: 14px;
}

.audio-exit-confirm-buttons {
    display: flex;
    gap: 12px;
}

.audio-exit-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.audio-exit-save {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: white;
}

.audio-exit-save:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.audio-exit-discard {
    background: linear-gradient(135deg, #64748B 0%, #475569 100%);
    color: white;
}

.audio-exit-discard:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(100, 116, 139, 0.4);
}

.audio-exit-btn:active {
    transform: translateY(0);
}
