/**
 * Therapy POS + Customer Menu — PWA splash, install banner, offline helpers.
 */

.pwa-splash {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-height: 100vh;
    min-height: 100dvh;
    padding:
        calc(1.25rem + env(safe-area-inset-top, 0px))
        calc(1.25rem + env(safe-area-inset-right, 0px))
        calc(1.25rem + env(safe-area-inset-bottom, 0px))
        calc(1.25rem + env(safe-area-inset-left, 0px));
    background: #111111;
    color: #f2ebe3;
    overflow: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.pwa-splash.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.pwa-splash__inner {
    box-sizing: border-box;
    width: min(100%, 20rem);
    max-width: 100%;
    text-align: center;
    padding: clamp(1rem, 4vw, 2rem);
    animation: pwaSplashFade 0.65s ease;
}

.pwa-splash__logo {
    display: block;
    width: min(96px, 22vw);
    height: auto;
    max-width: 100%;
    aspect-ratio: 1;
    margin: 0 auto clamp(0.85rem, 3vw, 1.25rem);
    border-radius: 18%;
    object-fit: contain;
    box-shadow: 0 8px 32px rgba(122, 31, 31, 0.35);
}

.pwa-splash__title {
    margin: 0 0 0.35rem;
    font-size: clamp(1.15rem, 4.5vw, 1.5rem);
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.25;
    word-wrap: break-word;
}

.pwa-splash__subtitle {
    margin: 0;
    font-size: clamp(0.85rem, 3.2vw, 0.95rem);
    line-height: 1.45;
    opacity: 0.8;
    animation: pwaSubtitlePulse 1.6s ease-in-out infinite;
    padding-inline: 0.25rem;
}

@keyframes pwaSplashFade {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pwaSubtitlePulse {
    0%, 100% { opacity: 0.55; }
    50% { opacity: 1; }
}

@media (max-width: 380px) {
    .pwa-splash__inner {
        padding: 1rem 0.75rem;
    }
}

@media (max-height: 500px) and (orientation: landscape) {
    .pwa-splash {
        align-items: flex-start;
        padding-top: calc(0.75rem + env(safe-area-inset-top, 0px));
    }

    .pwa-splash__logo {
        width: min(64px, 14vh);
        margin-bottom: 0.5rem;
    }

    .pwa-splash__title {
        font-size: 1rem;
    }

    .pwa-splash__subtitle {
        font-size: 0.8rem;
    }
}

.pwa-install-banner {
    position: fixed;
    left: 50%;
    bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    z-index: 9998;
    width: min(92vw, 24rem);
    padding: 1rem 1.1rem;
    border-radius: 14px;
    background: rgba(26, 21, 19, 0.96);
    border: 1px solid rgba(190, 58, 74, 0.35);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    color: #f2ebe3;
}

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

.pwa-install-banner__text {
    margin: 0 0 0.75rem;
    font-size: 0.95rem;
    line-height: 1.4;
}

.pwa-install-banner__actions {
    display: flex;
    gap: 0.5rem;
}

.pwa-install-banner__btn {
    flex: 1;
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    border: 1px solid rgba(242, 235, 227, 0.25);
    background: transparent;
    color: inherit;
    font-size: 0.9rem;
    cursor: pointer;
}

.pwa-install-banner__btn--primary {
    background: #7a1f1f;
    border-color: #7a1f1f;
    color: #fff;
    font-weight: 600;
}

.pwa-offline-badge {
    position: fixed;
    top: calc(0.5rem + env(safe-area-inset-top, 0px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 9997;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: rgba(190, 58, 74, 0.92);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.pwa-offline-badge[hidden] {
    display: none !important;
}

@media (display-mode: standalone) {
    body.pwa-standalone .pwa-install-banner {
        display: none !important;
    }
}
