﻿/* ============================================= */
/* COMPLETE SPACESHIP ANIMATION CSS (v2.4-radzen) */
/* Includes: Wrapper, Ship, Rings, Stars       */
/* Uses Radzen Blazor Theme CSS Variables      */
/* Container: 500px, Wrapper: No specific height */
/* Star colors: base-500/base-400              */
/* Scan rings fade out even earlier            */
/* ============================================= */

/* --- Wrapper (No Height/Flex Styling) --- */
.wrapper {
    width: 100%;
    /* Removed min-height, display:flex, align-items */
    /* Background is transparent (shows parent bg) */
}

/* --- Animation Container (Resized & Centered) --- */
.animation-container {
    position: relative;
    width: 500px;  /* CHANGED */
    height: 500px; /* CHANGED */
    display: flex; /* Keep flex for internal centering of scanner */
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    overflow: hidden;
    z-index: 1;
    margin: auto; /* ADDED for horizontal centering */
    /* Add top/bottom margin if needed, e.g.: */
    /* margin: 50px auto; */
}

/* --- Stars Container --- */
.stars {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}

/* --- Individual Star Styling (Radzen Base 500/400) --- */
.star {
    position: absolute;
    width: 2px;
    height: 2px;
    /* UPDATED color as per your note */
    background-color: var(--rz-base-500, #6c757d);
    border-radius: 50%;
    /* UPDATED shadow color & mix as per your note */
    /* Using color-mix for modern browsers, adjust if needed */
    box-shadow: 0 0 4px 1px color-mix(in srgb, var(--rz-base-400, #adb5bd) 70%, transparent);
    animation: twinkle 3s infinite ease-in-out alternate;
}

/* --- Star Positions (Adjust percentages if needed for 500px) --- */
/* NOTE: Percentage positions will scale relative to the 500px container */
/* You might want to adjust these or add more for the larger area */
.star1 { top: 15%; left: 20%; animation-delay: 0.5s; width: 1px; height: 1px;}
.star2 { top: 40%; left: 80%; animation-delay: 1.2s; }
.star3 { top: 75%; left: 50%; animation-delay: 0.2s; width: 3px; height: 3px;}
.star4 { top: 10%; left: 90%; animation-delay: 2s; }
.star5 { top: 85%; left: 10%; animation-delay: 1.5s; width: 1px; height: 1px;}
.star6 { top: 50%; left: 30%; animation-delay: 0.8s; }
.star7 { top: 25%; left: 65%; animation-delay: 2.5s; width: 3px; height: 3px;}
.star8 { top: 60%; left: 5%; animation-delay: 1.8s; }
.star9 { top: 5%; left: 50%; animation-delay: 0.1s; width: 1px; height: 1px; }
.star10 { top: 95%; left: 55%; animation-delay: 2.8s; }
.star11 { top: 50%; left: 95%; animation-delay: 0.4s; width: 3px; height: 3px; }
.star12 { top: 20%; left: 40%; animation-delay: 1.0s; }
.star13 { top: 70%; left: 75%; animation-delay: 1.6s; width: 1px; height: 1px; }
.star14 { top: 35%; left: 15%; animation-delay: 2.2s; }
.star15 { top: 90%; left: 30%; animation-delay: 0.7s; }
.star16 { top: 5%; left: 5%; animation-delay: 1.3s; width: 2px; height: 2px; }

/* --- Scanner & Ship Container --- */
.scanner {
    position: relative;
    width: 100px;
    height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 5;
}

/* --- Spaceship (Uses Radzen Base Colors) --- */
.spaceship {
    position: relative;
    width: 50px;
    height: 60px;
    animation: shipHover 4s infinite ease-in-out;
    z-index: 6;
}

.ship-body {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 55px;
    background-color: var(--rz-base-400, #adb5bd);
    border-radius: 50% 50% 10px 10px / 60% 60% 10px 10px;
    box-shadow: inset 0 -5px 10px rgba(0, 0, 0, 0.3);
}

.ship-wing {
    position: absolute;
    top: 15px;
    width: 25px;
    height: 30px;
    background-color: var(--rz-base-400, #adb5bd);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.3);
}

.ship-wing.left {
    left: -10px;
    border-radius: 80% 10px 10px 50%;
    transform: rotate(-15deg);
}

.ship-wing.right {
    right: -10px;
    border-radius: 10px 80% 50% 10px;
    transform: rotate(15deg);
}

.ship-engine {
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 15px;
    height: 10px;
    background-color: var(--rz-base-700, #495057);
    border-radius: 3px 3px 50% 50%;
}

.ship-engine::after { /* Engine glow (Uses Radzen Warning Color) */
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 15px;
    background: radial-gradient(ellipse at bottom, var(--rz-warning, #ffc107) 0%, transparent 70%);
    border-radius: 50%;
    opacity: 0.8;
    animation: enginePulse 1.5s infinite ease-in-out;
}

/* --- Scan Rings (Uses Radzen Info Color, Reduced Shadow) --- */
.scan-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 2px solid var(--rz-info, #0dcaf0);
    border-radius: 50%;
    opacity: 0; /* Initial opacity set by keyframes */
    animation: scan 3s infinite linear;
    /* REDUCED shadow slightly */
    box-shadow: 0 0 8px var(--rz-info, #0dcaf0), inset 0 0 4px var(--rz-info, #0dcaf0);
    z-index: 3;
}

/* Stagger the rings */
.scan-ring.ring1 { animation-delay: 0s; }
.scan-ring.ring2 { animation-delay: 1s; }
.scan-ring.ring3 { animation-delay: 2s; }

/* ========================================= */
/* KEYFRAMES                                 */
/* ========================================= */

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

@keyframes shipHover {
    0% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
    100% { transform: translateY(0); }
}

@keyframes enginePulse {
    0% { opacity: 0.7; transform: translateX(-50%) scaleY(1); }
    50% { opacity: 1; transform: translateX(-50%) scaleY(1.2); }
    100% { opacity: 0.7; transform: translateX(-50%) scaleY(1); }
}

/* --- Scan Ring Animation (Fade Out Even Earlier) --- */
@keyframes scan {
    0% {
        width: 20%;
        height: 20%;
        opacity: 0.7; /* Start slightly less opaque */
        transform: translate(-50%, -50%) scale(0.2);
    }
    /* Start fading much earlier */
    50% {
        opacity: 0.5;
    }
    /* Fully transparent well before the edge */
    90% {
        width: 250%;
        height: 250%;
        opacity: 0; /* Fully faded */
        transform: translate(-50%, -50%) scale(2.5);
    }
    100% {
        width: 250%;
        height: 250%;
        opacity: 0;
        transform: translate(-50%, -50%) scale(2.5);
    }
}

/* ========================================= */
/* ACCESSIBILITY                             */
/* ========================================= */
@media (prefers-reduced-motion: reduce) {
    .spaceship,
    .ship-engine::after,
    .scan-ring,
    .star {
        animation: none !important;
    }
    /* Static state */
    .ship-engine::after { opacity: 0.8; }
    .scan-ring { opacity: 0; }
    .star { opacity: 0.7; }
}
