/* sync_indicator.css — Phase 5G PWA offline & sync indicator */

/* ── Bell button ─────────────────────────────────────────────────────────── */

.vv-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

.vv-bell:hover {
  background: var(--hover, rgba(0,0,0,.05));
}

/* ── States ──────────────────────────────────────────────────────────────── */

.vv-bell--online-pending {
  color: #d97706;
  border-color: #d97706;
  background: #fffbeb;
}

.vv-bell--syncing {
  color: var(--accent);
  border-color: var(--accent);
  animation: vv-bell-pulse 1.2s ease-in-out infinite;
}

.vv-bell--offline {
  color: #9ca3af;
  border-color: #9ca3af;
  background: var(--surface);
}

.vv-bell--dead {
  color: #dc2626;
  border-color: #dc2626;
  background: #fef2f2;
}

@keyframes vv-bell-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .5; }
}

/* ── Badge (pending count) ───────────────────────────────────────────────── */

.vv-bell-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  border-radius: 8px;
  background: #dc2626;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

/* ── Offline banner ──────────────────────────────────────────────────────── */

.vv-offline-banner {
  position: sticky;
  top: 0;
  z-index: 900;
  background: #fef3c7;
  color: #92400e;
  border-bottom: 1px solid #f59e0b;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.vv-offline-banner::before {
  content: "⚡";
  flex-shrink: 0;
}

/* Dark mode */
[data-theme="dark"] .vv-offline-banner {
  background: #451a03;
  color: #fde68a;
  border-color: #92400e;
}

[data-theme="dark"] .vv-bell--online-pending {
  background: #451a03;
}

[data-theme="dark"] .vv-bell--dead {
  background: #450a0a;
}

/* ── Sync popover ────────────────────────────────────────────────────────── */

.vv-sync-popover {
  position: fixed;
  z-index: 9999;
  width: 320px;
  max-width: 95vw;
  max-height: 420px;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.16);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.vv-sp-header {
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 700;
  border-bottom: 1px solid var(--border, #e5e7eb);
  color: var(--fg, #111);
}

.vv-sp-list {
  overflow-y: auto;
  flex: 1;
}

.vv-sp-item {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border, #f3f4f6);
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 2px 8px;
  font-size: 12px;
}

.vv-sp-item--dead {
  background: #fef2f2;
}

[data-theme="dark"] .vv-sp-item--dead {
  background: #2d0a0a;
}

.vv-sp-type {
  font-weight: 600;
  color: var(--fg, #111);
}

.vv-sp-deal {
  color: var(--accent, #01696f);
  font-weight: 600;
  text-align: right;
}

.vv-sp-time {
  color: var(--muted, #6b7280);
  font-size: 11px;
}

.vv-sp-status {
  color: var(--muted, #6b7280);
  font-size: 11px;
  text-align: right;
}

.vv-sp-error {
  grid-column: 1 / -1;
  color: #dc2626;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vv-sp-empty {
  padding: 20px 16px;
  text-align: center;
  color: var(--muted, #6b7280);
  font-size: 13px;
}

.vv-sp-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border, #e5e7eb);
}

.vv-sp-retry-btn {
  width: 100%;
  padding: 8px;
  border-radius: 8px;
  background: var(--accent, #01696f);
  color: #fff;
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.vv-sp-retry-btn:hover {
  opacity: .85;
}

/* ── Update toast ────────────────────────────────────────────────────────── */

.vv-update-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1f2937;
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 12px;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 9998;
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
}

.vv-update-toast--show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.vv-update-toast button {
  background: var(--accent, #01696f);
  color: #fff;
  border: none;
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}

/* ── Surveyor offline state in forms ─────────────────────────────────────── */

.ss-offline-note {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: #92400e;
  margin-bottom: 12px;
  display: none;
}

.ss-offline-note--show {
  display: block;
}

[data-theme="dark"] .ss-offline-note {
  background: #451a03;
  color: #fde68a;
  border-color: #92400e;
}
