/* ===== MODERN PDF STITCHER UI ===== */

/* Upload Dropzone */
.upload-dropzone {
    border: 3px dashed #e2e8f0;
    border-radius: 24px;
    padding: 32px 24px;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
}

.upload-dropzone:hover {
    border-color: #8b5cf6;
    background: linear-gradient(135deg, #f5f3ff 0%, #ffffff 100%);
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgba(139, 92, 246, 0.1), 0 10px 10px -5px rgba(139, 92, 246, 0.04);
}

.upload-dropzone.drag-over {
    border-color: #8b5cf6;
    background: #ede9fe;
    transform: scale(1.02);
}

.upload-icon {
    width: 70px;
    height: 70px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%);
    border-radius: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: #8b5cf6;
    animation: float 3s ease-in-out infinite;
}

.upload-formats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 20px;
}

.format-badge {
    padding: 4px 12px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 30px;
    font-size: 11px;
    font-weight: 500;
    color: #475569;
    transition: all 0.2s ease;
}

.format-badge:hover {
    background: #8b5cf6;
    border-color: #8b5cf6;
    color: white;
}

/* Quick Action Buttons */
.quick-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    color: #475569;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quick-action-btn:hover {
    background: white;
    border-color: #8b5cf6;
    color: #8b5cf6;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.15);
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border-radius: 16px;
    padding: 16px 8px;
    text-align: center;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: #8b5cf6;
    box-shadow: 0 8px 16px -8px rgba(139, 92, 246, 0.3);
}

.stat-icon {
    width: 32px;
    height: 32px;
    margin: 0 auto 8px;
    background: #ede9fe;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8b5cf6;
    font-size: 14px;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.2;
    font-family: monospace;
}

.stat-label {
    font-size: 10px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Progress Container */
.progress-container {
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 16px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #8b5cf6, #c084fc);
    transition: width 0.3s ease;
    border-radius: 3px;
}

/* Toggle Switch */
.toggle-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch {
    display: inline-block;
    width: 44px;
    height: 24px;
    background: #cbd5e1;
    border-radius: 12px;
    position: relative;
    transition: all 0.2s ease;
    cursor: pointer;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 10px;
    top: 2px;
    left: 2px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.toggle-checkbox:checked + .toggle-switch {
    background: #8b5cf6;
}

.toggle-checkbox:checked + .toggle-switch::after {
    left: 22px;
}

/* Position Buttons */
.position-btn {
    padding: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
}

.position-btn:hover {
    border-color: #8b5cf6;
    color: #8b5cf6;
}

.position-btn.active {
    background: #8b5cf6;
    border-color: #8b5cf6;
    color: white;
}

/* Compression Slider */
.compression-slider {
    width: 100%;
    height: 6px;
    background: linear-gradient(to right, #94a3b8, #8b5cf6, #6d28d9);
    border-radius: 3px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    outline: none;
}

.compression-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: white;
    border: 2px solid #8b5cf6;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
    transition: all 0.2s ease;
    margin-top: -6px;
}

.compression-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

/* Merge Button */
.merge-btn {
    position: relative;
    width: 100%;
    padding: 18px 24px;
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    border: none;
    border-radius: 20px;
    color: white;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 10px 25px -5px rgba(139, 92, 246, 0.4);
}

.merge-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 20px 30px -5px rgba(139, 92, 246, 0.5);
}

.merge-btn:active:not(:disabled) {
    transform: translateY(1px);
}

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

.btn-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.btn-shine {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.merge-btn:hover:not(:disabled) .btn-shine {
    left: 100%;
}

/* File List Container */
.file-list-container {
    max-height: 400px;
    overflow-y: auto;
    padding: 16px;
}

/* File Items */
.file-item {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 10px;
    transition: all 0.2s ease;
    animation: slideIn 0.3s ease forwards;
    cursor: move;
}

.file-item:hover {
    transform: translateX(4px);
    border-color: #8b5cf6;
    box-shadow: 0 8px 16px -8px rgba(139, 92, 246, 0.2);
}

.file-item.dragging {
    opacity: 0.5;
    transform: scale(0.98);
    background: #ede9fe;
}

.file-item-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.file-icon {
    width: 40px;
    height: 40px;
    background: #fee2e2;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ef4444;
    font-size: 18px;
}

.file-icon.pdf {
    background: #ede9fe;
    color: #8b5cf6;
}

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

.file-name {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-meta {
    display: flex;
    gap: 16px;
    font-size: 11px;
    color: #64748b;
}

.file-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.file-actions {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

.file-action-btn {
    width: 32px;
    height: 32px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-action-btn:hover:not(:disabled) {
    background: #8b5cf6;
    border-color: #8b5cf6;
    color: white;
    transform: translateY(-1px);
}

.file-action-btn.delete:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 24px;
}

.empty-state-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 24px;
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    border-radius: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: #94a3b8;
    animation: pulse 2s ease-in-out infinite;
}

.empty-state h4 {
    font-size: 20px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 8px;
}

.empty-state p {
    color: #64748b;
    margin-bottom: 24px;
}

.empty-state-btn {
    padding: 12px 24px;
    background: #8b5cf6;
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.empty-state-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.4);
}

.empty-state-hint {
    margin-top: 24px;
    padding: 12px;
    background: #f8fafc;
    border-radius: 12px;
    color: #64748b;
    font-size: 12px;
}

/* Page Badge */
.page-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: #ede9fe;
    color: #6d28d9;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 600;
}

/* View Toggle */
.view-toggle-btn {
    width: 36px;
    height: 36px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-toggle-btn:hover {
    background: #8b5cf6;
    border-color: #8b5cf6;
    color: white;
}

/* Toast */
#toast {
    animation: slideInRight 0.3s ease forwards;
}

.toast-content {
    background: white;
    border-radius: 16px;
    padding: 16px 24px;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    border-left: 4px solid #8b5cf6;
}

.toast-content.success { border-left-color: #10b981; }
.toast-content.error { border-left-color: #ef4444; }
.toast-content.info { border-left-color: #3b82f6; }

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.8; }
}

/* Responsive */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .file-item-header {
        flex-wrap: wrap;
    }
    
    .file-actions {
        width: 100%;
        justify-content: flex-end;
        margin-top: 8px;
    }
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    .file-item {
        background: #1e293b;
        border-color: #334155;
    }
    
    .file-name {
        color: #e2e8f0;
    }
    
    .empty-state h4 {
        color: #e2e8f0;
    }
}