/* Vigil Monitor — application styles.
   Built on Bootstrap 5.3; only what Bootstrap does not already give us. */

:root {
  --vg-sidebar-w: 236px;
  --vg-up: #12b76a;
  --vg-down: #f04438;
  --vg-degraded: #f79009;
  --vg-maint: #0ea5e9;
  --vg-paused: #98a2b3;
  --vg-radius: 12px;
}

[data-bs-theme="dark"] {
  --bs-body-bg: #0f1520;
  --bs-tertiary-bg: #161e2b;
}

body.vg-app { background: var(--bs-tertiary-bg); }

/* ---------------------------------------------------------------- chrome */

.vg-topbar {
  background: var(--bs-body-bg);
  border-bottom: 1px solid var(--bs-border-color);
  min-height: 56px;
}

.vg-logo {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px;
  background: linear-gradient(135deg, #0d6efd, #6610f2);
  color: #fff; font-size: 15px;
}
.vg-logo-lg { width: 48px; height: 48px; font-size: 22px; border-radius: 12px; }

.vg-shell { display: flex; min-height: calc(100vh - 56px); }

.vg-sidebar {
  width: var(--vg-sidebar-w);
  flex: 0 0 var(--vg-sidebar-w);
  background: var(--bs-body-bg);
  border-right: 1px solid var(--bs-border-color);
  position: sticky; top: 56px;
  height: calc(100vh - 56px);
  display: flex; flex-direction: column;
}
@media (max-width: 991.98px) {
  .vg-sidebar { position: fixed; height: 100%; top: 0; }
}

.vg-main { flex: 1 1 auto; min-width: 0; }

/* At >=lg Bootstrap turns .offcanvas-lg .offcanvas-body into a flex ROW, which
   pushes the sidebar footer alongside the nav and squeezes the labels. */
.vg-sidebar .offcanvas-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  padding: 0;
}

.vg-nav { padding: 12px 10px; flex: 1 1 auto; overflow-y: auto; }
.vg-nav-group {
  font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--bs-secondary-color); padding: 14px 10px 6px; font-weight: 600;
}
.vg-nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  color: var(--bs-body-color); text-decoration: none;
  font-size: 14px; line-height: 1.2;
}
.vg-nav-link:hover { background: var(--bs-tertiary-bg); }
.vg-nav-link.active { background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis); font-weight: 600; }
.vg-nav-link i { width: 18px; text-align: center; font-size: 15px; flex: 0 0 auto; }
.vg-nav-link span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.vg-sidebar-foot {
  padding: 10px 16px;
  border-top: 1px solid var(--bs-border-color);
  flex: 0 0 auto;
  margin-top: auto;
}

.vg-flash-stack { position: sticky; top: 62px; z-index: 20; }

/* ----------------------------------------------------------------- cards */

.vg-card {
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: var(--vg-radius);
}
.vg-card-head {
  padding: 14px 16px; border-bottom: 1px solid var(--bs-border-color);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.vg-card-body { padding: 16px; }

.vg-stat { display: flex; flex-direction: column; gap: 2px; }
.vg-stat .value { font-size: 26px; font-weight: 700; line-height: 1.1; }
.vg-stat .label { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--bs-secondary-color); }

/* ---------------------------------------------------------- status atoms */

.vg-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.vg-dot.up { background: var(--vg-up); }
.vg-dot.down { background: var(--vg-down); }
.vg-dot.degraded { background: var(--vg-degraded); }
.vg-dot.maintenance { background: var(--vg-maint); }
.vg-dot.paused, .vg-dot.pending { background: var(--vg-paused); }

.vg-dot.down { animation: vg-throb 1.6s ease-in-out infinite; }
@keyframes vg-throb {
  0%, 100% { box-shadow: 0 0 0 0 rgba(240, 68, 56, .5); }
  50% { box-shadow: 0 0 0 5px rgba(240, 68, 56, 0); }
}

.vg-pulse { align-items: center; gap: 6px; }
.vg-pulse .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--vg-up);
  animation: vg-blink 2s ease-in-out infinite;
}
.vg-pulse.stale .dot { background: var(--vg-down); }
@keyframes vg-blink { 0%,100% { opacity: 1 } 50% { opacity: .25 } }

/* -------------------------------------------------------------- monitors */

.vg-monitor-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--bs-border-color);
  text-decoration: none; color: inherit;
}
.vg-monitor-row:last-child { border-bottom: 0; }
.vg-monitor-row:hover { background: var(--bs-tertiary-bg); }
.vg-monitor-name { font-weight: 600; font-size: 14px; }
.vg-monitor-target {
  font-size: 12px; color: var(--bs-secondary-color);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}

/* Uptime bar strip — the signature status-page element. */
.vg-bars { display: flex; gap: 2px; align-items: flex-end; height: 30px; }
.vg-bars.sm { height: 20px; gap: 1.5px; }
.vg-bar {
  flex: 1 1 0; min-width: 2px; height: 100%; border-radius: 2px;
  background: var(--vg-up); opacity: .92; transition: opacity .12s;
}
.vg-bar:hover { opacity: 1; transform: scaleY(1.06); }
.vg-bar.down { background: var(--vg-down); }
.vg-bar.degraded { background: var(--vg-degraded); }
.vg-bar.partial { background: linear-gradient(to top, var(--vg-down) 0 35%, var(--vg-up) 35% 100%); }
.vg-bar.empty { background: var(--bs-border-color); }

.vg-badge-status { font-size: 11px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; }

.vg-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

.vg-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------------ auth */

body.vg-auth {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--bs-tertiary-bg), var(--bs-body-bg));
  padding: 24px 16px;
}
.vg-auth-wrap { width: 100%; max-width: 420px; }
.vg-auth-card {
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 16px; padding: 28px;
  box-shadow: 0 12px 40px rgba(16, 24, 40, .08);
}

/* -------------------------------------------------------------- wallboard */

body.vg-tv { background: #0a0e16; color: #e6ecf5; }
.vg-tv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.vg-tv-tile {
  border-radius: 14px; padding: 16px; border: 1px solid #1d2635; background: #121a26;
  display: flex; flex-direction: column; gap: 6px; min-height: 110px;
}
.vg-tv-tile.down { background: #2a1418; border-color: #7a2530; }
.vg-tv-tile.degraded { background: #2a2114; border-color: #7a5c25; }
.vg-tv-tile .name { font-size: 17px; font-weight: 600; }
.vg-tv-tile .meta { font-size: 12px; color: #8a97ab; }

/* --------------------------------------------------------------- helpers */

.vg-scroll-y { max-height: 420px; overflow-y: auto; }
.form-hint { font-size: 12px; color: var(--bs-secondary-color); }
.vg-sticky-actions {
  position: sticky; bottom: 0; background: var(--bs-body-bg);
  border-top: 1px solid var(--bs-border-color); padding: 12px 16px; z-index: 5;
  border-radius: 0 0 var(--vg-radius) var(--vg-radius);
}
.vg-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px;
  background: var(--bs-tertiary-bg); border: 1px solid var(--bs-border-color);
  border-radius: 8px; padding: 10px 12px; overflow-x: auto; white-space: pre;
}
.vg-copy { cursor: pointer; }
table.vg-table td, table.vg-table th { vertical-align: middle; }
.vg-empty { text-align: center; padding: 48px 16px; color: var(--bs-secondary-color); }
.vg-empty i { font-size: 34px; display: block; margin-bottom: 10px; opacity: .5; }
