/* ====== TOAST ====== */
.toast-container {
    position: fixed;
    /* Clears the bottom nav, which the Android app lifts by the gesture-bar inset (0 on the web). */
    bottom: calc(90px + var(--safe-area-bottom-fixed));
    left: 50%;
    transform: translateX(-50%) translateY(60px);
    background: var(--toast-bg);
    color: #fff;
    padding: 12px 22px;
    border-radius: 12px;
    font-size: 13.5px;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    z-index: var(--z-system);
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-width: calc(100vw - 32px);
    text-align: center;
    pointer-events: none;
}

.toast-container.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ====== BLAZOR ERROR UI ======
   The error sheet (BlazorErrorUi.razor). The element itself is the scrim over the whole page,
   because nothing on the page answers a tap any more; the runtime shows it with display:block.
   The sheet inside takes AppSheet's look (AppSheet.razor.css), written out here because that
   stylesheet is scoped to the component and this markup is plain HTML: a bottom sheet on a
   phone, a centred card from 600px. No entrance animation: it appears at the moment of the
   error, and a slide would only delay the one thing left to do. */
#blazor-error-ui {
    display: none;
    position: fixed;
    inset: 0;
    background: color-mix(in srgb, var(--bg-page) 30%, transparent);
    /* The same layer as the reconnect modal (reconnect.css): both say the page is gone.
       At the template's 1000 the bar sat UNDER an open sheet's backdrop (9200), so a crash
       with a sheet open left "Muat ulang" visible but unclickable (seen 2026-10-26). */
    z-index: var(--z-system);
}

/* The page behind is blurred the way it is behind an AppSheet (AppShell.razor.css, which keys
   on the sheet's scrim), and its animations stop so the blur stays a cached picture. The runtime
   shows this element with an inline display:block, which is what the selector reads. */
body:has(#blazor-error-ui[style*='block']) .app-blur-target {
    filter: blur(4px) saturate(1.1);
}
body:has(#blazor-error-ui[style*='block']) .app-blur-target *,
body:has(#blazor-error-ui[style*='block']) .app-blur-target *::before,
body:has(#blazor-error-ui[style*='block']) .app-blur-target *::after {
    animation-play-state: paused !important;
}

#blazor-error-ui .beu-sheet {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0 auto;
    max-width: 500px;
    box-sizing: border-box;
    background: var(--bg-white);
    color: var(--text-primary);
    border-radius: 20px 20px 0 0;
    padding: 20px 16px calc(16px + var(--safe-area-bottom-fixed, 0px));
    box-shadow:
        0 -2px 4px rgba(13, 33, 55, 0.1),
        0 -4px 8px rgba(13, 33, 55, 0.08),
        0 -8px 16px rgba(13, 33, 55, 0.06);
}

#blazor-error-ui .beu-title {
    margin: 0 0 8px;
    font-size: 17px;
    font-weight: 800;
}

#blazor-error-ui .beu-text {
    margin: 0 0 8px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-secondary);
}

#blazor-error-ui .beu-note {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin: 4px 0 0;
    padding: 12px 14px;
    resize: none;
    font: inherit;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--field-fill, var(--bg-white));
    border: 1.5px solid var(--field-border-color, var(--border));
    border-radius: var(--field-radius-block, var(--radius-sm));
    outline: none;
}

#blazor-error-ui .beu-note:focus {
    border-color: var(--field-focus-border-color, var(--blue-primary));
    box-shadow: var(--field-focus-shadow, 0 0 0 3px rgba(21, 101, 192, 0.1));
}

#blazor-error-ui .beu-note::placeholder {
    color: var(--text-muted);
}

#blazor-error-ui .beu-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

#blazor-error-ui .beu-actions .btn {
    flex: 1;
    min-height: 42px;
    justify-content: center;
    text-decoration: none;
}

/* The dev-only link to the /dev console, in the DEV badge's own monospace so it reads as
   dev chrome and not as part of the message. */
#blazor-error-ui .dev {
    display: inline-block;
    margin-top: 12px;
    font-family: ui-monospace, Consolas, monospace;
    font-weight: 600;
    letter-spacing: 0.04em;
}

@media (min-width: 600px) {
    #blazor-error-ui .beu-sheet {
        top: 50%;
        bottom: auto;
        left: 50%;
        right: auto;
        width: 100%;
        margin: 0;
        transform: translate(-50%, -50%);
        border-radius: 16px;
        padding-bottom: 16px;
        box-shadow:
            0 10px 25px rgba(13, 33, 55, 0.18),
            0 20px 50px rgba(13, 33, 55, 0.14);
    }
}

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: white;
}

.blazor-error-boundary::after {
    content: 'An error has occurred.';
}

/* ====== PULL TO REFRESH ====== */
.ptr-indicator {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%) translateY(-40px);
    z-index: 99999;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-white);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s;
}

.ptr-spinner {
    width: 22px;
    height: 22px;
    border: 2.5px solid var(--blue-pale);
    border-top-color: var(--blue-primary);
    border-radius: 50%;
    transition: transform 0.05s linear;
}

.ptr-ready .ptr-spinner {
    border-top-color: #43a047;
}

.ptr-loading {
    opacity: 1 !important;
}

.ptr-loading .ptr-spinner {
    animation: spin 0.6s linear infinite;
    border-top-color: var(--blue-primary);
}
