/* ============================================
   TESSLIM360 - SUPER DARK PREMIUM PRELOADER
   Advanced, Beautiful, Glassmorphism, Neon Glows
   ============================================ */

/* Preloader Overlay */
.tesslim-preloader {
    position: fixed;
    inset: 0;
    background: #000000;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.7s cubic-bezier(0.8, 0, 0.2, 1), visibility 0.7s;
    overflow: hidden;
}

.tesslim-preloader.preloader-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: scale(1.02);
}

/* Animated Speed Lines (Hyper-drive effect) */
.preloader-bg-particles {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    perspective: 1000px;
}

.preloader-bg-particles span {
    position: absolute;
    width: 2px;
    height: 15vh;
    background: linear-gradient(to bottom, transparent, rgba(227, 30, 36, 0.8), transparent);
    border-radius: 2px;
    animation: speedLine 1.5s linear infinite;
    opacity: 0;
}

@keyframes speedLine {
    0% { transform: translateZ(-500px) translateY(-100vh); opacity: 0; }
    20% { opacity: 0.6; }
    80% { opacity: 0.6; }
    100% { transform: translateZ(200px) translateY(100vh); opacity: 0; }
}

.preloader-bg-particles span:nth-child(1) { left: 10%; animation-duration: 1.2s; animation-delay: 0s; height: 20vh; }
.preloader-bg-particles span:nth-child(2) { left: 25%; animation-duration: 1.8s; animation-delay: 0.4s; width: 3px; }
.preloader-bg-particles span:nth-child(3) { left: 40%; animation-duration: 1.1s; animation-delay: 0.8s; }
.preloader-bg-particles span:nth-child(4) { left: 55%; animation-duration: 1.6s; animation-delay: 0.3s; height: 10vh; }
.preloader-bg-particles span:nth-child(5) { left: 70%; animation-duration: 1.4s; animation-delay: 0.6s; width: 1px; }
.preloader-bg-particles span:nth-child(6) { left: 85%; animation-duration: 1.9s; animation-delay: 0.1s; }
.preloader-bg-particles span:nth-child(7) { left: 92%; animation-duration: 1.3s; animation-delay: 0.9s; height: 25vh; }
.preloader-bg-particles span:nth-child(8) { left: 5%; animation-duration: 1.5s; animation-delay: 0.5s; }

/* Logo Container */
.preloader-logo-wrap {
    position: relative;
    z-index: 10;
    margin-bottom: 50px;
    animation: dropGlow 1s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    opacity: 0;
}

@keyframes dropGlow {
    0% { opacity: 0; transform: translateY(-40px) scale(0.9); filter: drop-shadow(0 0 0 transparent); }
    100% { opacity: 1; transform: translateY(0) scale(1); filter: drop-shadow(0 5px 30px rgba(227, 30, 36, 0.5)); }
}

.preloader-logo-wrap img {
    max-width: 250px;
    max-height: 80px;
    object-fit: contain;
    position: relative;
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.1));
}

/* Fallback text logo if no image */
.preloader-logo-text {
    font-family: 'Inter', 'Plus Jakarta Sans', sans-serif;
    font-size: 3.5rem;
    font-weight: 900;
    color: #ffffff;
    letter-spacing: -2px;
    text-shadow: 0 0 20px rgba(255,255,255,0.2);
}

.preloader-logo-text span {
    color: #E31E24;
    text-shadow: 0 0 25px rgba(227, 30, 36, 0.6);
}

/* Dashboard Speedometer Spinner */
.preloader-spinner {
    position: relative;
    z-index: 10;
    width: 80px;
    height: 80px;
    margin-bottom: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: spinnerEnter 0.8s 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    opacity: 0;
}

@keyframes spinnerEnter {
    from { opacity: 0; transform: scale(0); filter: blur(10px); }
    to { opacity: 1; transform: scale(1); filter: blur(0); }
}

.preloader-spinner-ring {
    position: absolute;
    inset: 0;
    border: 3px solid rgba(255, 255, 255, 0.03);
    border-top-color: #E31E24;
    border-right-color: transparent;
    border-bottom-color: #FF5252;
    border-left-color: transparent;
    border-radius: 50%;
    animation: spinDash 1.2s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
    filter: drop-shadow(0 0 12px rgba(227, 30, 36, 0.7));
}

.preloader-spinner-inner {
    position: absolute;
    inset: 12px;
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    animation: spinDashReverse 3s linear infinite;
}

@keyframes spinDash {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes spinDashReverse {
    0% { transform: rotate(360deg); }
    100% { transform: rotate(-360deg); }
}

/* Car Icon in Spinner */
.preloader-spinner-icon {
    font-size: 2.4rem;
    color: #ffffff;
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.5)) drop-shadow(0 2px 8px rgba(227, 30, 36, 0.8));
    animation: carPulseMove 1.5s infinite ease-in-out;
    position: relative;
    z-index: 12;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preloader-spinner-icon svg {
    width: 1.2em;
    height: 1.2em;
}

@keyframes carPulseMove {
    0%, 100% { transform: scale(1) translateY(0); color: #ffffff; }
    50% { transform: scale(1.08) translateY(-3px); color: #FFF0F0; }
}

/* Ultra-Modern Glassmorphism Notice Box */
.preloader-notice {
    position: relative;
    z-index: 10;
    background: rgba(15, 15, 25, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 20px;
    padding: 20px 40px;
    display: flex;
    align-items: center;
    gap: 22px;
    animation: slideUpFade 0.8s 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    opacity: 0;
    transform: translateY(40px);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: 0 30px 60px rgba(0,0,0,0.6), inset 0 0 0 1px rgba(255,255,255,0.03);
    overflow: hidden;
}

.preloader-notice::before {
    content: '';
    position: absolute;
    top: 0; left: -150%;
    width: 50%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
    animation: glassShine 4s infinite;
    transform: skewX(-20deg);
}

@keyframes glassShine {
    0% { left: -150%; }
    20% { left: 200%; }
    100% { left: 200%; }
}

@keyframes slideUpFade {
    to { opacity: 1; transform: translateY(0); }
}

.preloader-notice-icon {
    width: 56px;
    height: 56px;
    background: rgba(227, 30, 36, 0.08);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 0 25px rgba(227, 30, 36, 0.25), inset 0 0 20px rgba(227, 30, 36, 0.15);
    position: relative;
}

.preloader-notice-icon::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 16px;
    padding: 1px;
    background: linear-gradient(135deg, #E31E24, transparent, #FF5252);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
}

.preloader-notice-icon i {
    font-size: 1.6rem;
    color: #E31E24;
    text-shadow: 0 0 15px rgba(227, 30, 36, 0.7);
    animation: pulseIcon 2s infinite ease-in-out;
}

@keyframes pulseIcon {
    0%, 100% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.15); filter: brightness(1.3); }
}

.preloader-notice-text {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.preloader-notice-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: #92929a;
    text-transform: uppercase;
    letter-spacing: 2.5px;
}

.preloader-notice-value {
    font-size: 1.4rem;
    font-weight: 300;
    color: #ffffff;
    line-height: 1;
}

.preloader-notice-value span {
    color: #E31E24;
    font-weight: 800;
    font-size: 1.8rem;
    text-shadow: 0 0 20px rgba(227, 30, 36, 0.5);
    display: inline-block;
    animation: bounceNumber 3s infinite;
}

@keyframes bounceNumber {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-4px); }
    60% { transform: translateY(-2px); }
}

/* Neon Laser Progress Bar */
.preloader-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: #000;
    z-index: 20;
}

.preloader-progress-bar {
    height: 100%;
    background: #E31E24;
    width: 0%;
    position: relative;
    animation: preloaderProgressLaser 2.2s cubic-bezier(0.8, 0, 0.2, 1) forwards;
    box-shadow: 0 0 20px #E31E24, 0 0 40px #E31E24;
    border-radius: 0 4px 4px 0;
}

.preloader-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 120px;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.9));
    border-radius: 0 4px 4px 0;
}

@keyframes preloaderProgressLaser {
    0% { width: 0%; }
    30% { width: 35%; }
    70% { width: 85%; }
    100% { width: 100%; }
}

/* Pulsing Loading Text */
.preloader-loading-text {
    position: relative;
    z-index: 10;
    margin-top: 30px;
    font-size: 0.8rem;
    color: #888;
    font-weight: 700;
    letter-spacing: 5px;
    text-transform: uppercase;
    animation: pulseText 1.5s infinite alternate;
}

@keyframes pulseText {
    0% { opacity: 0.3; text-shadow: 0 0 0 transparent; }
    100% { opacity: 1; color: #fff; text-shadow: 0 0 15px rgba(255,255,255,0.8); }
}

.preloader-loading-text .dot-anim::after {
    content: '';
    animation: dotAnimation 1.5s infinite;
}

@keyframes dotAnimation {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
    100% { content: ''; }
}

/* Mobile Responsive */
@media (max-width: 576px) {
    .preloader-logo-wrap img {
        max-width: 180px;
        max-height: 60px;
    }

    .preloader-logo-text { font-size: 2.6rem; }
    .preloader-notice { padding: 18px 24px; gap: 16px; margin: 0 20px; border-radius: 16px; }
    .preloader-notice-icon { width: 48px; height: 48px; }
    .preloader-notice-icon i { font-size: 1.3rem; }
    .preloader-notice-value { font-size: 1.1rem; }
    .preloader-notice-value span { font-size: 1.5rem; }
    .preloader-notice-label { font-size: 0.65rem; letter-spacing: 1.5px; }
    .preloader-spinner { width: 64px; height: 64px; margin-bottom: 40px; }
    .preloader-spinner-inner { inset: 10px; }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .tesslim-preloader *,
    .preloader-spinner-ring,
    .preloader-spinner-inner,
    .preloader-spinner-icon,
    .preloader-bg-particles span {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print */
@media print {
    .tesslim-preloader { display: none !important; }
}