/* ============================================================
   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); }
.toast-success { border-color: var(--ok); color: var(--ok); }
