/* PWA Install Button */
.pwa-install-btn {
    position: fixed;
    bottom: -90px;
    left: 24px;
    right: auto;
    background: linear-gradient(135deg, #132b4f 0%, #1d426f 100%);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 12px 18px;
    border-radius: 12px;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 650;
    cursor: pointer;
    box-shadow: 0 12px 30px rgba(9, 26, 48, 0.28);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    z-index: 10000;
}

.pwa-install-btn.show {
    bottom: max(24px, env(safe-area-inset-bottom));
    animation: installButtonIn 0.35s ease-out both;
}

.pwa-install-btn:hover {
    transform: translateY(-3px);
    background: linear-gradient(135deg, #f56a0a 0%, #ff7a1a 100%);
    box-shadow: 0 14px 34px rgba(245, 106, 10, 0.3);
}

.pwa-install-btn:focus-visible {
    outline: 3px solid rgba(245, 106, 10, 0.42);
    outline-offset: 3px;
}

.pwa-install-btn svg {
    width: 20px;
    height: 20px;
}

@keyframes installButtonIn {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

/* PWA Notification */
.pwa-notification {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 15px 30px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    font-weight: 600;
    z-index: 10001;
    transition: all 0.3s ease;
}

.pwa-notification.show {
    top: 20px;
}

.pwa-notification.success {
    border-left: 4px solid #4caf50;
    color: #2e7d32;
}

.pwa-notification.error {
    border-left: 4px solid #f44336;
    color: #c62828;
}

.pwa-notification.info {
    border-left: 4px solid #2196F3;
    color: #1565c0;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .pwa-install-btn {
        left: 15px;
        right: auto;
        bottom: -90px;
        max-width: calc(100% - 100px);
        padding: 11px 15px;
    }

    .pwa-install-btn.show {
        bottom: max(18px, env(safe-area-inset-bottom));
    }
}

/* iOS specific styles */
@supports (-webkit-touch-callout: none) {
    .pwa-install-btn {
        padding: 12px 20px;
        font-size: 14px;
    }
}

/* Standalone mode detection */
@media all and (display-mode: standalone) {

    /* Hide install button when app is installed */
    .pwa-install-btn {
        display: none !important;
    }

    /* Add status bar padding for notched devices */
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* Loading spinner for PWA */
.pwa-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.pwa-loading .spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #d4145a;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.pwa-loading .text {
    margin-top: 20px;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Offline indicator */
.offline-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: #ff9800;
    color: white;
    text-align: center;
    padding: 10px;
    font-weight: 600;
    z-index: 10002;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.offline-indicator.show {
    transform: translateY(0);
}

/* Update available notification */
.update-available {
    position: fixed;
    bottom: 80px;
    right: 20px;
    background: #2196F3;
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(33, 150, 243, 0.4);
    z-index: 10003;
    display: flex;
    align-items: center;
    gap: 15px;
}

.update-available button {
    background: white;
    color: #2196F3;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    font-weight: 600;
    cursor: pointer;
}

.update-available button:hover {
    background: #f0f0f0;
}
