/* PWA Frontend Styles */

/* Notification Prompt */
#pwa-notification-prompt {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999999;
    max-width: 500px;
    width: calc(100% - 40px);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

.pwa-prompt-content {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

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

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

.pwa-prompt-text strong {
    display: block;
    font-size: 16px;
    margin-bottom: 5px;
    color: #333;
}

.pwa-prompt-text p {
    margin: 0;
    font-size: 14px;
    color: #666;
}

.pwa-prompt-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.pwa-btn-primary,
.pwa-btn-secondary {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.pwa-btn-primary {
    background: #0073aa;
    color: #ffffff;
}

.pwa-btn-primary:hover {
    background: #005a87;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.3);
}

.pwa-btn-secondary {
    background: transparent;
    color: #666;
    border: 1px solid #ddd;
}

.pwa-btn-secondary:hover {
    background: #f5f5f5;
    color: #333;
}

/* Install Button */
.pwa-install-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #0073aa;
    color: #ffffff;
    border: none;
    border-radius: 50px;
    padding: 15px 25px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
    z-index: 999998;
    transition: all 0.3s ease;
    animation: pulse 2s infinite;
}

.pwa-install-btn:hover {
    background: #005a87;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 115, 170, 0.4);
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
    }
    50% {
        box-shadow: 0 4px 12px rgba(0, 115, 170, 0.6);
    }
}

/* Standalone Mode Adjustments */
body.pwa-standalone {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

.pwa-standalone .admin-bar {
    display: none !important;
}

/* Offline Indicator */
.pwa-offline-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #ff6b6b;
    color: #ffffff;
    text-align: center;
    padding: 10px;
    z-index: 999997;
    font-size: 14px;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.pwa-offline-indicator.visible {
    transform: translateY(0);
}

/* Loading Skeleton for Offline Content */
.pwa-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    #pwa-notification-prompt {
        bottom: 10px;
        width: calc(100% - 20px);
    }
    
    .pwa-prompt-content {
        flex-direction: column;
        text-align: center;
        padding: 15px;
    }
    
    .pwa-prompt-buttons {
        width: 100%;
    }
    
    .pwa-btn-primary,
    .pwa-btn-secondary {
        width: 100%;
    }
    
    .pwa-install-btn {
        bottom: 10px;
        right: 10px;
        padding: 12px 20px;
        font-size: 14px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .pwa-prompt-content {
        background: #1e1e1e;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    }
    
    .pwa-prompt-text strong {
        color: #ffffff;
    }
    
    .pwa-prompt-text p {
        color: #b0b0b0;
    }
    
    .pwa-btn-secondary {
        color: #b0b0b0;
        border-color: #444;
    }
    
    .pwa-btn-secondary:hover {
        background: #2a2a2a;
        color: #ffffff;
    }
}

/* Accessibility */
.pwa-btn-primary:focus,
.pwa-btn-secondary:focus,
.pwa-install-btn:focus {
    outline: 3px solid #0073aa;
    outline-offset: 2px;
}

/* iOS Specific */
@supports (-webkit-touch-callout: none) {
    .pwa-install-btn {
        bottom: calc(20px + env(safe-area-inset-bottom));
    }
    
    #pwa-notification-prompt {
        bottom: calc(20px + env(safe-area-inset-bottom));
    }
}

/* Print Styles */
@media print {
    #pwa-notification-prompt,
    .pwa-install-btn,
    .pwa-offline-indicator {
        display: none !important;
    }
}

/* Update Available Notification */
.pwa-update-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #4caf50;
    color: #ffffff;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
    z-index: 999996;
    animation: slideIn 0.3s ease-out;
    max-width: 300px;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.pwa-update-notification button {
    background: #ffffff;
    color: #4caf50;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    margin-top: 10px;
    cursor: pointer;
    font-weight: 600;
    width: 100%;
}

.pwa-update-notification button:hover {
    background: #f0f0f0;
}

/* Badge for notification count (optional) */
.pwa-badge {
    display: inline-block;
    background: #e74c3c;
    color: #ffffff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    line-height: 20px;
    text-align: center;
    font-weight: bold;
}

/* Smooth transitions for all PWA elements */
.pwa-smooth-transition {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
