/* Legal-themed loading animations for DocGen Pro */

/* Base loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(33, 37, 41, 0.95);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Loading container */
.loading-container {
    text-align: center;
    color: #fff;
    max-width: 400px;
    padding: 2rem;
}

.loading-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #ffc107;
}

.loading-subtitle {
    font-size: 1rem;
    margin-bottom: 2rem;
    color: #6c757d;
}

/* Document Generation Animation */
.legal-document-animation {
    width: 120px;
    height: 120px;
    margin: 0 auto 2rem;
    position: relative;
}

.document-icon {
    width: 80px;
    height: 100px;
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    border-radius: 8px;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.document-icon::before {
    content: '';
    position: absolute;
    top: 15px;
    left: 15px;
    right: 15px;
    height: 3px;
    background: #007bff;
    border-radius: 2px;
    animation: typing-line 2s ease-in-out infinite;
}

.document-icon::after {
    content: '';
    position: absolute;
    top: 30px;
    left: 15px;
    right: 25px;
    height: 2px;
    background: #6c757d;
    border-radius: 1px;
    animation: typing-line 2s ease-in-out infinite 0.5s;
}

.document-lines {
    position: absolute;
    top: 45px;
    left: 15px;
    right: 15px;
}

.document-lines .line {
    height: 2px;
    background: #dee2e6;
    margin-bottom: 8px;
    border-radius: 1px;
    transform-origin: left;
    animation: line-fill 3s ease-in-out infinite;
}

.document-lines .line:nth-child(1) { animation-delay: 0s; width: 90%; }
.document-lines .line:nth-child(2) { animation-delay: 0.3s; width: 75%; }
.document-lines .line:nth-child(3) { animation-delay: 0.6s; width: 85%; }
.document-lines .line:nth-child(4) { animation-delay: 0.9s; width: 60%; }

@keyframes typing-line {
    0%, 50% { width: 15px; background: #007bff; }
    100% { width: calc(100% - 30px); background: #28a745; }
}

@keyframes line-fill {
    0% { transform: scaleX(0); background: #dee2e6; }
    50% { transform: scaleX(0.7); background: #007bff; }
    100% { transform: scaleX(1); background: #28a745; }
}

/* AI Analysis Animation */
.ai-analysis-animation {
    width: 120px;
    height: 120px;
    margin: 0 auto 2rem;
    position: relative;
}

.ai-brain {
    width: 80px;
    height: 80px;
    background: linear-gradient(145deg, #007bff, #0056b3);
    border-radius: 50%;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 16px rgba(0, 123, 255, 0.3);
}

.ai-brain::before {
    content: '🧠';
    font-size: 2rem;
    animation: pulse-brain 2s ease-in-out infinite;
}

.ai-particles {
    position: absolute;
    width: 100%;
    height: 100%;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #ffc107;
    border-radius: 50%;
    animation: float-around 3s linear infinite;
}

.particle:nth-child(1) {
    top: 20%;
    left: 80%;
    animation-delay: 0s;
}

.particle:nth-child(2) {
    top: 80%;
    left: 20%;
    animation-delay: 1s;
}

.particle:nth-child(3) {
    top: 50%;
    left: 10%;
    animation-delay: 2s;
}

.particle:nth-child(4) {
    top: 10%;
    left: 50%;
    animation-delay: 1.5s;
}

@keyframes pulse-brain {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes float-around {
    0% { transform: translateY(0) rotate(0deg); opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { transform: translateY(-20px) rotate(360deg); opacity: 0; }
}

/* Payment Processing Animation */
.payment-animation {
    width: 120px;
    height: 120px;
    margin: 0 auto 2rem;
    position: relative;
}

.credit-card {
    width: 90px;
    height: 60px;
    background: linear-gradient(145deg, #28a745, #20c997);
    border-radius: 8px;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
    overflow: hidden;
}

.credit-card::before {
    content: '';
    position: absolute;
    top: 15px;
    left: 10px;
    width: 30px;
    height: 20px;
    background: #ffc107;
    border-radius: 4px;
    animation: card-chip 2s ease-in-out infinite;
}

.credit-card::after {
    content: '****';
    position: absolute;
    bottom: 8px;
    right: 10px;
    font-size: 10px;
    color: #fff;
    font-weight: bold;
}

.payment-waves {
    position: absolute;
    width: 120px;
    height: 120px;
    top: 0;
    left: 0;
}

.wave {
    position: absolute;
    border: 2px solid #28a745;
    border-radius: 50%;
    animation: payment-wave 2s ease-out infinite;
}

.wave:nth-child(1) {
    width: 60px;
    height: 60px;
    top: 30px;
    left: 30px;
    animation-delay: 0s;
}

.wave:nth-child(2) {
    width: 80px;
    height: 80px;
    top: 20px;
    left: 20px;
    animation-delay: 0.5s;
}

.wave:nth-child(3) {
    width: 100px;
    height: 100px;
    top: 10px;
    left: 10px;
    animation-delay: 1s;
}

@keyframes card-chip {
    0%, 100% { background: #ffc107; }
    50% { background: #fd7e14; }
}

@keyframes payment-wave {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    100% {
        transform: scale(1.2);
        opacity: 0;
    }
}

/* Legal Scales Animation */
.legal-scales-animation {
    width: 120px;
    height: 120px;
    margin: 0 auto 2rem;
    position: relative;
}

.scales-base {
    width: 80px;
    height: 80px;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.scales-beam {
    width: 60px;
    height: 3px;
    background: #6c757d;
    position: absolute;
    top: 20px;
    left: 10px;
    transform-origin: center;
    animation: scales-balance 3s ease-in-out infinite;
}

.scales-pan {
    width: 15px;
    height: 15px;
    border: 2px solid #6c757d;
    border-radius: 50% 50% 0 0;
    position: absolute;
    top: 23px;
}

.scales-pan.left {
    left: 0;
    animation: pan-bounce 3s ease-in-out infinite;
}

.scales-pan.right {
    right: 0;
    animation: pan-bounce 3s ease-in-out infinite reverse;
}

.scales-center {
    width: 4px;
    height: 30px;
    background: #6c757d;
    position: absolute;
    left: 38px;
    top: 5px;
}

@keyframes scales-balance {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg); }
    75% { transform: rotate(5deg); }
}

@keyframes pan-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(3px); }
}

/* Progress Bar */
.loading-progress {
    width: 100%;
    max-width: 300px;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin: 1rem auto;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #007bff, #28a745);
    border-radius: 4px;
    animation: progress-fill 3s ease-in-out infinite;
}

@keyframes progress-fill {
    0% { width: 0%; transform: translateX(-100%); }
    50% { width: 100%; transform: translateX(0%); }
    100% { width: 100%; transform: translateX(100%); }
}

/* Loading dots */
.loading-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
}

.dot {
    width: 6px;
    height: 6px;
    background: #007bff;
    border-radius: 50%;
    animation: dot-bounce 1.4s ease-in-out infinite;
}

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

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

/* Responsive design */
@media (max-width: 768px) {
    .loading-container {
        padding: 1rem;
        max-width: 300px;
    }
    
    .loading-title {
        font-size: 1.25rem;
    }
    
    .legal-document-animation,
    .ai-analysis-animation,
    .payment-animation,
    .legal-scales-animation {
        width: 100px;
        height: 100px;
    }
}

/* Success animation */
.success-checkmark {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #28a745;
    position: relative;
    animation: success-popup 0.6s ease-out;
}

.success-checkmark::after {
    content: '✓';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 2rem;
    font-weight: bold;
}

@keyframes success-popup {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Error animation */
.error-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #dc3545;
    position: relative;
    animation: error-shake 0.8s ease-out;
}

.error-icon::after {
    content: '✗';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 2rem;
    font-weight: bold;
}

@keyframes error-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}