/**
 * Premium Preloader Styles
 * Elegant, minimalist design with cream background
 * 
 * @package SENNA_Launcher
 * @since 4.1.0
 */

/* ===========================================
   PRELOADER CONTAINER
   =========================================== */

.premium-preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #FAF7F2; /* Cream background */
    z-index: 9999999; /* Higher than launcher container */
    display: none; /* Hidden by default, shown via JS */
    align-items: center;
    justify-content: center;
    overflow: hidden;
    opacity: 1;
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Subtle texture overlay */
.premium-preloader::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.8) 0%, transparent 70%);
    pointer-events: none;
}

/* ===========================================
   PRELOADER CONTENT
   =========================================== */

.preloader-content {
    position: relative;
    text-align: center;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
}

/* ===========================================
   BRAND LOGO - LARGE S WITH DOT
   =========================================== */

.preloader-brand-mark {
    position: relative;
    width: 120px;
    height: 140px;
    margin: 0 auto;
    opacity: 1; /* Show immediately for testing */
    animation: brand-fade-in 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.2s forwards;
}

/* Large S Letter */
.brand-letter-s {
    font-family: 'Playfair Display', serif;
    font-size: 120px;
    font-weight: 700;
    color: #1B4332;
    line-height: 1;
    letter-spacing: -5px;
    position: relative;
    display: inline-block;
    transform-origin: center;
    animation: s-reveal 1.2s cubic-bezier(0.4, 0, 0.2, 1) 0.3s forwards;
}

/* Navy Blue Dot with Gradient */
.brand-dot {
    position: absolute;
    top: 5px;
    right: -20px;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #1B4332 0%, #2D6A4F 50%, #52B788 100%);
    border-radius: 50%;
    opacity: 1; /* Show immediately for testing */
    transform: scale(1);
    animation: dot-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.8s forwards;
    box-shadow: 0 6px 20px rgba(27, 67, 50, 0.3);
}

/* ===========================================
   SKILL FARM TEXT
   =========================================== */

.preloader-brand-name {
    opacity: 1; /* Show immediately for testing */
    animation: text-fade-up 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.6s forwards;
}

.preloader-brand-text {
    font-family: 'Playfair Display', serif;
    font-size: 48px;
    font-weight: 600;
    color: #1B4332;
    letter-spacing: 8px;
    text-transform: uppercase;
    margin: 0;
    line-height: 1;
}

/* ===========================================
   TAGLINE
   =========================================== */

.preloader-tagline {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 400;
    color: #6B7C75;
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-top: -20px;
    opacity: 1; /* Show immediately for testing */
    animation: text-fade-up 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.9s forwards;
}

/* ===========================================
   PREMIUM MINIMAL BAR LOADER
   =========================================== */

.premium-loader {
    margin-top: 50px;
    position: relative;
    width: 200px;
    height: 4px;
    opacity: 1; /* Show immediately */
    /* animation: loader-fade 0.6s ease 1s forwards; */
}

/* Loader background track */
.loader-track {
    width: 100%;
    height: 100%;
    background: rgba(27, 67, 50, 0.08);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

/* Animated progress bar */
.loader-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, 
        #1B4332 0%, 
        #2D6A4F 35%, 
        #52B788 65%, 
        #1B4332 100%);
    background-size: 200% 100%;
    border-radius: 4px;
    transform: translateX(-100%);
    -webkit-animation: loader-slide 2.5s cubic-bezier(0.4, 0, 0.2, 1) 0.2s infinite !important;
    animation: loader-slide 2.5s cubic-bezier(0.4, 0, 0.2, 1) 0.2s infinite !important;
}

/* Elegant shimmer effect */
.loader-shimmer {
    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%);
    -webkit-animation: shimmer-pass 2.5s ease-in-out 0.5s infinite;
    animation: shimmer-pass 2.5s ease-in-out 0.5s infinite;
}

/* Elegant dots loader as secondary option */
.premium-dots-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 40px;
    opacity: 0;
    animation: loader-fade 0.6s ease 1.2s forwards;
}

.loader-dot {
    width: 10px;
    height: 10px;
    background: linear-gradient(135deg, #1B4332 0%, #2D6A4F 100%);
    border-radius: 50%;
    animation: dot-wave 1.4s ease-in-out infinite;
}

.loader-dot:nth-child(1) { animation-delay: 0s; }
.loader-dot:nth-child(2) { animation-delay: 0.15s; }
.loader-dot:nth-child(3) { animation-delay: 0.3s; }
.loader-dot:nth-child(4) { animation-delay: 0.45s; }

/* ===========================================
   ANIMATIONS
   =========================================== */

@keyframes brand-fade-in {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes s-reveal {
    0% {
        opacity: 0;
        transform: scale(0.7) rotate(-5deg);
    }
    50% {
        transform: scale(1.05) rotate(2deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

@keyframes dot-pop {
    0% {
        opacity: 0;
        transform: scale(0) rotate(-180deg);
    }
    50% {
        transform: scale(1.3) rotate(90deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

@keyframes text-fade-up {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes loader-fade {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

@keyframes loader-slide {
    0% {
        transform: translateX(-100%);
    }
    50% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(100%);
    }
}

@keyframes shimmer-pass {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

@keyframes dot-wave {
    0%, 60%, 100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
    30% {
        transform: translateY(-15px) scale(1.1);
        opacity: 0.7;
    }
}

/* ===========================================
   FADE OUT STATE
   =========================================== */

.premium-preloader.fade-out {
    opacity: 0;
}

.premium-preloader.fade-out .preloader-content {
    transform: scale(0.95);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===========================================
   PREMIUM DETAILS
   =========================================== */

/* Subtle grain texture for premium feel */
.preloader-grain {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.03;
    z-index: 1;
    pointer-events: none;
}

.preloader-grain::before {
    content: '';
    position: absolute;
    top: -100%;
    left: -100%;
    width: 300%;
    height: 300%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' /%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
    animation: grain 8s steps(10) infinite;
}

@keyframes grain {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-5%, -10%); }
    20% { transform: translate(-15%, 5%); }
    30% { transform: translate(7%, -25%); }
    40% { transform: translate(-5%, 25%); }
    50% { transform: translate(-15%, 10%); }
    60% { transform: translate(15%, 0%); }
    70% { transform: translate(0%, 15%); }
    80% { transform: translate(3%, 35%); }
    90% { transform: translate(-10%, 10%); }
}

/* ===========================================
   RESPONSIVE
   =========================================== */

@media (max-width: 768px) {
    .preloader-brand-mark {
        width: 90px;
        height: 110px;
    }
    
    .brand-letter-s {
        font-size: 90px;
    }
    
    .brand-dot {
        width: 14px;
        height: 14px;
        top: 5px;
        right: -10px;
    }
    
    .preloader-brand-text {
        font-size: 36px;
        letter-spacing: 6px;
    }
    
    .preloader-tagline {
        font-size: 11px;
        letter-spacing: 2px;
    }
}

@media (max-width: 480px) {
    .preloader-brand-mark {
        width: 70px;
        height: 85px;
    }
    
    .brand-letter-s {
        font-size: 70px;
    }
    
    .brand-dot {
        width: 12px;
        height: 12px;
        top: 3px;
        right: -8px;
    }
    
    .preloader-brand-text {
        font-size: 28px;
        letter-spacing: 4px;
    }
    
    .preloader-tagline {
        font-size: 10px;
        letter-spacing: 1.5px;
    }
    
    .preloader-content {
        gap: 30px;
    }
}

/* ===========================================
   HIGH-END REFINEMENTS
   =========================================== */

/* Remove selection on preloader elements */
.premium-preloader * {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Smooth rendering for text */
.preloader-brand-text,
.brand-letter-s {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Ensure crisp rendering on retina displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .brand-dot {
        transform-style: preserve-3d;
        backface-visibility: hidden;
    }
}