.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 1;
    transition: opacity 0.5s ease, transform 0.5s ease;
    background: #1a1f2e;
    overflow: hidden;
}

@supports (padding: max(0px)) {
    .splash-screen {
        padding-top: max(0px, env(safe-area-inset-top));
        padding-bottom: max(0px, env(safe-area-inset-bottom));
    }
}

.splash-screen::-webkit-scrollbar { display: none; }
.splash-screen { -ms-overflow-style: none; scrollbar-width: none; }
body.splash-active { overflow: hidden; }
body.splash-active::-webkit-scrollbar { display: none; }
body.splash-active { -ms-overflow-style: none; scrollbar-width: none; }

.splash-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #1a1f2e;
}

.splash-background::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 800px;
    height: 800px;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(74, 158, 255, 0.06) 0%, transparent 70%);
    animation: auraPulse 3s ease-in-out infinite;
}

.splash-background::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 500px;
    height: 500px;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(74, 158, 255, 0.04) 0%, transparent 60%);
    animation: auraPulse 3s ease-in-out infinite 1.5s;
}

.particles-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.splash-screen.fade-out {
    opacity: 0;
    transform: scale(1.03);
    pointer-events: none;
}

.splash-content {
    text-align: center;
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.splash-logo {
    position: relative;
    margin-bottom: 16px;
}

.logo-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 120px;
    height: 120px;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(74, 158, 255, 0.25) 0%, transparent 70%);
    border-radius: 50%;
    animation: logoGlowPulse 2s ease-in-out infinite;
    z-index: 0;
}

.logo-image {
    position: relative;
    width: 72px;
    height: 72px;
    border-radius: 14px;
    z-index: 1;
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    animation: logoEnter 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s forwards;
}

.splash-title {
    font-family: 'Rubik', sans-serif;
    font-size: 2.4rem;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 24px;
    letter-spacing: -0.5px;
    opacity: 0;
    transform: translateY(15px);
    animation: fadeUp 0.5s ease-out 0.3s forwards;
}

.loading-bar {
    width: 180px;
    height: 3px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    overflow: hidden;
    opacity: 0;
    transform: translateY(10px);
    animation: fadeUp 0.5s ease-out 0.45s forwards;
}

.loading-progress {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #4a9eff, #6db3ff);
    border-radius: 10px;
    animation: loadProgress 1.4s cubic-bezier(0.4, 0, 0.2, 1) 0.6s forwards;
    box-shadow: 0 0 12px rgba(74, 158, 255, 0.5);
}

.splash-hint {
    font-family: 'Rubik', sans-serif;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.35);
    margin-top: 16px;
    letter-spacing: 0.3px;
    opacity: 0;
    animation: fadeUp 0.5s ease-out 0.6s forwards;
}

@keyframes auraPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    50% { transform: translate(-50%, -50%) scale(1.15); opacity: 0.6; }
}

@keyframes logoGlowPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    50% { transform: translate(-50%, -50%) scale(1.2); opacity: 0.5; }
}

@keyframes logoEnter {
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes fadeUp {
    to { opacity: 1; transform: translateY(0); }
}

@keyframes loadProgress {
    0% { width: 0%; }
    100% { width: 100%; }
}

/* Hide logos initially until splash animation completes */
.navbar-logo img,
.sidebar-logo .logo-img {
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Show logos after page load if no splash */
body:not(.splash-active) .navbar-logo img,
body:not(.splash-active) .sidebar-logo .logo-img {
    visibility: visible;
}

.flying-logo {
    pointer-events: none;
    object-fit: contain;
    box-shadow: 0 12px 40px rgba(255, 255, 255, 0.3);
    filter: drop-shadow(0 0 25px rgba(255, 255, 255, 0.5));
    will-change: transform, opacity, left, top, width, height, border-radius;
    border-radius: 14px; /* Ensure it starts rounded */
    overflow: hidden; /* Clip content to rounded corners */
    /* GPU acceleration for smooth animation */
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Hide the logo images when placeholder is active */
.navbar-logo img.logo-placeholder,
.sidebar-logo .logo-img.logo-placeholder {
    visibility: hidden !important;
}

/* Show the glowing white dotted outline on the parent container */
.navbar-logo.has-placeholder,
.sidebar-logo.has-placeholder {
    position: relative;
}

.navbar-logo.has-placeholder::before,
.sidebar-logo.has-placeholder::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 40px;
    height: 40px;
    border: 3px dashed rgba(255, 255, 255, 0.8);
    border-radius: 6px;
    background-color: rgba(255, 255, 255, 0.05);
    box-shadow: 
        inset 0 0 20px rgba(255, 255, 255, 0.2),
        0 0 20px rgba(255, 255, 255, 0.4),
        0 0 40px rgba(255, 255, 255, 0.2);
    animation: placeholderPulse 1.5s ease-in-out infinite;
    pointer-events: none;
    z-index: 1;
}

@keyframes placeholderPulse {
    0%, 100% { 
        border-color: rgba(255, 255, 255, 0.8);
        background-color: rgba(255, 255, 255, 0.05);
        box-shadow: 
            inset 0 0 20px rgba(255, 255, 255, 0.2),
            0 0 20px rgba(255, 255, 255, 0.4),
            0 0 40px rgba(255, 255, 255, 0.2);
    }
    50% { 
        border-color: rgba(255, 255, 255, 1);
        background-color: rgba(255, 255, 255, 0.1);
        box-shadow: 
            inset 0 0 25px rgba(255, 255, 255, 0.3),
            0 0 30px rgba(255, 255, 255, 0.6),
            0 0 50px rgba(255, 255, 255, 0.3);
    }
}

@media (max-width: 480px) {
    .splash-title { font-size: 2rem; }
    .logo-image { width: 60px; height: 60px; }
    .logo-glow { width: 100px; height: 100px; }
    .loading-bar { width: 150px; }
    .splash-hint { font-size: 0.75rem; }
}
