/* =========================================
   Advanced Preloader for Click Solution
   ========================================= */
:root {
    --primary-blue: #1e3c72;
    --secondary-blue: #2a5298;
    --accent-blue: #64b5f6;
    --dark-blue: #0a1931;
    --light-blue: #e3f2fd;
    --white: #ffffff;
    --gradient-primary: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    --gradient-accent: linear-gradient(135deg, #2a5298 0%, #64b5f6 100%);
}

/* Preloader Container */
.advanced-preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    background: linear-gradient(135deg, #0a1931 0%, #1e3c72 50%, #2a5298 100%);
    overflow: hidden;
}

/* Background Animation Elements */
.preloader-bg-animation {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
}

/* Floating Particles */
.floating-particle {
    position: absolute;
    background: var(--accent-blue);
    border-radius: 50%;
    opacity: 0.1;
    animation: floatParticle 8s infinite ease-in-out;
}

.floating-particle:nth-child(1) {
    width: 80px;
    height: 80px;
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.floating-particle:nth-child(2) {
    width: 60px;
    height: 60px;
    top: 70%;
    left: 80%;
    animation-delay: 2s;
}

.floating-particle:nth-child(3) {
    width: 100px;
    height: 100px;
    top: 80%;
    left: 20%;
    animation-delay: 4s;
}

.floating-particle:nth-child(4) {
    width: 40px;
    height: 40px;
    top: 20%;
    left: 70%;
    animation-delay: 6s;
}

/* Grid Lines Background */
.grid-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(100, 181, 246, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(100, 181, 246, 0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: gridMove 20s linear infinite;
}

/* Main Logo Container */
.preloader-logo-container {
    position: relative;
    z-index: 10;
    text-align: center;
    animation: logoEntrance 1s ease-out;
}

/* Logo SVG Styles */
.click-logo {
    width: 300px;
    height: 120px;
    margin-bottom: 30px;
}

.logo-text-main {
    font-family: 'Oswald', 'Tajawal', sans-serif;
    font-size: 48px;
    font-weight: 900;
    fill: transparent;
    stroke: var(--white);
    stroke-width: 2px;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: logoDraw 2s ease-in-out forwards;
    text-transform: uppercase;
    letter-spacing: -2px;
}

.logo-text-main.click {
    animation-delay: 0.5s;
}

.logo-text-main.solution {
    animation-delay: 0.8s;
}

/* Loading Progress Bar */
.progress-container {
    width: 300px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin: 30px 0;
    position: relative;
    z-index: 10;
}

.progress-bar {
    height: 100%;
    background: var(--gradient-accent);
    border-radius: 2px;
    width: 0%;
    animation: progressGrow 3s ease-in-out forwards;
    box-shadow: 0 0 20px rgba(100, 181, 246, 0.8);
    position: relative;
}

.progress-glow {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(100, 181, 246, 0.6), transparent);
    animation: progressGlow 2s linear infinite;
    opacity: 0;
}

.progress-bar.active + .progress-glow {
    opacity: 1;
}

/* Loading Percentage */
.loading-percentage {
    color: var(--accent-blue);
    font-family: 'Oswald', 'Tajawal', sans-serif;
    font-size: 24px;
    font-weight: 700;
    margin-top: 15px;
    opacity: 0;
    animation: percentageFadeIn 1s ease-in-out 1s forwards;
    text-shadow: 0 0 10px rgba(100, 181, 246, 0.5);
}

/* Interactive Cursor Effect */
.cursor-effect {
    position: absolute;
    width: 20px;
    height: 20px;
    background: radial-gradient(circle, rgba(100, 181, 246, 0.3), transparent);
    border-radius: 50%;
    pointer-events: none;
    z-index: 100;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.advanced-preloader:hover .cursor-effect {
    opacity: 1;
}

/* Loading Text */
.loading-text {
    color: var(--white);
    font-family: 'Tajawal', sans-serif;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    animation: textFadeIn 1s ease-in-out 1.5s forwards;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 20px;
}

/* Dots Animation */
.loading-dots {
    display: inline-block;
    margin-left: 5px;
}

.loading-dots span {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--accent-blue);
    border-radius: 50%;
    margin: 0 2px;
    animation: dotPulse 1.5s infinite ease-in-out;
}

.loading-dots span:nth-child(1) { animation-delay: 0s; }
.loading-dots span:nth-child(2) { animation-delay: 0.3s; }
.loading-dots span:nth-child(3) { animation-delay: 0.6s; }

/* Tech Elements */
.tech-elements {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 5;
}

.tech-circle {
    position: absolute;
    border: 2px solid rgba(100, 181, 246, 0.3);
    border-radius: 50%;
    animation: rotateCircle 10s linear infinite;
}

.tech-circle:nth-child(1) {
    width: 200px;
    height: 200px;
    top: 10%;
    right: 10%;
}

.tech-circle:nth-child(2) {
    width: 150px;
    height: 150px;
    bottom: 10%;
    left: 10%;
    animation-direction: reverse;
}

.tech-circle:nth-child(3) {
    width: 100px;
    height: 100px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Code Lines Animation */
.code-lines {
    position: absolute;
    font-family: 'Courier New', monospace;
    font-size: 10px;
    color: rgba(100, 181, 246, 0.5);
    animation: codeScroll 5s linear infinite;
}

.code-lines:nth-child(1) {
    top: 20%;
    right: 5%;
}

.code-lines:nth-child(2) {
    bottom: 20%;
    left: 5%;
}

/* Exit Animation */
.preloader-exit {
    animation: preloaderExit 0.8s ease-in-out forwards;
}

/* =========================================
   Animations
   ========================================= */

@keyframes floatParticle {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
        opacity: 0.1;
    }
    50% {
        transform: translateY(-100px) rotate(180deg);
        opacity: 0.3;
    }
}

@keyframes gridMove {
    0% {
        transform: translate(0, 0);
    }
    100% {
        transform: translate(50px, 50px);
    }
}

@keyframes logoEntrance {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(50px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes logoDraw {
    0% {
        stroke-dashoffset: 1000;
        fill: transparent;
    }
    50% {
        stroke-dashoffset: 0;
        fill: transparent;
    }
    100% {
        stroke-dashoffset: 0;
        fill: var(--white);
        stroke-width: 1px;
    }
}

@keyframes progressGrow {
    0% {
        width: 0%;
    }
    100% {
        width: 100%;
    }
}

@keyframes textFadeIn {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes dotPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.5);
        opacity: 0.5;
    }
}

@keyframes rotateCircle {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes codeScroll {
    0% {
        transform: translateY(100%);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100%);
        opacity: 0;
    }
}

@keyframes progressGlow {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

@keyframes percentageFadeIn {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes preloaderExit {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(1.1);
        visibility: hidden;
    }
}

/* =========================================
   Responsive Design
   ========================================= */

@media (max-width: 768px) {
    .click-logo {
        width: 250px;
        height: 100px;
    }
    
    .logo-text-main {
        font-size: 36px;
    }
    
    .progress-container {
        width: 250px;
    }
    
    .loading-text {
        font-size: 12px;
    }
    
    .tech-circle:nth-child(1) {
        width: 150px;
        height: 150px;
    }
    
    .tech-circle:nth-child(2) {
        width: 100px;
        height: 100px;
    }
    
    .tech-circle:nth-child(3) {
        width: 80px;
        height: 80px;
    }
}

@media (max-width: 480px) {
    .click-logo {
        width: 200px;
        height: 80px;
    }
    
    .logo-text-main {
        font-size: 28px;
        stroke-width: 1.5px;
    }
    
    .progress-container {
        width: 200px;
    }
    
    .loading-text {
        font-size: 11px;
    }
    
    .floating-particle:nth-child(1) {
        width: 60px;
        height: 60px;
    }
    
    .floating-particle:nth-child(2) {
        width: 40px;
        height: 40px;
    }
    
    .floating-particle:nth-child(3) {
        width: 80px;
        height: 80px;
    }
    
    .floating-particle:nth-child(4) {
        width: 30px;
        height: 30px;
    }
}
