/* login.css - Cinematic intro, cosmic background, moon, ship animation, login card */

/* ==================== CINEMATIC INTRO STYLES ==================== */
.intro-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a1a0f 0%, #0d2818 30%, #0a1a0f 70%, #061208 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    overflow: hidden;
}

.intro-overlay.fade-out {
    animation: introFinalFade 0.8s ease-out forwards;
}

@keyframes introFinalFade {
    to {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }
}

.intro-overlay.hidden {
    display: none !important;
}

/* Intro cosmic background */
.intro-cosmic-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.intro-aurora-layer {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    animation: introAuroraFadeIn 2s ease-out 0.5s forwards;
}

@keyframes introAuroraFadeIn {
    to { opacity: 0.5; }
}

.intro-aurora {
    position: absolute;
    width: 150%;
    height: 60%;
    border-radius: 50%;
    filter: blur(80px);
    animation: introAuroraPulse 4s ease-in-out infinite;
}

.intro-aurora-1 {
    background: radial-gradient(ellipse, rgba(25,135,84,0.4) 0%, rgba(16,185,129,0.2) 40%, transparent 70%);
    top: -20%;
    left: -25%;
}

.intro-aurora-2 {
    background: radial-gradient(ellipse, rgba(16,185,129,0.3) 0%, rgba(25,135,84,0.2) 40%, transparent 70%);
    bottom: -20%;
    right: -25%;
    animation-delay: -2s;
}

@keyframes introAuroraPulse {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

.intro-stars-layer {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Intro logo container */
.intro-logo-container {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.intro-logo {
    width: 200px;
    height: 200px;
    animation: introLogoAppear 1.5s ease-out forwards, introLogoPulse 1.5s ease-in-out 1.5s infinite;
    position: relative;
    z-index: 2;
    filter: drop-shadow(0 0 30px rgba(34, 197, 94, 0.5));
}

@keyframes introLogoAppear {
    0% {
        opacity: 0;
        transform: scale(0) rotate(-180deg);
        filter: blur(20px) drop-shadow(0 0 0 transparent);
    }
    50% {
        opacity: 1;
        transform: scale(1.1) rotate(10deg);
        filter: blur(0) drop-shadow(0 0 40px rgba(34, 197, 94, 0.8));
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
        filter: blur(0) drop-shadow(0 0 30px rgba(34, 197, 94, 0.5));
    }
}

@keyframes introLogoPulse {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 0 30px rgba(34, 197, 94, 0.5));
    }
    50% {
        transform: scale(1.05);
        filter: drop-shadow(0 0 50px rgba(34, 197, 94, 0.8)) drop-shadow(0 0 80px rgba(34, 197, 94, 0.4));
    }
}

/* Glowing ring around logo */
.intro-logo-ring {
    position: absolute;
    width: 280px;
    height: 280px;
    border: 3px solid transparent;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(34,197,94,0.3), rgba(25,135,84,0.1)) padding-box,
                linear-gradient(135deg, #22c55e, #198754, #22c55e) border-box;
    opacity: 0;
    animation: introRingAppear 1s ease-out 0.8s forwards, introRingPulse 2s ease-in-out 1.8s infinite;
    z-index: 1;
}

@keyframes introRingAppear {
    0% { opacity: 0; transform: scale(0.5) rotate(0deg); }
    100% { opacity: 1; transform: scale(1) rotate(180deg); }
}

@keyframes introRingPulse {
    0%, 100% { transform: scale(1) rotate(180deg); opacity: 0.8; }
    50% { transform: scale(1.05) rotate(200deg); opacity: 1; }
}

/* Logo explosion state */
.intro-logo.exploding {
    animation: introLogoExplode 0.8s ease-in forwards !important;
}

@keyframes introLogoExplode {
    0% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
        filter: drop-shadow(0 0 30px rgba(34, 197, 94, 0.5));
    }
    30% {
        transform: scale(1.3) rotate(15deg);
        opacity: 1;
        filter: drop-shadow(0 0 60px rgba(34, 197, 94, 1)) brightness(1.5);
    }
    60% {
        transform: scale(1.5) rotate(-10deg);
        opacity: 0.8;
        filter: drop-shadow(0 0 100px rgba(255, 255, 255, 1)) brightness(2);
    }
    100% {
        transform: scale(0) rotate(360deg);
        opacity: 0;
        filter: drop-shadow(0 0 150px rgba(255, 255, 255, 1)) brightness(3);
    }
}

.intro-logo-ring.exploding {
    animation: introRingExplode 0.6s ease-out forwards !important;
}

@keyframes introRingExplode {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(3); opacity: 0; }
}

/* Explosion particles container */
.intro-particles {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

/* Individual explosion particle */
.intro-particle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.intro-particle.eff {
    background: linear-gradient(135deg, #22c55e 0%, #198754 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 10px;
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.6);
    border: 2px solid rgba(255,255,255,0.5);
}

.intro-particle.hub {
    background: linear-gradient(135deg, #ffffff, #dcfce7);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    border: 2px solid rgba(34, 197, 94, 0.3);
    overflow: hidden;
}

.intro-particle.hub img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.intro-particle.spark {
    background: radial-gradient(circle, #fff 0%, #22c55e 50%, transparent 70%);
    box-shadow: 0 0 10px #22c55e;
}

/* Flash overlay for explosion */
.intro-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(255,255,255,0.9) 0%, rgba(34,197,94,0.5) 50%, transparent 70%);
    opacity: 0;
    z-index: 100;
    pointer-events: none;
    animation: introFlash 0.6s ease-out forwards;
}

@keyframes introFlash {
    0% { opacity: 0; transform: scale(0.5); }
    20% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(1.5); }
}

.login-container {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0a1a0f 0%, #0d2818 30%, #0a1a0f 70%, #061208 100%);
    position: relative;
    overflow: hidden;
}

/* Cosmic background layers */
.cosmic-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
    animation: cosmicFadeIn 2s ease-out 2s forwards;
    opacity: 0;
}

@keyframes cosmicFadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

/* Stars layer */
.stars-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.star {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.9) 0%, rgba(150,255,150,0.6) 40%, transparent 70%);
    animation: twinkle var(--twinkle-duration, 3s) ease-in-out infinite;
    animation-delay: var(--twinkle-delay, 0s);
}

.star.green {
    background: radial-gradient(circle, rgba(200,255,200,1) 0%, rgba(25,135,84,0.7) 40%, transparent 70%);
}

.star.bright {
    background: radial-gradient(circle, rgba(255,255,255,1) 0%, rgba(150,255,180,0.8) 30%, rgba(25,135,84,0.4) 60%, transparent 80%);
    box-shadow: 0 0 10px rgba(25,135,84,0.5), 0 0 20px rgba(25,135,84,0.3);
}

@keyframes twinkle {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
}

@keyframes twinkleFade {
    0% { opacity: 0; transform: scale(0.5); }
    20% { opacity: 1; transform: scale(1); }
    80% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.5); }
}

/* Aurora layer */
.aurora-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.4;
}

.aurora {
    position: absolute;
    width: 150%;
    height: 60%;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0;
    animation: auroraFloat 15s ease-in-out infinite;
}

.aurora-1 {
    background: radial-gradient(ellipse, rgba(25,135,84,0.4) 0%, rgba(16,185,129,0.2) 40%, transparent 70%);
    top: -20%;
    left: -25%;
    animation-delay: 0s;
}

.aurora-2 {
    background: radial-gradient(ellipse, rgba(16,185,129,0.3) 0%, rgba(25,135,84,0.2) 40%, transparent 70%);
    top: 60%;
    left: 50%;
    animation-delay: -5s;
    width: 120%;
    height: 50%;
}

.aurora-3 {
    background: radial-gradient(ellipse, rgba(34,197,94,0.25) 0%, rgba(25,135,84,0.15) 40%, transparent 70%);
    top: 20%;
    left: -10%;
    animation-delay: -10s;
    width: 100%;
    height: 40%;
}

@keyframes auroraFloat {
    0%, 100% {
        opacity: 0;
        transform: translateX(0) translateY(0) scale(1);
    }
    25% {
        opacity: 0.6;
        transform: translateX(5%) translateY(-5%) scale(1.1);
    }
    50% {
        opacity: 0.4;
        transform: translateX(10%) translateY(5%) scale(1.05);
    }
    75% {
        opacity: 0.7;
        transform: translateX(3%) translateY(-3%) scale(1.15);
    }
}

/* Nebula glow spots */
.nebula-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0;
    animation: nebulaGlow 20s ease-in-out infinite;
}

@keyframes nebulaGlow {
    0%, 100% { opacity: 0; transform: scale(0.8); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

/* Shooting star */
.shooting-star {
    position: absolute;
    width: 100px;
    height: 2px;
    background: linear-gradient(90deg, rgba(25,135,84,0), rgba(150,255,150,0.8), rgba(255,255,255,1));
    border-radius: 50%;
    opacity: 0;
    transform-origin: left center;
}

@keyframes shootingStar {
    0% {
        opacity: 0;
        transform: translateX(0) translateY(0) rotate(var(--angle, -45deg));
    }
    10% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translateX(300px) translateY(200px) rotate(var(--angle, -45deg));
    }
}

/* ==================== MOON IN THE DISTANCE (Using moon.png) ==================== */
.space-moon {
    position: absolute;
    top: -2%;
    right: 2%;
    width: 280px;
    height: 280px;
    z-index: 1;
    opacity: 1;
    animation: moonPulse 12s ease-in-out infinite;
}

/* Moon size pulsing animation */
@keyframes moonPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.08);
    }
}

/* Main moon image with realistic soft glow */
.moon-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter:
        drop-shadow(0 0 10px rgba(255, 255, 255, 0.5))
        drop-shadow(0 0 25px rgba(220, 235, 255, 0.35))
        drop-shadow(0 0 50px rgba(200, 220, 250, 0.25));
    animation: moonGlow 6s ease-in-out infinite;
}

/* Moon glow breathing animation */
@keyframes moonGlow {
    0%, 100% {
        filter:
            drop-shadow(0 0 10px rgba(255, 255, 255, 0.5))
            drop-shadow(0 0 25px rgba(220, 235, 255, 0.35))
            drop-shadow(0 0 50px rgba(200, 220, 250, 0.25));
    }
    50% {
        filter:
            drop-shadow(0 0 15px rgba(255, 255, 255, 0.7))
            drop-shadow(0 0 35px rgba(220, 235, 255, 0.5))
            drop-shadow(0 0 70px rgba(200, 220, 250, 0.35));
    }
}

/* Hide fake lighting effects */
.moon-shimmer,
.moon-highlight {
    display: none;
}

/* ==================== EFF SHIP (Using SpaceShip.png) ==================== */
.eff-ship-container {
    position: fixed;
    bottom: 25%;
    left: 5%;
    z-index: 3;
    pointer-events: none;
    opacity: 0;
}

/* When launching class is added, ship becomes visible and animates */
.eff-ship-container.launching {
    opacity: 1;
}

.eff-ship {
    position: relative;
}

/* Idle floating animation - subtle zoom in/out when ship reaches destination */
.eff-ship.ship-idle {
    animation: shipIdle 4s ease-in-out infinite;
}

@keyframes shipIdle {
    0%, 100% {
        transform: scale(1) translate(0, 0);
    }
    50% {
        transform: scale(1.08) translate(2px, -2px);
    }
}

/* Main spaceship image */
.ship-image {
    width: 120px;
    height: auto;
    filter: drop-shadow(0 0 5px rgba(34, 197, 94, 0.4));
    position: relative;
    z-index: 2;
}

/* Engine exhaust container - positioned at back of ship */
.ship-exhaust {
    position: absolute;
    bottom: 18px;
    left: 8px;
    width: 40px;
    height: 25px;
    transform: rotate(-45deg);
    z-index: 1;
}

/* Individual flame elements */
.exhaust-flame {
    position: absolute;
    border-radius: 50% 20% 50% 20%;
    filter: blur(1px);
    transform-origin: right center;
}

/* Core flame - bright white/cyan center */
.exhaust-flame.flame-1 {
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 8px;
    background: linear-gradient(to left,
        rgba(255, 255, 255, 0.95) 0%,
        rgba(180, 255, 220, 0.9) 30%,
        rgba(80, 220, 140, 0.7) 70%,
        transparent 100%);
    animation: flameCore 0.05s ease-in-out infinite alternate;
}

/* Middle flame - green/teal */
.exhaust-flame.flame-2 {
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 12px;
    background: linear-gradient(to left,
        rgba(100, 255, 180, 0.8) 0%,
        rgba(34, 197, 94, 0.6) 40%,
        rgba(20, 150, 80, 0.3) 80%,
        transparent 100%);
    animation: flameMiddle 0.07s ease-in-out infinite alternate;
}

/* Outer flame - fading trail */
.exhaust-flame.flame-3 {
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 16px;
    background: linear-gradient(to left,
        rgba(34, 197, 94, 0.5) 0%,
        rgba(34, 197, 94, 0.2) 50%,
        transparent 100%);
    animation: flameOuter 0.1s ease-in-out infinite alternate;
    filter: blur(2px);
}

@keyframes flameCore {
    0% {
        width: 16px;
        height: 7px;
        opacity: 0.9;
    }
    100% {
        width: 20px;
        height: 9px;
        opacity: 1;
    }
}

@keyframes flameMiddle {
    0% {
        width: 26px;
        height: 11px;
        opacity: 0.7;
    }
    100% {
        width: 30px;
        height: 14px;
        opacity: 0.85;
    }
}

@keyframes flameOuter {
    0% {
        width: 35px;
        height: 14px;
        opacity: 0.4;
    }
    100% {
        width: 42px;
        height: 18px;
        opacity: 0.6;
    }
}

/* Floating icons (planets) - DVD bouncing style */
.login-floating-icons {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    overflow: hidden;
    opacity: 0;
    transition: opacity 1s ease-out;
}

.login-floating-icons.visible {
    opacity: 1;
}

.floating-icon {
    position: absolute;
    pointer-events: none;
    cursor: default;
    opacity: 0.85;
    z-index: 2;
    will-change: transform;
    user-select: none;
    -webkit-user-select: none;
}

.floating-icon.bouncing {
    transition: none;
}

.floating-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
}

.floating-icon.eff-avatar {
    background: linear-gradient(135deg, #22c55e 0%, #198754 50%, #157347 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.5), 0 0 40px rgba(25, 135, 84, 0.3), inset 0 -3px 10px rgba(0,0,0,0.2);
    border: 2px solid rgba(255,255,255,0.5);
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.floating-icon.hub-icon {
    background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 50%, #dcfce7 100%);
    border-radius: 50%;
    padding: 4px;
    box-shadow: 0 0 20px rgba(255,255,255,0.4), 0 0 40px rgba(34, 197, 94, 0.2), inset 0 -3px 10px rgba(0,0,0,0.1);
    border: 2px solid rgba(34, 197, 94, 0.4);
}

.floating-icon.hub-icon img {
    border-radius: 50%;
}

.floating-icon.chat-icon {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 50%, #bbf7d0 100%);
    border-radius: 50%;
    padding: 5px;
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.4), 0 0 40px rgba(25, 135, 84, 0.25), inset 0 -3px 10px rgba(0,0,0,0.1);
    border: 2px solid rgba(34, 197, 94, 0.5);
}

.floating-icon.chat-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.2));
}

.login-card {
    background: rgba(255, 255, 255, 0.97);
    border-radius: 1rem;
    box-shadow: 0 0 30px rgba(34, 197, 94, 0.15), 0 0 60px rgba(25, 135, 84, 0.1), 0 20px 60px rgba(0,0,0,0.3);
    padding: 3rem;
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 10;
    border: 1px solid rgba(34, 197, 94, 0.1);
    backdrop-filter: blur(10px);
    animation: loginCardAppear 1s ease-out 2.8s both;
}

/* Skip animation on logout return */
.login-card.no-animation {
    animation: none;
    opacity: 1;
    transform: scale(1) translateY(0);
    filter: blur(0);
}

@keyframes loginCardAppear {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(30px);
        filter: blur(10px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
        filter: blur(0);
    }
}

.login-logo {
    max-width: 280px;
    height: auto;
    margin-bottom: 1.5rem;
}

.login-title {
    font-size: 1.75rem;
    font-weight: 500;
    color: #212529;
    margin-bottom: 0.5rem;
}

.login-subtitle {
    color: #6c757d;
    margin-bottom: 2rem;
}

/* Demo User Selection */
.demo-users-section {
    margin-top: 0.5rem;
}

.demo-user-cards {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.demo-user-card {
    display: flex;
    align-items: center;
    padding: 0.875rem 1rem;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.demo-user-card.admin {
    background: linear-gradient(135deg, #fff5f5 0%, #fff 100%);
    border-color: #fecaca;
}

.demo-user-card.admin:hover {
    border-color: #f87171;
    box-shadow: 0 4px 12px rgba(248, 113, 113, 0.2);
    transform: translateX(4px);
}

.demo-user-card.standard {
    background: linear-gradient(135deg, #f0fdf4 0%, #fff 100%);
    border-color: #bbf7d0;
}

.demo-user-card.standard:hover {
    border-color: #22c55e;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.2);
    transform: translateX(4px);
}

.demo-user-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-right: 0.875rem;
    flex-shrink: 0;
}

.demo-user-avatar.admin {
    background: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
    color: #fff;
}

.demo-user-avatar.standard {
    background: linear-gradient(135deg, #22c55e 0%, #4ade80 100%);
    color: #fff;
}

.demo-user-info {
    flex: 1;
}

.demo-user-name {
    font-weight: 600;
    color: #1f2937;
    font-size: 0.95rem;
}

.demo-user-email {
    font-size: 0.8rem;
    color: #6b7280;
}

.demo-user-badge {
    display: inline-block;
    font-size: 0.65rem;
    padding: 0.15rem 0.5rem;
    border-radius: 1rem;
    margin-top: 0.25rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.demo-user-badge.admin {
    background: #fef2f2;
    color: #dc2626;
}

.demo-user-badge.standard {
    background: #f0fdf4;
    color: #16a34a;
}

.demo-user-arrow {
    color: #9ca3af;
    transition: transform 0.3s ease;
}

.demo-user-card:hover .demo-user-arrow {
    transform: translateX(4px);
    color: #6b7280;
}
