/* MikroWatch — tema internal (di atas AdminLTE 4 / Bootstrap 5) */

:root {
  --mw-cyan: #00c2d1;
  --mw-cyan-strong: #00f2fe;
  --mw-emerald: #10b981;
  --mw-crimson: #ef4444;
  --mw-amber: #f59e0b;
  --mw-surface: rgba(255, 255, 255, 0.03);
  --mw-border: rgba(148, 163, 184, 0.18);
  --mw-radius: 0.85rem;
  --mw-font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mw-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
}

html,
body {
  font-family: var(--mw-font);
}

body.mw-admin {
  min-height: 100vh;
  background:
    radial-gradient(1100px 600px at 85% -10%, rgba(0, 194, 209, 0.12), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(16, 185, 129, 0.08), transparent 55%),
    #0a0f1d;
  background-attachment: fixed;
}

.mw-icon {
  vertical-align: -0.15em;
  flex-shrink: 0;
}

/* ---------- Sidebar & header ---------- */

.app-sidebar {
  --bs-bg-opacity: 1;
  border-right: 1px solid var(--mw-border);
}

.sidebar-brand {
  border-bottom: 1px solid var(--mw-border);
  padding: 0.9rem 1rem;
}

.sidebar-brand .brand-link {
  color: inherit;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.mw-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 0.6rem;
  color: #04121a;
  background: linear-gradient(135deg, var(--mw-cyan-strong), var(--mw-emerald));
  box-shadow: 0 0 18px rgba(0, 242, 254, 0.25);
}

.sidebar-menu .nav-link {
  border-radius: 0.55rem;
  margin: 0.15rem 0.5rem;
  color: rgba(226, 232, 240, 0.82);
}

.sidebar-menu .nav-link:hover {
  background: rgba(0, 194, 209, 0.1);
  color: #fff;
}

.sidebar-menu .nav-link.active {
  background: linear-gradient(90deg, rgba(0, 194, 209, 0.22), rgba(0, 194, 209, 0.04));
  color: #fff;
  box-shadow: inset 2px 0 0 var(--mw-cyan);
}

.sidebar-menu .nav-icon {
  display: inline-flex;
  align-items: center;
  width: 1.6rem;
}

.mw-sidebar-note {
  margin: 1.5rem 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--mw-border);
}

.app-header {
  border-bottom: 1px solid var(--mw-border);
  backdrop-filter: blur(8px);
}

.mw-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 600;
  color: #04121a;
  background: linear-gradient(135deg, var(--mw-cyan-strong), var(--mw-emerald));
  text-transform: uppercase;
}

.app-footer {
  border-top: 1px solid var(--mw-border);
  color: rgba(148, 163, 184, 0.85);
  font-size: 0.82rem;
}

/* ---------- Cards & metric ---------- */

.card {
  --bs-card-bg: rgba(15, 23, 42, 0.72);
  --bs-card-border-color: var(--mw-border);
  border-radius: var(--mw-radius);
  backdrop-filter: blur(10px);
}

.card-header {
  background: rgba(148, 163, 184, 0.05);
  border-bottom: 1px solid var(--mw-border);
}

.mw-metric {
  position: relative;
  overflow: hidden;
  height: 100%;
}

.mw-metric::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: rgba(148, 163, 184, 0.35);
}

.mw-metric-up::before {
  background: var(--mw-emerald);
}

.mw-metric-down::before {
  background: var(--mw-crimson);
}

.mw-metric-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.95);
}

.mw-metric-value {
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.15;
  margin-top: 0.35rem;
  font-variant-numeric: tabular-nums;
}

.mw-metric-hint {
  font-size: 0.78rem;
  color: rgba(148, 163, 184, 0.85);
}

.mw-empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  color: var(--mw-cyan);
  background: rgba(0, 194, 209, 0.1);
  border: 1px solid rgba(0, 194, 209, 0.25);
}

/* ---------- Status pill ---------- */

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  white-space: nowrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.status-up {
  color: #34d399;
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
}

.status-up .status-dot {
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
  animation: mw-pulse 2s infinite;
}

.status-down {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
}

.status-down .status-dot {
  animation: mw-pulse-red 1.4s infinite;
}

.status-unknown {
  color: #cbd5e1;
  background: rgba(148, 163, 184, 0.12);
  border-color: rgba(148, 163, 184, 0.3);
}

.status-meta {
  font-weight: 500;
  opacity: 0.85;
  font-variant-numeric: tabular-nums;
}

@keyframes mw-pulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55); }
  70% { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes mw-pulse-red {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
  70% { box-shadow: 0 0 0 7px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .status-dot {
    animation: none !important;
  }
}

/* ---------- Tables & forms ---------- */

.table {
  --bs-table-bg: transparent;
  --bs-table-color: inherit;
  --bs-table-border-color: var(--mw-border);
}

.table > :not(caption) > * > * {
  padding: 0.65rem 0.9rem;
}

.mw-search {
  position: relative;
  min-width: 220px;
}

.mw-search .mw-icon {
  position: absolute;
  left: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(148, 163, 184, 0.8);
  pointer-events: none;
}

.mw-search input {
  padding-left: 2rem;
}

code {
  color: var(--mw-cyan);
}

.form-control,
.form-select {
  background-color: rgba(2, 6, 23, 0.55);
  border-color: rgba(148, 163, 184, 0.25);
}

.form-control:focus,
.form-select:focus {
  background-color: rgba(2, 6, 23, 0.75);
  border-color: var(--mw-cyan);
  box-shadow: 0 0 0 0.2rem rgba(0, 194, 209, 0.18);
}

.btn-primary {
  --bs-btn-bg: #0891b2;
  --bs-btn-border-color: #0891b2;
  --bs-btn-hover-bg: #0e7490;
  --bs-btn-hover-border-color: #0e7490;
  --bs-btn-active-bg: #155e75;
  --bs-btn-active-border-color: #155e75;
}

.mw-flash .alert {
  border-radius: var(--mw-radius);
}

/* ---------- Auth ---------- */

body.mw-auth {
  min-height: 100vh;
  background:
    radial-gradient(800px 500px at 20% 0%, rgba(0, 194, 209, 0.16), transparent 60%),
    radial-gradient(700px 400px at 100% 100%, rgba(16, 185, 129, 0.12), transparent 55%),
    #070c16;
}

.mw-auth-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.mw-auth-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 1.4rem;
  letter-spacing: 0.02em;
}

.mw-auth-card {
  width: 100%;
  max-width: 420px;
  padding: 1.75rem;
  border-radius: 1rem;
  border: 1px solid var(--mw-border);
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(14px);
  box-shadow: 0 20px 60px rgba(2, 6, 23, 0.55);
}

.mw-auth-footer {
  margin-top: 1.4rem;
  margin-bottom: 0;
  text-align: center;
}

.mw-error-code {
  font-size: 3.2rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.05em;
  background: linear-gradient(120deg, var(--mw-cyan-strong), var(--mw-emerald));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Admin: assignment ---------- */

.mw-access-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--mw-border);
  border-radius: 0.7rem;
  background: rgba(2, 6, 23, 0.35);
  cursor: pointer;
  height: 100%;
}

.mw-access-item:hover {
  border-color: rgba(0, 194, 209, 0.45);
  background: rgba(0, 194, 209, 0.06);
}

.mw-access-item .form-check-input {
  margin: 0;
  flex-shrink: 0;
}


/* ---------- Live badge, kartu armada, grafik ---------- */

.mw-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--mw-border);
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.6);
}

.mw-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
}

.mw-live-badge.is-live {
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.45);
}

.mw-live-badge.is-live .mw-live-dot {
  background: var(--mw-emerald);
  animation: mw-pulse 2s infinite;
}

.mw-live-badge.is-offline {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.45);
}

.mw-live-badge.is-offline .mw-live-dot {
  background: var(--mw-crimson);
}

.mw-router-card {
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.mw-router-card:hover {
  border-color: rgba(0, 194, 209, 0.35);
  transform: translateY(-1px);
}

.mw-router-card.mw-card-stale {
  border-style: dashed;
  opacity: 0.9;
}

.mw-router-name {
  color: #e2e8f0;
}

.mw-router-name:hover {
  color: var(--mw-cyan-strong);
}

.mw-live-value {
  font-size: 1.1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.mw-bar {
  height: 6px;
  margin-top: 0.4rem;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(148, 163, 184, 0.16);
}

.mw-bar > span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--mw-cyan), #3b82f6);
  transition: width 0.6s ease;
}

.mw-bar-up > span {
  background: linear-gradient(90deg, #8b5cf6, #6d28d9);
}

.mw-chart-wrap {
  position: relative;
  height: 320px;
}

.mw-uptime-value {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(120deg, var(--mw-cyan-strong), var(--mw-emerald));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.mw-scroll-menu {
  max-height: 60vh;
  overflow-y: auto;
}

.card-header-tabs .nav-link {
  color: rgba(226, 232, 240, 0.72);
  border: 0;
  border-bottom: 2px solid transparent;
}

.card-header-tabs .nav-link.active {
  color: #fff;
  background: transparent;
  border-bottom-color: var(--mw-cyan);
}

.min-w-0 {
  min-width: 0;
}

@media (max-width: 575.98px) {
  .mw-chart-wrap {
    height: 240px;
  }
}

/* ---------- Utility ---------- */

.mw-mono {
  font-family: var(--mw-mono);
  font-variant-numeric: tabular-nums;
}

.mw-tabular {
  font-variant-numeric: tabular-nums;
}

/* ---------- Detail router: kartu klik, rentang, status bar ---------- */

.mw-card-link {
  color: inherit;
  text-decoration: none;
  display: block;
}

.mw-card-link:hover {
  color: inherit;
}

.mw-card-link:focus-visible {
  outline: 2px solid var(--mw-cyan);
  outline-offset: 2px;
}

.mw-range {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  padding: 0.2rem;
  border-radius: 0.7rem;
  border: 1px solid var(--mw-border);
  background: rgba(15, 23, 42, 0.6);
}

.mw-range-btn {
  padding: 0.3rem 0.7rem;
  border-radius: 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(226, 232, 240, 0.75);
  text-decoration: none;
  white-space: nowrap;
}

.mw-range-btn:hover {
  color: #fff;
  background: rgba(0, 194, 209, 0.1);
}

.mw-range-btn.is-active {
  color: #04121a;
  background: linear-gradient(135deg, var(--mw-cyan-strong), var(--mw-emerald));
}

.mw-detail-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.mw-status-bar {
  position: relative;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(16, 185, 129, 0.5);
  border: 1px solid var(--mw-border);
}

.mw-status-bar .mw-status-down {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--mw-crimson);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.6);
}

.mw-bar-legend {
  display: inline-block;
  width: 12px;
  height: 8px;
  border-radius: 2px;
  margin-right: 0.25rem;
}

.mw-bar-legend.mw-bar-up {
  background: rgba(16, 185, 129, 0.85);
}

.mw-bar-legend.mw-bar-down {
  background: var(--mw-crimson);
}

.mw-incident-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 0.85rem;
}

.mw-incident-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.mw-incident-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mw-crimson);
  flex-shrink: 0;
}

.mw-summary-tile {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.55rem 0.75rem;
  border-radius: 0.6rem;
  border: 1px solid var(--mw-border);
  background: rgba(15, 23, 42, 0.5);
  font-size: 0.72rem;
  color: rgba(148, 163, 184, 0.92);
}

.mw-summary-tile strong {
  font-size: 0.95rem;
  color: #e2e8f0;
  font-variant-numeric: tabular-nums;
}

.mw-chart-short {
  height: 220px;
}

/* ---------- Custom range ---------- */

.mw-range-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.mw-custom-range {
  display: none;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: flex-end;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--mw-border);
  border-radius: 0.7rem;
  background: rgba(15, 23, 42, 0.6);
}

.mw-custom-range.is-open {
  display: flex;
}

.mw-custom-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.95);
}

.mw-custom-field input {
  padding: 0.35rem 0.5rem;
  border-radius: 0.45rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(2, 6, 23, 0.6);
  color: #e2e8f0;
  font-size: 0.85rem;
  color-scheme: dark;
}

.mw-custom-field input:focus {
  outline: none;
  border-color: var(--mw-cyan);
  box-shadow: 0 0 0 0.18rem rgba(0, 194, 209, 0.18);
}

.mw-custom-actions {
  display: flex;
  gap: 0.4rem;
}

.mw-range-apply {
  padding: 0.35rem 0.9rem;
  border: 0;
  border-radius: 0.5rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: #04121a;
  background: linear-gradient(135deg, var(--mw-cyan-strong), var(--mw-emerald));
  cursor: pointer;
}

.mw-range-cancel {
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--mw-border);
  border-radius: 0.5rem;
  background: transparent;
  color: rgba(226, 232, 240, 0.8);
  font-size: 0.78rem;
  cursor: pointer;
}
