/**
 * Critical CSS - Must be loaded immediately to prevent FOUC
 * Contains only essential styles for loading screen and initial layout
 */

/* IMMEDIATE LOADING SCREEN - PREVENT ANY FLICKER */
html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family:
        -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: #ffffff;
    display: flex !important;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    transition: opacity 0.5s ease-in-out;
}

/* Hide loading screen when app is ready */
#loading-screen.loading-hidden {
    display: none !important;
}

.loading-screen__content {
    text-align: center;
    max-width: 400px;
    padding: 2rem;
}

.loading-screen__logo h1 {
    font-size: 2.5rem;
    margin: 0 0 1rem 0;
    color: #2563eb;
    font-weight: 600;
}

.loading-screen__message {
    font-size: 1rem;
    color: #64748b;
    margin-bottom: 2rem;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top: 3px solid #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Hide everything else initially - will be shown by JS */
#app {
    opacity: 0;
    display: none;
    /* Critical app layout when shown */
    flex-direction: column;
    height: 100vh;
    background-color: #ffffff;
}

/* Ensure no CSS conflicts */
#app.app-visible {
    display: flex !important;
}

/* Dark theme */
[data-theme='dark'] #loading-screen {
    background: #1f2937;
}

[data-theme='dark'] .loading-screen__logo h1 {
    color: #f9fafb;
}
