/* ---------- Modal ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--backdrop);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}
.modal-backdrop.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  width: min(100%, 380px);
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.modal h2 {
  font-size: 1rem;
  color: var(--text-strong);
  margin-bottom: 1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.modal-section { margin-bottom: 1.2rem; }
.modal-section:last-of-type { margin-bottom: 0; }
.modal-section-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-subtle);
  padding-bottom: 0.4rem;
  margin-bottom: 0.2rem;
  border-bottom: 1px solid var(--border-subtle);
}
.modal-about {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.55;
  padding: 0.4rem 0;
}
.modal-about a { color: var(--accent); text-decoration: none; }
.modal-about a:hover { text-decoration: underline; }
.modal-about .version {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.7rem;
  color: var(--text-faint);
  margin-top: 0.4rem;
}

.modal-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0;
}

.modal-row label {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.modal-row select {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  min-width: 130px;
}

.modal-close {
  width: 100%;
  margin-top: 1rem;
  background: var(--accent);
  border: none;
  color: #ffffff;
  padding: 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 500;
}
.modal-close:hover { filter: brightness(1.1); }

/* ---------- Status Banner ---------- */

.status-banner {
  border-radius: 12px;
  padding: 1.8rem 2rem;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  margin-bottom: 1.5rem;
  border: 1px solid transparent;
  transition: all 0.4s ease;
}

.status-banner.ok         { background: var(--status-ok-bg);      border-color: var(--status-ok-border); }
.status-banner.outage     { background: var(--status-outage-bg);  border-color: var(--status-outage-border); }
.status-banner.warn       { background: var(--status-warn-bg);    border-color: var(--status-warn-border); }
.status-banner.unknown    { background: var(--status-unknown-bg); border-color: var(--status-unknown-border); }

.status-dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-banner.ok .status-dot      { background: #22c55e; box-shadow: 0 0 8px #22c55e88; animation: pulse-green 2s infinite; }
.status-banner.outage .status-dot  { background: #ef4444; box-shadow: 0 0 8px #ef444488; animation: pulse-red 1s infinite; }
.status-banner.warn .status-dot    { background: #f59e0b; box-shadow: 0 0 8px #f59e0b88; animation: pulse-amber 1.5s infinite; }
.status-banner.unknown .status-dot { background: #78716c; }

@keyframes pulse-green { 0%,100%{opacity:1} 50%{opacity:0.5} }
@keyframes pulse-red   { 0%,100%{opacity:1} 50%{opacity:0.4} }
@keyframes pulse-amber { 0%,100%{opacity:1} 50%{opacity:0.5} }

.status-text h2 { font-size: 1.2rem; font-weight: 600; color: var(--text-strong); }
.status-text p  { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.2rem; }

/* ---------- Tag, Table, Empty ---------- */

.tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.12rem 0.45rem;
  border-radius: 4px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.tag.power_off, .tag.device_down { background: var(--tag-confirmed-bg); color: var(--tag-confirmed-fg); }
.tag.power_on, .tag.device_up    { background: var(--tag-inferred-bg);  color: var(--tag-inferred-fg); }

table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }

thead th {
  text-align: left;
  padding: 0.6rem 0.8rem;
  color: var(--text-subtle);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
}

tbody tr { border-bottom: 1px solid var(--border-subtle); }
tbody tr:hover { background: var(--surface-hover); }
tbody td { padding: 0.65rem 0.8rem; color: var(--text); }

.empty { text-align: center; color: var(--text-faint); padding: 2rem; font-size: 0.88rem; }

/* ---------- Tooltip ---------- */

#info-tooltip {
  position: fixed;
  z-index: 100;
  pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  font-size: 0.8rem;
  color: var(--text);
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  max-width: 240px;
  line-height: 1.35;
}
#info-tooltip[hidden] { display: none; }
#info-tooltip .tip-region { font-weight: 600; color: var(--text-strong); margin-bottom: 0.2rem; }
#info-tooltip .tip-meta   { color: var(--text-muted); font-size: 0.75rem; }
#info-tooltip .tip-line   { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.25rem; }
#info-tooltip .tip-line::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%; display: inline-block;
}
#info-tooltip .tip-line.on::before      { background: #22c55e; }
#info-tooltip .tip-line.off::before     { background: #ef4444; }
#info-tooltip .tip-line.unknown::before { background: #94a3b8; }
