/* Page Loader V2 - Hexagon Military Tech Theme */

#page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0a0e0a;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    transition: opacity 0.8s ease, visibility 0.8s ease;
    overflow: hidden;
}

#page-loader.loaded {
    opacity: 0;
    visibility: hidden;
}

/* Animated Grid Background */
#page-loader::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(212, 175, 55, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(212, 175, 55, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: gridMove 20s linear infinite;
    opacity: 0.5;
}

@keyframes gridMove {
    0% {
        transform: translate(0, 0);
    }
    100% {
        transform: translate(50px, 50px);
    }
}

/* Scanning Lines */
#page-loader::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #d4af37, transparent);
    box-shadow: 0 0 20px #d4af37;
    animation: scanLine 3s ease-in-out infinite;
}

@keyframes scanLine {
    0%, 100% {
        top: 0%;
        opacity: 0;
    }
    50% {
        top: 100%;
        opacity: 1;
    }
}

/* Hexagon Container */
.loader-hexagon-container {
    position: relative;
    width: 200px;
    height: 230px;
    margin-bottom: 40px;
    z-index: 2;
}

/* Main Hexagon */
.hexagon {
    position: absolute;
    width: 100%;
    height: 100%;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: linear-gradient(135deg, rgba(45, 80, 22, 0.3), rgba(212, 175, 55, 0.3));
    border: 3px solid #d4af37;
    animation: hexagonPulse 3s ease-in-out infinite;
    box-shadow: 
        0 0 30px rgba(212, 175, 55, 0.5),
        inset 0 0 30px rgba(212, 175, 55, 0.2);
}

@keyframes hexagonPulse {
    0%, 100% {
        transform: scale(1) rotate(0deg);
        border-color: #d4af37;
    }
    50% {
        transform: scale(1.1) rotate(180deg);
        border-color: #4a7c2c;
    }
}

/* Inner Hexagons */
.hexagon-inner {
    position: absolute;
    top: 15%;
    left: 15%;
    width: 70%;
    height: 70%;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: linear-gradient(135deg, rgba(74, 124, 44, 0.4), rgba(212, 175, 55, 0.4));
    border: 2px solid #4a7c2c;
    animation: hexagonInnerSpin 4s linear infinite reverse;
}

@keyframes hexagonInnerSpin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Center Logo/Icon */
.hexagon-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
}

.hexagon-center i {
    font-size: 60px;
    color: #d4af37;
    animation: iconGlow 2s ease-in-out infinite;
    filter: drop-shadow(0 0 20px rgba(212, 175, 55, 0.8));
}

@keyframes iconGlow {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
}

/* Corner Brackets */
.corner-bracket {
    position: absolute;
    width: 30px;
    height: 30px;
    border: 2px solid #d4af37;
    z-index: 2;
}

.corner-bracket.top-left {
    top: -15px;
    left: -15px;
    border-right: none;
    border-bottom: none;
    animation: bracketPulse 2s ease-in-out infinite;
}

.corner-bracket.top-right {
    top: -15px;
    right: -15px;
    border-left: none;
    border-bottom: none;
    animation: bracketPulse 2s ease-in-out infinite 0.5s;
}

.corner-bracket.bottom-left {
    bottom: -15px;
    left: -15px;
    border-right: none;
    border-top: none;
    animation: bracketPulse 2s ease-in-out infinite 1s;
}

.corner-bracket.bottom-right {
    bottom: -15px;
    right: -15px;
    border-left: none;
    border-top: none;
    animation: bracketPulse 2s ease-in-out infinite 1.5s;
}

@keyframes bracketPulse {
    0%, 100% {
        opacity: 0.5;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Loading Text - Glitch Effect */
.loader-text {
    color: #d4af37;
    font-size: 1.5rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 8px;
    margin-bottom: 30px;
    position: relative;
    z-index: 2;
    animation: textGlitch 3s ease-in-out infinite;
}

.loader-text::before,
.loader-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.loader-text::before {
    left: 2px;
    text-shadow: -2px 0 #4a7c2c;
    clip: rect(24px, 550px, 90px, 0);
    animation: glitch-anim-1 2s infinite linear alternate-reverse;
}

.loader-text::after {
    left: -2px;
    text-shadow: -2px 0 #d4af37;
    clip: rect(85px, 550px, 140px, 0);
    animation: glitch-anim-2 2s infinite linear alternate-reverse;
}

@keyframes textGlitch {
    0%, 100% {
        text-shadow: 0 0 10px rgba(212, 175, 55, 0.8);
    }
    50% {
        text-shadow: 0 0 20px rgba(212, 175, 55, 1), 0 0 30px rgba(74, 124, 44, 0.8);
    }
}

@keyframes glitch-anim-1 {
    0% {
        clip: rect(61px, 9999px, 90px, 0);
    }
    20% {
        clip: rect(21px, 9999px, 120px, 0);
    }
    40% {
        clip: rect(85px, 9999px, 40px, 0);
    }
    60% {
        clip: rect(10px, 9999px, 70px, 0);
    }
    80% {
        clip: rect(50px, 9999px, 100px, 0);
    }
    100% {
        clip: rect(30px, 9999px, 80px, 0);
    }
}

@keyframes glitch-anim-2 {
    0% {
        clip: rect(10px, 9999px, 50px, 0);
    }
    20% {
        clip: rect(80px, 9999px, 20px, 0);
    }
    40% {
        clip: rect(40px, 9999px, 90px, 0);
    }
    60% {
        clip: rect(70px, 9999px, 30px, 0);
    }
    80% {
        clip: rect(20px, 9999px, 100px, 0);
    }
    100% {
        clip: rect(60px, 9999px, 40px, 0);
    }
}

/* Digital Progress Bar */
.loader-progress-digital {
    width: 400px;
    height: 40px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid #d4af37;
    border-radius: 0;
    position: relative;
    overflow: hidden;
    z-index: 2;
    box-shadow: 
        0 0 20px rgba(212, 175, 55, 0.3),
        inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.loader-progress-digital::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 10px,
        rgba(212, 175, 55, 0.1) 10px,
        rgba(212, 175, 55, 0.1) 11px
    );
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, 
        #4a7c2c 0%, 
        #d4af37 50%, 
        #4a7c2c 100%
    );
    background-size: 200% 100%;
    animation: progressFill 2s ease-in-out infinite;
    position: relative;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.8);
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 20px;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5));
    animation: progressShine 1s ease-in-out infinite;
}

@keyframes progressFill {
    0% {
        width: 0%;
        background-position: 0% 50%;
    }
    50% {
        width: 100%;
        background-position: 100% 50%;
    }
    100% {
        width: 0%;
        background-position: 0% 50%;
    }
}

@keyframes progressShine {
    0%, 100% {
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
}

/* Status Text */
.loader-status {
    color: #4a7c2c;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    margin-top: 15px;
    letter-spacing: 2px;
    z-index: 2;
    position: relative;
    animation: statusBlink 1s step-end infinite;
}

.loader-status::after {
    content: '_';
    animation: cursorBlink 1s step-end infinite;
}

@keyframes statusBlink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

@keyframes cursorBlink {
    0%, 50% {
        opacity: 1;
    }
    51%, 100% {
        opacity: 0;
    }
}

/* Radar Circles */
.radar-circle {
    position: absolute;
    border: 2px solid rgba(212, 175, 55, 0.3);
    border-radius: 50%;
    animation: radarPulse 3s ease-out infinite;
}

.radar-circle:nth-child(1) {
    width: 300px;
    height: 300px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: 0s;
}

.radar-circle:nth-child(2) {
    width: 400px;
    height: 400px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: 1s;
}

.radar-circle:nth-child(3) {
    width: 500px;
    height: 500px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: 2s;
}

@keyframes radarPulse {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0;
    }
}

/* Data Streams */
.data-stream {
    position: absolute;
    width: 2px;
    height: 100px;
    background: linear-gradient(to bottom, transparent, #d4af37, transparent);
    opacity: 0;
    animation: dataFlow 3s ease-in-out infinite;
}

.data-stream:nth-child(1) {
    left: 10%;
    animation-delay: 0s;
}

.data-stream:nth-child(2) {
    left: 30%;
    animation-delay: 0.5s;
}

.data-stream:nth-child(3) {
    left: 50%;
    animation-delay: 1s;
}

.data-stream:nth-child(4) {
    left: 70%;
    animation-delay: 1.5s;
}

.data-stream:nth-child(5) {
    left: 90%;
    animation-delay: 2s;
}

@keyframes dataFlow {
    0% {
        top: -100px;
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        top: 100%;
        opacity: 0;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .loader-hexagon-container {
        width: 150px;
        height: 173px;
    }
    
    .hexagon-center i {
        font-size: 45px;
    }
    
    .loader-text {
        font-size: 1.2rem;
        letter-spacing: 5px;
    }
    
    .loader-progress-digital {
        width: 300px;
        height: 35px;
    }
}

@media (max-width: 480px) {
    .loader-hexagon-container {
        width: 120px;
        height: 138px;
    }
    
    .hexagon-center i {
        font-size: 35px;
    }
    
    .loader-text {
        font-size: 1rem;
        letter-spacing: 3px;
    }
    
    .loader-progress-digital {
        width: 250px;
        height: 30px;
    }
    
    .loader-status {
        font-size: 0.8rem;
    }
}

/* Prevent body scroll */
body.loading {
    overflow: hidden;
}
