/* Wake-on Gaming — shared UI */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

:root {
  --bg: #070a0f;
  --bg-elevated: #0e141c;
  --surface: rgba(18, 24, 34, 0.72);
  --surface-solid: #121822;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #eef4fb;
  --text-muted: #8b9cb3;
  --text-dim: #5c6d82;
  --accent: #3b82f6;
  --accent-soft: rgba(59, 130, 246, 0.14);
  --accent-glow: rgba(59, 130, 246, 0.35);
  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, 0.12);
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.12);
  --amber: #f59e0b;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
  --font: 'DM Sans', system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(59, 130, 246, 0.18), transparent),
    radial-gradient(circle at 100% 0%, rgba(34, 197, 94, 0.06), transparent 40%),
    linear-gradient(180deg, #0a1018 0%, var(--bg) 100%);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(7, 10, 15, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.topbar-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

.brand {
  display: flex; align-items: center; gap: 0.65rem;
  font-weight: 700; font-size: 1.05rem; letter-spacing: -0.02em;
  text-decoration: none; color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, #2563eb, #22c55e);
  display: grid; place-items: center;
  box-shadow: 0 0 24px var(--accent-glow);
}
.brand-mark svg { width: 18px; height: 18px; color: #fff; }

.container {
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 1.75rem 1.25rem 3rem;
}

.page-title {
  margin: 0 0 0.35rem;
  font-size: clamp(1.5rem, 3vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}
.page-sub {
  margin: 0 0 1.5rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 52ch;
}

.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

.card {
  background: var(--surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem 1.4rem;
  box-shadow: var(--shadow);
}

.card-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; margin-bottom: 1rem;
}
.card-title { margin: 0; font-size: 1.05rem; font-weight: 600; letter-spacing: -0.02em; }
.card-desc { margin: 0.25rem 0 0; font-size: 0.875rem; color: var(--text-muted); }

.stat-row {
  display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1rem;
}
.stat {
  flex: 1; min-width: 120px;
  padding: 0.85rem 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.stat-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); font-weight: 600; }
.stat-value { margin-top: 0.25rem; font-size: 0.92rem; font-weight: 500; word-break: break-all; }
.stat-value code { font-size: 0.85em; color: var(--text-muted); }

.badge {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  font-size: 0.78rem; font-weight: 600;
}
.badge-dot { width: 7px; height: 7px; border-radius: 50%; }
.badge-online { background: var(--green-soft); color: var(--green); }
.badge-online .badge-dot { background: var(--green); box-shadow: 0 0 8px var(--green); }
.badge-offline { background: var(--red-soft); color: var(--red); }
.badge-offline .badge-dot { background: var(--red); }
.badge-neutral { background: rgba(255,255,255,0.06); color: var(--text-muted); }
.badge-wake { background: var(--accent-soft); color: #93c5fd; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  padding: 0.65rem 1.05rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: inherit; font-size: 0.875rem; font-weight: 600;
  cursor: pointer; transition: transform 0.15s, filter 0.15s, background 0.15s;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { filter: brightness(1.06); text-decoration: none; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.35);
}
.btn-success {
  background: linear-gradient(135deg, #15803d, #22c55e);
  color: #fff;
  box-shadow: 0 4px 20px rgba(34, 197, 94, 0.25);
}
.btn-danger {
  background: linear-gradient(135deg, #b91c1c, #ef4444);
  color: #fff;
}
.btn-ghost {
  background: rgba(255,255,255,0.04);
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.8rem; }

.btn-row { display: flex; flex-wrap: wrap; gap: 0.55rem; margin-top: 1rem; }

.toolbar {
  display: flex; flex-wrap: wrap; gap: 0.65rem; align-items: center;
  margin-bottom: 1rem;
}
.search-wrap { flex: 1; min-width: 200px; position: relative; }
.search-wrap svg {
  position: absolute; left: 0.85rem; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--text-dim); pointer-events: none;
}
.search-input {
  width: 100%;
  padding: 0.65rem 0.85rem 0.65rem 2.35rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: inherit; font-size: 0.875rem;
  outline: none;
}
.search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.scan-select {
  min-width: 220px;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: inherit;
  font-size: 0.875rem;
  outline: none;
}
.scan-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.text-input {
  min-width: 180px;
  flex: 1;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: inherit;
  font-size: 0.875rem;
  outline: none;
}
.text-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.file-btn { cursor: pointer; margin: 0; }
.file-btn input { display: none; }
.file-name {
  color: var(--text-muted);
  font-size: 0.82rem;
  min-width: 120px;
}

.wg-upload-form { margin-bottom: 0.75rem; }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
}
table.host-table {
  width: 100%; border-collapse: collapse;
  font-size: 0.84rem;
}
.host-table th {
  text-align: left; padding: 0.75rem 1rem;
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-dim); font-weight: 600;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.2);
}
.host-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.host-table tr:last-child td { border-bottom: none; }
.host-table tbody tr:hover { background: rgba(255,255,255,0.03); }
.host-table tr.is-default { background: var(--accent-soft); }
.host-name { font-weight: 600; color: var(--text); }
.host-sub { font-size: 0.78rem; color: var(--text-dim); margin-top: 0.15rem; }
.host-table code {
  font-family: ui-monospace, 'Cascadia Code', monospace;
  font-size: 0.82em;
  color: #a5b4c8;
  background: rgba(0,0,0,0.25);
  padding: 0.12rem 0.35rem;
  border-radius: 4px;
}

.empty-state {
  text-align: center; padding: 2.5rem 1rem;
  color: var(--text-muted); font-size: 0.9rem;
}
.empty-state svg { width: 40px; height: 40px; opacity: 0.35; margin-bottom: 0.75rem; }

.toast {
  margin-top: 0.85rem; padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm); font-size: 0.875rem;
  border: 1px solid transparent;
}
.toast-ok { background: var(--green-soft); border-color: rgba(34,197,94,0.25); color: #86efac; }
.toast-err { background: var(--red-soft); border-color: rgba(239,68,68,0.25); color: #fca5a5; }
.toast-info { background: var(--accent-soft); border-color: rgba(59,130,246,0.25); color: #93c5fd; }

.hint { font-size: 0.8rem; color: var(--text-dim); margin-top: 1rem; line-height: 1.55; }

.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Login */
.login-page {
  min-height: 100vh;
  display: grid; place-items: center;
  padding: 1.5rem;
}
.login-card {
  width: min(420px, 100%);
  text-align: center;
}
.login-card .brand { justify-content: center; margin-bottom: 1.5rem; }
.flash {
  margin: 1rem 0; padding: 0.75rem 1rem;
  border-radius: var(--radius-sm); font-size: 0.875rem; text-align: left;
}
.flash.error { background: var(--red-soft); color: #fca5a5; border: 1px solid rgba(239,68,68,0.2); }
.flash.success { background: var(--green-soft); color: #86efac; border: 1px solid rgba(34,197,94,0.2); }

/* Directions / docs */
.docs { max-width: 820px; padding-bottom: 3rem; }
.docs-toc { margin-bottom: 1rem; padding: 1rem 1.25rem; }
.docs-toc-title { font-size: 0.9rem; margin: 0 0 0.65rem; color: var(--text-muted); }
.docs-toc ol { margin: 0; padding-left: 1.25rem; }
.docs-toc li { margin: 0.35rem 0; font-size: 0.9rem; }
.docs-section { margin-bottom: 1rem; padding: 1.25rem 1.5rem; }
.docs-section h2 { margin: 0 0 0.85rem; font-size: 1.2rem; }
.docs-section h3 { margin: 1.25rem 0 0.5rem; font-size: 1rem; color: var(--text-muted); }
.docs-section p, .docs-section li { color: var(--text-muted); font-size: 0.92rem; line-height: 1.65; }
.docs-section ul, .docs-section ol { margin: 0.5rem 0 1rem; padding-left: 1.35rem; }
.docs-section li { margin: 0.35rem 0; }
.docs-table {
  width: 100%; border-collapse: collapse; font-size: 0.84rem;
  margin: 0.75rem 0 1rem;
}
.docs-table th, .docs-table td {
  text-align: left; padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.docs-table th { color: var(--text-dim); font-weight: 500; }
.docs-footer { text-align: center; margin-top: 1.5rem; }
.docs-callout {
  margin: 1rem 0 1.25rem;
  padding: 1rem 1.15rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(59, 130, 246, 0.35);
  background: var(--accent-soft);
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-muted);
}
.docs-callout ul { margin: 0.5rem 0 0; padding-left: 1.25rem; }
.docs-callout strong { color: var(--text); }

@media (max-width: 640px) {
  .host-table th:nth-child(3), .host-table td:nth-child(3) { display: none; }
  .topbar { padding: 0.75rem 1rem; }
}
