/* PWA Installation Prompt Styles */
.pwa-install-prompt {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.3);
    z-index: 10000;
    opacity: 0;
    transform: translateY(100px);
    transition: all 0.3s ease;
    max-width: 400px;
    margin: 0 auto;
}

.pwa-install-prompt.show {
    opacity: 1;
    transform: translateY(0);
}

.pwa-prompt-content {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.pwa-prompt-icon {
    flex-shrink: 0;
}

.pwa-prompt-icon img {
    width: 48px;
    height: 48px;
    border-radius: 8px;
}

.pwa-prompt-text {
    flex: 1;
}

.pwa-prompt-text h4 {
    margin: 0 0 5px 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.pwa-prompt-text p {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.9;
    line-height: 1.4;
}

.pwa-prompt-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.pwa-prompt-buttons .btn {
    font-size: 0.85rem;
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.pwa-prompt-buttons .btn.primary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.pwa-prompt-buttons .btn.primary:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.pwa-prompt-buttons .btn.secondary {
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.pwa-prompt-buttons .btn.secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* PWA Mode Adjustments */
body.pwa-mode {
    padding-top: 0;
    /* Remove extra padding when running as PWA */
}

body.pwa-mode .site-header {
    padding-top: env(safe-area-inset-top, 0);
}

/* Offline Indicator */
body.offline::before {
    content: "You are currently offline";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #ef4444;
    color: white;
    text-align: center;
    padding: 8px 0;
    font-size: 0.85rem;
    z-index: 10001;
}

body.offline .site-header {
    top: 36px;
}

/* Install button in header (optional) */
.pwa-install-header-btn {
    display: none;
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
    border: 1px solid rgba(37, 99, 235, 0.2);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    align-items: center;
    gap: 6px;
}

.pwa-install-header-btn:hover {
    background: rgba(37, 99, 235, 0.2);
    transform: translateY(-1px);
}

.pwa-install-header-btn.show {
    display: inline-flex;
}

/* iOS specific PWA adjustments */
@supports (-webkit-touch-callout: none) {
    body.pwa-mode {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .pwa-install-prompt {
        left: 10px;
        right: 10px;
        bottom: 10px;
    }

    .pwa-prompt-content {
        padding: 15px;
        gap: 12px;
    }

    .pwa-prompt-text h4 {
        font-size: 1rem;
    }

    .pwa-prompt-text p {
        font-size: 0.85rem;
    }

    .pwa-prompt-buttons {
        gap: 8px;
    }

    .pwa-prompt-buttons .btn {
        font-size: 0.8rem;
        padding: 6px 12px;
    }
}

/* Desktop specific PWA prompt */
@media (min-width: 769px) {
    .pwa-install-prompt {
        left: auto;
        right: 20px;
        max-width: 350px;
    }
}

/* App icon badge for shortcuts */
.app-shortcut-badge {
    position: relative;
}

.app-shortcut-badge::after {
    content: "";
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid white;
}

/* PWA splash screen simulation */
.pwa-splash {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 99999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.pwa-splash.show {
    opacity: 1;
    pointer-events: all;
}

.pwa-splash .splash-logo {
    width: 120px;
    height: 120px;
    margin-bottom: 20px;
    border-radius: 20px;
}

.pwa-splash .splash-text {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.pwa-splash .splash-tagline {
    font-size: 1rem;
    opacity: 0.8;
    margin-bottom: 30px;
}

.pwa-splash .splash-loading {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Update notification */
.pwa-update-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #10b981;
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    z-index: 10000;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    max-width: 320px;
}

.pwa-update-notification.show {
    opacity: 1;
    transform: translateX(0);
}

.pwa-update-notification .update-text {
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.pwa-update-notification .update-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    margin-right: 8px;
}

.pwa-update-notification .update-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}