/* ============ 音频剪切工具样式 ============ */

.upload-section {
    margin-bottom: 16px;
}

/* 上传区与空白预览区域 */
.empty-preview {
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #fafafa;
    position: relative;
}

.empty-preview:hover {
    border-color: #8b5cf6;
    background: #f5f3ff;
}

.upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

.upload-icon {
    font-size: 36px;
}

.upload-text {
    font-size: 15px;
    font-weight: 600;
    color: #374151;
}

.upload-hint {
    font-size: 13px;
    color: #9ca3af;
}

.upload-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.uploading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e5e7eb;
    border-top-color: #8b5cf6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.uploading-text {
    font-size: 14px;
    color: #6b7280;
}

.uploading-sub {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 4px;
}

/* 音频信息 */
.audio-info-section {
    margin-top: 16px;
}

.audio-info-row {
    display: flex;
    gap: 12px;
    align-items: stretch;
}

.audio-info-item {
    flex: 1;
    min-width: 0;
    background: #f9fafb;
    border: 1px solid #eef0f3;
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.audio-info-item:first-child {
    flex: 2;
}

.audio-info-label {
    font-size: 12px;
    color: #9ca3af;
}

.audio-info-value {
    font-size: 14px;
    color: #374151;
    font-weight: 600;
    word-break: break-all;
}

.audio-file-name {
    font-size: 13px;
}

/* 右侧预览内容 */
.audio-player-section {
    margin-bottom: 16px;
}

.audio-player {
    width: 100%;
    border-radius: 8px;
}

/* 波形可视化 */
.waveform-section {
    background: #fff;
    border: 1px solid #eef0f3;
    border-radius: 10px;
    padding: 14px 14px 28px;
    margin-bottom: 14px;
    overflow: visible;
    position: relative;
}

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

.clip-range-inline {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    white-space: nowrap;
}

.waveform-title {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

.waveform-hint {
    font-size: 12px;
    color: #9ca3af;
    font-weight: 400;
}

.waveform-container {
    position: relative;
    height: 80px;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
}

#waveformCanvas {
    width: 100%;
    height: 80px;
    display: block;
}

.waveform-overlay {
    position: absolute;
    inset: 0;
}

.handle {
    position: absolute;
    top: 0;
    width: 12px;
    height: 100%;
    background: rgba(16, 185, 129, 0.85);
    cursor: ew-resize;
    z-index: 3;
    border-radius: 4px;
    transform: translateX(-50%);
}

.handle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 40px;
    background: #fff;
    border-radius: 2px;
}

.selection {
    position: absolute;
    top: 0;
    height: 100%;
    background: rgba(139, 92, 246, 0.18);
    z-index: 1;
}

.playback-line {
    position: absolute;
    top: 0;
    height: 100%;
    width: 2px;
    background: #ef4444;
    z-index: 2;
    cursor: ew-resize;
}

.playback-time {
    position: absolute;
    top: 130px;
    transform: translateX(-50%);
    font-size: 10px;
    color: #ef4444;
    white-space: nowrap;
    font-weight: 600;
    z-index: 5;
    pointer-events: none;
}

.time-axis {
    position: relative;
    height: 40px;
    margin-top: 6px;
}

.time-ticks {
    position: relative;
    height: 8px;
}

.tick {
    position: absolute;
    top: 0;
    width: 1px;
    height: 5px;
    background: #e5e7eb;
    transform: translateX(-50%);
}

.tick.main {
    height: 8px;
    background: #d1d5db;
}

.handle-labels {
    position: relative;
    height: 14px;
}

.handle-labels span {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    font-size: 11px;
    font-weight: 600;
    color: #8b5cf6;
    background: rgba(139, 92, 246, 0.1);
    padding: 1px 5px;
    border-radius: 4px;
    white-space: nowrap;
}

.time-labels {
    position: relative;
    height: 14px;
    margin-top: 2px;
}

.time-label {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    font-size: 10px;
    color: #9ca3af;
    white-space: nowrap;
}

/* 剪切范围显示 */
.clip-range-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    background: #f9fafb;
    border: 1px solid #eef0f3;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 14px;
}

.clip-range-label {
    font-size: 13px;
    color: #6b7280;
}

.clip-range-value {
    font-size: 14px;
    font-weight: 600;
    color: #8b5cf6;
}

.clip-range-duration {
    font-size: 13px;
    color: #9ca3af;
}

/* 播放与操作区 */
.play-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.format-label {
    font-size: 14px;
    color: #374151;
    font-weight: 500;
    white-space: nowrap;
}

.format-select {
    width: auto;
    min-width: 120px;
    padding: 8px 32px 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 10px center;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.format-select:focus {
    outline: none;
    border-color: #8b5cf6;
}

/* 提示框 */
.hint-box {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
}

.hint-box.error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.hint-box.info {
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #bfdbfe;
}

/* 处理中提示 */
.processing-tip {
    margin-top: 14px;
    background: #f5f3ff;
    border: 1px solid #e9d5ff;
    border-radius: 8px;
    padding: 14px;
}

.processing-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.processing-icon {
    font-size: 20px;
}

.processing-tip p {
    margin: 0;
    font-size: 14px;
    color: #7c3aed;
    font-weight: 600;
}

.processing-sub {
    font-size: 12px !important;
    color: #a78bfa !important;
    font-weight: 400 !important;
    margin-top: 2px !important;
}

.processing-progress {
    margin-top: 10px;
    height: 6px;
    background: #ede9fe;
    border-radius: 3px;
    overflow: hidden;
}

.processing-bar {
    height: 100%;
    width: 40%;
    background: linear-gradient(90deg, #ef4444, #dc2626);
    border-radius: 3px;
    animation: indeterminate 1.2s ease-in-out infinite;
}

@keyframes indeterminate {
    0% { margin-left: -40%; }
    100% { margin-left: 100%; }
}

/* 剪切列表 */
.clip-list {
    margin-top: 16px;
}

.clip-list .card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.clip-list-count {
    font-size: 13px;
    color: #9ca3af;
}

.clip-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px;
    border: 1px solid #eef0f3;
    border-radius: 10px;
    margin-bottom: 10px;
}

.clip-item:last-child {
    margin-bottom: 0;
}

.clip-thumb {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: linear-gradient(135deg, #ede9fe, #ddd6fe);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.clip-play-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #fff;
    color: #7c3aed;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.clip-thumb.playing .clip-play-btn {
    background: #8b5cf6;
    color: #fff;
}

.clip-info {
    flex: 1;
    min-width: 0;
}

.clip-file-name-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.clip-index {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #ede9fe;
    color: #7c3aed;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.clip-file-name-input {
    flex: 1;
    min-width: 0;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 13px;
    color: #374151;
}

.clip-file-name-input:focus {
    outline: none;
    border-color: #8b5cf6;
}

.clip-file-ext {
    font-size: 13px;
    color: #9ca3af;
}

.clip-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.clip-format-tag {
    font-size: 11px;
    font-weight: 600;
    color: #8b5cf6;
    background: #f5f3ff;
    padding: 2px 8px;
    border-radius: 4px;
}

.clip-size {
    font-size: 12px;
    color: #9ca3af;
}

.clip-time {
    font-size: 12px;
    color: #6b7280;
}

/* 响应式 */
@media (max-width: 768px) {
    .audio-info-row {
        flex-direction: column;
    }

    .play-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .play-actions .btn {
        width: 100%;
    }

    .format-select {
        width: 100%;
    }
}
