/*
 * Connection notification (C5): "You're offline" / "You're back online".
 * Template look (the offline-message / online-message bars of the AppKit template), moved to the bottom of the screen so it never covers the header buttons.
 * Page-independent: linked from partials/pwa.blade.php, so both AppKit layouts (customer pages and sign-in pages) get it.
 * The markup is a <template> in that partial; pwa.js clones it into the body and toggles .is-shown. Nothing here is visible until then.
 *
 * Colours: the template's red and green hues, darkened only as far as needed for white text and icon at 4.5:1 or better
 * (Tests\Unit\Appkit\ConnectionBarContrastTest reads these four tokens). These are the only colour literals of the feature.
 */
:root {
    --rm-conn-offline: #CC3344;   /* template red #DA4453 darkened */
    --rm-conn-online: #3F7E1E;    /* template green #8CC152 darkened */
    --rm-conn-text: #FFFFFF;
    /* C6 slow-connection note: neutral, like the dashboard toast (dark bar on a light page, light bar on a dark page) */
    --rm-conn-slow: #374151;
    --rm-conn-slow-text: #FFFFFF;
    --rm-conn-slow-close: #D1D5DB;
}
.theme-dark {
    --rm-conn-offline: #B92B3B;
    --rm-conn-online: #35701A;
    --rm-conn-slow: #E5E7EB;
    --rm-conn-slow-text: #111827;
    --rm-conn-slow-close: #4B5563;
}

.rm-conn {
    position: fixed; left: 0; right: 0; z-index: 130; display: flex; justify-content: center; pointer-events: none;
    padding: 0 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));   /* sign-in pages: no bottom nav */
}
/* Customer pages (they have the bottom nav): above the nav and above the floating What's new bell (48px tall, 16px above the nav) */
body:has(#footer-bar) .rm-conn { bottom: calc(var(--footer-h, 61px) + 16px + 48px + 12px + env(safe-area-inset-bottom, 0px)); }

.rm-conn__bar {
    display: none; align-items: center; justify-content: center; gap: 10px;
    box-sizing: border-box; width: 100%; max-width: calc(var(--col, 520px) - 2 * var(--pad, 16px)); padding: 12px 18px;
    border-radius: 14px; color: var(--rm-conn-text); font-size: 14px; font-weight: 600; line-height: 1.3; text-align: center;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
}
.rm-conn__bar i { color: inherit; font-size: 15px; flex: 0 0 auto; }
.rm-conn__bar--offline { background-color: var(--rm-conn-offline); }
.rm-conn__bar--online { background-color: var(--rm-conn-online); }
.rm-conn__bar--slow { background-color: var(--rm-conn-slow); color: var(--rm-conn-slow-text); pointer-events: auto; }
.rm-conn__bar--slow span { text-align: start; }
.rm-conn__close {
    flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px;
    margin: -12px -14px -12px 0; padding: 0; border: 0; border-radius: 12px; background: transparent; color: var(--rm-conn-slow-close); cursor: pointer;
}
.rm-conn__close i { color: inherit; font-size: 16px; }
.rm-conn__close:focus-visible { outline: 2px solid var(--rm-conn-slow-close); outline-offset: -2px; }
.rm-conn__bar.is-shown { display: flex; }

/* Slide and fade in: transform and opacity only. Reduced motion = plain show and hide. */
@media (prefers-reduced-motion: no-preference) {
    .rm-conn__bar.is-shown { animation: rm-conn-in 300ms cubic-bezier(0.2, 0.8, 0.2, 1) both; }
}
@keyframes rm-conn-in {
    from { transform: translateY(24px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
