/* PWA Styles - Styles pour les fonctionnalités PWA */

/* Notifications PWA */
.pwa-update-notification,
.pwa-install-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    background: rgba(240, 246, 252, 0.95);
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    max-width: 350px;
    animation: slideInRight 0.3s ease-out;
}

.pwa-update-notification {
    border-left: 4px solid #3b82f6;
}

.pwa-install-notification {
    border-left: 4px solid #10b981;
}

.pwa-notification-content {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: #374151;
}

.pwa-notification-content span {
    flex: 1;
    font-weight: 500;
}

.pwa-notification-content button {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.pwa-notification-content button:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

#pwa-dismiss-btn {
    background: transparent !important;
    color: #6b7280 !important;
    padding: 4px 8px !important;
    font-size: 16px !important;
    font-weight: bold !important;
}

#pwa-dismiss-btn:hover {
    background: #f3f4f6 !important;
    color: #374151 !important;
}

/* Notifications de connectivité */
.connectivity-notification {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    border-radius: 25px;
    padding: 12px 20px;
    backdrop-filter: blur(10px);
    animation: slideInUp 0.3s ease-out;
}

.connectivity-notification.online {
    background: rgba(16, 185, 129, 0.9);
    color: white;
}

.connectivity-notification.offline {
    background: rgba(239, 68, 68, 0.9);
    color: white;
}

.connectivity-content {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
}

.connectivity-icon {
    font-size: 16px;
}

/* Indicateur de statut hors ligne */
.offline-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #ef4444;
    color: white;
    text-align: center;
    padding: 8px;
    font-size: 12px;
    font-weight: 500;
    z-index: 9999;
    animation: slideInDown 0.3s ease-out;
}

/* Bouton d'installation PWA */
.pwa-install-prompt {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    background: white;
    color: #4f46e5;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-weight: 500;
    font-size: 13px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 120px;
    justify-content: space-between;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.pwa-install-prompt:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    background: #f8fafc;
    border-color: #d1d5db;
}

.pwa-install-prompt:active {
    transform: translateY(0);
}

.pwa-install-prompt .install-icon {
    font-size: 14px;
    color: #6b7280;
}

.pwa-install-prompt .install-text {
    flex: 1;
    text-align: center;
}

.pwa-install-prompt .close-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #9ca3af;
    padding: 2px;
    line-height: 1;
    transition: color 0.2s ease;
    margin-left: 4px;
}

.pwa-install-prompt .close-btn:hover {
    color: #6b7280;
}

.pwa-install-prompt.hidden {
    display: none;
}

/* Mode sombre */
@media (prefers-color-scheme: dark) {
    .pwa-install-prompt {
        background: #1f2937;
        color: #e5e7eb;
        border-color: #374151;
    }
    
    .pwa-install-prompt:hover {
        background: #111827;
        border-color: #4b5563;
    }
    
    .pwa-install-prompt .install-icon {
        color: #9ca3af;
    }
    
    .pwa-install-prompt .close-btn {
        color: #6b7280;
    }
    
    .pwa-install-prompt .close-btn:hover {
        color: #9ca3af;
    }
}

/* Splash screen PWA */
.pwa-splash {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    animation: fadeOut 0.5s ease-out 2s forwards;
}

.pwa-splash-content {
    text-align: center;
    color: white;
}

.pwa-splash-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    animation: bounce 1s infinite;
}

.pwa-splash-title {
    font-size: 24px;
    font-weight: 300;
    margin-bottom: 10px;
}

.pwa-splash-subtitle {
    font-size: 14px;
    opacity: 0.8;
}

/* Mode sombre PWA */
@media (prefers-color-scheme: dark) {
    .pwa-update-notification,
    .pwa-install-notification {
        background: rgba(31, 41, 55, 0.95);
        border-color: #374151;
    }
    
    .pwa-notification-content {
        color: #f9fafb;
    }
    
    #pwa-dismiss-btn:hover {
        background: #374151 !important;
        color: #f9fafb !important;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .pwa-update-notification,
    .pwa-install-notification {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .pwa-install-prompt {
        bottom: 10px;
        right: 10px;
        left: 10px;
        text-align: center;
        border-radius: 12px;
    }
    
    .connectivity-notification {
        bottom: 10px;
        left: 10px;
        right: 10px;
        transform: none;
    }
}

/* Animations */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

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

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        visibility: hidden;
    }
}

/* Styles pour les éléments en mode hors ligne */
.offline-mode {
    filter: grayscale(0.3);
    opacity: 0.8;
}

.offline-disabled {
    pointer-events: none;
    opacity: 0.5;
    position: relative;
}

.offline-disabled::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.1);
    z-index: 1;
}

/* Badge de statut de cache */
.cache-status-badge {
    position: fixed;
    top: 70px;
    right: 20px;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cache-status-badge.cached {
    background: rgba(16, 185, 129, 0.8);
}

.cache-status-badge.loading {
    background: rgba(245, 158, 11, 0.8);
}

.cache-status-badge.error {
    background: rgba(239, 68, 68, 0.8);
}