/* Loading Screen - Sleek & Smooth */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #000000 0%, #0a0a0a 50%, #000000 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), 
                visibility 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.loading-screen.fade-out {
    opacity: 0;
    visibility: hidden;
}

/* Animated Background Grid */
.loading-bg-grid {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(220, 38, 38, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(220, 38, 38, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: gridMove 20s linear infinite;
    opacity: 0.3;
}

@keyframes gridMove {
    0% {
        transform: translate(0, 0);
    }
    100% {
        transform: translate(50px, 50px);
    }
}

/* Glowing Orbs */
.loading-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    animation: orbFloat 8s ease-in-out infinite;
}

.loading-orb-1 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(220, 38, 38, 0.4) 0%, transparent 70%);
    top: 20%;
    left: 10%;
    animation-delay: 0s;
}

.loading-orb-2 {
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(239, 68, 68, 0.3) 0%, transparent 70%);
    bottom: 20%;
    right: 15%;
    animation-delay: 2s;
}

.loading-orb-3 {
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(185, 28, 28, 0.3) 0%, transparent 70%);
    top: 50%;
    right: 20%;
    animation-delay: 4s;
}

@keyframes orbFloat {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(30px, -30px) scale(1.1);
    }
    66% {
        transform: translate(-20px, 20px) scale(0.9);
    }
}

/* Loading Content Container */
.loading-content {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

/* Logo/Icon Container */
.loading-logo {
    position: relative;
    width: 100px;
    height: 100px;
    animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Hexagon Shape */
.loading-hexagon {
    position: relative;
    width: 100%;
    height: 100%;
}

.loading-hexagon svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 20px rgba(220, 38, 38, 0.5));
}

.hex-outer {
    fill: none;
    stroke: #dc2626;
    stroke-width: 2;
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    animation: drawHex 2s ease-in-out forwards, pulseStroke 2s ease-in-out infinite 2s;
}

.hex-inner {
    fill: rgba(220, 38, 38, 0.1);
    stroke: #ef4444;
    stroke-width: 1;
    opacity: 0;
    animation: fadeInHex 1s ease-in-out 1s forwards;
}

@keyframes drawHex {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes fadeInHex {
    to {
        opacity: 1;
    }
}

@keyframes pulseStroke {
    0%, 100% {
        stroke-width: 2;
        opacity: 1;
    }
    50% {
        stroke-width: 3;
        opacity: 0.7;
    }
}

/* Letter in Center */
.loading-letter {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.5rem;
    font-weight: 700;
    font-family: 'Fira Code', monospace;
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    opacity: 0;
    animation: fadeInLetter 0.5s ease-in-out 1.5s forwards, letterGlow 2s ease-in-out infinite 2s;
}

@keyframes fadeInLetter {
    to {
        opacity: 1;
    }
}

@keyframes letterGlow {
    0%, 100% {
        filter: drop-shadow(0 0 10px rgba(220, 38, 38, 0.5));
    }
    50% {
        filter: drop-shadow(0 0 20px rgba(220, 38, 38, 0.8));
    }
}

/* Loading Text */
.loading-text-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.loading-title {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'Fira Code', monospace;
    color: #ffffff;
    letter-spacing: 0.1em;
    opacity: 0;
    animation: fadeInUp 0.8s ease-out 0.5s forwards;
}

.loading-subtitle {
    font-size: 0.875rem;
    color: #9ca3af;
    font-family: 'Fira Code', monospace;
    opacity: 0;
    animation: fadeInUp 0.8s ease-out 0.8s forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Progress Bar Container */
.loading-progress-container {
    width: 300px;
    height: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
    opacity: 0;
    animation: fadeIn 0.5s ease-out 1s forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

/* Progress Bar */
.loading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, 
        #dc2626 0%, 
        #ef4444 50%, 
        #dc2626 100%);
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s ease-out;
    position: relative;
    box-shadow: 0 0 10px rgba(220, 38, 38, 0.5);
}

.loading-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.3) 50%, 
        transparent 100%);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Percentage Text */
.loading-percentage {
    margin-top: 0.75rem;
    font-size: 0.875rem;
    font-family: 'Fira Code', monospace;
    color: #dc2626;
    font-weight: 600;
    letter-spacing: 0.05em;
    opacity: 0;
    animation: fadeIn 0.5s ease-out 1.2s forwards;
}

/* Spinning Dots */
.loading-dots {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    opacity: 0;
    animation: fadeIn 0.5s ease-out 1.5s forwards;
}

.loading-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #dc2626;
    animation: dotPulse 1.4s ease-in-out infinite;
}

.loading-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dotPulse {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 640px) {
    .loading-logo {
        width: 80px;
        height: 80px;
    }
    
    .loading-letter {
        font-size: 2rem;
    }
    
    .loading-title {
        font-size: 1.25rem;
    }
    
    .loading-subtitle {
        font-size: 0.75rem;
    }
    
    .loading-progress-container {
        width: 250px;
    }
    
    .loading-orb-1,
    .loading-orb-2,
    .loading-orb-3 {
        width: 150px;
        height: 150px;
    }
}

/* Prevent body scroll during loading */
body.loading {
    overflow: hidden;
}
