/**
 * PWA UI Styles
 * Install button, update banner, toast notifications
 */

/* Install Button */
.pwa-install-button {
    position: fixed;
    bottom: 80px;
    right: 20px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 9999;
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    transition: all 0.3s ease;
}

.pwa-install-button.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.pwa-install-button:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 12px 32px rgba(59, 130, 246, 0.5);
}

.pwa-install-button:active {
    transform: translateY(0) scale(0.98);
}

.pwa-install-button i {
    font-size: 18px;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

/* Update Banner */
.pwa-update-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.pwa-update-banner.show {
    transform: translateY(0);
}

.pwa-update-banner .update-content {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
}

.pwa-update-banner .update-content i {
    font-size: 20px;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.pwa-update-banner button {
    background: white;
    color: #059669;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pwa-update-banner button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Toast Notifications */
.pwa-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(15, 23, 42, 0.95);
    color: white;
    padding: 14px 24px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 500;
    z-index: 9998;
    opacity: 0;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.pwa-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.pwa-toast.success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.95), rgba(5, 150, 105, 0.95));
}

.pwa-toast.warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.95), rgba(217, 119, 6, 0.95));
}

.pwa-toast.error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.95), rgba(220, 38, 38, 0.95));
}

/* PWA Splash Screen (iOS) */
@media (display-mode: standalone) {
    body {
        -webkit-user-select: none;
        -webkit-touch-callout: none;
        user-select: none;
    }
    
    /* Hide install button when running as PWA */
    .pwa-install-button {
        display: none !important;
    }
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .pwa-install-button {
        bottom: 70px;
        right: 16px;
        padding: 12px 20px;
        font-size: 14px;
    }
    
    .pwa-update-banner {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .pwa-toast {
        bottom: 80px;
        max-width: 90%;
        font-size: 13px;
    }
}

/* Loading Spinner for PWA */
.pwa-loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.pwa-loading .spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(59, 130, 246, 0.2);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* iOS Safe Area */
@supports (padding: max(0px)) {
    body {
        padding-top: max(0px, env(safe-area-inset-top));
        padding-bottom: max(0px, env(safe-area-inset-bottom));
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }
}
