/*
====================================================================================================
MOHAMMAD ABOWARDA PORTFOLIO - "POWERING UP" LOADING SCREEN
====================================================================================================
Author: Mohammad Abowarda (Senior Developer Approach)
Description: Distinctive loading screen simulating smart system boot sequence
Visual Identity: Modern, technical, clean, professional, and precise
Colors: Green (#2e7d32), Blue (#1565c0), Dark Background (#0a0a0a)
====================================================================================================
*/

/* Import Fonts */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&family=Inter:wght@400;500&display=swap');

/* Loading Screen Container */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #0a0a0a;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    overflow: hidden;
    transition: opacity 0.8s ease-out, visibility 0.8s ease-out;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Animated Circuit Background */
.circuit-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.1;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(46, 125, 50, 0.3) 1px, transparent 1px),
        radial-gradient(circle at 80% 70%, rgba(21, 101, 192, 0.3) 1px, transparent 1px),
        radial-gradient(circle at 40% 80%, rgba(46, 125, 50, 0.2) 1px, transparent 1px),
        radial-gradient(circle at 90% 20%, rgba(21, 101, 192, 0.2) 1px, transparent 1px);
    background-size: 100px 100px, 150px 150px, 120px 120px, 180px 180px;
    animation: circuitFlow 8s linear infinite;
}

@keyframes circuitFlow {
    0% { transform: translateX(0) translateY(0); }
    25% { transform: translateX(-10px) translateY(-5px); }
    50% { transform: translateX(-5px) translateY(-10px); }
    75% { transform: translateX(-15px) translateY(-2px); }
    100% { transform: translateX(0) translateY(0); }
}

/* Circuit Lines */
.circuit-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.2;
}

.circuit-line {
    position: absolute;
    background: linear-gradient(90deg, transparent, #2e7d32, transparent);
    animation: circuitPulse 3s ease-in-out infinite;
}

.circuit-line.horizontal {
    height: 2px;
    width: 200px;
}

.circuit-line.vertical {
    width: 2px;
    height: 200px;
    background: linear-gradient(180deg, transparent, #1565c0, transparent);
}

.circuit-line:nth-child(1) { top: 20%; left: 10%; animation-delay: 0s; }
.circuit-line:nth-child(2) { top: 60%; right: 15%; animation-delay: 1s; }
.circuit-line:nth-child(3) { bottom: 30%; left: 20%; animation-delay: 2s; }
.circuit-line:nth-child(4) { top: 40%; right: 25%; animation-delay: 0.5s; }

@keyframes circuitPulse {
    0%, 100% { opacity: 0.1; transform: scaleX(0.5); }
    50% { opacity: 0.8; transform: scaleX(1); }
}

/* Main Loading Container */
.loading-container {
    text-align: center;
    z-index: 2;
    animation: containerFadeIn 1s ease-out;
}

@keyframes containerFadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Smart Home Icon Container */
.smart-icon-container {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 30px;
    animation: iconPulse 2s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Main Icon */
.smart-icon {
    width: 100%;
    height: 100%;
    position: relative;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(46, 125, 50, 0.2), rgba(21, 101, 192, 0.2));
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 
        0 0 30px rgba(46, 125, 50, 0.4),
        0 0 60px rgba(21, 101, 192, 0.3),
        inset 0 0 20px rgba(255, 255, 255, 0.1);
    animation: iconGlow 3s ease-in-out infinite alternate;
}

@keyframes iconGlow {
    0% { 
        box-shadow: 
            0 0 30px rgba(46, 125, 50, 0.4),
            0 0 60px rgba(21, 101, 192, 0.3),
            inset 0 0 20px rgba(255, 255, 255, 0.1);
    }
    100% { 
        box-shadow: 
            0 0 40px rgba(46, 125, 50, 0.6),
            0 0 80px rgba(21, 101, 192, 0.5),
            inset 0 0 30px rgba(255, 255, 255, 0.2);
    }
}

/* SVG Icon */
.smart-icon svg {
    width: 60px;
    height: 60px;
    fill: none;
    stroke: #ffffff;
    stroke-width: 2;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.5));
}

/* Progress Ring */
.progress-ring {
    position: absolute;
    top: -10px;
    left: -10px;
    width: 140px;
    height: 140px;
    transform: rotate(-90deg);
}

.progress-ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 4;
}

.progress-ring-fill {
    fill: none;
    stroke: url(#progressGradient);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 440;
    stroke-dashoffset: 440;
    animation: progressFill 4s ease-out forwards;
    filter: drop-shadow(0 0 10px rgba(46, 125, 50, 0.8));
}

@keyframes progressFill {
    to { stroke-dashoffset: 0; }
}

/* Loading Text */
.loading-text {
    margin-bottom: 20px;
}

.main-text {
    font-family: 'Inter', sans-serif;
    font-size: 24px;
    font-weight: 500;
    color: #ffffff;
    margin-bottom: 8px;
    opacity: 0;
    animation: textFadeIn 1s ease-out 0.5s forwards;
    letter-spacing: 1px;
}

.secondary-text {
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #2e7d32;
    text-transform: uppercase;
    letter-spacing: 3px;
    opacity: 0;
    animation: textFadeIn 1s ease-out 1s forwards;
}

@keyframes textFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Progress Counter */
.progress-counter {
    font-family: 'Poppins', sans-serif;
    font-size: 48px;
    font-weight: 700;
    color: #1565c0;
    margin-top: 20px;
    text-shadow: 0 0 20px rgba(21, 101, 192, 0.6);
    opacity: 0;
    animation: textFadeIn 1s ease-out 1.5s forwards;
}

.progress-counter::after {
    content: '%';
    font-size: 32px;
    opacity: 0.8;
}

/* System Status Indicators */
.system-status {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    opacity: 0;
    animation: textFadeIn 1s ease-out 2s forwards;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    color: #ffffff;
    opacity: 0.7;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2e7d32;
    animation: statusBlink 2s ease-in-out infinite;
}

.status-item:nth-child(2) .status-dot {
    background: #1565c0;
    animation-delay: 0.5s;
}

.status-item:nth-child(3) .status-dot {
    background: #2e7d32;
    animation-delay: 1s;
}

@keyframes statusBlink {
    0%, 50% { opacity: 0.3; }
    100% { opacity: 1; }
}

/* Exit Animation */
.loading-screen.exiting {
    animation: exitAnimation 1s ease-out forwards;
}

.loading-screen.exiting .smart-icon {
    animation: iconExpand 0.8s ease-out forwards;
}

@keyframes exitAnimation {
    0% { opacity: 1; transform: scale(1); }
    70% { opacity: 1; transform: scale(1.02); }
    100% { opacity: 0; transform: scale(1.1); }
}

@keyframes iconExpand {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(0); opacity: 0; }
}

/* Responsive Design */
@media (max-width: 768px) {
    .smart-icon-container {
        width: 100px;
        height: 100px;
    }
    
    .smart-icon svg {
        width: 50px;
        height: 50px;
    }
    
    .progress-ring {
        width: 120px;
        height: 120px;
        top: -10px;
        left: -10px;
    }
    
    .main-text {
        font-size: 20px;
    }
    
    .progress-counter {
        font-size: 36px;
    }
    
    .system-status {
        bottom: 40px;
        flex-direction: column;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .smart-icon-container {
        width: 80px;
        height: 80px;
    }
    
    .progress-ring {
        width: 100px;
        height: 100px;
    }
    
    .main-text {
        font-size: 18px;
    }
    
    .secondary-text {
        font-size: 12px;
        letter-spacing: 2px;
    }
    
    .progress-counter {
        font-size: 32px;
    }
}

/* Performance Optimizations */
.loading-screen * {
    will-change: transform, opacity;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .loading-screen *,
    .loading-screen *::before,
    .loading-screen *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print styles */
@media print {
    .loading-screen {
        display: none !important;
    }
}
