/* ============================================================
   Zallixor Admin Dashboard — style.css
   Standalone visual identity (not copied from any main-app CSS
   or from any third-party product UI). Mobile-first, dark by
   default with a light-mode toggle in prefers-color-scheme.
   ============================================================ */

:root {
  --bg: #0f1420;
  --bg-elevated: #161d2e;
  --border: #263049;
  --text: #e7ecf7;
  --muted: #8a93ab;
  --accent: #6d5bff;
  --accent-2: #22c9a8;
  --danger: #ef4a63;
  --warn: #f0ad4e;
  --ok: #22c9a8;
  --radius: 12px;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f6fb; --bg-elevated: #ffffff; --border: #e1e6f0;
    --text: #171c2a; --muted: #626b82;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
#admin-app { min-height: 100vh; display: flex; flex-direction: column; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
code { background: var(--bg-elevated); padding: 2px 6px; border-radius: 6px; font-size: 0.85em; }

.admin-boot { display: flex; align-items: center; justify-content: center; height: 100vh; }
.boot-spinner { width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Auth screens ── */
.auth-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card { width: 100%; max-width: 380px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px 24px; display: flex; flex-direction: column; gap: 12px; }
.auth-logo { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.wordmark { font-weight: 800; font-size: 1.15rem; letter-spacing: -0.02em; }
.admin-badge { background: var(--accent); color: #fff; font-size: 0.7rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.denied-card { text-align: center; }
.denied-card h2 { color: var(--danger); }

.field-input { width: 100%; padding: 11px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font-size: 0.95rem; }
.post-image-preview { display: block; max-width: 240px; max-height: 240px; border-radius: 8px; object-fit: cover; margin: 8px 0; }
.hidden { display: none !important; }
.btn { padding: 10px 16px; border-radius: 8px; border: none; font-weight: 600; font-size: 0.9rem; cursor: pointer; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 10px; font-size: 0.8rem; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warn { background: var(--warn); color: #241a00; }
.btn:disabled { opacity: 0.6; }

/* ── Shell / nav ── */
.admin-nav { display: flex; align-items: center; gap: 16px; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--bg-elevated); flex-wrap: wrap; position: sticky; top: 0; z-index: 5; }
.admin-brand { display: flex; align-items: center; gap: 8px; }
.admin-tabs { display: flex; gap: 4px; overflow-x: auto; flex: 1; }
.admin-tab { background: transparent; border: none; color: var(--muted); padding: 8px 12px; border-radius: 8px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.admin-tab.active { background: var(--accent); color: #fff; }
.admin-me { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.admin-main { padding: 16px; flex: 1; max-width: 960px; margin: 0 auto; width: 100%; }

.panel-header h2 { margin: 0 0 4px; }
.panel-header p { margin: 0 0 16px; }

/* ── Overview ── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.stat-card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.stat-card-placeholder { opacity: 0.55; }
.stat-value { font-size: 1.5rem; font-weight: 800; }
.stat-label { font-size: 0.82rem; color: var(--muted); margin-top: 2px; }
.stat-sub { font-size: 0.72rem; color: var(--muted); margin-top: 4px; }

/* ── Users ── */
.search-bar { display: flex; gap: 8px; margin-bottom: 12px; }
.users-layout { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 760px) { .users-layout { grid-template-columns: 1fr 1fr; } }
.user-results { display: flex; flex-direction: column; gap: 6px; }
.user-row { display: flex; align-items: center; gap: 10px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; text-align: left; cursor: pointer; }
.user-avatar-sm { width: 34px; height: 34px; border-radius: 50%; background: var(--border); object-fit: cover; }
.user-avatar-lg { width: 56px; height: 56px; border-radius: 50%; background: var(--border); object-fit: cover; }
.user-row-info { flex: 1; min-width: 0; }
.user-row-name { font-weight: 700; font-size: 0.9rem; }
.user-row-handle, .user-row-followers { font-size: 0.78rem; color: var(--muted); }
.badge-verified { color: var(--accent-2); margin-left: 4px; }
.row-chip { display: flex; align-items: center; gap: 8px; }
.row-chip-link { background: none; border: none; padding: 0; margin: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; }
.user-detail-card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.user-detail-header { display: flex; align-items: center; gap: 12px; }
.user-detail-name { font-weight: 800; }
.user-detail-fields { display: grid; grid-template-columns: 1fr; gap: 6px; font-size: 0.86rem; }
.user-detail-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.empty-state, .loading-block { color: var(--muted); padding: 20px; text-align: center; }
.user-cover { width: 100%; max-height: 160px; object-fit: cover; border-radius: 10px; background: var(--border); cursor: pointer; margin-bottom: 4px; }

/* ── Posts (Users tab profile + Assistant tab) ── */
.post-list { display: flex; flex-direction: column; gap: 10px; }
.post-card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.post-media { width: 100%; max-height: 220px; object-fit: cover; border-radius: 8px; cursor: pointer; background: var(--border); }
.post-card-body { display: flex; flex-direction: column; gap: 2px; }
.post-card-text { font-size: 0.9rem; white-space: pre-wrap; }

.badge { font-size: 0.72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; display: inline-block; }
.badge-ok { background: rgba(34,201,168,0.15); color: var(--ok); }
.badge-warn { background: rgba(240,173,78,0.18); color: var(--warn); }
.badge-danger { background: rgba(239,74,99,0.15); color: var(--danger); }

/* ── Audit log ── */
.audit-list { display: flex; flex-direction: column; gap: 8px; }
.audit-row { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.audit-row-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.audit-action { font-weight: 700; font-size: 0.88rem; }

/* ── Shared subsections (Boosts, Verifications, Plus, Group Chats, Reports) ── */
.adm-subsection { margin-top: 18px; }
.adm-subsection:first-of-type { margin-top: 14px; }
.adm-subsection-title { font-size: 0.95rem; margin: 0 0 8px; }

/* ── Lightbox (receipts / reported media) ── */
.lightbox-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.85); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 20px; }
.lightbox-img { max-width: 100%; max-height: 90vh; border-radius: 8px; }
.lightbox-close { position: absolute; top: 16px; right: 16px; background: var(--bg-elevated); color: var(--text); border: 1px solid var(--border); border-radius: 50%; width: 36px; height: 36px; cursor: pointer; font-size: 1rem; }

/* ── Group Chats: message thread modal ── */
.group-thread-card { max-width: 560px; }
.group-thread-log { max-height: 52vh; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 4px; }
.group-msg-row { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }

/* ── Modal ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.55); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal-card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 10px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.modal-error { color: var(--danger); font-size: 0.82rem; min-height: 1em; }

/* ── Toast ── */
#toast-host { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 100; }
.toast { padding: 10px 16px; border-radius: 8px; background: var(--bg-elevated); border: 1px solid var(--border); box-shadow: 0 4px 20px rgba(0,0,0,0.3); font-size: 0.88rem; }
.toast-error { border-color: var(--danger); color: var(--danger); }
/* --danger (#ef4a63) is bright enough for the dark surface (4.67) but
   only reaches 3.60 on the white light-mode card. A darker red for
   light mode only: 6.91. */
@media (prefers-color-scheme: light) {
  .toast-error { color: #b3122b; border-color: #b3122b; }
}
.toast-success { border-color: var(--ok); color: var(--ok); }

/* ── Push ── */
.push-layout { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }
@media (min-width: 860px) { .push-layout { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); } }
.push-composer { display: flex; flex-direction: column; gap: 14px; }
.push-field { display: flex; flex-direction: column; gap: 5px; }
.push-label { display: flex; justify-content: space-between; align-items: baseline; font-size: 0.82rem; font-weight: 600; color: var(--muted); }
.push-count { font-weight: 400; }
.push-check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.push-check input { margin-top: 3px; flex: 0 0 auto; }
.push-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.push-audience:not(:empty) { margin-top: 4px; }

/* Approximation of a lock-screen banner. Deliberately plain — the real
   thing is drawn by the OS, and a pixel-perfect fake would only promise
   an appearance we don't control. */
.push-preview { display: flex; gap: 10px; align-items: flex-start; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.push-preview-icon { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.push-preview-title { font-weight: 700; margin-bottom: 2px; }
.push-preview-body { color: var(--text); overflow-wrap: anywhere; }
.push-preview-body.muted { color: var(--muted); }
.push-side { display: flex; flex-direction: column; gap: 8px; }

.push-history-row { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; display: flex; flex-direction: column; gap: 4px; }
.push-history-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ── Handles tab ──
   Reserved / reclaimed usernames. Reuses the existing badge, button and
   field-input styles; only the layout below is new. */
.handle-card {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 16px;
}
.handle-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.handle-name { font-weight: 700; font-size: 1.05rem; word-break: break-all; }
.handle-card-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.handle-meta > div, .handle-owner > div { margin-top: 3px; }

.handle-bulk { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.handle-bulk .btn { align-self: flex-start; }
.handle-bulk-out:not(:empty) { margin-bottom: 12px; }

.handle-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border: 1px solid var(--border); border-radius: 10px;
  margin-bottom: 8px; background: var(--bg-elevated);
}
.handle-row-main { display: flex; align-items: center; gap: 8px; min-width: 0; }
/* Pushes the Release button to the far edge and lets the reason column
   absorb the slack, so rows line up whatever the name length. */
.handle-row-meta { margin-left: auto; text-align: right; min-width: 0; }
.handle-row-meta > div { word-break: break-word; }

/* Scoped to this tab's own header only. The base .panel-header is used
   by every other tab with an <h2> above a <p>, and turning that global
   rule into a flex row would have laid those two out side by side. */
.panel-header.with-action { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.panel-header.with-action h3 { margin: 0 0 4px; }

@media (max-width: 560px) {
  .handle-row { flex-wrap: wrap; }
  .handle-row-meta { margin-left: 0; text-align: left; flex-basis: 100%; }
}

/* ============================================================
   Zallixor Admin Dashboard — badge tier control styles

   APPEND TO css/style.css.

   If you already appended admin-broadcasts.css, you have
   .panel-section, .field-grid and .field-check — skip straight to
   the .vt-* block at the bottom. If you have NOT, take the whole
   file; the shared classes are identical in both, so appending
   both is harmless but redundant.
   ============================================================ */

/* ── Shared form classes (same as admin-broadcasts.css) ── */

.panel-section {
  background: var(--surface-2, rgba(255, 255, 255, 0.03));
  border: 1px solid var(--line, rgba(255, 255, 255, 0.08));
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 22px;
}
.panel-section > h3 {
  margin: 0 0 12px;
  font-size: 0.95rem;
  font-weight: 700;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}
.field-grid > label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.field-grid .field-input {
  width: 100%;
  box-sizing: border-box;
}

.field-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 6px 0 2px;
  cursor: pointer;
  line-height: 1.4;
}
.field-check input[type="checkbox"] {
  margin-top: 2px;
  flex: 0 0 auto;
}

.badge-muted {
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted, #9aa3b2);
}

/* ── Badge tier control ── */

.vt-result-wrap {
  border-top: 1px solid var(--line, rgba(255, 255, 255, 0.08));
  padding-top: 12px;
}

/* Minimum height so the panel does not jump between "Searching…" and a
   found account — a layout that shifts under the cursor is how an admin
   clicks Apply on the wrong row. */
.vt-result {
  min-height: 44px;
}

.vt-current {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding: 4px 10px 4px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.8rem;
}

.vt-swatch {
  display: inline-flex;
  align-items: center;
  line-height: 0;
}

/* ============================================================
   Zallixor Admin Dashboard — blue badge tab styles
   APPEND TO css/style.css (after the announcements/tier block).
   ============================================================ */

.blue-name { margin: 6px 0 2px; }

.blue-code {
  margin: 6px 0 10px;
  font-size: 0.82rem;
}
.blue-code code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 700;
  letter-spacing: .05em;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(26, 127, 224, .14);
  color: #4aa3f0;
  user-select: all;
}

/* Machine-checkable parts of the policy. Green here does NOT mean
   approved - it means "this part needs no judgement". The judgement
   is whether the links are real, and that is on the admin. */
.blue-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.blue-check {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.bc-ok { background: rgba(34, 201, 168, .14); color: var(--ok, #22c9a8); }
.bc-no { background: rgba(239, 74, 99, .14); color: var(--danger, #ef4a63); }

.blue-group {
  margin: 10px 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line, rgba(255, 255, 255, .08));
  background: rgba(255, 255, 255, .02);
}
.blue-group-title {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--muted, #9aa3b2);
  margin-bottom: 8px;
}

.blue-item {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 0.82rem;
  min-width: 0;
}
.blue-item:last-child { margin-bottom: 0; }

.blue-plat {
  flex: 0 0 auto;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
}

/* Long URLs must wrap rather than stretch the row off-screen. */
.blue-link {
  color: #4aa3f0;
  text-decoration: underline;
  word-break: break-all;
  min-width: 0;
}
.blue-link:hover { text-decoration: none; }

.blue-note {
  margin-top: 8px;
  font-style: italic;
}

/* ── Announcement compose form ──
   One full-width control per line. This lives here rather than in the
   .field-grid block above because the title and the message body need
   the whole row, while the selects beside them share one. */
.field-row {
  margin-bottom: 10px;
}
.field-row > .field-input {
  width: 100%;
  box-sizing: border-box;
}
.field-row textarea.field-input {
  resize: vertical;
  min-height: 88px;
  font: inherit;
  line-height: 1.5;
}

/* Report grouping — the count is the signal. */
.rep-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.rep-group .badge-danger { flex: 0 0 auto; }
