/* ===================================================
   PWA WF – Floating Install Button (FAB)
   =================================================== */

#pwa-wf-fab {
    position: fixed;
    z-index: 99999;
    display: none; /* shown via JS when prompt available */
    align-items: center;
    gap: 10px;
    background: #1976D2;
    color: #ffffff;
    padding: 12px 20px 12px 14px;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 6px 24px rgba(25, 118, 210, 0.45);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.2px;
    transition:
        transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow 0.25s ease,
        opacity 0.3s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    overflow: hidden;
    animation: pwa-fab-enter 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes pwa-fab-enter {
    from {
        opacity: 0;
        transform: scale(0.6) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

#pwa-wf-fab:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 12px 36px rgba(25, 118, 210, 0.55);
}

#pwa-wf-fab:active {
    transform: scale(0.97);
}

/* Icon */
.pwa-wf-fab-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    flex-shrink: 0;
}

.pwa-wf-fab-icon svg,
.pwa-wf-fab-ps-icon {
    width: 22px;
    height: 22px;
    fill: #ffffff;
    display: block;
}

.pwa-fab-custom-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    border-radius: 4px;
}

/* Label */
.pwa-wf-fab-label {
    white-space: nowrap;
    line-height: 1;
}

/* Ripple */
.pwa-wf-fab-ripple {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
    opacity: 0;
    transform: scale(0);
    transition: transform 0.5s ease, opacity 0.5s ease;
    pointer-events: none;
}

#pwa-wf-fab:active .pwa-wf-fab-ripple {
    opacity: 1;
    transform: scale(2);
    transition: none;
}

/* Hide when dismissed */
#pwa-wf-fab.pwa-fab-dismissed {
    animation: pwa-fab-exit 0.3s ease forwards;
}

@keyframes pwa-fab-exit {
    to {
        opacity: 0;
        transform: scale(0.7) translateY(10px);
    }
}

/* Responsive – smaller on mobile */
@media (max-width: 480px) {
    #pwa-wf-fab {
        font-size: 13px;
        padding: 10px 16px 10px 12px;
        gap: 8px;
    }
    .pwa-wf-fab-icon {
        width: 22px;
        height: 22px;
    }
    .pwa-wf-fab-ps-icon {
        width: 18px;
        height: 18px;
    }
}

/* =====================
   FAB TOOLTIP
   ===================== */
#pwa-wf-fab-tooltip {
    position: fixed;
    z-index: 100000;
    max-width: 280px;
    background: #1a2332;
    color: #fff;
    border-radius: 12px;
    padding: 16px 18px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 13px;
    line-height: 1.6;
    box-shadow: 0 8px 32px rgba(0,0,0,.35);
    opacity: 0;
    transform: translateY(8px) scale(.97);
    transition: opacity .25s ease, transform .25s ease;
    pointer-events: none;
}
#pwa-wf-fab-tooltip.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}
#pwa-wf-fab-tooltip strong {
    display: block;
    font-size: 14px;
    margin-bottom: 8px;
    color: #fff;
}
#pwa-wf-fab-tooltip ol {
    margin: 0;
    padding-left: 18px;
}
#pwa-wf-fab-tooltip ol li {
    margin-bottom: 5px;
}
#pwa-wf-fab-tooltip p {
    margin: 0;
    color: rgba(255,255,255,.85);
}
/* Arrow – default: tooltip is ABOVE the FAB, arrow points DOWN */
#pwa-wf-fab-tooltip::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 20px;
    border: 8px solid transparent;
    border-bottom: none;
    border-top-color: #1a2332;
}
/* Arrow – .arrow-up: tooltip is BELOW the FAB, arrow points UP */
#pwa-wf-fab-tooltip.arrow-up::after {
    bottom: auto;
    top: -8px;
    border-top: none;
    border-bottom: 8px solid #1a2332;
}
/* Warning variant for ios-other mode */
#pwa-wf-fab-tooltip.pwa-wf-tooltip-warn {
    background: #1e1209;
    border: 1px solid rgba(255, 160, 0, 0.4);
}
#pwa-wf-fab-tooltip.pwa-wf-tooltip-warn::after {
    border-top-color: #1e1209;
}
#pwa-wf-fab-tooltip.pwa-wf-tooltip-warn.arrow-up::after {
    border-top-color: transparent;
    border-bottom-color: #1e1209;
}

/* ── Push opt-in banner ──────────────────────────────────────── */
.pwa-wf-push-banner {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 99999;
    background: #fff;
    border-top: 3px solid #1976D2;
    box-shadow: 0 -4px 24px rgba(0,0,0,.15);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    transform: translateY(100%);
    transition: transform .35s cubic-bezier(.4,0,.2,1);
    font-family: inherit;
}
.pwa-wf-push-banner-visible { transform: translateY(0); }

.pwa-wf-push-banner-icon { font-size: 28px; flex-shrink: 0; }

.pwa-wf-push-banner-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.pwa-wf-push-banner-text strong { font-size: 15px; color: #111; }
.pwa-wf-push-banner-text span   { font-size: 13px; color: #555; }

.pwa-wf-push-banner-actions { display: flex; gap: 8px; flex-shrink: 0; flex-wrap: wrap; }

.pwa-wf-push-btn-allow {
    background: #1976D2; color: #fff;
    border: none; border-radius: 8px;
    padding: 10px 20px; font-size: 14px; font-weight: 600;
    cursor: pointer; transition: background .2s;
}
.pwa-wf-push-btn-allow:hover { background: #1557a8; }

.pwa-wf-push-btn-dismiss {
    background: transparent; color: #666;
    border: 1px solid #ddd; border-radius: 8px;
    padding: 10px 16px; font-size: 14px;
    cursor: pointer; transition: all .2s;
}
.pwa-wf-push-btn-dismiss:hover { background: #f5f5f5; color: #333; }

/* ── Toast ──────────────────────────────────────────────────── */
.pwa-wf-push-toast {
    position: fixed;
    bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
    background: #1a1a2e; color: #fff;
    padding: 12px 24px; border-radius: 24px;
    font-size: 14px; font-weight: 500;
    z-index: 100000;
    opacity: 0;
    transition: opacity .3s, transform .3s;
    pointer-events: none;
}
.pwa-wf-push-toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 600px) {
    .pwa-wf-push-banner { flex-direction: column; align-items: flex-start; padding: 16px; }
    .pwa-wf-push-banner-actions { width: 100%; }
    .pwa-wf-push-btn-allow, .pwa-wf-push-btn-dismiss { flex: 1; text-align: center; }
}

/* ══════════════════════════════════════════════════════

/* ══════════════════════════════════════════════════════
   Universal Install Wizard – works on mobile + desktop
══════════════════════════════════════════════════════ */

/* Overlay */
.pwa-wf-wizard-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.55);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    z-index: 999998;
    opacity: 0;
    transition: opacity .35s ease;
}
.pwa-wf-wizard-overlay.visible { opacity: 1; }

/* Sheet — mobile: bottom drawer, desktop: centered card */
.pwa-wf-wizard-sheet {
    position: fixed;
    background: #fff;
    z-index: 999999;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;

    /* Mobile first: full-width bottom drawer */
    bottom: 0; left: 0; right: 0;
    border-radius: 24px 24px 0 0;
    padding: 20px 24px env(safe-area-inset-bottom, 24px);
    max-height: 82dvh;
    transform: translateY(100%);
    transition: transform .42s cubic-bezier(.4,0,.2,1);
}
.pwa-wf-wizard-sheet.visible { transform: translateY(0); }

/* Desktop: centered floating card */
@media (min-width: 640px) {
    .pwa-wf-wizard-sheet {
        top: 50%; left: 50%;
        bottom: auto; right: auto;
        width: 440px;
        max-height: 90vh;
        border-radius: 24px;
        padding: 28px 32px 32px;
        transform: translate(-50%, calc(-50% + 20px));
        opacity: 0;
        transition: transform .38s cubic-bezier(.4,0,.2,1), opacity .38s ease;
        box-shadow: 0 24px 64px rgba(0,0,0,.22);
    }
    .pwa-wf-wizard-sheet.visible {
        transform: translate(-50%, -50%);
        opacity: 1;
    }
}

/* Close button */
.pwa-wf-wizard-close {
    position: absolute; top: 16px; right: 16px;
    width: 34px; height: 34px;
    background: #f1f5f9; border: none; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: #475569;
    transition: background .2s;
    flex-shrink: 0;
}
.pwa-wf-wizard-close:hover { background: #e2e8f0; }
.pwa-wf-wizard-close:focus { outline: 2px solid #1976D2; outline-offset: 2px; }
.pwa-wf-wizard-close svg { width: 16px; height: 16px; }

/* Steps container */
.pwa-wf-wizard-steps { min-height: 210px; margin-top: 4px; }
.pwa-wf-wizard-step {
    display: none; flex-direction: column;
    align-items: center; text-align: center;
    gap: 14px; padding-top: 8px;
}
.pwa-wf-wizard-step.active { display: flex; animation: pwa-step-in .3s ease; }
@keyframes pwa-step-in {
    from { opacity:0; transform: translateY(10px); }
    to   { opacity:1; transform: translateY(0); }
}

/* Badge */
.pwa-wf-wz-badge {
    font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
    color: #1976D2; background: #e8f0fe;
    padding: 4px 12px; border-radius: 20px;
}

/* Icon circle */
.pwa-wf-wz-icon {
    width: 76px; height: 76px;
    border-radius: 22px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 8px 24px rgba(0,0,0,.18);
    flex-shrink: 0;
}
.pwa-wf-wz-icon svg { width: 38px; height: 38px; }

/* Titles & desc */
.pwa-wf-wz-title {
    font-size: clamp(18px, 4.5vw, 22px);
    font-weight: 700; color: #0f172a;
    line-height: 1.3; margin: 0;
}
.pwa-wf-wz-title em { font-style: normal; color: #1976D2; }
.pwa-wf-wz-desc {
    font-size: 14px; color: #475569;
    line-height: 1.6; margin: 0;
    max-width: 340px;
}

/* Pulse hint (iOS arrow label) */
.pwa-wf-wz-hint {
    font-size: 13px; color: #94a3b8; margin: 0;
    animation: pwa-pulse 1.8s ease-in-out infinite;
}
@keyframes pwa-pulse { 0%,100%{opacity:1} 50%{opacity:.35} }

/* Progress dots */
.pwa-wf-wz-dots {
    display: flex; gap: 8px; justify-content: center;
    margin: 16px 0 8px;
}
.pwa-wf-wz-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #e2e8f0; transition: all .25s;
}
.pwa-wf-wz-dot.active { width: 24px; border-radius: 4px; background: #1976D2; }

/* Navigation */
.pwa-wf-wz-nav {
    display: flex; justify-content: space-between;
    align-items: center; gap: 12px; padding-top: 12px;
}
.pwa-wf-wz-prev {
    background: transparent; color: #64748b;
    border: 1px solid #e2e8f0; border-radius: 12px;
    padding: 12px 20px; font-size: 15px; cursor: pointer;
    transition: all .2s; white-space: nowrap; flex-shrink: 0;
}
.pwa-wf-wz-prev:hover { background: #f8fafc; border-color: #cbd5e1; }
.pwa-wf-wz-next {
    flex: 1; background: #1976D2; color: #fff;
    border: none; border-radius: 12px;
    padding: 14px 24px; font-size: 16px; font-weight: 600;
    cursor: pointer; transition: background .2s;
}
.pwa-wf-wz-next:hover { background: #1557a8; }
.pwa-wf-wz-next:focus { outline: 2px solid #1976D2; outline-offset: 3px; }

/* Animated share arrow (iOS only) */
.pwa-wf-share-arrow {
    position: fixed;
    bottom: max(env(safe-area-inset-bottom, 20px), 80px);
    left: 50%; transform: translateX(-50%);
    z-index: 1000001;
    display: flex; flex-direction: column;
    align-items: center; gap: 4px;
    opacity: 0; transition: opacity .3s;
    pointer-events: none;
}
.pwa-wf-share-arrow.visible {
    opacity: 1;
    animation: pwa-arrow-bounce 1.3s ease-in-out infinite;
}
.pwa-wf-share-arrow svg { width: 40px; height: 60px; filter: drop-shadow(0 2px 6px rgba(25,118,210,.4)); }
.pwa-wf-share-arrow-label {
    font-size: 11px; font-weight: 600; color: #1976D2;
    background: rgba(255,255,255,.92); padding: 3px 8px;
    border-radius: 8px; white-space: nowrap;
    box-shadow: 0 1px 4px rgba(0,0,0,.1);
}
@keyframes pwa-arrow-bounce {
    0%,100% { transform: translateX(-50%) translateY(0); }
    50%      { transform: translateX(-50%) translateY(10px); }
}
/* Hide arrow on desktop (no Safari toolbar) */
@media (min-width: 640px) {
    .pwa-wf-share-arrow { display: none !important; }
}

/* Responsive small phones */
@media (max-height: 600px) {
    .pwa-wf-wizard-sheet { padding-top: 14px; }
    .pwa-wf-wz-icon { width: 56px; height: 56px; border-radius: 16px; }
    .pwa-wf-wz-icon svg { width: 28px; height: 28px; }
    .pwa-wf-wizard-steps { min-height: 170px; }
    .pwa-wf-wz-title { font-size: 17px; }
}
