/* Document Conversion Loading Animations */

/* Rotating icon animation */
@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Pulsing animation for status indicators */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Document processing animation */
@keyframes documentProcess {
    0% { transform: translateX(-10px); opacity: 0.3; }
    50% { transform: translateX(0px); opacity: 1; }
    100% { transform: translateX(10px); opacity: 0.3; }
}

/* Progress bar shimmer effect */
@keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

/* Floating document animation */
@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

/* Typing effect for processing stages */
@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

/* Conversion stages animation */
@keyframes stageProgress {
    0% { transform: scale(0.8); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

/* Applied animation classes */
.rotating-icon {
    animation: rotate 2s linear infinite;
}

/* Convert button loading animation */
.btn-loading {
    position: relative;
    pointer-events: none;
}

.btn-loading .btn-text {
    opacity: 0;
}

.btn-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin-top: -10px;
    margin-left: -10px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: rotate 1s linear infinite;
}

/* Button loading states */
.btn.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.8;
}

/* Mobile-specific loading animation improvements */
@media (max-width: 768px) {
    .btn.loading::after {
        width: 16px;
        height: 16px;
        margin-top: -8px;
        margin-left: -8px;
        border-width: 2px;
    }
    
    .btn.loading {
        min-height: 44px; /* Ensure touch-friendly size */
    }
}

.btn.loading .btn-text {
    opacity: 0;
}

.btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin-top: -9px;
    margin-left: -9px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: rotate 1s linear infinite;
    z-index: 1;
}

/* Loading state for different button variants */
.btn-primary.loading::after {
    border-top-color: white;
}

.btn-outline-primary.loading::after {
    border-top-color: #0d6efd;
}

.btn-success.loading::after {
    border-top-color: white;
}

/* Ensure spinner is visible over button content */
.btn.loading * {
    opacity: 0;
}

.btn.loading::after {
    opacity: 1;
}

/* Additional mobile touch improvements */
@media (max-width: 768px) {
    .btn.loading {
        -webkit-tap-highlight-color: transparent;
        touch-action: none;
    }
    
    /* Ensure animation is smooth on mobile */
    .btn.loading::after {
        will-change: transform;
        transform-origin: center;
    }
    
    /* Enhanced rotating icon for mobile */
    .rotating-icon {
        animation: rotate 1s linear infinite !important;
        transform-origin: center;
        will-change: transform;
    }
}

/* Ensure rotating icon works on all devices */
.rotating-icon {
    animation: rotate 1s linear infinite;
    transform-origin: center;
    display: inline-block;
}

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

.pulsing {
    animation: pulse 1.5s ease-in-out infinite;
}

.document-processing {
    animation: documentProcess 2s ease-in-out infinite;
}

.progress-shimmer {
    background: linear-gradient(90deg, 
        #1565C0 0%, 
        #ffffff 50%, 
        #1565C0 100%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

.floating-document {
    animation: float 3s ease-in-out infinite;
}

.typing-text {
    overflow: hidden;
    white-space: nowrap;
    animation: typing 2s steps(20, end);
}

/* Conversion Visual Components */
.conversion-visual {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    gap: 1.5rem;
}

.document-icon {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 12px;
    color: white;
    position: relative;
}

.document-icon.file-type-docx {
    background: linear-gradient(135deg, #2b5ce6 0%, #1a47b8 100%);
}

.document-icon.file-type-pdf {
    background: linear-gradient(135deg, #dc3545 0%, #b02a37 100%);
}

.conversion-arrow {
    color: #6c757d;
    font-size: 1.5rem;
}

.conversion-arrow i {
    animation: pulse 2s ease-in-out infinite;
}

/* Processing Stages */
.progress-stages {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 1.5rem 0;
    padding: 1rem;
    background: rgba(21, 101, 192, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(21, 101, 192, 0.1);
}

.stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    flex: 1;
}

.stage:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 16px;
    right: -50%;
    width: 100%;
    height: 2px;
    background: #e9ecef;
    z-index: 0;
}

.stage.completed:not(:last-child)::after {
    background: #28a745;
}

.stage-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.stage.active .stage-icon {
    background: #1565C0;
    color: white;
    animation: stageProgress 0.5s ease-out;
}

.stage.completed .stage-icon {
    background: #28a745;
    color: white;
}

.stage-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: #6c757d;
    text-align: center;
}

.stage.active .stage-label {
    color: #1565C0;
    font-weight: 600;
}

.stage.completed .stage-label {
    color: #28a745;
    font-weight: 600;
}

/* Queue Animation */
.queue-animation {
    display: flex;
    gap: 4px;
    align-items: center;
}

.queue-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #1565C0;
    animation: queuePulse 1.5s ease-in-out infinite;
}

.queue-dot:nth-child(2) {
    animation-delay: 0.3s;
}

.queue-dot:nth-child(3) {
    animation-delay: 0.6s;
}

@keyframes queuePulse {
    0%, 80%, 100% { 
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% { 
        transform: scale(1.2);
        opacity: 1;
    }
}

/* Processing Particles */
.processing-particles {
    position: relative;
    height: 4px;
    background: rgba(66, 133, 244, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.processing-particles::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent 0%, 
        #1565C0 50%, 
        transparent 100%);
    animation: particleFlow 2s linear infinite;
}

@keyframes particleFlow {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Enhanced Progress Bar */
.progress {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

.progress-bar {
    transition: width 0.3s ease;
    background: linear-gradient(90deg, #1565C0 0%, #34a853 100%);
    position: relative;
    overflow: hidden;
}

.progress-bar.processing-indicator::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.4) 50%, 
        transparent 100%);
    animation: shimmer 2s infinite;
}

/* Responsive Design */
@media (max-width: 768px) {
    .conversion-visual {
        gap: 1rem;
    }
    
    .document-icon {
        width: 50px;
        height: 50px;
        font-size: 10px;
    }
    
    .progress-stages {
        padding: 0.5rem;
    }
    
    .stage-icon {
        width: 28px;
        height: 28px;
    }
    
    .stage-label {
        font-size: 0.7rem;
    }
}
    animation: typing 2s steps(40) infinite;
}

.stage-indicator {
    transition: all 0.3s ease;
}

.stage-indicator.active {
    animation: stageProgress 0.6s ease-out;
}

/* Conversion visual indicator */
.conversion-visual {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
    height: 80px;
}

.document-icon {
    width: 50px;
    height: 60px;
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    color: #6c757d;
}

.document-icon::before {
    content: '';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: #dee2e6;
    clip-path: polygon(0 0, 100% 0, 100% 100%);
}

.conversion-arrow {
    font-size: 24px;
    color: #1565C0;
    animation: documentProcess 2s ease-in-out infinite;
}

.document-icon.source {
    background: #e3f2fd;
    border-color: #2196f3;
    color: #1976d2;
}

.document-icon.target {
    background: #e8f5e8;
    border-color: #4caf50;
    color: #388e3c;
}

/* Progress stages visual */
.progress-stages {
    display: flex;
    justify-content: space-between;
    margin: 20px 0;
    padding: 0 10px;
}

.stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    flex: 1;
}

.stage-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    transition: all 0.3s ease;
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    color: #6c757d;
}

.stage.active .stage-icon {
    background: #1565C0;
    border-color: #1565C0;
    color: white;
    animation: pulse 1.5s infinite;
}

.stage.completed .stage-icon {
    background: #28a745;
    border-color: #28a745;
    color: white;
}

.stage-label {
    font-size: 12px;
    color: #6c757d;
    margin-top: 4px;
}

.stage.active .stage-label {
    color: #1565C0;
    font-weight: 600;
}

.stage.completed .stage-label {
    color: #28a745;
}

/* Connecting lines between stages */
.stage:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 20px;
    left: calc(50% + 20px);
    width: calc(100% - 40px);
    height: 2px;
    background: #dee2e6;
    z-index: -1;
}

.stage.completed:not(:last-child)::after {
    background: #28a745;
}

/* Queue animation */
.queue-animation {
    display: flex;
    align-items: center;
    gap: 10px;
}

.queue-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #1565C0;
    animation: pulse 1s infinite;
}

.queue-dot:nth-child(1) { animation-delay: 0s; }
.queue-dot:nth-child(2) { animation-delay: 0.2s; }
.queue-dot:nth-child(3) { animation-delay: 0.4s; }

/* Processing particles effect */
.processing-particles {
    position: relative;
    height: 4px;
    background: #f8f9fa;
    border-radius: 2px;
    overflow: hidden;
}

.processing-particles::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent 0%, 
        #1565C0 50%, 
        transparent 100%);
    animation: shimmer 1.5s infinite;
}

/* File type specific colors */
.file-type-pdf {
    background: #fff5f5 !important;
    border-color: #dc3545 !important;
    color: #dc3545 !important;
}

.file-type-docx {
    background: #f0f8ff !important;
    border-color: #0066cc !important;
    color: #0066cc !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .conversion-visual {
        flex-direction: column;
        height: auto;
        gap: 10px;
    }
    
    .conversion-arrow {
        transform: rotate(90deg);
    }
    
    .progress-stages {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .stage {
        min-width: 80px;
    }
}