/* AUTO TESTER - Page Loader Styles */

/* Page Loader Container */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #002b5c, #004481);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.page-loader.show {
    opacity: 1;
    visibility: visible;
}

.page-loader.fade-out {
    opacity: 0;
    visibility: hidden;
}

.loader-container {
    text-align: center;
    color: white;
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    max-width: 300px;
}

/* Loader Logo */
.loader-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    animation: logoFloat 3s ease-in-out infinite;
}

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

.loader-logo .logo-icon {
    width: 80px;
    height: 80px;
    background: rgba(255, 215, 0, 0.2);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: #ffd700;
    transform: rotate(45deg);
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(255, 215, 0, 0.3);
}

.loader-logo .logo-icon i {
    transform: rotate(-45deg);
}

.loader-logo .logo-text {
    font-size: 2rem;
    font-weight: 900;
    color: white;
    text-align: center;
}

.loader-logo .logo-text span {
    color: #ffd700;
}

/* Loader Spinner */
.loader-spinner {
    position: relative;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: #ffd700;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    position: relative;
}

.spinner::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border: 4px solid transparent;
    border-top-color: rgba(255, 215, 0, 0.3);
    border-radius: 50%;
    animation: spin 1.5s linear infinite reverse;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Loading Text */
.loader-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.loading-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.loading-dots {
    display: flex;
    gap: 4px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: #ffd700;
    border-radius: 50%;
    animation: dotPulse 1.4s ease-in-out infinite both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0s; }

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

/* Progress Bar */
.loader-progress {
    width: 100%;
    max-width: 250px;
    display: none;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ffd700, #ffed4e);
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .loader-content {
        gap: 25px;
        max-width: 250px;
    }
    
    .loader-logo .logo-icon {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }
    
    .loader-logo .logo-text {
        font-size: 1.5rem;
    }
    
    .spinner {
        width: 50px;
        height: 50px;
        border-width: 3px;
    }
    
    .spinner::before {
        border-width: 3px;
    }
    
    .loading-text {
        font-size: 1rem;
    }
    
    .loading-dots span {
        width: 6px;
        height: 6px;
    }
    
    .loader-progress {
        max-width: 200px;
    }
}

@media (max-width: 480px) {
    .loader-content {
        gap: 20px;
        max-width: 200px;
    }
    
    .loader-logo .logo-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    .loader-logo .logo-text {
        font-size: 1.2rem;
    }
    
    .spinner {
        width: 40px;
        height: 40px;
        border-width: 2px;
    }
    
    .spinner::before {
        border-width: 2px;
    }
    
    .loading-text {
        font-size: 0.9rem;
    }
    
    .loading-dots span {
        width: 5px;
        height: 5px;
    }
    
    .loader-progress {
        max-width: 150px;
    }
}

/* High Performance Mode */
@media (prefers-reduced-motion: reduce) {
    .page-loader,
    .loader-logo,
    .spinner,
    .loading-dots span,
    .progress-fill {
        animation: none;
        transition: none;
    }
    
    .loader-logo {
        transform: none;
    }
    
    .spinner {
        animation: spin 2s linear infinite;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .page-loader {
        background: linear-gradient(135deg, #001a33, #002855);
    }
    
    .loading-text {
        color: rgba(255, 255, 255, 0.95);
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .page-loader {
        background: #000;
    }
    
    .spinner {
        border-color: #fff;
        border-top-color: #ffd700;
    }
    
    .loading-text {
        color: #fff;
    }
    
    .loading-dots span {
        background: #ffd700;
    }
}

/* RTL Support */
html[dir="rtl"] .loader-content {
    direction: rtl;
}

html[dir="rtl"] .loading-dots {
    direction: ltr;
}

/* Print Styles */
@media print {
    .page-loader {
        display: none !important;
    }
}

/* Accessibility */
.page-loader:focus {
    outline: none;
}

.page-loader[aria-label] {
    /* Screen reader support */
}

/* Variations */
.page-loader.minimal {
    background: rgba(255, 255, 255, 0.95);
}

.page-loader.minimal .loader-content {
    color: #002b5c;
}

.page-loader.minimal .spinner {
    border-color: rgba(0, 43, 92, 0.1);
    border-top-color: #002b5c;
}

.page-loader.minimal .loading-text {
    color: #002b5c;
}

.page-loader.minimal .loading-dots span {
    background: #002b5c;
}

.page-loader.simple .spinner {
    border: none;
    background: none;
}

.page-loader.simple .spinner::before {
    content: '...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    color: #ffd700;
    animation: none;
}

/* Error State */
.page-loader.error {
    background: linear-gradient(135deg, #dc2626, #991b1b);
}

.page-loader.error .spinner {
    border-top-color: #fff;
}

.page-loader.error .loading-text {
    color: #fff;
}

.page-loader.error .loading-dots span {
    background: #fff;
}

/* Success State */
.page-loader.success {
    background: linear-gradient(135deg, #16a34a, #15803d);
}

.page-loader.success .spinner {
    border-top-color: #fff;
}

.page-loader.success .loading-text {
    color: #fff;
}

.page-loader.success .loading-dots span {
    background: #fff;
}

/* Custom Loading States */
.page-loader.uploading .loading-text::before {
    content: 'Uploading... ';
}

.page-loader.downloading .loading-text::before {
    content: 'Downloading... ';
}

.page-loader.processing .loading-text::before {
    content: 'Processing... ';
}

.page-loader.authenticating .loading-text::before {
    content: 'Authenticating... ';
}

/* Debug Mode (development only) */
.page-loader.debug .loader-content::after {
    content: attr(data-debug);
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    font-family: monospace;
}
