/* =============================================================================
 * Autofand PWA install prompt
 * --------------------------------------------------------------------------- */

#pwaInstallBanner,
#pwaIosSheet {
    position: fixed;
    z-index: 99990;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Plus Jakarta Sans', sans-serif;
    color: #1e293b;
}

/* -------- Bottom banner (Android / Desktop Chrome) --------------------- */
#pwaInstallBanner {
    left: 16px;
    right: 16px;
    bottom: 16px;
    max-width: 460px;
    margin-inline: auto;
    background: #ffffff;
    border-radius: 18px;
    padding: 14px 14px 14px 16px;
    box-shadow: 0 14px 40px rgba(15, 23, 42, 0.20), 0 2px 6px rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(15, 23, 42, 0.06);
    display: none;
    align-items: center;
    gap: 12px;
    transform: translateY(140%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
    opacity: 0;
}
#pwaInstallBanner.is-visible {
    display: flex;
    transform: translateY(0);
    opacity: 1;
}
#pwaInstallBanner .pwa-icon {
    width: 44px;
    height: 44px;
    border-radius: 11px;
    flex: 0 0 44px;
    background: linear-gradient(135deg, var(--pwa-primary, #059669) 0%, var(--pwa-primary-end, #10b981) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12);
}
#pwaInstallBanner .pwa-icon img {
    width: 100%;
    height: 100%;
    border-radius: inherit;
    object-fit: cover;
}
#pwaInstallBanner .pwa-text {
    flex: 1 1 auto;
    min-width: 0;
}
#pwaInstallBanner .pwa-title {
    font-weight: 600;
    font-size: 14.5px;
    margin: 0 0 2px 0;
    line-height: 1.25;
}
#pwaInstallBanner .pwa-sub {
    font-size: 12px;
    color: #64748b;
    line-height: 1.35;
}
#pwaInstallBanner .pwa-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}
#pwaInstallBanner button {
    border: 0;
    border-radius: 100px;
    padding: 9px 16px;
    font-weight: 600;
    font-size: 13.5px;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.2s ease;
    font-family: inherit;
}
#pwaInstallBanner button:active { transform: scale(0.96); }
#pwaInstallBanner .pwa-install-btn {
    background: var(--pwa-primary, #059669);
    color: #fff;
}
#pwaInstallBanner .pwa-install-btn:hover { filter: brightness(1.05); }
#pwaInstallBanner .pwa-dismiss-btn {
    background: transparent;
    color: #94a3b8;
    padding: 6px 8px;
    font-size: 18px;
    line-height: 1;
}
#pwaInstallBanner .pwa-dismiss-btn:hover { color: #475569; }

/* -------- iOS Safari bottom sheet ------------------------------------- */
#pwaIosSheet {
    left: 0;
    right: 0;
    bottom: 0;
    background: #ffffff;
    border-radius: 18px 18px 0 0;
    padding: 18px 20px max(22px, env(safe-area-inset-bottom)) 20px;
    box-shadow: 0 -10px 30px rgba(15, 23, 42, 0.18);
    display: none;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
#pwaIosSheet.is-visible {
    display: block;
    transform: translateY(0);
}
#pwaIosSheet .pwa-ios-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}
#pwaIosSheet .pwa-ios-header .pwa-icon {
    width: 46px;
    height: 46px;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--pwa-primary, #059669) 0%, var(--pwa-primary-end, #10b981) 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}
#pwaIosSheet .pwa-ios-header .pwa-icon img {
    width: 100%;
    height: 100%;
    border-radius: inherit;
    object-fit: cover;
}
#pwaIosSheet .pwa-ios-header h3 {
    font-size: 16px;
    margin: 0;
    font-weight: 600;
}
#pwaIosSheet .pwa-ios-header p {
    margin: 2px 0 0;
    font-size: 12.5px;
    color: #64748b;
}
#pwaIosSheet .pwa-ios-step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    border-top: 1px solid #f1f5f9;
    font-size: 14px;
    color: #334155;
    line-height: 1.45;
}
#pwaIosSheet .pwa-ios-step:first-of-type { border-top: 0; }
#pwaIosSheet .pwa-ios-step .num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--pwa-primary, #059669);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 24px;
    margin-top: 1px;
}
#pwaIosSheet .pwa-ios-step .ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ecfdf5;
    color: var(--pwa-primary, #059669);
    border-radius: 6px;
    padding: 2px 6px;
    margin: 0 2px;
    font-size: 13px;
}
#pwaIosSheet .pwa-ios-close {
    margin-top: 14px;
    width: 100%;
    background: var(--pwa-primary, #059669);
    color: #fff;
    border: 0;
    border-radius: 12px;
    padding: 12px;
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
#pwaIosSheet .pwa-ios-close:active { transform: scale(0.99); }

/* -------- "Install app" header chip (manual trigger) ----------------- */
.pwa-install-chip {
    display: none;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    padding: 6px 12px;
    border-radius: 100px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.35);
    transition: background 0.2s ease;
}
.pwa-install-chip:hover { background: rgba(255, 255, 255, 0.28); }
.pwa-install-chip.is-available { display: inline-flex; }

@media (max-width: 380px) {
    #pwaInstallBanner .pwa-sub { display: none; }
    #pwaInstallBanner .pwa-install-btn { padding: 9px 14px; }
}

/* Don't show the banner when running standalone — the user already installed. */
@media all and (display-mode: standalone) {
    #pwaInstallBanner, #pwaIosSheet, .pwa-install-chip { display: none !important; }
}
