/* PWA Install Button and Notifications */

/* Install Button */
#pwa-install-btn {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 1rem 1.5rem;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    z-index: 9998;
    transition: all 0.3s ease;
    animation: bounceIn 0.5s ease;
}

#pwa-install-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

#pwa-install-btn:active {
    transform: translateY(-1px) scale(1.02);
}

#pwa-install-btn::before {
    content: "📱 ";
    margin-right: 0.5rem;
}

/* Update Notification */
.pwa-update-notification {
    display: none;
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 9999;
    animation: slideDown 0.3s ease;
}

.pwa-update-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
}

.pwa-update-content span {
    font-weight: 600;
    color: #333;
}

.pwa-update-btn {
    background: #0d6efd;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.pwa-update-btn:hover {
    background: #0b5ed7;
    transform: scale(1.05);
}

.pwa-dismiss-btn {
    background: transparent;
    border: none;
    color: #999;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.5rem;
    transition: color 0.2s;
}

.pwa-dismiss-btn:hover {
    color: #333;
}

/* Animations */
@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-100%);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(100%);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Mobile optimizations */
@media (max-width: 768px) {
    #pwa-install-btn {
        bottom: 10px;
        right: 10px;
        padding: 0.875rem 1.25rem;
        font-size: 0.875rem;
    }
    
    .pwa-update-notification {
        left: 10px;
        right: 10px;
        transform: none;
        width: calc(100% - 20px);
    }
    
    .pwa-update-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

/* iOS specific styles */
@supports (-webkit-touch-callout: none) {
    #pwa-install-btn {
        padding: 1rem 1.5rem;
        font-size: 1rem;
    }
}

/* Standalone mode (when installed as PWA) */
@media (display-mode: standalone) {
    #pwa-install-btn {
        display: none !important;
    }
    
    body {
        /* Add safe area padding for notched devices */
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* Loading indicator for offline */
.pwa-offline-badge {
    position: fixed;
    top: 10px;
    right: 10px;
    background: #dc3545;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    z-index: 9997;
    box-shadow: 0 2px 10px rgba(220, 53, 69, 0.3);
}

.pwa-offline-badge::before {
    content: "● ";
    animation: blink 1s infinite;
}

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