/**
 * PWA Styles - Boutique AEEP
 * Styles pour les composants PWA : Install Banner, Update Banner, Toast, Offline Badge
 * 
 * Développé par Téra Vision - Ouattara Gnelezie Arouna
 */

/* ========================================
   INSTALL BANNER
   ======================================== */
#pwa-install-banner {
    position: fixed;
    bottom: -120px;
    left: 0;
    right: 0;
    z-index: 99999;
    transition: bottom 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0 16px 16px;
    pointer-events: none;
}

#pwa-install-banner.visible {
    bottom: 70px; /* Au-dessus de la nav mobile */
    pointer-events: all;
}

@media (min-width: 769px) {
    #pwa-install-banner.visible {
        bottom: 16px;
    }
}

.pwa-install-content {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: linear-gradient(135deg, #054401, #0a6b03);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25), 0 0 0 1px rgba(255,255,255,0.1) inset;
    color: #fff;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.pwa-install-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.pwa-install-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.pwa-install-text strong {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pwa-install-text span {
    display: block;
    font-size: 0.75rem;
    opacity: 0.8;
    line-height: 1.3;
}

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

.pwa-btn-install {
    padding: 10px 22px;
    background: #F5B800;
    color: #054401;
    border: none;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    white-space: nowrap;
}

.pwa-btn-install:hover {
    background: #fff;
    transform: scale(1.05);
}

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

.pwa-btn-close {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255,255,255,0.15);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.pwa-btn-close:hover {
    background: rgba(255,255,255,0.3);
}

/* ========================================
   UPDATE BANNER
   ======================================== */
#pwa-update-banner {
    position: fixed;
    top: -80px;
    left: 0;
    right: 0;
    z-index: 99999;
    transition: top 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 16px 16px 0;
    pointer-events: none;
}

#pwa-update-banner.visible {
    top: 0;
    pointer-events: all;
}

.pwa-update-content {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    background: linear-gradient(135deg, #1a5f2a, #054401);
    border-radius: 0 0 16px 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 500;
}

.pwa-update-content span {
    flex: 1;
}

.pwa-btn-update {
    padding: 8px 18px;
    background: #F5B800;
    color: #054401;
    border: none;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    white-space: nowrap;
}

.pwa-btn-update:hover {
    background: #fff;
}

/* ========================================
   TOAST NOTIFICATION
   ======================================== */
.pwa-toast {
    position: fixed;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100000;
    padding: 12px 24px;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: 'Montserrat', sans-serif;
    white-space: nowrap;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.pwa-toast.visible {
    bottom: 90px;
}

@media (min-width: 769px) {
    .pwa-toast.visible {
        bottom: 30px;
    }
}

/* ========================================
   OFFLINE BADGE
   ======================================== */
#pwa-offline-badge {
    position: fixed;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99998;
    padding: 6px 16px;
    background: #ff4444;
    color: #fff;
    border-radius: 0 0 12px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 10px rgba(255,68,68,0.4);
    transition: top 0.3s ease;
}

#pwa-offline-badge.visible {
    top: 0;
}

.pwa-offline-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fff;
    animation: pwa-blink 1.5s ease-in-out infinite;
}

@keyframes pwa-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ========================================
   iOS STANDALONE ADJUSTMENTS
   ======================================== */
@media all and (display-mode: standalone) {
    /* Ajustements pour le mode PWA installée */
    body {
        -webkit-user-select: none;
        user-select: auto;
        -webkit-touch-callout: none;
        -webkit-tap-highlight-color: transparent;
    }
    
    /* Safe area pour les appareils avec notch */
    .header {
        padding-top: env(safe-area-inset-top);
    }
    
    .mobile-bottom-nav {
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    /* Cacher le banner d'installation si déjà en mode standalone */
    #pwa-install-banner {
        display: none !important;
    }
}

/* ========================================
   SPLASH SCREEN OVERRIDE
   ======================================== */
@media all and (display-mode: standalone) {
    .loader {
        background: #054401 !important;
    }
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */
@media (max-width: 480px) {
    .pwa-install-content {
        padding: 12px 14px;
        gap: 10px;
    }
    
    .pwa-install-icon {
        width: 40px;
        height: 40px;
        border-radius: 10px;
    }
    
    .pwa-install-text strong {
        font-size: 0.82rem;
    }
    
    .pwa-install-text span {
        display: none;
    }
    
    .pwa-btn-install {
        padding: 8px 16px;
        font-size: 0.8rem;
    }
}
