/* ============================================================
   DJIBOUTI SUUQ — PWA Styles
   Bannière installation, toasts, mode offline
   ============================================================ */

/* ── Bannière d'installation ─────────────────────────────── */
#pwa-install-banner,
#pwa-update-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    padding: 0 0 env(safe-area-inset-bottom);
    transform: translateY(100%);
    transition: transform .4s cubic-bezier(.34,1.56,.64,1);
    will-change: transform;
}

#pwa-install-banner.pwa-banner-visible,
#pwa-update-banner.pwa-banner-visible {
    transform: translateY(0);
}

.pwa-banner-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #1a2840;
    border-top: 1px solid #1e3a5f;
    padding: 14px 16px;
    box-shadow: 0 -4px 24px rgba(0,0,0,.5);
}

.pwa-banner-icon {
    flex-shrink: 0;
}

.pwa-banner-icon img {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: block;
}

.pwa-banner-text {
    flex: 1;
    min-width: 0;
}

.pwa-banner-title {
    font-size: .88rem;
    font-weight: 700;
    color: #f1f5f9;
    margin-bottom: 2px;
}

.pwa-banner-subtitle {
    font-size: .75rem;
    color: #64748b;
}

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

.pwa-btn-install {
    background: #6366f1;
    color: #fff;
    border: none;
    padding: 9px 16px;
    border-radius: 9px;
    font-size: .82rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    transition: opacity .2s;
}

.pwa-btn-install:hover { opacity: .88; }

.pwa-btn-dismiss {
    width: 30px;
    height: 30px;
    background: transparent;
    border: 1px solid #334155;
    border-radius: 50%;
    color: #64748b;
    font-size: .7rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .2s;
    flex-shrink: 0;
}

.pwa-btn-dismiss:hover {
    background: #0f1929;
    color: #ef4444;
    border-color: #ef4444;
}

/* ── Toast offline ───────────────────────────────────────── */
#pwa-offline-toast {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    opacity: 0;
    transition: all .3s ease;
    background: #1a2840;
    border: 1px solid #f59e0b;
    color: #fbbf24;
    font-size: .78rem;
    font-weight: 600;
    padding: 9px 16px;
    border-radius: 100px;
    white-space: nowrap;
    z-index: 9998;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,.4);
    pointer-events: none;
}

#pwa-offline-toast.pwa-toast-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.pwa-toast-dot {
    width: 8px;
    height: 8px;
    background: #f59e0b;
    border-radius: 50%;
    flex-shrink: 0;
    animation: pulse-dot 1.5s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .5; transform: scale(.8); }
}

/* ── Mode offline ────────────────────────────────────────── */
body.is-offline .checkout-btn,
body.is-offline #addToCartBtn {
    opacity: .5;
    pointer-events: none;
}

body.is-offline .checkout-btn::after {
    content: ' (hors ligne)';
    font-size: .75em;
}

/* ── Prompt notification ─────────────────────────────────── */
.pwa-notif-prompt {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(.9);
    opacity: 0;
    transition: all .3s cubic-bezier(.34,1.56,.64,1);
    background: #1a2840;
    border: 1px solid #1e3a5f;
    border-radius: 20px;
    padding: 28px 24px;
    width: min(340px, 90vw);
    z-index: 10000;
    box-shadow: 0 20px 60px rgba(0,0,0,.6);
}

.pwa-notif-prompt.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.pwa-notif-prompt-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #4338ca, #6366f1);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.pwa-notif-prompt-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: #f1f5f9;
    text-align: center;
    margin-bottom: 8px;
}

.pwa-notif-prompt-text {
    font-size: .84rem;
    color: #64748b;
    text-align: center;
    line-height: 1.6;
    margin-bottom: 20px;
}

.pwa-notif-actions {
    display: flex;
    gap: 10px;
}

.pwa-notif-accept {
    flex: 1;
    background: #6366f1;
    color: #fff;
    border: none;
    padding: 12px;
    border-radius: 10px;
    font-size: .88rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
}

.pwa-notif-decline {
    background: #0f1929;
    color: #64748b;
    border: 1px solid #1e3a5f;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: .84rem;
    cursor: pointer;
    font-family: inherit;
}

/* ── Indicateur mode app ─────────────────────────────────── */
@media (display-mode: standalone) {
    /* Cache la barre de navigation du navigateur dans le calcul */
    body { padding-top: env(safe-area-inset-top); }

    /* Cache certains éléments redondants en mode app */
    .navbar-browser-hint { display: none; }
}

/* ── Adaptation mobile PWA ───────────────────────────────── */
@media (max-width: 480px) {
    #pwa-install-banner {
        /* S'assurer que la bannière ne cache pas la bottom nav */
        bottom: 0;
    }

    .pwa-banner-inner {
        padding: 12px 14px;
    }

    .pwa-banner-icon img {
        width: 38px;
        height: 38px;
    }

    .pwa-banner-title { font-size: .82rem; }
    .pwa-banner-subtitle { font-size: .7rem; }
}
