/* HART-CRS online-only PWA connection and installation UI. */

.service-offline-overlay {
    position: fixed;
    inset: 0;
    z-index: 30000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: rgba(2, 14, 60, .86);
    backdrop-filter: blur(10px);
}

.service-offline-overlay.is-visible {
    display: flex;
}

body.service-offline-active {
    overflow: hidden !important;
}

.service-offline-card {
    width: min(520px, 100%);
    padding: clamp(1.6rem, 5vw, 2.4rem);
    text-align: center;
    background: var(--bs-body-bg, #fff);
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 24px;
    box-shadow: 0 32px 80px rgba(0, 0, 0, .35);
}

.service-offline-icon {
    width: 72px;
    height: 72px;
    display: grid;
    place-items: center;
    margin: 0 auto 1rem;
    color: #05228b;
    background: #eef3ff;
    border-radius: 20px;
    font-size: 2rem;
}

.service-offline-card h2 {
    margin: 0;
    color: var(--bs-heading-color, #020e3c);
    font-size: clamp(1.7rem, 5vw, 2.35rem);
    font-weight: 900;
    letter-spacing: -.035em;
}

.service-offline-card p {
    margin: .8rem auto 0;
    color: var(--bs-secondary-color, #667085);
    font-size: .95rem;
    line-height: 1.7;
}

.service-offline-status {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    margin-top: 1rem;
    padding: .42rem .75rem;
    color: #b42318;
    background: #fff1f0;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 900;
}

.service-offline-status-dot {
    width: 8px;
    height: 8px;
    background: #d92d20;
    border-radius: 50%;
}

.service-offline-actions {
    display: grid;
    gap: .65rem;
    margin-top: 1.35rem;
}

.service-offline-retry {
    min-height: 50px;
    color: #fff;
    background: #05228b;
    border: 0;
    border-radius: 13px;
    font-weight: 900;
}

.service-offline-retry:hover,
.service-offline-retry:focus {
    color: #fff;
    background: #020e3c;
}

.service-offline-footnote {
    margin-top: .85rem !important;
    color: #98a2b3 !important;
    font-size: .72rem !important;
}

.pwa-install-item .dropdown-item {
    cursor: pointer;
}

.pwa-install-item .dropdown-item i {
    color: #05228b;
}

/* =========================================================
   Homepage install prompt
   - Homepage only
   - Bottom dismissible alert-bar style
   - Dismissal stored only in sessionStorage
   ========================================================= */

.pwa-home-install-bar[hidden] {
    display: none !important;
}

.pwa-home-install-bar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 22000;
    padding: 0 .9rem calc(.9rem + env(safe-area-inset-bottom));
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
    transition:
        opacity .22s ease,
        transform .22s ease;
}

.pwa-home-install-bar.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.pwa-home-install-bar.is-hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(110%);
}

.pwa-home-install-shell {
    width: min(1180px, 100%);
    margin: 0 auto;
    overflow: hidden;
    color: #fff;
    background: #056b17;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 18px;
    box-shadow: 0 22px 60px rgba(2, 14, 60, .34);
    backdrop-filter: blur(16px);
}

.pwa-home-install-main {
    min-height: 86px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    padding: .9rem 1rem;
}

.pwa-home-install-brand {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: .9rem;
}

.pwa-home-install-icon {
    width: 52px;
    height: 52px;
    display: grid;
    flex: 0 0 52px;
    place-items: center;
    overflow: hidden;
    padding: .2rem;
    background: #fff;
    border-radius: 14px;
    box-shadow:
        0 10px 24px rgba(0, 0, 0, .2);
}

.pwa-home-install-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.pwa-home-install-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.pwa-home-install-copy strong {
    color: #fff;
    font-size: .92rem;
    font-weight: 900;
}

.pwa-home-install-copy span {
    margin-top: .2rem;
    color: rgba(255, 255, 255, .68);
    font-size: .72rem;
    line-height: 1.45;
}

.pwa-home-install-actions {
    display: flex;
    align-items: center;
    gap: .55rem;
}

.pwa-home-about-button,
.pwa-home-install-button {
    min-height: 42px;
    padding: .58rem .85rem;
    border-radius: 11px;
    font-size: .75rem;
    font-weight: 900;
    white-space: nowrap;
}

.pwa-home-about-button {
    color: #fff;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .2);
}

.pwa-home-about-button:hover,
.pwa-home-about-button:focus {
    color: #fff;
    background: rgba(255, 255, 255, .14);
    border-color: rgba(255, 255, 255, .28);
}

.pwa-home-install-button {
    color: #05228b;
    background: #fff;
    border: 1px solid #fff;
    box-shadow:
        0 10px 22px rgba(0, 0, 0, .17);
}

.pwa-home-install-button:hover,
.pwa-home-install-button:focus {
    color: #020e3c;
    background: #f3f6ff;
    border-color: #f3f6ff;
}

.pwa-home-install-dismiss {
    width: 38px;
    height: 38px;
    display: grid;
    flex: 0 0 38px;
    place-items: center;
    color: rgba(255, 255, 255, .76);
    background: transparent;
    border: 0;
    border-radius: 10px;
}

.pwa-home-install-dismiss:hover,
.pwa-home-install-dismiss:focus {
    color: #fff;
    background: rgba(255, 255, 255, .1);
}

.pwa-home-install-details {
    padding: 1rem;
    background: rgba(0, 0, 0, .12);
    border-top:
        1px solid rgba(255, 255, 255, .11);
}

.pwa-home-install-details[hidden] {
    display: none !important;
}

.pwa-home-install-detail-grid {
    display: grid;
    grid-template-columns:
        repeat(3, minmax(0, 1fr));
    gap: .8rem;
}

.pwa-home-install-detail-grid > div {
    min-height: 122px;
    padding: .85rem;
    background: rgba(255, 255, 255, .07);
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 13px;
}

.pwa-home-install-detail-icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    margin-bottom: .65rem;
    color: #fff;
    background: rgba(255, 255, 255, .1);
    border-radius: 10px;
}

.pwa-home-install-detail-grid strong {
    display: block;
    color: #fff;
    font-size: .76rem;
    font-weight: 900;
}

.pwa-home-install-detail-grid p {
    margin: .3rem 0 0;
    color: rgba(255, 255, 255, .62);
    font-size: .66rem;
    line-height: 1.55;
}

.pwa-home-install-help {
    display: flex;
    align-items: flex-start;
    gap: .55rem;
    margin-top: .8rem;
    padding: .72rem .8rem;
    color: #fff;
    background: rgba(255, 255, 255, .09);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 11px;
    font-size: .7rem;
    line-height: 1.5;
}

.pwa-home-install-help[hidden] {
    display: none !important;
}

.pwa-home-install-help i {
    margin-top: .08rem;
    color: #ffd166;
}

body.pwa-home-install-active {
    padding-bottom:
        calc(112px + env(safe-area-inset-bottom));
}

body.pwa-home-install-expanded {
    padding-bottom:
        calc(285px + env(safe-area-inset-bottom));
}

/*
 * The offline overlay must always remain above the install prompt.
 */
.service-offline-overlay {
    z-index: 30000;
}

@media (max-width: 767.98px) {
    .pwa-home-install-bar {
        padding:
            0 .55rem
            calc(.55rem + env(safe-area-inset-bottom));
    }

    .pwa-home-install-shell {
        border-radius: 15px;
    }

    .pwa-home-install-main {
        align-items: flex-start;
        flex-direction: column;
        gap: .75rem;
        padding: .8rem;
    }

    .pwa-home-install-brand {
        width: 100%;
        padding-right: 2.8rem;
    }

    .pwa-home-install-actions {
        width: 100%;
    }

    .pwa-home-about-button,
    .pwa-home-install-button {
        flex: 1;
    }

    .pwa-home-install-dismiss {
        position: absolute;
        top: .7rem;
        right: .7rem;
    }

    .pwa-home-install-detail-grid {
        grid-template-columns: 1fr;
    }

    .pwa-home-install-detail-grid > div {
        min-height: auto;
    }

    body.pwa-home-install-active {
        padding-bottom:
            calc(154px + env(safe-area-inset-bottom));
    }

    body.pwa-home-install-expanded {
        padding-bottom:
            calc(470px + env(safe-area-inset-bottom));
    }
}

@media (max-width: 479.98px) {
    .pwa-home-install-icon {
        width: 46px;
        height: 46px;
        flex-basis: 46px;
    }

    .pwa-home-install-copy strong {
        font-size: .82rem;
    }

    .pwa-home-install-copy span {
        font-size: .66rem;
    }

    .pwa-home-install-actions {
        flex-wrap: wrap;
    }

    .pwa-home-about-button,
    .pwa-home-install-button {
        min-width: calc(50% - .3rem);
    }
}

@media (prefers-reduced-motion: reduce) {
    .pwa-home-install-bar {
        transition: none;
    }
}



/*
 * Homepage markup starts visible by design. This fallback gives the page
 * enough bottom breathing room even before pwa.js executes.
 */
body:has(.pwa-home-install-bar:not([hidden])) {
    padding-bottom:
        calc(112px + env(safe-area-inset-bottom));
}

@media (max-width: 767.98px) {
    body:has(.pwa-home-install-bar:not([hidden])) {
        padding-bottom:
            calc(154px + env(safe-area-inset-bottom));
    }
}
