/* PWA Styles for Nerdi Gras */

/* Install Banner */
.pwa-install-banner {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    z-index: 1000;
    max-width: 400px;
    margin: 0 auto;
    background: linear-gradient(135deg, #6f42c1, #5a359a);
    color: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(111, 66, 193, 0.3);
    transform: translateY(0);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.pwa-install-banner.hidden {
    transform: translateY(100px);
    opacity: 0;
    pointer-events: none;
}

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

.pwa-banner-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.pwa-banner-text {
    flex: 1;
    min-width: 0;
}

.pwa-banner-text h4 {
    margin: 0 0 4px 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.pwa-banner-text p {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.9;
    line-height: 1.3;
}

.pwa-banner-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

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

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

.btn-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Notification Permission Banner */
.pwa-notification-banner {
    position: fixed;
    top: 80px;
    left: 20px;
    right: 20px;
    z-index: 1000;
    max-width: 400px;
    margin: 0 auto;
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(40, 167, 69, 0.3);
    animation: slideDown 0.3s ease;
}

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

.btn-enable {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

/* Update Prompt */
.pwa-update-prompt {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
    background: linear-gradient(135deg, #ffc107, #fd7e14);
    color: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(255, 193, 7, 0.3);
    max-width: 350px;
    animation: slideIn 0.3s ease;
}

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

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

.pwa-update-icon {
    font-size: 1.5rem;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.pwa-update-text h4 {
    margin: 0 0 4px 0;
    font-size: 1rem;
    font-weight: 600;
}

.pwa-update-text p {
    margin: 0;
    font-size: 0.85rem;
    opacity: 0.9;
}

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

.btn-update {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-update:hover {
    background: rgba(255, 255, 255, 0.3);
}

.btn-dismiss {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-dismiss:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* PWA Install Button in Navigation */
.pwa-install-btn {
    background: linear-gradient(135deg, #6f42c1, #5a359a);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 16px;
}

.pwa-install-btn:hover {
    background: linear-gradient(135deg, #5a359a, #4c2d87);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(111, 66, 193, 0.3);
}

/* Standalone Mode Adjustments */
.pwa-standalone {
    /* Add safe area padding for devices with notches */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

.pwa-standalone header {
    /* Adjust header for standalone mode */
    padding-top: calc(env(safe-area-inset-top) + 16px);
}

/* iOS specific adjustments */
@supports (-webkit-appearance: none) {
    .pwa-standalone {
        /* iOS status bar height */
        --status-bar-height: 44px;
    }
    
    .pwa-standalone header {
        padding-top: calc(var(--status-bar-height) + 16px);
    }
}

/* Offline Indicator */
.pwa-offline-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #dc3545;
    color: white;
    text-align: center;
    padding: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    z-index: 1002;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

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

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

/* PWA Notification Styles */
.pwa-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    padding: 16px 20px;
    max-width: 300px;
    z-index: 1001;
    animation: slideIn 0.3s ease;
}

.pwa-notification.success {
    border-left: 4px solid #28a745;
}

.pwa-notification.error {
    border-left: 4px solid #dc3545;
}

.pwa-notification.warning {
    border-left: 4px solid #ffc107;
}

.pwa-notification.info {
    border-left: 4px solid #6f42c1;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .pwa-install-banner,
    .pwa-notification-banner {
        left: 10px;
        right: 10px;
        bottom: 10px;
    }
    
    .pwa-update-prompt {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .pwa-banner-content {
        padding: 12px 16px;
        gap: 12px;
    }
    
    .pwa-banner-text h4 {
        font-size: 1rem;
    }
    
    .pwa-banner-text p {
        font-size: 0.85rem;
    }
    
    .btn-install,
    .btn-enable {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .pwa-install-banner,
    .pwa-notification-banner,
    .pwa-update-prompt {
        border: 2px solid white;
    }
    
    .btn-install,
    .btn-enable,
    .btn-update {
        border-width: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .pwa-install-banner,
    .pwa-notification-banner,
    .pwa-update-prompt,
    .pwa-notification {
        animation: none;
        transition: none;
    }
    
    .pwa-update-icon {
        animation: none;
    }
    
    .pwa-loading {
        animation: none;
        border-top-color: rgba(255, 255, 255, 0.6);
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .pwa-notification {
        background: #2d3748;
        border-color: #4a5568;
        color: white;
    }
}