/* Network Notifier — topbar badge, dashboard banner, and details panel.
   Driven by js/network-notifier.js. Uses the --page-network identity hue
   (rose) so it reads as a distinct "network attention" signal next to the
   amber update badge. Falls back gracefully if the token is absent. */

/* ---- Topbar badge -------------------------------------------------------- */

.network-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--page-network, #e5556e);
  border-radius: 6px;
  background: rgba(var(--page-network-rgb, 229, 85, 110), 0.14);
  color: var(--page-network, #e5556e);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  white-space: nowrap;
}

.network-badge:hover { background: rgba(var(--page-network-rgb, 229, 85, 110), 0.24); }
.network-badge:active { transform: scale(0.97); }

.network-badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--page-network, #e5556e);
  box-shadow: 0 0 0 0 rgba(var(--page-network-rgb, 229, 85, 110), 0.6);
  animation: network-badge-pulse 2s infinite;
}

@keyframes network-badge-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(var(--page-network-rgb, 229, 85, 110), 0.6); }
  70%  { box-shadow: 0 0 0 7px rgba(var(--page-network-rgb, 229, 85, 110), 0); }
  100% { box-shadow: 0 0 0 0 rgba(var(--page-network-rgb, 229, 85, 110), 0); }
}

@media (prefers-reduced-motion: reduce) {
  .network-badge-dot { animation: none; }
}

/* ---- Dashboard banner ---------------------------------------------------- */

.network-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  padding: 16px 20px;
  border: 1px solid var(--page-network, #e5556e);
  border-left-width: 4px;
  border-radius: 10px;
  background: rgba(var(--page-network-rgb, 229, 85, 110), 0.1);
  color: var(--text-primary, #fff);
}

.network-banner-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: var(--page-network, #e5556e);
}

.network-banner-text { flex: 1 1 auto; min-width: 0; }
.network-banner-title { font-weight: 700; font-size: 1rem; }

.network-banner-sub {
  margin-top: 2px;
  font-size: 0.85rem;
  color: var(--text-muted, #9aa);
}

.network-banner-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

/* ---- Shared action buttons ----------------------------------------------- */

.network-btn-primary,
.network-btn-secondary {
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  border: 1px solid transparent;
  white-space: nowrap;
}

.network-btn-primary {
  background: var(--page-network, #e5556e);
  color: var(--text-on-accent, #fff);
}

.network-btn-primary:hover { filter: brightness(1.08); }

.network-btn-secondary {
  background: transparent;
  border-color: var(--border-color, rgba(255, 255, 255, 0.2));
  color: var(--text-primary, #fff);
}

.network-btn-secondary:hover { background: var(--surface-hover, rgba(255, 255, 255, 0.08)); }

/* ---- Details panel (modal) ----------------------------------------------- */

.network-panel-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
}

.network-panel {
  width: 100%;
  max-width: 460px;
  border: 1px solid var(--card-border, var(--border-color, rgba(255, 255, 255, 0.15)));
  border-radius: 12px;
  background: var(--card-bg, var(--surface-bg-solid, #1b1f2a));
  box-shadow: var(--card-shadow, 0 20px 60px rgba(0, 0, 0, 0.45));
  color: var(--text-primary, #fff);
  overflow: hidden;
}

.network-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
}

.network-panel-header h3 { margin: 0; font-size: 1.05rem; }

.network-panel-close {
  border: none;
  background: transparent;
  color: var(--text-muted, #9aa);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.network-panel-close:hover { color: var(--text-primary, #fff); }

.network-panel-status {
  padding: 14px 20px 0;
  font-size: 0.9rem;
  color: var(--text-secondary, var(--text-muted, #9aa));
}

.network-panel-status.is-conflict {
  color: var(--page-network, #e5556e);
  font-weight: 600;
}

.network-panel-error {
  margin: 12px 20px 0;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.82rem;
  background: rgba(var(--status-danger-rgb, 220, 53, 69), 0.12);
  color: var(--status-danger, #dc3545);
}

.network-panel-rows {
  margin: 14px 0 0;
  padding: 0 20px;
}

.network-panel-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
  font-size: 0.88rem;
}

.network-panel-row:last-child { border-bottom: none; }
.network-panel-row dt { color: var(--text-muted, #9aa); margin: 0; }

.network-panel-row dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
  word-break: break-word;
}

/* affected-apps list */
.network-panel-apps {
  margin: 14px 20px 0;
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  border-radius: 8px;
  overflow: hidden;
}

.network-panel-app {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  font-size: 0.84rem;
  border-bottom: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
}

.network-panel-app:last-child { border-bottom: none; }
.network-panel-app-name { font-weight: 600; }
.network-panel-app-ip { color: var(--text-muted, #9aa); font-family: var(--font-mono, monospace); }

.network-panel-note {
  margin: 14px 20px 0;
  font-size: 0.8rem;
  color: var(--text-muted, #9aa);
  line-height: 1.45;
}

.network-panel-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 18px 20px 20px;
}

@media (max-width: 600px) {
  .network-banner { flex-wrap: wrap; }
  .network-banner-actions { width: 100%; }
  .network-banner-actions button { flex: 1 1 auto; }
}
