/* ============================================================
   network-status.css — global online/offline status indicator
   Injected by /js/networkStatus.js on every page. Kept in its
   own file so it can be linked independently of the navbar.
   ============================================================ */

.net-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.22);
  color: #fff;
  font-family: var(--font-family-base, 'Segoe UI', system-ui, sans-serif);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: default;
  flex-shrink: 0;
  transition: background-color .3s ease, border-color .3s ease;
}

/* Floating fallback for pages without the shared navbar (e.g. auth screens) */
.net-status--floating {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 4000;
  background: #1a1d2e;
  border-color: rgba(255,255,255,0.14);
  box-shadow: 0 8px 24px rgba(0,0,0,.22);
}

.net-status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #9ca3af;
  box-shadow: 0 0 0 0 rgba(0,0,0,0);
  transition: background-color .35s ease, box-shadow .35s ease;
}

.net-status-text {
  transition: opacity .2s ease;
}

/* ---- State colors ---- */
.net-status[data-state="connecting"] .net-status-dot {
  background: #eab308;
  animation: net-pulse 1s ease-in-out infinite;
}
.net-status[data-state="online"] .net-status-dot {
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34,197,94,.18);
}
.net-status[data-state="offline"] .net-status-dot {
  background: #ef4444;
  animation: net-pulse 1.4s ease-in-out infinite;
}
.net-status[data-state="server_unavailable"] .net-status-dot {
  background: #f97316;
  animation: net-pulse 1.4s ease-in-out infinite;
}

@keyframes net-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0,0,0,.16); }
  50%      { box-shadow: 0 0 0 4px rgba(0,0,0,0); }
}

/* Text hidden on narrow viewports — icon + tooltip only */
@media (max-width: 860px) {
  .net-status-text { display: none; }
  .net-status { padding: 0; width: 34px; justify-content: center; }
}

/* ---- Offline / degraded banner ---- */
.net-banner {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%) translateY(-14px);
  z-index: 5000;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(560px, calc(100vw - 32px));
  padding: 12px 14px 12px 16px;
  border-radius: 12px;
  background: #1a1d2e;
  color: #fff;
  box-shadow: 0 14px 36px rgba(0,0,0,.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.net-banner.net-banner--show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.net-banner.net-banner--offline { background: #7f1d1d; }
.net-banner.net-banner--server_unavailable { background: #7c2d12; }
.net-banner.net-banner--success { background: #14532d; }

.net-banner-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
  flex-shrink: 0;
}

.net-banner-text {
  font-family: var(--font-family-base, 'Segoe UI', system-ui, sans-serif);
  font-size: 13.5px;
  line-height: 1.4;
}

.net-banner-close {
  margin-left: 4px;
  background: rgba(255,255,255,.14);
  border: none;
  color: #fff;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 13px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color .15s ease;
}
.net-banner-close:hover { background: rgba(255,255,255,.26); }

@media (max-width: 640px) {
  .net-banner { left: 16px; right: 16px; transform: translateY(-14px); max-width: none; }
  .net-banner.net-banner--show { transform: translateY(0); }
}

/* ---- Database unavailable / restarting (see networkStatus.js) ---- */
.net-status[data-state="database_unavailable"] .net-status-dot {
  background: #f97316;
  animation: net-pulse 1.4s ease-in-out infinite;
}
.net-status[data-state="restarting"] .net-status-dot {
  background: #60a5fa;
  animation: net-pulse 1s ease-in-out infinite;
}
.net-banner.net-banner--restarting { background: #1e3a8a; }
.net-banner.net-banner--update { background: #1e293b; }

.net-banner-action {
  background: #fff;
  color: #1e293b;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font: 600 12.5px var(--font-family-base, 'Segoe UI', system-ui, sans-serif);
  cursor: pointer;
  flex-shrink: 0;
}
.net-banner-action:hover { background: #e2e8f0; }

/* ---- Maintenance bar: stays up while maintenance mode is on ---- */
.maint-bar {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 16px;
  background: #fff7ed;
  color: #7c2d12;
  border-bottom: 1px solid #fdba74;
  font-family: var(--font-family-base, 'Segoe UI', system-ui, sans-serif);
  font-size: 13.5px;
  line-height: 1.45;
}
.maint-bar-label {
  flex-shrink: 0;
  padding: 1px 8px;
  border-radius: 999px;
  background: #c2410c;
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.maint-bar-text { min-width: 0; overflow-wrap: anywhere; }

/* In the app shell: in the page flow beside the sidebar, like announcements */
.maint-bar--app {
  position: relative;
  z-index: 1500;
  flex: 0 0 auto;
  margin-left: var(--sidebar-w, 0);
  transition: margin-left 0.2s ease;
}
body.sidebar-collapsed .maint-bar--app { margin-left: var(--sidebar-w-collapsed, 0); }
@media (max-width: 768px) { .maint-bar--app { margin-left: 0 !important; } }

/* Bare pages (login, status): pinned to the top */
.maint-bar--fixed {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 4500;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0,0,0,.08);
}

/* ---- Public downtime notices (login page, /status) — /js/systemNotices.js ---- */
.sys-notices { display: grid; gap: 10px; margin: 0 0 22px; }
.sys-notices[hidden] { display: none; }
.sys-notice {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #c7d2fe;
  background: #eef2ff;
  color: #312e81;
  font-family: var(--font-family-base, 'Segoe UI', system-ui, sans-serif);
  font-size: 13.5px;
  line-height: 1.45;
}
.sys-notice--warning { background: #fffbeb; color: #78350f; border-color: #fde68a; }
.sys-notice--critical { background: #fef2f2; color: #7f1d1d; border-color: #fecaca; }
.sys-notice-label {
  display: inline-block;
  margin-right: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  opacity: .85;
}
.sys-notice-title { font-weight: 700; }
.sys-notice-body { margin: 4px 0 0; white-space: pre-line; overflow-wrap: anywhere; }
.sys-notice-meta { margin: 6px 0 0; font-size: 12px; opacity: .8; }

/* ==== DARK THEME: generated by scripts/theme/generate-dark.js — do not edit by hand; run `npm run theme:dark` after changing the styles above. ==== */
@media screen {
  :root[data-theme="dark"] .net-status--floating:not(:where(.theme-paper, .theme-paper *)) {
    background: #2d314e;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.396);
  }
  :root[data-theme="dark"] .net-status-dot:not(:where(.theme-paper, .theme-paper *)) {
    background: #393e5d;
    box-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
  }
  :root[data-theme="dark"] .net-banner:not(:where(.theme-paper, .theme-paper *)) {
    background: #2d314e;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.504);
  }
  :root[data-theme="dark"] .net-banner-dot:not(:where(.theme-paper, .theme-paper *)) {
    background: #181b2d;
  }
  :root[data-theme="dark"] .net-banner.net-banner--update:not(:where(.theme-paper, .theme-paper *)) {
    background: #2d314e;
  }
  :root[data-theme="dark"] .net-banner-action:not(:where(.theme-paper, .theme-paper *)) {
    background: #181b2d;
    color: #cccdd8;
  }
  :root[data-theme="dark"] .net-banner-action:hover:not(:where(.theme-paper, .theme-paper *)) {
    background: #24283c;
  }
  :root[data-theme="dark"] .maint-bar:not(:where(.theme-paper, .theme-paper *)) {
    background: #202234;
    color: #eea288;
    border-bottom: 1px solid #6b4d2e;
  }
  :root[data-theme="dark"] .maint-bar--fixed:not(:where(.theme-paper, .theme-paper *)) {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.144);
  }
  :root[data-theme="dark"] .sys-notice:not(:where(.theme-paper, .theme-paper *)) {
    border: 1px solid #2e3a6b;
    background: #212437;
    color: #9a98da;
  }
  :root[data-theme="dark"] .sys-notice--warning:not(:where(.theme-paper, .theme-paper *)) {
    background: #181b2d;
    color: #f0ac86;
    border-color: #6b5f2e;
  }
  :root[data-theme="dark"] .sys-notice--critical:not(:where(.theme-paper, .theme-paper *)) {
    background: #212335;
    color: #e58f8f;
    border-color: #6b2e2e;
  }
}
/* ==== END DARK THEME ==== */
