html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

/* Startup loading screen (index.html) -- mirrors LoginBanner in LoginScreen.kt. */
#compose-root {
    width: 100%;
    height: 100%;
}

/* Overlays #compose-root until the app's first frame is drawn. */
#app-loading {
    position: fixed;
    inset: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: #FFFFFF; /* AppTheme background */
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.app-loading-banner {
    position: relative;
    flex: 0 0 250px; /* same height as LoginBanner */
    background: url("loading_background.jpg") center / cover no-repeat;
}

/* Flat white veil at alpha 160/255, same as LoginBanner / Android atkConnectWelcomeView. */
.app-loading-banner::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.627);
}

.app-loading-banner-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 32px;
}

.app-loading-logo {
    height: 90px;
}

.app-loading-phrase {
    margin: 0;
    position: relative;
    top: -35px;
    left: 10px;
    padding-left: 50px;
    font-size: 16px;
    font-style: italic;
    color: #1C1B1F;
}

/* The login form (LoginScreen.kt) is top-aligned under the banner: place the progress area where
   the form is about to appear rather than in the middle of the remaining space. */
.app-loading-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 110px 16px 0;
    color: #1C1B1F;
    font-size: 14px;
    text-align: center;
}

.app-loading-body p {
    margin: 0;
}

[hidden] {
    display: none !important;
}

/* Linear progress indicator in the app accent color (teal #009688, AppTheme primary). */
.app-loading-bar {
    position: relative;
    width: 240px;
    max-width: 100%;
    height: 4px;
    border-radius: 2px;
    overflow: hidden;
    background: rgba(0, 150, 136, 0.2);
}

.app-loading-bar-fill {
    height: 100%;
    width: 0;
    border-radius: 2px;
    background: #009688;
    transition: width 0.2s linear;
}

.app-loading-bar.indeterminate .app-loading-bar-fill {
    position: absolute;
    width: 40%;
    transition: none;
    animation: app-loading-slide 1.2s ease-in-out infinite;
}

@keyframes app-loading-slide {
    from { left: -40%; }
    to { left: 100%; }
}

.app-loading-status {
    margin-top: 12px !important;
    color: #49454F;
}

.app-loading-stall {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: #49454F;
}

.app-loading-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    max-width: 420px;
}

.app-loading-error-title {
    font-size: 18px;
    font-weight: 500;
    color: #B3261E;
}

.app-loading-error-message {
    color: #49454F;
    line-height: 1.4;
}

/* Filled button, Material 3 style. */
.app-loading-button {
    margin-top: 4px;
    padding: 10px 24px;
    border: none;
    border-radius: 20px;
    background: #009688;
    color: #FFFFFF;
    font: inherit;
    font-weight: 500;
    cursor: pointer;
}

.app-loading-button:hover {
    background: #00897B;
}

.app-loading-error details {
    align-self: stretch;
    text-align: left;
    color: #49454F;
}

.app-loading-error summary {
    cursor: pointer;
    text-align: center;
}

.app-loading-error pre {
    margin: 8px 0 0;
    padding: 8px;
    max-height: 160px;
    overflow: auto;
    font-size: 12px;
    white-space: pre-wrap;
    word-break: break-word;
    background: #F3F3F3;
    border-radius: 4px;
}
