/* ============================================================
   PWA Install Prompt — MitraMail
   Mendukung: light mode, dark mode, safe area (notch), mobile
   ============================================================ */

#pwa-install-prompt {
    position: fixed;
    bottom: 20px;
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 420px;
    background: #D32F2F;
    color: #ffffff;
    padding: 14px 16px;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25), 0 2px 8px rgba(211, 47, 47, 0.3);
    display: none;
    z-index: 99999;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    animation: mmPwaSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes mmPwaSlideUp {
    from {
        transform: translateX(-50%) translateY(100px);
        opacity: 0;
    }

    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

#pwa-install-prompt .pwa-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

#pwa-install-prompt img {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px;
    flex-shrink: 0;
}

#pwa-install-prompt .pwa-text h4 {
    margin: 0 0 2px 0;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#pwa-install-prompt .pwa-text p {
    margin: 0;
    font-size: 12px;
    opacity: 0.85;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#pwa-install-prompt .pwa-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

#pwa-install-prompt button#pwa-install-btn {
    background: #ffffff;
    color: #C62828;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    white-space: nowrap;
}

#pwa-install-prompt button#pwa-install-btn:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

#pwa-install-prompt button#pwa-install-btn:active {
    transform: scale(0.95);
}

#pwa-install-prompt .pwa-close {
    cursor: pointer;
    padding: 6px;
    opacity: 0.75;
    transition: opacity 0.2s ease;
    font-size: 18px;
    line-height: 1;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#pwa-install-prompt .pwa-close:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.15);
}

/* ── Dark Mode Support ── */
html.dark-mode #pwa-install-prompt {
    background: #7f1d1d;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(127, 29, 29, 0.4);
}

html.dark-mode #pwa-install-prompt button#pwa-install-btn {
    background: #fca5a5;
    color: #7f1d1d;
}

@media (prefers-color-scheme: dark) {
    html:not(.light-mode) #pwa-install-prompt {
        background: #7f1d1d;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(127, 29, 29, 0.4);
    }

    html:not(.light-mode) #pwa-install-prompt button#pwa-install-btn {
        background: #fca5a5;
        color: #7f1d1d;
    }
}

/* ── Mobile ── */
@media screen and (max-width: 480px) {
    #pwa-install-prompt {
        bottom: 12px;
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        width: 95%;
        border-radius: 12px;
        padding: 12px 14px;
    }

    #pwa-install-prompt button#pwa-install-btn {
        padding: 7px 13px;
        font-size: 12px;
    }
}