﻿body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow-x: hidden; /* Prevent horizontal overflow */
}

/* World-Class Minimalistic Preloader - Cursor Style */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.4s ease-out, visibility 0.4s ease-out;
}

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

.preloader-content {
    text-align: center;
    color: #374151;
}

/* Minimalistic Logo */
.preloader-logo {
    width: 32px;
    height: 32px;
    margin: 0 auto 24px;
    opacity: 0.9;
}

.preloader-logo svg {
    width: 100%;
    height: 100%;
    color: #3b82f6;
}

/* Clean Spinner */
.preloader-spinner {
    width: 32px;
    height: 32px;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

/* Search-specific spinner */
.search-loader-spinner {
    width: 32px;
    height: 32px;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
    display: block;
}

/* Typography */
.preloader-text {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 8px;
    color: #374151;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Minimal Progress Bar */
.preloader-progress {
    width: 160px;
    height: 2px;
    background: #f3f4f6;
    border-radius: 1px;
    margin: 20px auto 0;
    overflow: hidden;
}

.preloader-progress-bar {
    height: 100%;
    background: #3b82f6;
    border-radius: 1px;
    width: 0%;
    transition: width 0.3s ease;
}

/* Skeleton Loading States */
.skeleton {
    background: linear-gradient(90deg, #f9fafb 25%, #f3f4f6 50%, #f9fafb 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
}

.skeleton-text:last-child {
    width: 60%;
}

.skeleton-image {
    width: 100%;
    height: 200px;
    border-radius: 8px;
}

.skeleton-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

/* Loading States for AJAX Content */
.loading-overlay {
    position: relative;
    min-height: 200px;
}

.loading-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.loading-spinner-small {
    width: 24px;
    height: 24px;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

@keyframes skeleton-loading {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Progress Bar Animation */
@keyframes progress-animation {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

/* Loading Dots Animation */
@keyframes dot-pulse {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Fade In Animation for Content */
.fade-in {
    opacity: 0;
    transform: translateY(16px);
    animation: fadeInUp 0.5s ease-out forwards;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .preloader-logo {
        width: 40px;
        height: 40px;
        margin-bottom: 20px;
    }
    
    .preloader-spinner {
        width: 28px;
        height: 28px;
        margin-bottom: 16px;
    }
    
    .preloader-text {
        font-size: 15px;
    }
    
    .preloader-progress {
        width: 120px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .preloader {
        background: #111827;
    }
    
    .preloader-text {
        color: #f9fafb;
    }
    
    .skeleton {
        background: linear-gradient(90deg, #1f2937 25%, #374151 50%, #1f2937 75%);
    }
    
    .skeleton-card {
        background: #1f2937;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    }
    
    .loading-overlay::before {
        background: rgba(17, 24, 39, 0.9);
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .preloader-spinner,
    .loading-spinner-small {
        animation: none;
    }
    
    .skeleton {
        animation: none;
    }
    
    .preloader-progress-bar {
        animation: none;
        width: 100%;
    }
    
    .fade-in {
        animation: none;
        opacity: 1;
        transform: none;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .preloader-spinner {
        border-color: #000000;
        border-top-color: #0066cc;
    }
    
    .preloader-progress-bar {
        background: #0066cc;
    }
    
    .preloader-progress {
        background: #000000;
    }
}
