/* Offline sync status — fixed, unobtrusive, colour-coded by state. The pill and
   the optional manual-sync button flow together inside #sync-status. */
#sync-status {
  position: fixed;
  bottom: 12px;
  right: 12px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

#sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: min(90vw, 360px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 6px 12px;
  border: none;
  border-radius: 999px;
  font: 600 12px/1 system-ui, sans-serif;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  opacity: 0.92;
}

#sync-pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.85;
}

#sync-pill[data-sync-state="synced"] { background: #2e7d32; }
#sync-pill[data-sync-state="pending"] { background: #ed6c02; }
#sync-pill[data-sync-state="syncing"] { background: #0277bd; }
#sync-pill[data-sync-state="offline"] { background: #616161; }
#sync-pill[data-sync-state="auth"] { background: #c62828; }

/* Pulse the status dot while syncing so progress is felt before counts change. */
#sync-pill[data-sync-state="syncing"]::before { animation: sync-pulse 1s ease-in-out infinite; }
@keyframes sync-pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }

/* Manual "Nu synchroniseren" trigger — visually subordinate to the pill. */
#sync-now {
  padding: 6px 12px;
  border: 1px solid #2e7d32;
  border-radius: 999px;
  background: #fff;
  color: #2e7d32;
  font: 600 12px/1 system-ui, sans-serif;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
#sync-now[disabled] { opacity: 0.6; cursor: default; }

/* Per-item sync badges (photos, inspection rows). */
[data-sync-badge] {
  display: inline-block;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #eee;
  color: #555;
}
[data-sync-badge="pending"],
[data-sync-badge="syncing"] { background: #fff3e0; color: #ed6c02; }
[data-sync-badge="synced"] { background: #e8f5e9; color: #2e7d32; }
[data-sync-badge="error"] { background: #ffebee; color: #c62828; }
