/* ===================================================================
   PWA INSTALL BUTTON & NOTIFICATIONS STYLES
   =================================================================== */

/* Bouton d'installation PWA - Version compacte à gauche */
#pwa-install-button button {
    position: fixed !important; /* Forcer fixed pour rester visible en bas à gauche */
    bottom: 20px;
    left: 20px; /* Déplacé à gauche */
    background: linear-gradient(135deg, #4a90a4 0%, #7a95a8 100%);
    color: white;
    padding: 12px; /* Plus compact */
    border-radius: 50%; /* Forme circulaire */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 20px; /* Taille de l'icône */
    cursor: pointer;
    border: none;
    width: 50px; /* Largeur fixe */
    height: 50px; /* Hauteur fixe */
    transition: all 0.3s ease;
    animation: bounce 2s infinite; /* Animation flottante */
}

#pwa-install-button button:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 20px rgba(74, 144, 164, 0.4);
    animation: none; /* Arrêter l'animation au survol */
}

#pwa-install-button button:active {
    transform: translateY(-1px) scale(1);
}

/* Tooltip personnalisé au survol - Affiché à DROITE */
#pwa-install-button button::after {
    content: attr(title);
    position: absolute;
    left: 100%; /* Positionné à droite du bouton */
    top: 50%;
    transform: translateY(-50%) translateX(10px);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 10000;
    margin-left: 8px;
}

/* Flèche du tooltip pointant vers la gauche (vers le bouton) */
#pwa-install-button button::before {
    content: '';
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%) translateX(-2px);
    border: 6px solid transparent;
    border-right-color: rgba(0, 0, 0, 0.85); /* Flèche pointant vers la gauche */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 10000;
}

#pwa-install-button button:hover::after {
    opacity: 1;
    transform: translateY(-50%) translateX(10px);
}

#pwa-install-button button:hover::before {
    opacity: 1;
    transform: translateY(-50%) translateX(-2px);
}

/* Le texte (label) du bouton est masqué par défaut */
#pwa-install-button button span {
    display: none;
}

/* Afficher uniquement l'icône */
#pwa-install-button button i {
    margin: 0;
}

/* Notification de mise à jour */
#pwa-update-notification > div {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #4a90a4 0%, #7a95a8 100%);
    color: white;
    padding: 15px 25px;
    border-radius: 50px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 15px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    animation: slideUp 0.5s ease;
}

#pwa-update-notification button {
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

#pwa-update-notification button:first-of-type {
    background: white;
    color: #4a90a4;
}

#pwa-update-notification button:first-of-type:hover {
    transform: scale(1.05);
}

#pwa-update-notification button:last-of-type {
    background: transparent;
    color: white;
    border: 1px solid white;
}

#pwa-update-notification button:last-of-type:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Animations */
@keyframes slideUp {
    from {
        transform: translate(-50%, 100px);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        transform: translate(-50%, 0);
        opacity: 1;
    }
    to {
        transform: translate(-50%, 100px);
        opacity: 0;
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Responsive Mobile */
@media (max-width: 768px) {
    #pwa-install-button button {
        bottom: 10px;
        left: 10px; /* À gauche aussi sur mobile */
        padding: 10px;
        font-size: 18px;
        width: 45px;
        height: 45px;
    }
    
    /* Tooltip plus petit sur mobile */
    #pwa-install-button button::after {
        font-size: 11px;
        padding: 6px 10px;
    }
    
    #pwa-install-button button::before {
        border-width: 5px;
    }

    #pwa-update-notification > div {
        bottom: 10px;
        left: 10px;
        right: 10px;
        transform: none;
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        border-radius: 16px;
        padding: 15px 20px;
    }

    #pwa-update-notification button {
        width: 100%;
    }

    @keyframes slideUp {
        from {
            transform: translateY(100px);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }

    @keyframes slideDown {
        from {
            transform: translateY(0);
            opacity: 1;
        }
        to {
            transform: translateY(100px);
            opacity: 0;
        }
    }
}

/* Mode sombre (si implémenté dans le futur) */
@media (prefers-color-scheme: dark) {
    #pwa-install-button button {
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    }

    #pwa-update-notification > div {
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    }
}

/* Masquer le bouton quand l'app est déjà installée */
@media (display-mode: standalone) {
    #pwa-install-button {
        display: none !important;
    }
}

/* iOS PWA spécifique */
@supports (-webkit-touch-callout: none) {
    #pwa-install-button button {
        bottom: 30px; /* Éviter la zone de geste iOS */
        left: 20px; /* À gauche aussi sur iOS */
    }
}
