/* ==============================================
   PREMIUM ANIMATION SYSTEM — matehubtools
   ============================================== */

/* ── WELCOME LOADER ── */
#welcome-loader {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #000212;
    overflow: hidden;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}
#welcome-loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Loader canvas (particles + animals) */
#loader-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

/* Central content */
.loader-content {
    position: relative;
    z-index: 10;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

/* Neon badge */
.loader-badge {
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.35em;
    text-transform: uppercase;
    color: rgba(0, 229, 255, 0.7);
    animation: badge-pulse 2s ease-in-out infinite;
}
@keyframes badge-pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; text-shadow: 0 0 20px rgba(0, 229, 255, 0.8); }
}

/* Cinematic Logo in Loader */
.loader-logo-container {
    margin-bottom: 0.5rem;
    perspective: 1000px;
}
.loader-logo {
    height: 120px;
    width: auto;
    border-radius: 20px;
    filter: drop-shadow(0 0 15px rgba(0, 229, 255, 0.4));
    opacity: 0;
    transform: translateZ(-100px) rotateX(20deg);
    animation: loader-logo-entrance 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.3s forwards,
               loader-logo-pulse 2.5s ease-in-out 1.5s infinite;
}

@keyframes loader-logo-entrance {
    to {
        opacity: 1;
        transform: translateZ(0) rotateX(0);
        filter: drop-shadow(0 0 30px rgba(0, 229, 255, 0.7));
    }
}

@keyframes loader-logo-pulse {
    0%, 100% { filter: drop-shadow(0 0 30px rgba(0, 229, 255, 0.5)); transform: scale(1); }
    50% { filter: drop-shadow(0 0 50px rgba(127, 0, 255, 0.8)); transform: scale(1.05); }
}

/* Main title */
.loader-title {
    font-size: clamp(1.8rem, 5vw, 3.5rem);
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: -0.02em;
    animation: title-flicker 0.15s ease-in-out 0.3s;
}

.loader-title .word-welcome {
    display: block;
    color: #ffffff;
    opacity: 0;
    transform: translateY(30px);
    animation: word-rise 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;
}
.loader-title .word-to {
    display: block;
    color: #94A3B8;
    font-size: 0.5em;
    font-weight: 400;
    letter-spacing: 0.5em;
    text-transform: uppercase;
    opacity: 0;
    transform: translateY(20px);
    animation: word-rise 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.45s forwards;
}
.loader-title .word-brand {
    display: block;
    background: linear-gradient(135deg, #00E5FF 0%, #7F00FF 40%, #FF006E 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    opacity: 0;
    transform: translateY(30px);
    animation: word-rise 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.65s forwards,
               brand-glow-pulse 2s ease-in-out 1.4s infinite;
    filter: drop-shadow(0 0 30px rgba(0, 229, 255, 0.3));
}

@keyframes word-rise {
    to { opacity: 1; transform: translateY(0); }
}
@keyframes brand-glow-pulse {
    0%, 100% { filter: drop-shadow(0 0 15px rgba(0, 229, 255, 0.2)); }
    50% { filter: drop-shadow(0 0 40px rgba(127, 0, 255, 0.6)); }
}

/* Sub tagline */
.loader-tagline {
    font-size: clamp(0.85rem, 2vw, 1.1rem);
    color: rgba(148, 163, 184, 0.8);
    letter-spacing: 0.1em;
    opacity: 0;
    animation: word-rise 0.6s ease 1.1s forwards;
}

/* Progress bar */
.loader-progress-track {
    width: clamp(200px, 40vw, 380px);
    height: 2px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 99px;
    overflow: hidden;
    opacity: 0;
    animation: word-rise 0.5s ease 1.3s forwards;
}
.loader-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #00E5FF, #7F00FF, #FF006E);
    border-radius: 99px;
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.6);
    animation: progress-fill 2.8s cubic-bezier(0.4, 0, 0.2, 1) 1.4s forwards;
}
@keyframes progress-fill {
    0%   { width: 0%;   }
    30%  { width: 25%;  }
    60%  { width: 60%;  }
    85%  { width: 85%;  }
    100% { width: 100%; }
}

/* Count up display */
.loader-percent {
    font-size: 0.8rem;
    font-weight: 700;
    color: rgba(0, 229, 255, 0.6);
    font-variant-numeric: tabular-nums;
    opacity: 0;
    animation: word-rise 0.5s ease 1.3s forwards;
}

/* ── NEON ANIMALS (SVG floaters) ── */
.neon-animal {
    position: absolute;
    pointer-events: none;
    opacity: 0;
    filter: drop-shadow(0 0 12px currentColor);
    animation: animal-float-in 1.2s ease forwards;
}
.neon-animal svg { width: 100%; height: 100%; }

@keyframes animal-float-in {
    0%   { opacity: 0; transform: translateY(20px) scale(0.8); }
    100% { opacity: 0.55; transform: translateY(0) scale(1); }
}

/* Loader scan line */
.loader-scan {
    position: absolute;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 229, 255, 0.4), transparent);
    animation: scan-move 3s linear infinite;
    pointer-events: none;
}
@keyframes scan-move {
    0%   { top: -1px; opacity: 0; }
    10%  { opacity: 1; }
    90%  { opacity: 1; }
    100% { top: 100%; opacity: 0; }
}

/* Corner decorators */
.loader-corner {
    position: absolute;
    width: 40px;
    height: 40px;
    border-color: rgba(0, 229, 255, 0.35);
    border-style: solid;
    pointer-events: none;
    animation: corner-pulse 2s ease-in-out infinite;
}
.loader-corner.tl { top: 2rem; left: 2rem; border-width: 2px 0 0 2px; }
.loader-corner.tr { top: 2rem; right: 2rem; border-width: 2px 2px 0 0; }
.loader-corner.bl { bottom: 2rem; left: 2rem; border-width: 0 0 2px 2px; }
.loader-corner.br { bottom: 2rem; right: 2rem; border-width: 0 2px 2px 0; }
@keyframes corner-pulse {
    0%, 100% { border-color: rgba(0, 229, 255, 0.25); }
    50% { border-color: rgba(127, 0, 255, 0.6); }
}

/* ── BACKGROUND HUD CANVAS ── */
#hud-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.55;
}

/* ── PARALLAX ORBS ── */
.orb-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}
.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.12;
    animation: orb-drift linear infinite;
    will-change: transform;
}
.orb-1 {
    width: 600px; height: 600px;
    background: radial-gradient(circle, #7F00FF, transparent 70%);
    top: -150px; left: -150px;
    animation-duration: 22s;
}
.orb-2 {
    width: 500px; height: 500px;
    background: radial-gradient(circle, #00E5FF, transparent 70%);
    bottom: -100px; right: -100px;
    animation-duration: 28s;
    animation-delay: -9s;
}
.orb-3 {
    width: 350px; height: 350px;
    background: radial-gradient(circle, #FF006E, transparent 70%);
    top: 40%; left: 55%;
    animation-duration: 18s;
    animation-delay: -5s;
}
@keyframes orb-drift {
    0%   { transform: translate(0, 0) rotate(0deg); }
    33%  { transform: translate(30px, -40px) rotate(120deg); }
    66%  { transform: translate(-20px, 25px) rotate(240deg); }
    100% { transform: translate(0, 0) rotate(360deg); }
}

/* ── TOOL PAGE INTRO ANIMATION ── */
#tool-intro-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 2, 18, 0.92);
    backdrop-filter: blur(8px);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
}
#tool-intro-overlay.show { opacity: 1; }

.tool-intro-inner {
    text-align: center;
    transform: scale(0.85);
    opacity: 0;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.5s ease;
}
#tool-intro-overlay.show .tool-intro-inner {
    transform: scale(1);
    opacity: 1;
}

.tool-intro-icon {
    font-size: 3.5rem;
    margin-bottom: 1.2rem;
    display: block;
    filter: drop-shadow(0 0 20px rgba(0, 229, 255, 0.6));
    animation: icon-bounce 0.6s cubic-bezier(0.36, 0.07, 0.19, 0.97) 0.2s both;
}
@keyframes icon-bounce {
    0%, 100% { transform: translateY(0); }
    40% { transform: translateY(-12px); }
    70% { transform: translateY(-4px); }
}

.tool-intro-name {
    font-size: clamp(1.6rem, 4vw, 2.8rem);
    font-weight: 900;
    background: linear-gradient(135deg, #00E5FF, #7F00FF);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.2;
    letter-spacing: -0.02em;
    filter: drop-shadow(0 0 25px rgba(0, 229, 255, 0.4));
}

.tool-intro-line {
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, #00E5FF, #7F00FF);
    border-radius: 99px;
    margin: 1rem auto;
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.5);
    animation: line-expand 0.5s ease 0.3s both;
}
@keyframes line-expand {
    from { width: 0; opacity: 0; }
    to   { width: 60px; opacity: 1; }
}

.tool-intro-category {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: rgba(0, 229, 255, 0.6);
}

/* ── CONTENT FADE-IN AFTER LOADER ── */
.content-hidden {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}
.content-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered sections */
.stagger-1 { transition-delay: 0.1s; }
.stagger-2 { transition-delay: 0.25s; }
.stagger-3 { transition-delay: 0.4s; }
.stagger-4 { transition-delay: 0.55s; }

/* ── CURSOR TRAIL ── */
.cursor-trail-dot {
    position: fixed;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9998;
    opacity: 0;
    background: rgba(0, 229, 255, 0.7);
    transform: translate(-50%, -50%);
    transition: opacity 0.2s ease;
    will-change: left, top;
}

/* ── TOOL CARDS HOVER GLOW ── */
.tool-card {
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275),
                box-shadow 0.3s ease,
                border-color 0.3s ease !important;
}
.tool-card:hover {
    transform: translateY(-6px) scale(1.02) !important;
    box-shadow: 0 12px 40px rgba(127, 0, 255, 0.25), 0 0 0 1px rgba(0, 229, 255, 0.15) !important;
}

/* ── FLOATING BACKGROUND ANIMALS ── */
.bg-animal {
    position: fixed;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    animation: bg-animal-float linear infinite;
    will-change: transform, opacity;
    filter: drop-shadow(0 0 8px currentColor);
}
@keyframes bg-animal-float {
    0%   { transform: translateY(0) rotate(0deg);   opacity: 0;    }
    5%   { opacity: 0.12; }
    95%  { opacity: 0.12; }
    100% { transform: translateY(-120px) rotate(8deg); opacity: 0; }
}

/* ── MOBILE OPTIMIZATIONS ── */
@media (max-width: 768px) {
    .loader-title { font-size: 2rem; }
    .orb { opacity: 0.07; }
    .neon-animal { display: none; }
    #hud-canvas { opacity: 0.3; }
}

/* ─────────────────────────────────────────
   PROCESSING OVERLAY
───────────────────────────────────────── */
#processing-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    pointer-events: all;
}

#processing-overlay.active {
    opacity: 1;
    visibility: visible;
}

.processing-box {
    background: rgba(17, 24, 39, 0.8);
    border: 1px solid rgba(0, 229, 255, 0.2);
    border-radius: 20px;
    padding: 3rem;
    text-align: center;
    max-width: 400px;
    width: 90%;
    transform: translateY(30px) scale(0.95);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 30px rgba(127, 0, 255, 0.15);
}

#processing-overlay.active .processing-box {
    transform: translateY(0) scale(1);
}

/* Dynamic State Icons */
.processing-icon-container {
    height: 80px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.processing-spinner {
    position: absolute;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: #00E5FF;
    border-bottom-color: #7F00FF;
    animation: process-spin 1.2s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
    filter: drop-shadow(0 0 10px rgba(0, 229, 255, 0.5));
}

.processing-inner-icon {
    font-size: 2rem;
    color: #ffffff;
    animation: process-pulse 1.5s ease-in-out infinite;
    z-index: 2;
}

.processing-success-icon {
    font-size: 3.5rem;
    color: #10B981;
    display: none;
    filter: drop-shadow(0 0 15px rgba(16, 185, 129, 0.6));
    animation: process-bounce-in 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* Titles and Text */
.processing-title {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #00E5FF, #7F00FF);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.processing-step {
    font-size: 0.95rem;
    color: var(--text-secondary);
    min-height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* Animated Dots */
.processing-dots span {
    animation: process-dots 1.4s infinite ease-in-out both;
    font-size: 1.5rem;
    line-height: 0;
    color: #00E5FF;
}
.processing-dots span:nth-child(1) { animation-delay: -0.32s; }
.processing-dots span:nth-child(2) { animation-delay: -0.16s; }

/* Progress Bar */
.processing-progress {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    margin-top: 1.5rem;
    overflow: hidden;
    position: relative;
    display: none;
}

.processing-progress-fill {
    position: absolute;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #00E5FF, #7F00FF);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Keyframes */
@keyframes process-spin {
    0% { transform: rotate(0deg) scale(0.8); }
    50% { transform: rotate(180deg) scale(1.1); }
    100% { transform: rotate(360deg) scale(0.8); }
}

@keyframes process-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(0.8); opacity: 0.6; }
}

@keyframes process-bounce-in {
    0% { transform: scale(0.2); opacity: 0; }
    70% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes process-dots {
    0%, 80%, 100% { transform: scale(0); opacity: 0.2; }
    40% { transform: scale(1); opacity: 1; }
}

