/* ============================================
   PWA — Styles spécifiques à l'application offline-first
   ============================================ */

/* Barre de connectivité */
#pwaConnectivityBar {
  font-family: 'Google Sans', system-ui, sans-serif;
  letter-spacing: 0.2px;
}

/* Bannière de mise à jour */
#pwaUpdateBanner {
  font-family: 'Google Sans', system-ui, sans-serif;
}

/* Bannière d'installation */
#pwaInstallBannerV2 {
  font-family: 'Google Sans', system-ui, sans-serif;
}

/* Toast de notification */
.pwa-toast {
  font-family: 'Google Sans', system-ui, sans-serif;
}

/* Badge de statut de synchronisation dans les tableaux */
.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.sync-badge.draft {
  background: #f3f4f6;
  color: #6b7280;
}

.sync-badge.pending {
  background: #fef3c7;
  color: #92400e;
}

.sync-badge.syncing {
  background: #dbeafe;
  color: #1e40af;
  animation: sync-pulse 1.5s ease-in-out infinite;
}

.sync-badge.synced {
  background: #d1fae5;
  color: #065f46;
}

.sync-badge.conflict {
  background: #fee2e2;
  color: #991b1b;
}

.sync-badge.error {
  background: #fecaca;
  color: #7f1d1d;
}

/* Indicateur de file d'attente de sync */
#pwaSyncBadge {
  font-family: 'Google Sans', system-ui, sans-serif;
  user-select: none;
  -webkit-user-select: none;
}

#pwaSyncBadge:hover {
  transform: scale(1.05);
}

/* Animation de pulsation pour synchronisation */
@keyframes sync-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.sync-pulsing {
  animation: sync-pulse 1.5s ease-in-out infinite;
}

/* Mode sombre automatique (si le thème supporte) */
@media (prefers-color-scheme: dark) {
  #pwaInstallBannerV2 {
    background: #1f2937 !important;
    border-color: #374151 !important;
  }
  #pwaInstallBannerV2 div {
    color: #e5e7eb !important;
  }
}

/* Amélioration de l'affichage en mode standalone PWA */
@media all and (display-mode: standalone) {
  body {
    -webkit-user-select: none;
    user-select: none;
  }
  input, textarea, [contenteditable] {
    -webkit-user-select: text;
    user-select: text;
  }
  .pwa-install-banner-v2 {
    display: none !important;
  }
  #installNotification {
    display: none !important;
  }
}

/* Indicateur de chargement offline */
.offline-loading {
  position: relative;
}

.offline-loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, #d41b24, #17a1de, #d41b24);
  background-size: 200% 100%;
  animation: loading-bar 1.5s ease-in-out infinite;
}

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

/* Message de statut pour les données offline */
.offline-data-notice {
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 12px;
  color: #92400e;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.offline-data-notice i {
  font-size: 14px;
}

/* Indicateur de connexion dans la sidebar */
.online-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  transition: background 0.3s;
}

.online-indicator.online { background: #22c55e; }
.online-indicator.offline { background: #ef4444; }

/* Notification toast pour sync */
.sync-toast {
  position: fixed;
  bottom: 80px;
  right: 16px;
  z-index: 1060;
  background: #1e293b;
  color: #fff;
  padding: 10px 18px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 320px;
  animation: fadeInUp 0.3s ease;
  font-weight: 500;
  font-family: 'Google Sans', system-ui, sans-serif;
}
