/* ============================================
   Batch Processing Module - Separate CSS
   ============================================ */

/* Main Container */
.batch-step {
    padding: 20px 0;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.batch-step h4 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

/* File Upload Area */
.batch-file-upload {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 32px 24px;
    text-align: center;
    background: var(--bg-input);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

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

.batch-file-upload.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    transform: scale(1.01);
}

.batch-file-upload-icon {
    font-size: 48px;
    margin-bottom: 12px;
    display: block;
}

.batch-file-upload-text {
    font-size: 16px;
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 4px;
}

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

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

.batch-file-selected {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 8px;
    margin-top: 12px;
}

.batch-file-selected-icon {
    font-size: 24px;
}

.batch-file-selected-info {
    flex: 1;
}

.batch-file-selected-name {
    font-weight: 600;
    color: var(--text-primary);
}

.batch-file-selected-size {
    font-size: 12px;
    color: var(--text-muted);
}

.batch-file-selected-remove {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.batch-file-selected-remove:hover {
    opacity: 1;
}

/* Divider */
.batch-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
    color: var(--text-muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.batch-divider::before,
.batch-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--border-color), transparent);
}

/* Text Input Area */
.batch-textarea-wrapper {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.batch-textarea-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.batch-textarea {
    width: 100%;
    min-height: 200px;
    padding: 16px;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    resize: vertical;
}

.batch-textarea::placeholder {
    color: var(--text-muted);
}

.batch-textarea:focus {
    outline: none;
}

.batch-textarea-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.02);
    border-top: 1px solid var(--border-color);
}

[data-theme="dark"] .batch-textarea-footer {
    background: rgba(255, 255, 255, 0.02);
}

.batch-char-count {
    font-size: 12px;
    color: var(--text-muted);
}

.batch-char-count.warning {
    color: var(--warning);
}

.batch-char-count.error {
    color: var(--danger);
}

.batch-clear-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s;
}

.batch-clear-btn:hover {
    color: var(--danger);
}

/* Voice Selection */
.batch-voice-section {
    margin-top: 24px;
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.batch-voice-section label {
    display: block;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.batch-voice-select {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-input);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.batch-voice-select:hover {
    border-color: var(--primary-light);
}

.batch-voice-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Provider Selector */
.batch-provider-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.batch-provider-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    background: var(--bg-input);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.batch-provider-btn:hover {
    border-color: var(--primary-light);
    background: rgba(99, 102, 241, 0.05);
}

.batch-provider-btn.active {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.batch-provider-btn.active[data-provider="minimax"] {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.batch-provider-btn.active[data-provider="elevenlabs"] {
    border-color: #8b5cf6;
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

.batch-provider-btn .provider-icon {
    font-size: 20px;
}

/* Voice Loading Indicator */
.batch-voice-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    margin-top: 10px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 8px;
    font-size: 13px;
    color: var(--primary);
}

.batch-voice-loading .spinner.small {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

/* Preview Button */
.batch-preview-btn {
    width: 100%;
    margin-top: 24px;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: #ffffff !important;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.batch-preview-btn span {
    color: #ffffff !important;
}

.batch-preview-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
}

.batch-preview-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
}

/* ============================================
   Step 2: Preview Chunks
   ============================================ */
.batch-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.batch-stat-card {
    padding: 20px;
    background: linear-gradient(135deg, var(--bg-input), var(--bg-card));
    border: 1px solid var(--border-color);
    border-radius: 12px;
    text-align: center;
}

.batch-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

.batch-stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.batch-chunks-list {
    max-height: 320px;
    overflow-y: auto;
    padding-right: 8px;
    margin-bottom: 24px;
}

.batch-chunks-list::-webkit-scrollbar {
    width: 6px;
}

.batch-chunks-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.batch-chunk-item {
    display: flex;
    gap: 12px;
    padding: 16px;
    margin-bottom: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    transition: all 0.2s;
}

.batch-chunk-item:hover {
    border-color: var(--primary-light);
}

.batch-chunk-number {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: white;
    font-weight: 700;
    font-size: 14px;
    border-radius: 8px;
}

.batch-chunk-content {
    flex: 1;
    min-width: 0;
}

.batch-chunk-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.batch-chunk-preview {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.batch-step-actions {
    display: flex;
    gap: 12px;
}

.batch-step-actions .btn {
    flex: 1;
    padding: 14px 24px;
    font-size: 15px;
}

/* ============================================
   Step 3: Processing
   ============================================ */
.batch-processing-container {
    text-align: center;
    padding: 32px 0;
}

.batch-progress-ring {
    position: relative;
    width: 160px;
    height: 160px;
    margin: 0 auto 24px;
}

.batch-progress-circle {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.batch-progress-bg {
    fill: none;
    stroke: var(--bg-input);
    stroke-width: 10;
}

.batch-progress-fill {
    fill: none;
    stroke: var(--primary);
    stroke-width: 10;
    stroke-linecap: round;
    stroke-dasharray: 440;
    stroke-dashoffset: 440;
    transition: stroke-dashoffset 0.5s ease;
}

.batch-progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
}

.batch-chunks-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 24px;
}

.batch-chunk-status,
.batch-chunk-indicator {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 18px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.batch-chunk-status.pending,
.batch-chunk-indicator.pending {
    color: var(--text-muted);
}

.batch-chunk-status.processing,
.batch-chunk-indicator.processing {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--primary);
    animation: pulse 1.5s infinite;
}

.batch-chunk-status.completed,
.batch-chunk-indicator.completed {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--success);
    color: var(--success);
}

.batch-chunk-status.failed,
.batch-chunk-indicator.failed {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--danger);
    color: var(--danger);
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

/* ============================================
   Step 4: Result
   ============================================ */
.batch-result-container {
    text-align: center;
    padding: 32px 0;
}

.batch-result-success {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    background: linear-gradient(135deg, var(--success), #059669);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    animation: bounceIn 0.5s ease;
}

@keyframes bounceIn {
    0% {
        transform: scale(0);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

.batch-result-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.batch-result-subtitle {
    color: var(--text-muted);
    margin-bottom: 24px;
}

.batch-result-audio {
    width: 100%;
    max-width: 500px;
    margin: 0 auto 24px;
}

.batch-result-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .batch-stats {
        grid-template-columns: 1fr;
    }

    .batch-step-actions {
        flex-direction: column;
    }

    .batch-progress-ring {
        width: 120px;
        height: 120px;
    }

    .batch-progress-text {
        font-size: 24px;
    }

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