/**
 * Tech6Sense Modern Preloader Styles
 * Clean, minimalist design with advanced animations
 */

/* Base Preloader Styles with high specificity */
#preloader.preloader {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 9999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #ffffff !important;
    opacity: 1 !important;
    visibility: visible !important;
    transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
                visibility 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
    overflow: hidden !important;
}

#preloader::before {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: radial-gradient(circle at 50% 50%, rgba(102, 126, 234, 0.03) 0%, transparent 50%) !important;
    animation: pulseBackground 4s ease-in-out infinite !important;
}

#preloader.fade-out {
    opacity: 0 !important;
    visibility: hidden !important;
    transform: scale(1) !important; /* No scaling */
}

/* Content Container */
.preloader-content {
    position: relative;
    z-index: 2;
    text-align: center;
    animation: fadeInUp 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Logo Container */
.logo-container {
    margin-bottom: 30px;
    position: relative;
}

.preloader-logo {
    max-width: 280px;
    height: auto;
    animation: logoFloat 3s ease-in-out infinite;
    filter: drop-shadow(0 8px 32px rgba(0, 0, 0, 0.1));
    transition: all 0.3s ease;
}

.logo-container::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #000000, transparent);
    animation: lineExpand 2s ease-in-out infinite;
}

/* Tagline Container */
.tagline-container {
    margin-bottom: 35px;
    overflow: hidden;
}

.tagline-wrapper {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}

.tagline-word {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 1.8rem;
    font-weight: 600;
    color: #1a1a1a;
    opacity: 0;
    transform: translateY(30px);
    animation: wordAppear 0.8s ease-out forwards;
    letter-spacing: -0.02em;
    position: relative;
}

.tagline-word::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    animation: underlineExpand 0.6s ease-out forwards;
    animation-delay: inherit;
}

.tagline-word:nth-child(1) { animation-delay: 0.2s; }
.tagline-word:nth-child(1)::after { animation-delay: 0.8s; }
.tagline-word:nth-child(2) { animation-delay: 0.4s; }
.tagline-word:nth-child(2)::after { animation-delay: 1s; }
.tagline-word:nth-child(3) { animation-delay: 0.6s; }
.tagline-word:nth-child(3)::after { animation-delay: 1.2s; }
.tagline-word:nth-child(4) { animation-delay: 0.8s; }
.tagline-word:nth-child(4)::after { animation-delay: 1.4s; }

/* Loading Container */
.loading-container {
    margin-bottom: 18px;
}

.loading-message {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 1.2rem;
    font-weight: 500;
    color: #6b7280;
    opacity: 0;
    animation: fadeIn 1s ease-out 1.5s forwards;
    letter-spacing: 0.02em;
    margin-bottom: 10px;
}

/* Progress Container */
.progress-container {
    position: relative;
    width: 200px;
    margin: 0 auto;
}

.progress-bar {
    width: 100%;
    height: 3px;
    background: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: #000000;
    border-radius: 2px;
    width: 0%;
    animation: progressFill 3s ease-in-out infinite;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background-image: linear-gradient(
        -45deg,
        rgba(255, 255, 255, 0.2) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0.2) 75%,
        transparent 75%,
        transparent
    );
    background-size: 16px 16px;
    animation: progressShine 1s linear infinite;
}

/* Keyframe Animations */
@keyframes pulseBackground {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05); }
}

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(40px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes logoFloat {
    0%, 100% {
        transform: translateY(0px) scale(1);
    }
    50% {
        transform: translateY(-10px) scale(1.02);
    }
}

@keyframes lineExpand {
    0%, 100% {
        width: 20px;
        opacity: 0.3;
    }
    50% {
        width: 80px;
        opacity: 1;
    }
}

@keyframes wordAppear {
    0% {
        opacity: 0;
        transform: translateY(30px) rotateX(-90deg);
    }
    100% {
        opacity: 1;
        transform: translateY(0) rotateX(0deg);
    }
}

@keyframes underlineExpand {
    0% {
        width: 0%;
        opacity: 0;
    }
    100% {
        width: 100%;
        opacity: 1;
    }
}

@keyframes fadeIn {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes progressFill {
    0% {
        width: 0%;
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        width: 100%;
    }
    100% {
        width: 100%;
        opacity: 0.8;
    }
}

@keyframes progressShine {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .preloader-logo {
        max-width: 200px;
    }
    
    .tagline-word {
        font-size: 1.4rem;
    }
    
    .progress-container {
        width: 160px;
    }
    
    .tagline-wrapper {
        gap: 6px;
    }
    
    .logo-container {
        margin-bottom: 25px;
    }
    
    .logo-container::after {
        bottom: -6px;
    }
    
    .tagline-container {
        margin-bottom: 30px;
    }
    
    .loading-message {
        font-size: 1.1rem;
        margin-bottom: 8px;
    }
    
    .loading-container {
        margin-bottom: 15px;
    }
}

@media (max-width: 480px) {
    .preloader-logo {
        max-width: 150px;
    }
    
    .tagline-word {
        font-size: 1.1rem;
    }
    
    .progress-container {
        width: 140px;
    }
    
    .loading-message {
        font-size: 1rem;
        margin-bottom: 6px;
    }
    
    .logo-container {
        margin-bottom: 20px;
    }
    
    .logo-container::after {
        bottom: -5px;
    }
    
    .tagline-container {
        margin-bottom: 25px;
    }
    
    .loading-container {
        margin-bottom: 12px;
    }
}

@media (max-width: 320px) {
    .preloader-logo {
        max-width: 120px;
    }
    
    .tagline-word {
        font-size: 1rem;
    }
    
    .progress-container {
        width: 120px;
    }
    
    .loading-message {
        font-size: 0.95rem;
        margin-bottom: 5px;
    }
    
    .logo-container {
        margin-bottom: 18px;
    }
    
    .logo-container::after {
        bottom: -4px;
    }
    
    .tagline-container {
        margin-bottom: 20px;
    }
    
    .loading-container {
        margin-bottom: 10px;
    }
}

/* High-end animations for modern browsers */
@media (prefers-reduced-motion: no-preference) {
    .preloader-content {
        animation-duration: 1.2s;
        animation-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    }
    
    .tagline-word {
        animation-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1);
    }
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    #preloader::before,
    .preloader-logo,
    .progress-fill::after {
        animation: none;
    }
    
    .tagline-word {
        animation: fadeIn 0.5s ease-out forwards;
    }
}

/* Dark mode support (keep white for consistency) */
@media (prefers-color-scheme: dark) {
    #preloader {
        background: #ffffff;
    }
}

/* Modern blur effect for supported browsers */
@supports (backdrop-filter: blur(10px)) {
    #preloader {
        backdrop-filter: blur(10px);
    }
}

/* Print styles */
@media print {
    #preloader {
        display: none !important;
    }
}
