/* ==========================================================================
   ParkNow — Agency-Level PWA Install Card & iOS Guide Sheet
   ========================================================================== */

.pn-pwa-banner {
    position: fixed;
    left: 14px;
    right: 14px;
    bottom: calc(var(--app-bottom-nav-height, 68px) + env(safe-area-inset-bottom, 0px) + 12px);
    z-index: 1045;
    max-width: 420px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(22px) saturate(180%);
    -webkit-backdrop-filter: blur(22px) saturate(180%);
    border: 1px solid rgba(75, 63, 114, 0.14);
    border-radius: 22px;
    padding: 15px 15px 14px;
    box-shadow:
        0 20px 46px rgba(36, 37, 54, 0.16),
        0 4px 12px rgba(75, 63, 114, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    gap: 13px;
    opacity: 0;
    transform: translateY(28px) scale(0.96);
    pointer-events: none;
    transition:
        opacity 0.34s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.42s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.pn-pwa-banner::before {
    content: "";
    position: absolute;
    top: 0;
    left: 20px;
    right: 20px;
    height: 2px;
    border-radius: 0 0 999px 999px;
    background: linear-gradient(90deg, transparent, rgba(89, 70, 143, 0.45), rgba(22, 133, 103, 0.45), transparent);
    pointer-events: none;
}

.pn-pwa-banner.pn-no-bottom-nav {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
}

.pn-pwa-banner.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

@media (min-width: 768px) {
    .pn-pwa-banner {
        left: auto;
        right: 24px;
        bottom: 24px;
        margin: 0;
        width: 376px;
        max-width: calc(100vw - 48px);
        padding: 16px;
        border-radius: 22px;
    }

    .pn-pwa-banner.pn-no-bottom-nav {
        bottom: 24px;
    }
}

.pn-pwa-top {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.pn-pwa-icon {
    position: relative;
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    border-radius: 15px;
    background: linear-gradient(145deg, #FFFFFF 0%, #F3EFFA 100%);
    border: 1px solid rgba(75, 63, 114, 0.14);
    padding: 6px;
    box-shadow:
        0 8px 18px rgba(75, 63, 114, 0.14),
        inset 0 1px 0 rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pn-pwa-icon img {
    width: 100%;
    height: 100%;
    border-radius: 9px;
    object-fit: contain;
}

.pn-pwa-icon-dot {
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #168567;
    border: 2px solid #FFFFFF;
    box-shadow: 0 2px 6px rgba(22, 133, 103, 0.45);
}

.pn-pwa-body {
    flex: 1;
    min-width: 0;
    padding-top: 1px;
}

.pn-pwa-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.69rem;
    font-weight: 700;
    letter-spacing: 0.015em;
    color: #168567;
    background: rgba(22, 133, 103, 0.1);
    padding: 2px 8px;
    border-radius: 9999px;
    margin-bottom: 4px;
}

.pn-pwa-badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #168567;
    animation: pnPulseDot 2.2s ease-in-out infinite;
}

@keyframes pnPulseDot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.45; transform: scale(0.82); }
}

.pn-pwa-title {
    margin: 0;
    font-size: 0.98rem;
    font-weight: 800;
    color: #242536;
    line-height: 1.28;
    letter-spacing: -0.01em;
}

.pn-pwa-sub {
    margin: 3px 0 0;
    font-size: 0.8rem;
    font-weight: 500;
    color: #6B7280;
    line-height: 1.38;
}

.pn-pwa-close-btn {
    flex-shrink: 0;
    border: none;
    background: #F4F1FA;
    color: #5C5470;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-top: -2px;
    margin-right: -2px;
    transition: background-color 0.18s ease, color 0.18s ease, transform 0.15s ease;
}

.pn-pwa-close-btn:hover {
    background: #E8E1F5;
    color: #242536;
}

.pn-pwa-close-btn:active {
    transform: scale(0.9);
}

.pn-pwa-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pn-pwa-later-btn {
    flex: 0 0 auto;
    height: 41px;
    padding: 0 15px;
    border: 1px solid #E6E1F0;
    border-radius: 13px;
    background: #FAF9FC;
    color: #5C5470;
    font-size: 0.84rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.16s ease, color 0.16s ease, transform 0.15s ease;
}

.pn-pwa-later-btn:hover {
    background: #F0ECF8;
    color: #242536;
}

.pn-pwa-later-btn:active {
    transform: scale(0.97);
}

.pn-pwa-install-btn {
    position: relative;
    overflow: hidden;
    flex: 1;
    height: 41px;
    padding: 0 16px;
    border: none;
    outline: none;
    border-radius: 13px;
    background: linear-gradient(135deg, #4B3F72 0%, #59468F 55%, #6A53A8 100%);
    color: #FFFFFF;
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    white-space: nowrap;
    cursor: pointer;
    box-shadow:
        0 8px 20px rgba(75, 63, 114, 0.30),
        inset 0 1px 0 rgba(255, 255, 255, 0.22);
    transition: transform 0.16s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.pn-pwa-install-btn::after {
    content: "";
    position: absolute;
    top: 0;
    left: -120%;
    width: 60%;
    height: 100%;
    background: linear-gradient(105deg, transparent 20%, rgba(255, 255, 255, 0.28) 50%, transparent 80%);
    transform: skewX(-18deg);
    animation: pnButtonSheen 4.5s ease-in-out infinite;
    pointer-events: none;
}

@keyframes pnButtonSheen {
    0%, 62% { left: -120%; }
    88%, 100% { left: 160%; }
}

.pn-pwa-install-btn:hover {
    filter: brightness(1.06);
    box-shadow:
        0 10px 24px rgba(75, 63, 114, 0.38),
        inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.pn-pwa-install-btn:active {
    transform: scale(0.97);
}

@media (prefers-reduced-motion: reduce) {
    .pn-pwa-badge-dot,
    .pn-pwa-install-btn::after {
        animation: none;
    }
}

/* iOS Guided Install Bottom Sheet */
.pn-ios-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1060;
    background: rgba(36, 37, 54, 0.54);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.26s ease;
}

.pn-ios-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

.pn-ios-sheet {
    width: 100%;
    max-width: 440px;
    background: #FFFFFF;
    border-radius: 26px 26px 0 0;
    padding: 12px 20px calc(22px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -18px 46px rgba(36, 37, 54, 0.24);
    transform: translateY(100%);
    transition: transform 0.36s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (min-width: 640px) {
    .pn-ios-backdrop {
        align-items: center;
        padding: 20px;
    }

    .pn-ios-sheet {
        border-radius: 24px;
        padding: 22px 24px 24px;
        transform: translateY(20px) scale(0.96);
    }
}

.pn-ios-backdrop.is-open .pn-ios-sheet {
    transform: translateY(0) scale(1);
}

.pn-ios-handle {
    width: 40px;
    height: 4px;
    border-radius: 9999px;
    background: #DED8EB;
    margin: 0 auto 14px;
}

@media (min-width: 640px) {
    .pn-ios-handle {
        display: none;
    }
}

.pn-ios-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.pn-ios-header-text h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
    color: #242536;
}

.pn-ios-header-text p {
    margin: 3px 0 0;
    font-size: 0.82rem;
    color: #6B7280;
}

.pn-ios-steps {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 18px;
}

.pn-ios-step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 13px;
    border-radius: 15px;
    background: #FAF9FC;
    border: 1px solid #ECE8F4;
}

.pn-ios-step-num {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4B3F72, #59468F);
    color: #FFFFFF;
    font-size: 0.78rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}

.pn-ios-step-content {
    flex: 1;
    min-width: 0;
}

.pn-ios-step-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: #242536;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pn-ios-step-desc {
    margin: 3px 0 0;
    font-size: 0.79rem;
    color: #6B7280;
    line-height: 1.42;
}

.pn-ios-inline-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 7px;
    background: #F0ECF8;
    color: #4B3F72;
}

.pn-ios-done-btn {
    width: 100%;
    height: 46px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #4B3F72 0%, #59468F 100%);
    color: #FFFFFF;
    font-size: 0.94rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(75, 63, 114, 0.26);
    transition: transform 0.15s ease, filter 0.15s ease;
}

.pn-ios-done-btn:active {
    transform: scale(0.98);
}

/* Installed Confirmation Toast */
.pn-pwa-toast {
    position: fixed;
    left: 50%;
    bottom: calc(var(--app-bottom-nav-height, 68px) + env(safe-area-inset-bottom, 0px) + 18px);
    transform: translate(-50%, 20px);
    z-index: 1070;
    background: #168567;
    color: #FFFFFF;
    padding: 10px 18px;
    border-radius: 9999px;
    font-size: 0.86rem;
    font-weight: 700;
    box-shadow: 0 10px 26px rgba(22, 133, 103, 0.35);
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
    white-space: nowrap;
}

.pn-pwa-toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}
