/**
 * PWA Installation & Notification Styles
 * Enhanced user experience for PWA features
 * Version: 2.0.0 - 2025-09-05
 */

/* PWA Install Banner */
.pwa-install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    color: white;
    z-index: 1000;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    transform: translateY(0);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.pwa-install-banner.hidden {
    transform: translateY(100%);
    opacity: 0;
}

.pwa-banner-content {
    display: flex;
    align-items: center;
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
    gap: 1rem;
}

.pwa-banner-icon img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

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

.pwa-banner-title {
    font-weight: bold;
    font-size: 1.1rem;
    margin-bottom: 0.2rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.pwa-banner-subtitle {
    font-size: 0.9rem;
    opacity: 0.9;
    line-height: 1.3;
}

.pwa-banner-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* PWA Buttons */
.pwa-btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 20px;
    font-family: 'Comic Sans MS', cursive, sans-serif;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    white-space: nowrap;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 80px;
}

.pwa-btn-install {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
}

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

.pwa-btn-close {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 2px solid transparent;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    padding: 0;
    font-size: 1rem;
}

.pwa-btn-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.pwa-btn-primary {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.pwa-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

/* PWA Modal */
.pwa-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.pwa-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.pwa-modal-content {
    position: relative;
    background: white;
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.pwa-modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.pwa-modal-header h3 {
    margin: 0;
    color: #2e7d32;
    font-family: 'Comic Sans MS', cursive, sans-serif;
    font-size: 1.3rem;
}

.pwa-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.pwa-modal-close:hover {
    background: rgba(0, 0, 0, 0.1);
    transform: rotate(90deg);
}

.pwa-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: 60vh;
}

.pwa-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: center;
    background: #fafafa;
}

/* Install Steps */
.install-steps {
    margin: 1rem 0;
}

.step {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 12px;
    border-left: 4px solid #4caf50;
}

.step-number {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 1rem;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.step-text {
    font-size: 1.1rem;
    line-height: 1.5;
    color: #333;
}

/* PWA Notifications */
.pwa-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    max-width: 400px;
    z-index: 3000;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.pwa-notification.show {
    transform: translateX(0);
    opacity: 1;
}

.pwa-notification-content {
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    backdrop-filter: blur(10px);
    font-family: 'Comic Sans MS', cursive, sans-serif;
    font-weight: bold;
    line-height: 1.4;
}

.pwa-notification-success .pwa-notification-content {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.pwa-notification-error .pwa-notification-content {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.pwa-notification-info .pwa-notification-content {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.pwa-notification-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: currentColor;
    cursor: pointer;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.pwa-notification-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Update Banner */
.pwa-update-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: white;
    padding: 0.8rem;
    text-align: center;
    z-index: 1500;
    transform: translateY(-100%);
    transition: all 0.4s ease;
}

.pwa-update-banner.show {
    transform: translateY(0);
}

.pwa-update-banner .pwa-btn {
    margin-left: 1rem;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 0.4rem 1rem;
    font-size: 0.9rem;
}

.pwa-update-banner .pwa-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Network Status */
.pwa-network-status {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 1rem 2rem;
    border-radius: 20px;
    z-index: 4000;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
    transition: all 0.4s ease;
    font-family: 'Comic Sans MS', cursive, sans-serif;
    font-weight: bold;
    text-align: center;
}

.pwa-network-status.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.pwa-network-status.online {
    background: rgba(76, 175, 80, 0.95);
}

.pwa-network-status.offline {
    background: rgba(244, 67, 54, 0.95);
}

/* Responsive Design */
@media (max-width: 768px) {
    .pwa-banner-content {
        padding: 0.8rem;
        gap: 0.8rem;
    }
    
    .pwa-banner-title {
        font-size: 1rem;
    }
    
    .pwa-banner-subtitle {
        font-size: 0.85rem;
        display: none; /* Hide on mobile to save space */
    }
    
    .pwa-btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
    
    .pwa-btn-install {
        min-width: 70px;
    }
    
    .pwa-modal-content {
        width: 95%;
        margin: 1rem;
    }
    
    .pwa-modal-header {
        padding: 1rem;
    }
    
    .pwa-modal-body {
        padding: 1rem;
    }
    
    .pwa-notification {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .step {
        padding: 0.8rem;
    }
    
    .step-text {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .pwa-banner-content {
        flex-wrap: wrap;
        justify-content: center;
        text-align: center;
    }
    
    .pwa-banner-text {
        order: 1;
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .pwa-banner-icon {
        order: 2;
    }
    
    .pwa-banner-actions {
        order: 3;
    }
    
    .pwa-btn-close {
        display: none; /* Hide close button on very small screens */
    }
}

/* Loading States */
.pwa-loading {
    position: relative;
    overflow: hidden;
}

.pwa-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(76, 175, 80, 0.6), transparent);
    animation: pwaLoading 2s infinite;
}

@keyframes pwaLoading {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Installation Success Animation */
.pwa-install-success {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    color: white;
    padding: 2rem;
    border-radius: 20px;
    text-align: center;
    z-index: 5000;
    box-shadow: 0 20px 60px rgba(76, 175, 80, 0.4);
    animation: successBounce 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes successBounce {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.3);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.pwa-install-success .icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
    animation: bounce 2s infinite;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .pwa-modal-content {
        background: #2d2d2d;
        color: white;
    }
    
    .pwa-modal-header {
        background: linear-gradient(135deg, #3d3d3d 0%, #2d2d2d 100%);
        border-bottom-color: #444;
    }
    
    .pwa-modal-footer {
        background: #3d3d3d;
        border-top-color: #444;
    }
    
    .step {
        background: #3d3d3d;
        color: white;
    }
    
    .step-text {
        color: #e0e0e0;
    }
}