/* Zendra minimal theme scaffold (safe drop-in)
   If you already have a stronger theme, keep this file but you can merge later. */

:root{
  --bg:#070812;
  --card:#0f1224;
  --card2:#0b0e1d;
  --text:#e9e9f2;
  --muted:#a5a7c2;
  --line:rgba(255,255,255,.08);
  --btn:#151a33;
  --btn2:#10142b;
  --accent:#9a66ff;
  --accent2:#ff4fd8;
  --shadow: 0 18px 60px rgba(0,0,0,.55);
  --radius:18px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: radial-gradient(1200px 700px at 20% 0%, rgba(154,102,255,.18), transparent 55%),
              radial-gradient(900px 600px at 80% 10%, rgba(255,79,216,.12), transparent 60%),
              var(--bg);
  color:var(--text);
}

a{ color:inherit; text-decoration:none; opacity:.9; }
a:hover{ opacity:1; text-decoration:underline; }

.z-topbar{
  position:sticky; top:0; z-index:10;
  background: rgba(7,8,18,.78);
  backdrop-filter: blur(10px);
  border-bottom:1px solid var(--line);
  padding:14px 18px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
}

.z-brand{ display:flex; align-items:center; gap:12px; }
.z-logo{
  width:40px; height:40px;
  display:grid; place-items:center;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.12);
  background: linear-gradient(135deg, rgba(154,102,255,.22), rgba(255,79,216,.12));
  box-shadow: 0 0 0 6px rgba(154,102,255,.08);
  font-weight:800;
}
.z-title{ font-weight:800; letter-spacing:.2px; }
.z-sub{ font-size:12px; color:var(--muted); margin-top:2px; }

.z-nav{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; justify-content:flex-end; }
.z-navlink{
  padding:8px 10px;
  border-radius:12px;
  border:1px solid transparent;
}
.z-navlink:hover{
  text-decoration:none;
  border-color: rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
}

.z-navbtn{
  padding:9px 12px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.10);
  background: linear-gradient(180deg, rgba(21,26,51,.9), rgba(16,20,43,.9));
  color:var(--text);
  cursor:pointer;
}
.z-navbtn:hover{ filter:brightness(1.05); }

.z-wrap{ max-width:1100px; margin:0 auto; padding:22px 16px 40px; }
.z-panel{
  background: linear-gradient(180deg, rgba(15,18,36,.85), rgba(11,14,29,.72));
  border:1px solid rgba(255,255,255,.10);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.z-panelhead{
  padding:18px 18px 10px;
  border-bottom:1px solid rgba(255,255,255,.06);
  display:flex;
  justify-content:space-between;
  gap:14px;
  flex-wrap:wrap;
  align-items:flex-end;
}
.z-h1{ margin:0; font-size:22px; }
.z-muted{ color:var(--muted); font-size:13px; margin:8px 0 0; }

.z-actions{ display:flex; gap:10px; flex-wrap:wrap; }
.z-input, .z-select{
  border-radius:14px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(7,8,18,.6);
  color:var(--text);
  padding:10px 12px;
  outline:none;
  min-width: 220px;
}
.z-select{ min-width: 200px; cursor:pointer; }
.z-input:focus, .z-select:focus{ border-color: rgba(154,102,255,.55); box-shadow:0 0 0 4px rgba(154,102,255,.12); }

.z-grid{
  padding:16px;
  display:grid;
  grid-template-columns: repeat( auto-fit, minmax(220px, 1fr) );
  gap:14px;
}

.z-card{
  border-radius: 18px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(7,8,18,.45);
  overflow:hidden;
  transition: transform .12s ease, filter .12s ease;
}
.z-card:hover{ transform: translateY(-2px); filter: brightness(1.03); }

.z-cardtop{
  height:140px;
  background: linear-gradient(135deg, rgba(154,102,255,.25), rgba(255,79,216,.10));
  display:flex;
  align-items:flex-end;
  padding:12px;
}
.z-badge{
  font-size:12px;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.16);
  background: rgba(0,0,0,.20);
}
.z-cardbody{ padding:12px; }
.z-name{ font-weight:800; font-size:16px; margin:0; }
.z-meta{ color:var(--muted); font-size:12px; margin:6px 0 0; }
.z-bio{ color: rgba(233,233,242,.92); font-size:13px; margin:10px 0 0; line-height:1.35; min-height: 34px; }

.z-cardactions{
  display:flex; gap:10px;
  padding:12px;
  border-top:1px solid rgba(255,255,255,.06);
}
.z-btn{
  flex:1;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(21,26,51,.85);
  color:var(--text);
  cursor:pointer;
  text-align:center;
}
.z-btn:hover{ filter:brightness(1.05); }
.z-btn.primary{
  border-color: rgba(154,102,255,.35);
  background: linear-gradient(180deg, rgba(154,102,255,.22), rgba(21,26,51,.85));
}

.z-empty{ padding:22px; }
.z-emptycard{
  border-radius: 18px;
  border:1px dashed rgba(255,255,255,.18);
  background: rgba(7,8,18,.35);
  padding:18px;
  text-align:center;
}
.z-emptytitle{ font-weight:800; margin-bottom:6px; }

.z-footer{
  border-top:1px solid rgba(255,255,255,.08);
  background: rgba(7,8,18,.65);
  padding:14px 16px;
}
.z-footerinner{
  max-width:1100px; margin:0 auto;
  display:flex; justify-content:space-between; align-items:center;
  gap:12px; flex-wrap:wrap;
}
.z-footlinks{ display:flex; gap:14px; }
.z-footlinks a{ color: var(--muted); }
.z-footlinks a:hover{ color: var(--text); text-decoration:none; }

@media (max-width:520px){
  .z-input{ min-width: 100%; }
  .z-select{ min-width: 100%; }
}

/* ---------- Global layout helpers ---------- */
.container{ width:min(1100px, calc(100% - 48px)); margin:0 auto; }
.page{ min-height:100vh; padding:24px 0 56px; }
.section{ margin-top:22px; }
.row{ display:flex; gap:16px; flex-wrap:wrap; }
.card{ background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.01));
       border:1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad{ padding:18px; }
.card.soft{ box-shadow: 0 12px 40px rgba(0,0,0,.35); }

/* ---------- Typography ---------- */
h1,h2,h3{ letter-spacing:-.02em; }
h1{ font-size: clamp(28px, 3.4vw, 46px); margin: 0 0 10px; }
h2{ font-size: clamp(20px, 2.2vw, 28px); margin: 0 0 10px; }
h3{ font-size: 18px; margin: 0 0 8px; }
p{ color: var(--muted); line-height:1.55; }
.small{ font-size: 13px; color: var(--muted); }

/* ---------- Nav ---------- */
.topnav{
  position:sticky; top:0; z-index:30;
  backdrop-filter: blur(10px);
  background: linear-gradient(180deg, rgba(7,8,18,.82), rgba(7,8,18,.55));
  border-bottom: 1px solid var(--line);
}
.topnav .inner{ width:min(1100px, calc(100% - 32px)); margin:0 auto; display:flex; align-items:center; gap:14px; padding: 10px 0; }
.brand{ display:flex; align-items:center; gap:10px; font-weight:800; letter-spacing:.08em; color: var(--text); text-decoration:none; }
.brand .logo{
  width:34px; height:34px; border-radius: 10px;
  background: radial-gradient(circle at 30% 30%, rgba(154,102,255,.55), rgba(255,79,216,.18) 45%, rgba(255,255,255,.05) 70%);
  border: 1px solid var(--line);
  box-shadow: 0 14px 40px rgba(0,0,0,.45);
  display:grid; place-items:center;
  font-weight:900;
}
.navlinks{ display:flex; gap:10px; flex-wrap:wrap; margin-left: 8px; }
.navlinks a{
  color: var(--muted); text-decoration:none; padding:8px 10px; border-radius: 12px;
  border: 1px solid transparent;
}
.navlinks a:hover{ color: var(--text); border-color: var(--line); background: rgba(255,255,255,.03); }
.navspacer{ flex:1; }
.navactions{ display:flex; gap:10px; align-items:center; }

/* ---------- Forms ---------- */
label{ display:block; font-size: 13px; color: var(--muted); margin: 10px 0 6px; }
input, textarea, select{
  width:100%;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(10,12,28,.62);
  color: var(--text);
  outline: none;
}
input:focus, textarea:focus, select:focus{
  border-color: rgba(154,102,255,.55);
  box-shadow: 0 0 0 4px rgba(154,102,255,.12);
}
.form-row{ display:flex; gap:12px; flex-wrap:wrap; }
.form-row > *{ flex:1; min-width: 180px; }

/* ---------- Buttons ---------- */
button, .btn{
  appearance:none; border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(21,26,51,.9), rgba(16,20,43,.9));
  color: var(--text);
  padding: 10px 14px;
  border-radius: 14px;
  cursor:pointer;
  font-weight: 650;
}
button:hover, .btn:hover{ transform: translateY(-1px); box-shadow: 0 16px 40px rgba(0,0,0,.35); }
button:active, .btn:active{ transform: translateY(0); }
.btn.primary{
  border-color: rgba(154,102,255,.55);
  background: linear-gradient(135deg, rgba(154,102,255,.85), rgba(255,79,216,.22));
}
.btn.ghost{ background: transparent; }
.btn.small{ padding: 8px 10px; border-radius: 12px; font-size: 13px; }

/* ---------- Toast / overlays ---------- */
.toast{
  position: fixed; right: 18px; bottom: 18px; z-index: 60;
  background: rgba(12,14,33,.9);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  color: var(--text);
  box-shadow: 0 18px 60px rgba(0,0,0,.55);
  font-size: 13px;
}
.z-overlay{
  position: fixed; inset:0; z-index: 80;
  background: rgba(6,7,16,.55);
  backdrop-filter: blur(8px);
  display:flex; align-items:center; justify-content:center;
  padding: 18px;
}
.z-modal{
  width:min(520px, 100%);
  background: rgba(12,14,33,.92);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(0,0,0,.65);
  padding: 18px;
}
.z-modal h3{ margin: 0 0 8px; }
.z-modal .actions{ display:flex; gap:10px; justify-content:center; margin-top: 14px; }

/* ---------- Footer ---------- */
.footer{
  margin-top: 34px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
  color: var(--muted);
  font-size: 13px;
  display:flex; justify-content:space-between; gap:14px; flex-wrap:wrap;
}
.footer a{ color: var(--muted); text-decoration:none; }
.footer a:hover{ color: var(--text); }

/* =================================================
   ZENDRA — GLOBAL MOBILE CLEANUP (ALL PAGES)
   Mobile-only polish: calmer spacing, stacked layouts,
   thumb-friendly buttons, reduced visual noise.
   ================================================= */
@media (max-width: 768px){

  /* Prevent sideways scroll */
  html, body{ overflow-x:hidden; }

  /* Base readability */
  body{ font-size:16px; line-height:1.55; }

  /* Universal padding compression */
  .page, .z-wrap, .container, .legal-wrap, .chat-container, section, .section{
    padding-left:16px !important;
    padding-right:16px !important;
  }
  .page{ padding-top:24px !important; padding-bottom:48px !important; }

  /* Headings + text */
  h1{ font-size:1.7rem !important; line-height:1.15 !important; margin-bottom:8px !important; }
  h2{ font-size:1.35rem !important; line-height:1.2 !important; margin-bottom:8px !important; }
  h3{ font-size:1.05rem !important; margin-bottom:6px !important; }
  p{ margin-bottom:12px !important; }

  /* Cards / panels: tighter */
  .card, .z-panel, .z-card, .member-item, .chat-user-panel, .chat-main-panel, .chat-side-panel, .legal-card{
    padding:16px !important;
    border-radius:18px !important;
  }
  .z-grid{ grid-template-columns: 1fr !important; gap:12px !important; padding:14px !important; }

  /* Force common multi-column layouts to single column */
  .row, .hero-layout, .profile-layout, .browse-layout{
    display:grid !important;
    grid-template-columns: 1fr !important;
    gap:14px !important;
  }

  /* Top nav variants: prevent wrap chaos */
  .topnav .inner{ width: calc(100% - 32px) !important; padding: 8px 0 !important; }
  .navlinks{ gap:6px !important; }
  .navlinks a{ padding:8px 10px !important; white-space:nowrap !important; }

  .site-header{ padding:12px 16px 0 !important; }
  .nav-inner{ gap:14px !important; }
  .nav-links{ gap:6px !important; }
  .nav-links a{ padding:6px 10px !important; white-space:nowrap !important; }

  /* Buttons: thumb-friendly + full width where sensible */
  button, .btn, .z-btn, .hero-primary-btn, .chat-send-btn{
    min-height:46px !important;
  }
  .hero-primary-btn{ width:100% !important; padding:14px 18px !important; }
  .z-btn, .btn, button{ width:100% !important; padding:12px 14px !important; }

  /* Inputs: stop iOS zoom */
  input, select, textarea, .z-input, .z-select, .chat-input{
    font-size:16px !important;
    min-height:46px !important;
  }

  /* Chat: already collapses at 800px, just tighten padding */
  .chat-messages{ padding:14px 14px !important; }
  .chat-input-row{ padding:10px 10px 12px !important; }

  /* Reduce heavy glow/noise if any */
  .glow, .neon, .halo{
    box-shadow:none !important;
    text-shadow:none !important;
    filter:none !important;
  }
}


/* ===== Admin authority banner (visual confirmation) ===== */

.zendra-god-banner{
  position: sticky;
  top: 0;
  z-index: 9999;
  margin: 0;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,.12);
  background: rgba(12,14,22,.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.zendra-god-banner .left{
  display:flex;
  align-items:center;
  gap:10px;
  min-width: 0;
}
.zendra-god-banner .pill{
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: .08em;
  font-size: 12px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.06);
  flex: 0 0 auto;
}
.zendra-god-banner .status{
  font-size: 13px;
  opacity: .92;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.zendra-god-banner.is-god{
  border-bottom-color: rgba(255,70,140,.35);
  background: rgba(60,10,32,.65);
}
.zendra-god-banner.is-god .pill{
  border-color: rgba(255,70,140,.55);
  box-shadow: 0 0 0 1px rgba(255,70,140,.18) inset;
}
.zendra-god-banner .right{
  font-size: 12px;
  opacity: .75;
  flex: 0 0 auto;
}


/* --- Zendra Toast Notifications --- */
.toast-host{
  position:fixed;
  top:18px;
  right:18px;
  z-index:9999;
  display:flex;
  flex-direction:column;
  gap:10px;
  pointer-events:none;
  max-width:min(420px, calc(100vw - 36px));
}
.toast{
  pointer-events:auto;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(20,20,28,.92);
  backdrop-filter: blur(10px);
  border-radius:14px;
  padding:10px 12px;
  box-shadow:0 10px 30px rgba(0,0,0,.35);
  font-size:14px;
  line-height:1.25;
  display:flex;
  gap:10px;
  align-items:flex-start;
}
.toast .toast-dot{
  width:10px;height:10px;border-radius:50%;
  margin-top:4px;
  background:rgba(255,255,255,.55);
  flex:0 0 auto;
}
.toast.toast-success .toast-dot{ background: rgba(70, 220, 160, .85); }
.toast.toast-error .toast-dot{ background: rgba(255, 90, 120, .9); }
.toast.toast-warn .toast-dot{ background: rgba(255, 200, 80, .9); }
.toast .toast-body{ flex:1 1 auto; }
.toast .toast-title{ font-weight:700; margin-bottom:2px; }
.toast .toast-msg{ opacity:.95; }
.toast .toast-close{
  appearance:none;border:0;background:transparent;color:rgba(255,255,255,.75);
  cursor:pointer;font-size:18px;line-height:1; padding:0 4px;
}
@media (max-width: 700px){
  .toast-host{ left:12px; right:12px; top:12px; }
}

/* Zendra wordmark (site header) */
.site-header .logo{
  display:inline-flex;
  align-items:center;
  gap:12px;
  text-decoration:none;
  font-weight:850;
  letter-spacing:.06em;
  text-transform:none;
  line-height:1;
  padding:10px 14px;
  border-radius:16px;
  color: var(--text);
  background: rgba(255,255,255,.015);
  border: 1px solid rgba(199,148,255,.14);
  box-shadow: 0 10px 34px rgba(0,0,0,.28);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
}
.site-header .logo .logo-svg{
  flex:0 0 auto;
  width:24px;
  height:24px;
  filter:
    drop-shadow(0 14px 30px rgba(154,102,255,.36))
    drop-shadow(0 10px 24px rgba(79,214,255,.22))
    drop-shadow(0 8px 22px rgba(255,79,216,.14));
}
.site-header .logo .logo-type{
  font-size:16px;
  font-weight:850;
  letter-spacing:.17em;
  color: var(--text);
  text-shadow:
    0 0 20px rgba(154,102,255,.30),
    0 0 26px rgba(79,214,255,.20),
    0 0 30px rgba(255,79,216,.16);
}
.site-header .logo:hover{
  transform: translateY(-1px);
  background: rgba(255,255,255,.03);
  border-color: rgba(199,148,255,.28);
  box-shadow: 0 18px 50px rgba(0,0,0,.35);
}


/* --- FIX: chat bubble word wrapping --- */
.chat-bubble{
  width: auto !important;
  min-width: 0 !important;
  max-width: min(78%, 640px) !important;
  white-space: pre-wrap !important;
  overflow-wrap: break-word !important;
  word-break: break-word !important;
  line-height: 1.35 !important;
}

/* --- FIX: chat bubble row flex --- */
.message-row, .msg-row, .chat-row, .chat-message-row{
  display: flex;
  gap: 10px;
  min-width: 0;
}


/* === Presence name colours (Online / Recent / Offline) ===
   Safe visual-only layer. Applied by chat-page.js via classes:
   .presence-online / .presence-recent / .presence-offline (+ optional .presence-colour)
*/
.presence-offline { opacity: 0.92; }
.presence-recent  { opacity: 0.98; }
.presence-online  { opacity: 1; }

/* Premium, subtle pulse only when colour is enabled */
@keyframes zendraOnlinePulse {
  0%   { text-shadow: 0 0 0 rgba(154,102,255,0.0); filter: brightness(1); }
  50%  { text-shadow: 0 0 14px rgba(154,102,255,0.55); filter: brightness(1.08); }
  100% { text-shadow: 0 0 0 rgba(154,102,255,0.0); filter: brightness(1); }
}
.presence-online.presence-colour {
  animation: zendraOnlinePulse 2.8s ease-in-out infinite;
  will-change: text-shadow, filter;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .presence-online.presence-colour { animation: none !important; }
}


/* =========================
   Presence colours (Chat)
   ========================= */
.presence-dot{
  position:absolute;
  right:-2px;
  bottom:-2px;
  width:10px;
  height:10px;
  border-radius:999px;
  border:2px solid rgba(10, 7, 20, .9);
  background:#6f7782; /* offline default */
  box-shadow:0 0 10px rgba(0,0,0,.35);
}
.presence-colour.presence-offline .chat-user-name,
#chatThreadTitle.presence-offline{
  color:#8c94a3;
}
.presence-colour.presence-recent .chat-user-name,
#chatThreadTitle.presence-recent{
  color:#ff9f43;
}
.presence-colour.presence-online .chat-user-name,
#chatThreadTitle.presence-online{
  color:#9a66ff;
}
.presence-online .presence-dot{
  background:#9a66ff;
  animation:zendraPulse 1.4s ease-in-out infinite;
  box-shadow:0 0 14px rgba(154, 102, 255, .55);
}
.presence-recent .presence-dot{
  background:#ff9f43;
  animation:none;
  box-shadow:0 0 12px rgba(255, 159, 67, .45);
}
.presence-offline .presence-dot{
  background:#6f7782;
  animation:none;
}
