/*
 * POE.Multi Admin UI — styles.
 * Palette mirrors the desktop app (AppTheme.cs): dark background + orange accent.
 */

:root {
  --bg-main: #0d0d0f;
  --bg-sidebar: #121214;
  --panel: #18181b;
  --panel-hover: #222226;
  --border: #2a2a2e;
  --button-border: #555560;
  --accent: #ff6b1a;
  --accent-dim: #c85210;
  --text-primary: #e4e4e7;
  --text-secondary: #8b8b93;
  --text-muted: #6b6b73;
  --green: #4ade80;
  --red: #ef4444;
  --amber: #ff6b1a;
  --radius: 8px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 14px;
}

/* ── Utility ─────────────────────────────────────────────────────────── */
.hidden {
  display: none !important;
}

button {
  font-family: var(--font);
  cursor: pointer;
}

input,
select {
  font-family: var(--font);
}

a {
  color: var(--accent);
}

.muted {
  color: var(--text-secondary);
}

.error-text {
  color: var(--red);
  font-size: 13px;
  min-height: 18px;
  margin: 6px 0 0;
}

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  background: var(--panel);
  color: var(--text-primary);
  border: 1px solid var(--button-border);
  border-radius: var(--radius);
  padding: 8px 14px;
  font-size: 13px;
  transition: background 0.12s, border-color 0.12s;
}
.btn:hover {
  background: var(--panel-hover);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #0d0d0f;
  font-weight: 600;
}
.btn-primary:hover {
  background: var(--accent-dim);
  border-color: var(--accent-dim);
}
.btn-danger {
  border-color: var(--red);
  color: var(--red);
}
.btn-danger:hover {
  background: rgba(239, 68, 68, 0.12);
}
.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

/* ── Form fields ─────────────────────────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
}
.field label {
  font-size: 12px;
  color: var(--text-secondary);
}
.field input,
.field select {
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  padding: 9px 11px;
  font-size: 14px;
  outline: none;
}
.field input:focus,
.field select:focus {
  border-color: var(--accent);
}

/* ── Login screen ────────────────────────────────────────────────────── */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px 28px;
}
.login-card h1 {
  margin: 0 0 4px;
  font-size: 20px;
}
.login-card .subtitle {
  margin: 0 0 24px;
  color: var(--text-secondary);
  font-size: 13px;
}
.login-card .btn-primary {
  width: 100%;
  padding: 10px;
  margin-top: 6px;
}
.qr-box {
  text-align: center;
  margin: 12px 0;
}
.qr-box canvas,
.qr-box img {
  background: #fff;
  padding: 10px;
  border-radius: var(--radius);
}
.secret-code {
  font-family: Consolas, monospace;
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  text-align: center;
  letter-spacing: 1px;
  word-break: break-all;
  margin: 8px 0 16px;
  color: var(--accent);
}

/* ── App shell ───────────────────────────────────────────────────────── */
#app-screen {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 210px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 18px 12px;
  flex-shrink: 0;
}
.sidebar .brand {
  font-size: 16px;
  font-weight: 700;
  padding: 0 8px 18px;
}
.sidebar .brand span {
  color: var(--accent);
}
.nav-item {
  background: none;
  border: none;
  color: var(--text-secondary);
  text-align: left;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 2px;
  width: 100%;
}
.nav-item:hover {
  background: var(--panel);
  color: var(--text-primary);
}
.nav-item.active {
  background: var(--panel);
  color: var(--accent);
  font-weight: 600;
}
.sidebar .spacer {
  flex: 1;
}
.sidebar .user-box {
  border-top: 1px solid var(--border);
  padding: 12px 8px 4px;
  font-size: 12px;
  color: var(--text-muted);
}
.sidebar .user-box strong {
  display: block;
  color: var(--text-primary);
  font-size: 13px;
  margin-bottom: 8px;
}

.main {
  flex: 1;
  padding: 24px 28px;
  overflow: auto;
}
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 12px;
  flex-wrap: wrap;
}
.page-head h2 {
  margin: 0;
  font-size: 20px;
}
.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.toolbar input,
.toolbar select {
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  padding: 7px 10px;
  font-size: 13px;
  outline: none;
}
.toolbar input:focus,
.toolbar select:focus {
  border-color: var(--accent);
}

/* ── Table ───────────────────────────────────────────────────────────── */
.table-wrap {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th {
  text-align: left;
  padding: 11px 12px;
  color: var(--text-secondary);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--bg-sidebar);
  position: sticky;
  top: 0;
}
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:last-child td {
  border-bottom: none;
}
tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}
.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ── Badges / status ─────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.badge-active {
  background: rgba(74, 222, 128, 0.15);
  color: var(--green);
}
.badge-locked {
  background: rgba(239, 68, 68, 0.15);
  color: var(--red);
}
.badge-admin {
  background: rgba(255, 107, 26, 0.15);
  color: var(--accent);
}
.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}
.dot-on {
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
}
.dot-off {
  background: var(--text-muted);
}

/* ── Pagination ──────────────────────────────────────────────────────── */
.pager {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  justify-content: flex-end;
  color: var(--text-secondary);
  font-size: 13px;
}

/* ── Modal ───────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow: auto;
}
.modal h3 {
  margin: 0 0 18px;
  font-size: 17px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

/* ── Toast ───────────────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  max-width: 320px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
  animation: toast-in 0.15s ease-out;
}
.toast.ok {
  border-left-color: var(--green);
}
.toast.err {
  border-left-color: var(--red);
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.empty {
  padding: 30px;
  text-align: center;
  color: var(--text-muted);
}
