/* Loading Screen Styles - Fiber Optic Network Theme */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, #0f172a 0%, #020617 100%);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    opacity: 1;
    visibility: visible;
    overflow: hidden;
}

.page-loader.loaded {
    opacity: 0;
    visibility: hidden;
}

/* Fiber Optic Network SVG Background */
.fiber-network {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
}

/* Legacy support */
#page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0066cc 0%, #004499 100%);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    opacity: 1;
    visibility: visible;
}

#page-loader.loaded {
    opacity: 0;
    visibility: hidden;
}

/* Prevent white flash and FOUC (Flash of Unstyled Content) */
html {
    background: #0f172a;
}

body {
    opacity: 0;
    transition: opacity 0.3s ease;
}

body.loaded {
    opacity: 1 !important;
}

/* Hide body content until CSS loads to prevent FOUC */
body:not(.loaded) > *:not(#page-loader):not(.page-loader) {
    visibility: hidden !important;
}

.loader-content {
    text-align: center;
    color: white;
    position: relative;
    z-index: 10;
}

/* WiFi Router Icon */
.wifi-router {
    width: 120px;
    height: 120px;
    margin: 0 auto 40px;
    position: relative;
    animation: float 3s ease-in-out infinite;
    filter: drop-shadow(0 0 20px rgba(96, 165, 250, 0.4));
}

.wifi-router svg {
    width: 100%;
    height: 100%;
}

/* Connection Nodes Around Router */
.connection-nodes {
    position: absolute;
    width: 400px;
    height: 400px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.node {
    position: absolute;
    width: 10px;
    height: 10px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 0 15px rgba(96, 165, 250, 0.8),
                0 0 30px rgba(96, 165, 250, 0.4);
    animation: node-pulse 2s ease-in-out infinite;
}

.node::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid rgba(96, 165, 250, 0.4);
    border-radius: 50%;
    animation: node-ring 2s ease-out infinite;
}

.node-1 {
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
    animation-delay: 0s;
}

.node-2 {
    right: -50px;
    top: 50%;
    transform: translateY(-50%);
    animation-delay: 0.5s;
}

.node-3 {
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    animation-delay: 1s;
}

.node-4 {
    left: -50px;
    top: 50%;
    transform: translateY(-50%);
    animation-delay: 1.5s;
}

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

.node-1 { transform: translateX(-50%); }
.node-2 { transform: translateY(-50%); }
.node-3 { transform: translateX(-50%); }
.node-4 { transform: translateY(-50%); }

@keyframes node-ring {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(3);
        opacity: 0;
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

.loader-text {
    font-size: 20px;
    font-weight: 600;
    margin-top: 20px;
    margin-bottom: 8px;
    letter-spacing: 3px;
    text-transform: uppercase;
    background: linear-gradient(90deg, #fff 30%, #60a5fa 50%, #fff 70%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: text-shimmer 3s linear infinite;
}

.loader-subtext {
    font-size: 13px;
    opacity: 0.6;
    letter-spacing: 1px;
    font-weight: 300;
}

@keyframes text-shimmer {
    0% {
        background-position: 0% center;
    }
    100% {
        background-position: 200% center;
    }
}

/* Router Activity LEDs */
.router-leds {
    position: absolute;
    top: -80px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 20;
}

.led {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    box-shadow: 0 0 10px currentColor;
}

.led-power {
    background: #10b981;
    animation: led-blink 1s ease-in-out infinite;
}

.led-wan {
    background: #60a5fa;
    animation: led-blink 1.2s ease-in-out infinite 0.2s;
}

.led-wifi {
    background: #f59e0b;
    animation: led-blink 0.8s ease-in-out infinite 0.4s;
}

@keyframes led-blink {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 10px currentColor, 0 0 20px currentColor;
    }
    50% {
        opacity: 0.3;
        box-shadow: 0 0 5px currentColor;
    }
}

/* Network Stats */
.network-stats {
    position: absolute;
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    font-size: 11px;
    opacity: 0.7;
    z-index: 20;
}

.stat {
    display: flex;
    align-items: center;
    gap: 5px;
}

.stat-icon {
    font-size: 14px;
    color: #60a5fa;
    margin-right: 5px;
}

.stat-value {
    font-family: 'Courier New', monospace;
    color: #60a5fa;
    font-weight: 600;
}

/* Signal Strength Bars */
.signal-strength {
    position: absolute;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 4px;
    align-items: flex-end;
    height: 30px;
}

.signal-bar {
    width: 6px;
    background: linear-gradient(to top, #60a5fa, #3b82f6);
    border-radius: 2px 2px 0 0;
    opacity: 0.3;
    transition: all 0.3s ease;
}

.signal-bar.bar-1 {
    height: 8px;
    animation: signal-fill 0.5s ease forwards;
}

.signal-bar.bar-2 {
    height: 16px;
    animation: signal-fill 0.5s ease 0.5s forwards;
}

.signal-bar.bar-3 {
    height: 24px;
    animation: signal-fill 0.5s ease 1s forwards;
}

.signal-bar.bar-4 {
    height: 30px;
    animation: signal-fill 0.5s ease 1.5s forwards;
}

@keyframes signal-fill {
    to {
        opacity: 1;
        box-shadow: 0 0 10px rgba(96, 165, 250, 0.5);
    }
}

/* Loading Percentage */
.loading-percentage {
    position: absolute;
    bottom: -90px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 18px;
    font-weight: 700;
    color: #60a5fa;
    font-family: 'Courier New', monospace;
    text-shadow: 0 0 10px rgba(96, 165, 250, 0.5);
}

.loader-spinner {
    width: 60px;
    height: 60px;
    position: relative;
    margin: 0 auto;
}

.loader-spinner::before {
    content: '';
    position: absolute;
    border-radius: 50%;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top: 4px solid #fff;
    border-right: 4px solid #60a5fa;
    animation: spin 1.2s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
}

@keyframes spin {
    0% { 
        transform: rotate(0deg);
        border-top-color: #fff;
        border-right-color: #60a5fa;
    }
    50% {
        border-top-color: #60a5fa;
        border-right-color: #fff;
    }
    100% { 
        transform: rotate(360deg);
        border-top-color: #fff;
        border-right-color: #60a5fa;
    }
}

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

/* Loading dots animation */
.loading-dots {
    display: inline-block;
}

.loading-dots::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

/* Link loading effect */
.link-loading {
    pointer-events: none;
    opacity: 0.6;
    position: relative;
}

.link-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Enhanced Loader Animations */
.loader-logo {
    width: 100px;
    height: 100px;
    margin-bottom: 30px;
    position: relative;
    animation: float 3s ease-in-out infinite;
}

.loader-logo svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.3));
}

/* Signal Waves Animation */
.signal-waves {
    position: relative;
    width: 120px;
    height: 60px;
    margin: 0 auto 30px;
}

.wave {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 80px;
    border: 3px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    animation: wave-pulse 2s ease-out infinite;
}

.wave:nth-child(2) {
    animation-delay: 0.5s;
}

.wave:nth-child(3) {
    animation-delay: 1s;
}

@keyframes wave-pulse {
    0% {
        transform: translateX(-50%) scale(0.3);
        opacity: 1;
    }
    100% {
        transform: translateX(-50%) scale(1.5);
        opacity: 0;
    }
}

/* Spinning Dots */
.spinner-dots {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 30px;
}

.dot {
    width: 15px;
    height: 15px;
    background: white;
    border-radius: 50%;
    animation: dot-bounce 1.4s ease-in-out infinite both;
}

.dot:nth-child(1) {
    animation-delay: -0.32s;
}

.dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes dot-bounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Loading Text */
.loading-text {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 10px;
    letter-spacing: 2px;
    animation: text-glow 2s ease-in-out infinite;
}

@keyframes text-glow {
    0%, 100% {
        text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    }
    50% {
        text-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
    }
}

.loading-subtext {
    font-size: 14px;
    opacity: 0.8;
    animation: fade-pulse 2s ease-in-out infinite;
}

@keyframes fade-pulse {
    0%, 100% {
        opacity: 0.5;
    }
    50% {
        opacity: 1;
    }
}

/* Progress Bar */
.progress-bar-container {
    width: 250px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 30px;
}

.progress-bar {
    height: 100%;
    background: white;
    width: 0%;
    animation: progress-load 2s ease-out forwards;
    border-radius: 2px;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

@keyframes progress-load {
    0% {
        width: 0%;
    }
    100% {
        width: 100%;
    }
}

/* Particles Background */
.particles {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    animation: particle-float 10s linear infinite;
}

@keyframes particle-float {
    0% {
        transform: translateY(100vh) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100px) translateX(100px);
        opacity: 0;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .loading-text {
        font-size: 14px;
        letter-spacing: 2px;
    }
    
    .loading-subtext {
        font-size: 11px;
    }
    
    .wifi-router {
        width: 90px;
        height: 90px;
        margin-bottom: 25px;
    }
    
    .router-leds {
        top: -70px;
        gap: 6px;
    }
    
    .led {
        width: 6px;
        height: 6px;
    }
    
    .network-stats {
        top: -45px;
        gap: 15px;
        font-size: 10px;
    }
    
    .stat-icon {
        font-size: 11px;
    }
    
    .signal-strength {
        bottom: -50px;
        height: 25px;
    }
    
    .signal-bar {
        width: 5px;
    }
    
    .signal-bar.bar-1 { height: 6px; }
    .signal-bar.bar-2 { height: 13px; }
    .signal-bar.bar-3 { height: 20px; }
    .signal-bar.bar-4 { height: 25px; }
    
    .loading-percentage {
        bottom: -75px;
        font-size: 16px;
    }
}

