/**
 * PWA Styles for MobiFirms
 * Install prompt, update notification, and offline indicators
 */

/* ============================================
   PWA INSTALL PROMPT
   ============================================ */

.pwa-install-prompt {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    display: none;
    animation: slideInUp 0.5s ease-out;
}

.pwa-install-prompt.show {
    display: flex;
    align-items: center;
    gap: 15px;
}

@keyframes slideInUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.pwa-install-prompt .icon {
    font-size: 40px;
    flex-shrink: 0;
}

.pwa-install-prompt .content {
    flex: 1;
}

.pwa-install-prompt .content h3 {
    margin: 0 0 5px 0;
    font-size: 18px;
    font-weight: 600;
}

.pwa-install-prompt .content p {
    margin: 0;
    font-size: 14px;
    opacity: 0.9;
}

.pwa-install-prompt .actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.pwa-install-prompt button {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.pwa-install-prompt .btn-install {
    background: white;
    color: #667eea;
}

.pwa-install-prompt .btn-install:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.3);
}

.pwa-install-prompt .btn-dismiss {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

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

/* Mobile responsive */
@media (max-width: 768px) {
    .pwa-install-prompt {
        left: 10px;
        right: 10px;
        bottom: 10px;
        flex-direction: column;
        text-align: center;
    }
    
    .pwa-install-prompt .icon {
        font-size: 50px;
    }
    
    .pwa-install-prompt .actions {
        width: 100%;
        flex-direction: column;
    }
    
    .pwa-install-prompt button {
        width: 100%;
    }
}

/* ============================================
   PWA UPDATE NOTIFICATION
   ============================================ */

.pwa-update-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.4);
    z-index: 9999;
    display: none;
    animation: slideInRight 0.5s ease-out;
}

.pwa-update-notification.show {
    display: flex;
    align-items: center;
    gap: 15px;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.pwa-update-notification .icon {
    font-size: 24px;
}

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

.pwa-update-notification .content p {
    margin: 0 0 5px 0;
    font-size: 14px;
    font-weight: 600;
}

.pwa-update-notification .content small {
    font-size: 12px;
    opacity: 0.9;
}

.pwa-update-notification button {
    background: white;
    color: #28a745;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s ease;
    font-size: 13px;
}

.pwa-update-notification button:hover {
    transform: scale(1.05);
}

@media (max-width: 768px) {
    .pwa-update-notification {
        top: 10px;
        right: 10px;
        left: 10px;
    }
}

/* ============================================
   OFFLINE INDICATOR
   ============================================ */

.offline-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #dc3545;
    color: white;
    padding: 10px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    z-index: 99999;
    display: none;
    animation: slideInDown 0.3s ease-out;
}

.offline-indicator.show {
    display: block;
}

@keyframes slideInDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

.offline-indicator.online {
    background: #28a745;
}

/* ============================================
   INSTALL BUTTON (Optional standalone button)
   ============================================ */

.pwa-install-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    display: none;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.pwa-install-button.show {
    display: inline-flex;
}

.pwa-install-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.pwa-install-button .icon {
    font-size: 20px;
}

/* ============================================
   iOS INSTALL INSTRUCTIONS
   ============================================ */

.ios-install-prompt {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 20px;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    display: none;
    animation: slideInUp 0.5s ease-out;
}

.ios-install-prompt.show {
    display: block;
}

.ios-install-prompt .close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.ios-install-prompt h3 {
    margin: 0 0 15px 0;
    color: #667eea;
    font-size: 18px;
}

.ios-install-prompt ol {
    margin: 0;
    padding-left: 20px;
    color: #666;
}

.ios-install-prompt li {
    margin-bottom: 10px;
    font-size: 14px;
}

.ios-install-prompt .icon {
    font-size: 24px;
    vertical-align: middle;
}

/* ============================================
   LOADING SPINNER (for PWA operations)
   ============================================ */

.pwa-spinner {
    border: 3px solid rgba(102, 126, 234, 0.2);
    border-top: 3px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================
   STANDALONE MODE DETECTION
   ============================================ */

@media all and (display-mode: standalone) {
    /* Hide browser-specific UI when in standalone mode */
    .browser-only {
        display: none !important;
    }
    
    /* Add padding for iOS notch in standalone mode */
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* ============================================
   DARK MODE SUPPORT
   ============================================ */

@media (prefers-color-scheme: dark) {
    .pwa-update-notification {
        background: #1e7e34;
    }
    
    .ios-install-prompt {
        background: #1a1a1a;
        color: white;
    }
    
    .ios-install-prompt h3 {
        color: #8fa3f0;
    }
    
    .ios-install-prompt ol {
        color: #ccc;
    }
}
