
/* Keep body styles minimal to avoid interfering with Flutter Web platform views (e.g., HtmlEditor iframe) */
body {
    margin: 0;
    padding: 0;
}

/* ============================================
   STRUCTO PREMIUM LOADING SCREEN
   Stunning Orbital Charging Effect
   ============================================ */

:root {
    /* Dark Mode Colors */
    --structo-primary: #818CF8;
    --structo-primary-dark: #6366F1;
    --structo-primary-light: #A5B4FC;
    --structo-primary-glow: rgba(129, 140, 248, 0.6);
    --structo-background: #0f1419;
    --structo-card: #1a2332;
    --structo-foreground: #E2E8F0;
    --structo-foreground-muted: #94A3B8;
    --structo-muted: #1e293b;
    --structo-border: #334155;
    --structo-success: #10B981;
    --structo-success-light: #34D399;
    --structo-cyan: #22D3EE;
    --structo-purple: #A78BFA;
}

/* Main loading screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: radial-gradient(ellipse at center, #1a2332 0%, #0f1419 70%);
    z-index: 999999;
    overflow: hidden;
}

.loading-screen.fade-out {
    animation: fadeOut 0.6s ease-out forwards;
}

@keyframes fadeOut {
    to { opacity: 0; visibility: hidden; }
}

/* ============================================
   BACKGROUND EFFECTS
   ============================================ */

.bg-grid {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(129, 140, 248, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(129, 140, 248, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    mask-image: radial-gradient(ellipse at center, black 20%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse at center, black 20%, transparent 70%);
}

.bg-glow {
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--structo-primary-glow) 0%, transparent 60%);
    opacity: 0.15;
    filter: blur(60px);
    animation: bgPulse 4s ease-in-out infinite;
}

@keyframes bgPulse {
    0%, 100% { transform: scale(1); opacity: 0.15; }
    50% { transform: scale(1.1); opacity: 0.25; }
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.loading-content {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: contentIn 0.8s ease-out;
}

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

/* ============================================
   LOGO SECTION - ORBITAL SYSTEM
   ============================================ */

.logo-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 48px;
}

.logo-container {
    position: relative;
    width: 200px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Outer orbital ring */
.orbit-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid;
    border-color: rgba(129, 140, 248, 0.2);
    animation: orbitRotate 20s linear infinite;
}

.orbit-ring-1 {
    width: 180px;
    height: 180px;
    animation-duration: 25s;
}

.orbit-ring-2 {
    width: 140px;
    height: 140px;
    animation-duration: 18s;
    animation-direction: reverse;
}

.orbit-ring-3 {
    width: 100px;
    height: 100px;
    animation-duration: 12s;
}

@keyframes orbitRotate {
    to { transform: rotate(360deg); }
}

/* Orbital particles on rings */
.orbit-particle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: var(--structo-primary);
    border-radius: 50%;
    box-shadow: 
        0 0 10px var(--structo-primary),
        0 0 20px var(--structo-primary),
        0 0 30px var(--structo-primary-glow);
}

.orbit-ring-1 .orbit-particle { top: -3px; left: 50%; margin-left: -3px; }
.orbit-ring-2 .orbit-particle { top: 50%; right: -3px; margin-top: -3px; }
.orbit-ring-3 .orbit-particle { bottom: -3px; left: 50%; margin-left: -3px; }

/* Additional orbital particles */
.orbit-ring-1 .orbit-particle-2 { bottom: -3px; left: 50%; margin-left: -3px; top: auto; }
.orbit-ring-2 .orbit-particle-2 { top: 50%; left: -3px; right: auto; margin-top: -3px; }

/* Energy streams flowing to center */
.energy-stream {
    position: absolute;
    width: 2px;
    height: 60px;
    background: linear-gradient(to bottom, transparent, var(--structo-primary), var(--structo-primary-light), transparent);
    transform-origin: bottom center;
    opacity: 0;
    animation: streamFlow 2s ease-in-out infinite;
}

.energy-stream:nth-child(1) { transform: rotate(0deg) translateY(-40px); animation-delay: 0s; }
.energy-stream:nth-child(2) { transform: rotate(45deg) translateY(-40px); animation-delay: 0.25s; }
.energy-stream:nth-child(3) { transform: rotate(90deg) translateY(-40px); animation-delay: 0.5s; }
.energy-stream:nth-child(4) { transform: rotate(135deg) translateY(-40px); animation-delay: 0.75s; }
.energy-stream:nth-child(5) { transform: rotate(180deg) translateY(-40px); animation-delay: 1s; }
.energy-stream:nth-child(6) { transform: rotate(225deg) translateY(-40px); animation-delay: 1.25s; }
.energy-stream:nth-child(7) { transform: rotate(270deg) translateY(-40px); animation-delay: 1.5s; }
.energy-stream:nth-child(8) { transform: rotate(315deg) translateY(-40px); animation-delay: 1.75s; }

@keyframes streamFlow {
    0% { opacity: 0; height: 60px; }
    30% { opacity: 0.8; }
    100% { opacity: 0; height: 0; }
}

/* Core glow behind logo */
.core-glow {
    position: absolute;
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, var(--structo-primary) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(20px);
    opacity: 0.4;
    transition: all 0.3s ease;
    animation: coreGlow 2s ease-in-out infinite;
}

@keyframes coreGlow {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.15); }
}

/* Hexagon frame around logo */
.hex-frame {
    position: absolute;
    width: 76px;
    height: 76px;
}

.hex-frame svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: var(--structo-primary);
    stroke-width: 1.5;
    opacity: 0.6;
    filter: drop-shadow(0 0 8px var(--structo-primary-glow));
}

/* Rotating outer hex */
.hex-outer {
    position: absolute;
    width: 90px;
    height: 90px;
    animation: hexRotate 8s linear infinite;
}

.hex-outer svg {
    stroke: rgba(129, 140, 248, 0.3);
    stroke-width: 1;
}

@keyframes hexRotate {
    to { transform: rotate(360deg); }
}

/* Logo image */
.logo-image {
    position: relative;
    z-index: 5;
    width: 48px;
    height: 48px;
    object-fit: contain;
    /* Color override to match primary purple/indigo */
    filter: drop-shadow(0 0 20px var(--structo-primary-glow)) 
            brightness(0) saturate(100%) 
            invert(67%) sepia(42%) saturate(2876%) hue-rotate(206deg) brightness(101%) contrast(94%);
    animation: logoPulse 2s ease-in-out infinite;
}

@keyframes logoPulse {
    0%, 100% { 
        filter: drop-shadow(0 0 20px var(--structo-primary-glow)) 
                brightness(0) saturate(100%) 
                invert(67%) sepia(42%) saturate(2876%) hue-rotate(206deg) brightness(101%) contrast(94%);
    }
    50% { 
        filter: drop-shadow(0 0 30px var(--structo-primary-glow)) 
                brightness(0) saturate(100%) 
                invert(67%) sepia(42%) saturate(2876%) hue-rotate(206deg) brightness(110%) contrast(94%);
    }
}

/* Pulse rings emanating from center */
.pulse-ring {
    position: absolute;
    width: 60px;
    height: 60px;
    border: 2px solid var(--structo-primary);
    border-radius: 50%;
    opacity: 0;
    animation: pulseOut 3s ease-out infinite;
}

.pulse-ring:nth-child(1) { animation-delay: 0s; }
.pulse-ring:nth-child(2) { animation-delay: 1s; }
.pulse-ring:nth-child(3) { animation-delay: 2s; }

@keyframes pulseOut {
    0% { transform: scale(1); opacity: 0.6; border-width: 2px; }
    100% { transform: scale(3); opacity: 0; border-width: 0.5px; }
}

/* Brand name */
.brand-name {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
    font-size: 28px;
    font-weight: 600;
    letter-spacing: 4px;
    margin: 24px 0 0 0;
    background: linear-gradient(135deg, #fff 0%, var(--structo-primary-light) 50%, var(--structo-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px var(--structo-primary-glow);
}

/* ============================================
   PROGRESS SECTION
   ============================================ */

.progress-section {
    width: 100%;
    max-width: 300px;
    animation: progressIn 0.8s ease-out 0.3s both;
}

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

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 10px;
}

.progress-percentage {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 14px;
    font-weight: 600;
    color: var(--structo-primary-light);
    font-variant-numeric: tabular-nums;
}

/* Progress bar */
.progress-container {
    position: relative;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--structo-primary-dark), var(--structo-primary), var(--structo-primary-light));
    border-radius: 2px;
    transition: width 0.3s ease-out;
    box-shadow: 0 0 10px var(--structo-primary-glow);
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 30px;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4));
    animation: progressShine 1.5s ease-in-out infinite;
}

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

.progress-glow {
    position: absolute;
    top: -2px;
    left: 0;
    height: 8px;
    width: 0%;
    background: var(--structo-primary);
    filter: blur(4px);
    opacity: 0.5;
    border-radius: 4px;
}

/* Status text */
.progress-status {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
    font-size: 13px;
    color: var(--structo-foreground-muted);
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.status-dots {
    display: inline-flex;
    gap: 3px;
}

.status-dot {
    width: 4px;
    height: 4px;
    background: var(--structo-primary);
    border-radius: 50%;
    animation: dotPulse 1.2s ease-in-out infinite;
}

.status-dot:nth-child(1) { animation-delay: 0s; }
.status-dot:nth-child(2) { animation-delay: 0.2s; }
.status-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotPulse {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}

/* ============================================
   FOOTER
   ============================================ */

.loading-footer {
    position: absolute;
    bottom: 24px;
    animation: footerIn 0.8s ease-out 0.5s both;
}

@keyframes footerIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.loading-version {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 11px;
    color: var(--structo-foreground-muted);
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

/* ============================================
   SUCCESS STATE
   ============================================ */

.loading-screen.success .core-glow {
    background: radial-gradient(circle, var(--structo-success) 0%, transparent 70%);
    animation: successPulse 0.5s ease-out;
}

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

.loading-screen.success .orbit-particle {
    background: var(--structo-success);
    box-shadow: 0 0 10px var(--structo-success), 0 0 20px var(--structo-success);
}

.loading-screen.success .progress-bar {
    background: linear-gradient(90deg, var(--structo-success), var(--structo-success-light));
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
}

.loading-screen.success .progress-percentage {
    color: var(--structo-success-light);
}

.loading-screen.success .pulse-ring {
    border-color: var(--structo-success);
}

.loading-screen.success .hex-frame svg {
    stroke: var(--structo-success);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 480px) {
    .logo-container {
        width: 160px;
        height: 160px;
    }
    
    .orbit-ring-1 { width: 140px; height: 140px; }
    .orbit-ring-2 { width: 110px; height: 110px; }
    .orbit-ring-3 { width: 80px; height: 80px; }
    
    .brand-name {
        font-size: 22px;
        letter-spacing: 3px;
    }
    
    .progress-section {
        max-width: 260px;
    }
}

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

/* Hidden elements for compatibility */
.particles,
.charging-ring,
.electric-arcs,
.energy-particles,
.energy-particles-inner,
.charge-burst,
.logo-spinner,
.logo-core,
.logo-glow,
.gradient-overlay {
    display: none;
}
