/**
 * EstatixPMS - Progressive Web App (PWA) Stylesheet
 * Cross-browser UI components: Install Prompts, iOS Safari Guide, Offline/Online Status Badges
 */

/* Safe area padding for notch & dynamic island in standalone mode */
@supports (padding-top: env(safe-area-inset-top)) {
    body.pwa-standalone {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}

/* Offline / Online Network Status Toast */
#pwa-network-toast {
    position: fixed;
    bottom: 1.25rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    z-index: 99999;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
    opacity: 0;
    pointer-events: none;
    max-width: 90vw;
}

#pwa-network-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* Custom In-App Install Banner */
#pwa-install-banner {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 99990;
    max-width: 24rem;
    width: calc(100vw - 2.5rem);
    transform: translateY(120px);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
    pointer-events: none;
}

#pwa-install-banner.show {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* iOS Safari "Add to Home Screen" Guide Sheet */
#pwa-ios-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#pwa-ios-modal.show {
    opacity: 1;
    pointer-events: auto;
}

#pwa-ios-modal .pwa-ios-card {
    background: var(--fallback-b1,oklch(var(--b1)/1));
    border-top-left-radius: 1.5rem;
    border-top-right-radius: 1.5rem;
    padding: 1.75rem 1.5rem calc(1.75rem + env(safe-area-inset-bottom, 0px)) 1.5rem;
    width: 100%;
    max-width: 28rem;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.25);
}

#pwa-ios-modal.show .pwa-ios-card {
    transform: translateY(0);
}

/* Subtle pulse for PWA install button in navbar */
.pwa-pulse-dot {
    animation: pwaPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pwaPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.4;
    }
}
