/**
 * RAN Asgard Online - Premium Background Effects
 * AAA+ Grade Visual Enhancement
 * 
 * @author RAN Asgard Team
 * @version 1.0.0
 */

/* ========================================
   Global Premium Background Layer
======================================== */
.premium-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

/* Noise Texture Overlay */
.noise-overlay {
    position: absolute;
    inset: 0;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    mix-blend-mode: overlay;
}

/* Animated Grid Pattern */
.grid-pattern {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(212, 168, 83, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(212, 168, 83, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image: radial-gradient(ellipse 80% 50% at 50% 50%, black 40%, transparent 100%);
    -webkit-mask-image: radial-gradient(ellipse 80% 50% at 50% 50%, black 40%, transparent 100%);
    animation: gridPulse 8s ease-in-out infinite;
}

@keyframes gridPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Floating Geometric Shapes */
.geo-shapes {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.geo-shape {
    position: absolute;
    border: 1px solid rgba(212, 168, 83, 0.1);
    opacity: 0;
    animation: floatShape 20s ease-in-out infinite;
}

.geo-shape.circle {
    border-radius: 50%;
}

.geo-shape.diamond {
    transform: rotate(45deg);
}

.geo-shape-1 {
    width: 100px;
    height: 100px;
    top: 10%;
    left: 5%;
    animation-delay: 0s;
}

.geo-shape-2 {
    width: 150px;
    height: 150px;
    top: 60%;
    right: 8%;
    animation-delay: -5s;
}

.geo-shape-3 {
    width: 80px;
    height: 80px;
    top: 30%;
    right: 15%;
    animation-delay: -10s;
}

.geo-shape-4 {
    width: 120px;
    height: 120px;
    bottom: 20%;
    left: 10%;
    animation-delay: -15s;
}

.geo-shape-5 {
    width: 60px;
    height: 60px;
    top: 80%;
    left: 50%;
    animation-delay: -8s;
}

.geo-shape-6 {
    width: 90px;
    height: 90px;
    top: 15%;
    left: 60%;
    animation-delay: -12s;
}

@keyframes floatShape {
    0%, 100% {
        opacity: 0;
        transform: translateY(0) rotate(0deg);
    }
    25% {
        opacity: 0.3;
    }
    50% {
        opacity: 0.5;
        transform: translateY(-30px) rotate(180deg);
    }
    75% {
        opacity: 0.3;
    }
}

/* Ambient Glow Orbs */
.ambient-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    animation: ambientPulse 10s ease-in-out infinite;
}

.ambient-glow-1 {
    width: 600px;
    height: 600px;
    top: -200px;
    left: -200px;
    background: radial-gradient(circle, rgba(212, 168, 83, 0.08) 0%, transparent 70%);
    animation-delay: 0s;
}

.ambient-glow-2 {
    width: 500px;
    height: 500px;
    bottom: -150px;
    right: -150px;
    background: radial-gradient(circle, rgba(212, 168, 83, 0.06) 0%, transparent 70%);
    animation-delay: -5s;
}

.ambient-glow-3 {
    width: 400px;
    height: 400px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(212, 168, 83, 0.04) 0%, transparent 70%);
    animation-delay: -2.5s;
}

@keyframes ambientPulse {
    0%, 100% {
        opacity: 0.5;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}

/* Vertical Light Beams */
.light-beams {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.light-beam {
    position: absolute;
    width: 1px;
    height: 100%;
    background: linear-gradient(to bottom,
        transparent 0%,
        rgba(212, 168, 83, 0.1) 50%,
        transparent 100%
    );
    animation: beamShimmer 8s ease-in-out infinite;
}

.light-beam-1 { left: 10%; animation-delay: 0s; }
.light-beam-2 { left: 25%; animation-delay: -2s; }
.light-beam-3 { left: 50%; animation-delay: -4s; }
.light-beam-4 { left: 75%; animation-delay: -6s; }
.light-beam-5 { left: 90%; animation-delay: -1s; }

@keyframes beamShimmer {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

/* ========================================
   Section-Specific Enhancements
======================================== */

/* Enhanced Section Background */
.section-enhanced-bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

/* Corner Accents */
.corner-accent {
    position: absolute;
    width: 100px;
    height: 100px;
    border: 1px solid rgba(212, 168, 83, 0.2);
    opacity: 0.5;
}

.corner-accent::before,
.corner-accent::after {
    content: '';
    position: absolute;
    background: rgba(212, 168, 83, 0.3);
}

.corner-accent.top-left {
    top: 20px;
    left: 20px;
    border-right: none;
    border-bottom: none;
}

.corner-accent.top-right {
    top: 20px;
    right: 20px;
    border-left: none;
    border-bottom: none;
}

.corner-accent.bottom-left {
    bottom: 20px;
    left: 20px;
    border-right: none;
    border-top: none;
}

.corner-accent.bottom-right {
    bottom: 20px;
    right: 20px;
    border-left: none;
    border-top: none;
}

/* Hex Pattern */
.hex-pattern {
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='49' viewBox='0 0 28 49'%3E%3Cg fill-rule='evenodd'%3E%3Cg fill='%23d4a853' fill-opacity='0.02'%3E%3Cpath d='M13.99 9.25l13 7.5v15l-13 7.5L1 31.75v-15l12.99-7.5zM3 17.9v12.7l10.99 6.34 11-6.35V17.9l-11-6.34L3 17.9zM0 15l12.98-7.5V0h-2v6.35L0 12.69v2.3zm0 18.5L12.98 41v8h-2v-6.85L0 35.81v-2.3zM15 0v7.5L27.99 15H28v-2.31h-.01L17 6.35V0h-2zm0 49v-8l12.99-7.5H28v2.31h-.01L17 42.15V49h-2z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.5;
}

/* Floating Particles for Sections */
.section-particles {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.section-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(212, 168, 83, 0.6);
    border-radius: 50%;
    animation: floatParticleSection 15s linear infinite;
}

@keyframes floatParticleSection {
    0% {
        transform: translateY(100%) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100%) translateX(50px);
        opacity: 0;
    }
}

/* Energy Lines */
.energy-lines {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.energy-line {
    position: absolute;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(212, 168, 83, 0.3), 
        transparent
    );
    animation: energyFlow 3s ease-in-out infinite;
}

.energy-line-1 {
    top: 20%;
    left: 0;
    width: 30%;
    animation-delay: 0s;
}

.energy-line-2 {
    top: 50%;
    right: 0;
    width: 25%;
    animation-delay: -1s;
}

.energy-line-3 {
    bottom: 30%;
    left: 0;
    width: 35%;
    animation-delay: -2s;
}

@keyframes energyFlow {
    0%, 100% {
        opacity: 0;
        transform: scaleX(0.5) translateX(-50%);
    }
    50% {
        opacity: 1;
        transform: scaleX(1) translateX(0);
    }
}

/* Glow Border */
.glow-border-top,
.glow-border-bottom {
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(212, 168, 83, 0.3) 20%,
        rgba(212, 168, 83, 0.6) 50%,
        rgba(212, 168, 83, 0.3) 80%,
        transparent 100%
    );
}

.glow-border-top {
    top: 0;
    box-shadow: 0 0 20px rgba(212, 168, 83, 0.3);
}

.glow-border-bottom {
    bottom: 0;
    box-shadow: 0 0 20px rgba(212, 168, 83, 0.3);
}

/* Radial Spotlight */
.spotlight {
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        ellipse 50% 30% at 50% 0%,
        rgba(212, 168, 83, 0.05) 0%,
        transparent 70%
    );
    pointer-events: none;
}

/* Animated Stars */
.stars-container {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: white;
    border-radius: 50%;
    animation: twinkle 3s ease-in-out infinite;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.2; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.5); }
}

/* Generate star positions dynamically via JS or manually */
.star:nth-child(1) { top: 5%; left: 10%; animation-delay: 0s; }
.star:nth-child(2) { top: 15%; left: 30%; animation-delay: -0.5s; }
.star:nth-child(3) { top: 8%; left: 50%; animation-delay: -1s; }
.star:nth-child(4) { top: 20%; left: 70%; animation-delay: -1.5s; }
.star:nth-child(5) { top: 10%; left: 85%; animation-delay: -2s; }
.star:nth-child(6) { top: 25%; left: 15%; animation-delay: -2.5s; }
.star:nth-child(7) { top: 30%; left: 40%; animation-delay: -0.3s; }
.star:nth-child(8) { top: 35%; left: 60%; animation-delay: -0.8s; }
.star:nth-child(9) { top: 40%; left: 80%; animation-delay: -1.3s; }
.star:nth-child(10) { top: 45%; left: 25%; animation-delay: -1.8s; }
.star:nth-child(11) { top: 50%; left: 55%; animation-delay: -2.3s; }
.star:nth-child(12) { top: 55%; left: 75%; animation-delay: -0.1s; }
.star:nth-child(13) { top: 60%; left: 5%; animation-delay: -0.6s; }
.star:nth-child(14) { top: 65%; left: 35%; animation-delay: -1.1s; }
.star:nth-child(15) { top: 70%; left: 65%; animation-delay: -1.6s; }
.star:nth-child(16) { top: 75%; left: 90%; animation-delay: -2.1s; }
.star:nth-child(17) { top: 80%; left: 20%; animation-delay: -2.6s; }
.star:nth-child(18) { top: 85%; left: 45%; animation-delay: -0.4s; }
.star:nth-child(19) { top: 90%; left: 70%; animation-delay: -0.9s; }
.star:nth-child(20) { top: 95%; left: 10%; animation-delay: -1.4s; }

/* Vignette Effect */
.vignette {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    background: radial-gradient(
        ellipse 70% 60% at 50% 50%,
        transparent 50%,
        rgba(0, 0, 0, 0.4) 100%
    );
}

/* Cyber Lines Decoration */
.cyber-lines {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.cyber-line-h,
.cyber-line-v {
    position: absolute;
    background: linear-gradient(90deg, transparent, rgba(212, 168, 83, 0.1), transparent);
}

.cyber-line-h {
    height: 1px;
    width: 100%;
    left: 0;
}

.cyber-line-v {
    width: 1px;
    height: 100%;
    top: 0;
    background: linear-gradient(180deg, transparent, rgba(212, 168, 83, 0.1), transparent);
}

/* Data Stream Effect */
.data-stream {
    position: absolute;
    width: 1px;
    height: 100%;
    overflow: hidden;
}

.data-stream::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 50px;
    background: linear-gradient(180deg, transparent, rgba(212, 168, 83, 0.5), transparent);
    animation: dataFlow 4s linear infinite;
}

@keyframes dataFlow {
    0% { top: -50px; }
    100% { top: 100%; }
}

.data-stream-1 { left: 5%; animation-delay: 0s; }
.data-stream-2 { left: 95%; animation-delay: -2s; }

/* ========================================
   Performance Optimizations
======================================== */
@media (prefers-reduced-motion: reduce) {
    .geo-shape,
    .ambient-glow,
    .light-beam,
    .section-particle,
    .energy-line,
    .star,
    .data-stream::before,
    .grid-pattern {
        animation: none !important;
        opacity: 0.3;
    }
}

/* Disable heavy effects on mobile for performance */
@media (max-width: 768px) {
    .geo-shapes,
    .light-beams,
    .data-stream,
    .cyber-lines {
        display: none;
    }
    
    .ambient-glow {
        filter: blur(60px);
    }
    
    .grid-pattern {
        background-size: 40px 40px;
    }
}
