/* PWA Installation Prompt */
.pwa-install-prompt {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: linear-gradient(135deg, #FF6B35 0%, #F7931E 100%);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(255, 107, 53, 0.3);
    z-index: 1000;
    display: none;
    opacity: 0;
    transform: translateY(100%);
    transition: all 0.3s ease-out;
    max-width: 400px;
    margin: 0 auto;
}

.pwa-install-prompt.pwa-install-visible {
    opacity: 1;
    transform: translateY(0);
}

.pwa-install-content {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    gap: 16px;
}

.pwa-install-icon {
    color: white;
    flex-shrink: 0;
}

.pwa-install-text {
    flex: 1;
    color: white;
}

.pwa-install-title {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 4px;
}

.pwa-install-subtitle {
    font-size: 14px;
    opacity: 0.9;
}

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

.pwa-install-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.pwa-install-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.pwa-install-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
    opacity: 0.7;
}

.pwa-install-close:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

/* PWA Update Notification */
.pwa-update-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease-out;
    max-width: 350px;
    border-left: 4px solid #4F46E5;
}

.pwa-update-notification.pwa-update-visible {
    opacity: 1;
    transform: translateX(0);
}

.pwa-update-content {
    padding: 16px 20px;
}

.pwa-update-text {
    margin-bottom: 12px;
}

.pwa-update-text strong {
    color: #1F2937;
    font-size: 16px;
}

.pwa-update-text p {
    color: #6B7280;
    font-size: 14px;
    margin: 4px 0 0 0;
}

.pwa-update-actions {
    display: flex;
    gap: 8px;
}

.pwa-update-btn {
    background: #4F46E5;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.pwa-update-btn:hover {
    background: #4338CA;
    transform: translateY(-1px);
}

.pwa-update-close {
    background: #F3F4F6;
    color: #6B7280;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.pwa-update-close:hover {
    background: #E5E7EB;
    color: #374151;
}

/* Connection Status */
.connection-status {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 8px 16px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    z-index: 1002;
    display: none;
    transition: all 0.3s ease;
}

.connection-status.online {
    background: #10B981;
    color: white;
}

.connection-status.offline {
    background: #EF4444;
    color: white;
}

/* PWA Notifications */
.pwa-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    z-index: 1003;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease-out;
    max-width: 350px;
    margin-bottom: 12px;
}

.pwa-notification.pwa-notification-visible {
    opacity: 1;
    transform: translateX(0);
}

.pwa-notification-content {
    display: flex;
    align-items: flex-start;
    padding: 16px 20px;
    gap: 12px;
}

.pwa-notification-icon {
    flex-shrink: 0;
    margin-top: 2px;
}

.pwa-notification-success .pwa-notification-icon {
    color: #10B981;
}

.pwa-notification-warning .pwa-notification-icon {
    color: #F59E0B;
}

.pwa-notification-error .pwa-notification-icon {
    color: #EF4444;
}

.pwa-notification-info .pwa-notification-icon {
    color: #3B82F6;
}

.pwa-notification-text {
    flex: 1;
}

.pwa-notification-title {
    font-weight: 600;
    color: #1F2937;
    margin-bottom: 4px;
}

.pwa-notification-message {
    color: #6B7280;
    font-size: 14px;
}

.pwa-notification-close {
    background: none;
    border: none;
    color: #9CA3AF;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.pwa-notification-close:hover {
    color: #6B7280;
    background: #F3F4F6;
}

/* PWA Status Badge */
.pwa-status-badge {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    z-index: 999;
    display: none;
    backdrop-filter: blur(10px);
}

.pwa-status-badge.installed {
    background: rgba(16, 185, 129, 0.9);
    display: block;
}

.pwa-status-badge.installable {
    background: rgba(79, 70, 229, 0.9);
    display: block;
}

/* Installation Success Animation */
@keyframes pwa-success-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.pwa-install-success {
    animation: pwa-success-pulse 0.6s ease-out;
}

/* Responsive Design */
@media (max-width: 640px) {
    .pwa-install-prompt {
        left: 16px;
        right: 16px;
        bottom: 16px;
    }
    
    .pwa-install-content {
        padding: 14px 16px;
        gap: 12px;
    }
    
    .pwa-install-title {
        font-size: 15px;
    }
    
    .pwa-install-subtitle {
        font-size: 13px;
    }
    
    .pwa-update-notification,
    .pwa-notification {
        left: 16px;
        right: 16px;
        top: 16px;
        max-width: none;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .pwa-update-notification,
    .pwa-notification {
        background: #1F2937;
        border-color: #374151;
    }
    
    .pwa-notification-title {
        color: #F9FAFB;
    }
    
    .pwa-notification-message {
        color: #D1D5DB;
    }
    
    .pwa-update-text strong {
        color: #F9FAFB;
    }
    
    .pwa-update-text p {
        color: #D1D5DB;
    }
    
    .pwa-update-close {
        background: #374151;
        color: #D1D5DB;
    }
    
    .pwa-update-close:hover {
        background: #4B5563;
        color: #F9FAFB;
    }
    
    .pwa-notification-close {
        color: #6B7280;
    }
    
    .pwa-notification-close:hover {
        color: #D1D5DB;
        background: #374151;
    }
}

/* Animations for better UX */
.pwa-install-prompt,
.pwa-update-notification,
.pwa-notification {
    will-change: transform, opacity;
}

/* Loading spinner for PWA operations */
.pwa-loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: pwa-spin 1s ease-in-out infinite;
}

@keyframes pwa-spin {
    to { transform: rotate(360deg); }
}

/* PWA Icon in navigation */
.pwa-icon {
    width: 20px;
    height: 20px;
    color: currentColor;
}

/* Offline mode styles */
.offline-mode .pwa-offline-indicator {
    display: block;
}

.pwa-offline-indicator {
    display: none;
    background: #FEF3C7;
    color: #92400E;
    padding: 8px 16px;
    text-align: center;
    font-size: 14px;
    border-bottom: 1px solid #FDE68A;
}

/* App-like header for installed PWA */
@media all and (display-mode: standalone) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .pwa-standalone-header {
        position: sticky;
        top: 0;
        background: white;
        border-bottom: 1px solid #E5E7EB;
        z-index: 50;
        padding: 12px 16px;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    
    .pwa-standalone-title {
        font-weight: 600;
        color: #1F2937;
    }
}