:root {
  --bg: #070b1a;
  --bg2: #0b1026;
  --panel: rgba(17, 23, 50, 0.72);
  --panel-solid: #121836;
  --line: rgba(140, 160, 255, 0.14);
  --text: #e8ecff;
  --muted: #9aa3c7;
  --accent: #4cc9f0;
  --accent2: #9b5de5;
  --accent3: #f15bb5;
  --danger: #ff5d73;
  --ok: #3ddc97;
  --radius: 16px;
}
body[data-accent="purple"] { --accent: #9b5de5; --accent2: #4cc9f0; --accent3: #f15bb5; }
body[data-accent="pink"]   { --accent: #f15bb5; --accent2: #9b5de5; --accent3: #4cc9f0; }

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: Tahoma, "Segoe UI", Vazirmatn, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  line-height: 1.7;
}

/* ---------- aurora background ---------- */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: radial-gradient(1200px 800px at 80% -10%, #141b3f 0%, var(--bg) 55%); }
.aurora i { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.5; animation: drift 22s ease-in-out infinite alternate; }
.aurora i:nth-child(1) { width: 46vw; height: 46vw; background: #134e6f; top: -12%; inset-inline-start: -8%; }
.aurora i:nth-child(2) { width: 38vw; height: 38vw; background: #3a1c66; top: 30%; inset-inline-end: -10%; animation-delay: -6s; }
.aurora i:nth-child(3) { width: 30vw; height: 30vw; background: #5c1a4d; bottom: -15%; inset-inline-start: 30%; animation-delay: -12s; }
@keyframes drift { from { transform: translate(0,0) scale(1); } to { transform: translate(4vw, 3vh) scale(1.12); } }

/* ---------- generic ---------- */
.glass { background: var(--panel); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--line); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: rgba(255,255,255,0.04); color: var(--text);
  padding: 9px 16px; border-radius: 12px; font-size: 14px; font-family: inherit; cursor: pointer;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease;
}
.btn:hover { transform: translateY(-1px); background: rgba(255,255,255,0.08); }
.btn:active { transform: translateY(0); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); border: none; color: #06122b; font-weight: 700; box-shadow: 0 6px 24px rgba(76,201,240,0.25); }
.btn.primary:hover { box-shadow: 0 8px 30px rgba(155,93,229,0.35); }
.btn.danger { border-color: rgba(255,93,115,0.4); color: var(--danger); }
.btn.small { padding: 5px 12px; font-size: 12.5px; border-radius: 9px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
input, textarea, select {
  width: 100%; background: rgba(7,11,26,0.6); border: 1px solid var(--line); color: var(--text);
  border-radius: 12px; padding: 10px 14px; font-size: 14px; font-family: inherit; transition: border-color .2s, box-shadow .2s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(76,201,240,0.15); }
textarea { resize: vertical; min-height: 70px; }
label { display: block; font-size: 12.5px; color: var(--muted); margin: 12px 0 5px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.muted { color: var(--muted); font-size: 13px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #4a5378; display: inline-block; flex: none; }
.dot.on { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.avatar {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; color: #06122b;
  background: linear-gradient(135deg, hsl(var(--h,200) 85% 65%), hsl(calc(var(--h,200) + 60) 85% 60%));
}
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 11.5px; background: rgba(155,93,229,0.18); color: #c9a6ff; border: 1px solid rgba(155,93,229,0.35); }
.badge.warn { background: rgba(255,193,7,0.12); color: #ffd166; border-color: rgba(255,193,7,0.35); }
.badge.ok { background: rgba(61,220,151,0.12); color: var(--ok); border-color: rgba(61,220,151,0.35); }
.badge.danger { background: rgba(255,93,115,0.12); color: var(--danger); border-color: rgba(255,93,115,0.35); }
.empty { text-align: center; color: var(--muted); padding: 34px 10px; font-size: 13.5px; }
h3.sec { font-size: 15px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
h3.sec::before { content: ""; width: 4px; height: 16px; border-radius: 4px; background: linear-gradient(var(--accent), var(--accent3)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.grid { display: grid; gap: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: start; padding: 8px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 12px; }

/* ---------- auth screen ---------- */
.auth-wrap { height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card { width: 400px; max-width: 100%; border-radius: 22px; padding: 34px; animation: pop .4s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.brand-line { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.brand-line img { width: 46px; height: 46px; }
.brand-line .name { font-size: 26px; font-weight: 800; background: linear-gradient(90deg, var(--accent), var(--accent3)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-switch { margin-top: 16px; font-size: 13px; color: var(--muted); text-align: center; }
.link-btn { background: none; border: none; color: var(--accent); cursor: pointer; font-family: inherit; font-size: inherit; }
.link-btn:hover { text-decoration: underline; }

/* ---------- app shell ---------- */
.shell { display: flex; height: 100vh; }
.sidebar { width: 232px; flex: none; display: flex; flex-direction: column; border-block: none; border-inline-start: none; border-radius: 0; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px; font-weight: 800; font-size: 19px; }
.brand img { width: 34px; height: 34px; }
.sidebar nav { flex: 1; padding: 6px 10px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.nav-btn {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px;
  color: var(--muted); cursor: pointer; border: 1px solid transparent; font-size: 14px; background: none; font-family: inherit; text-align: start; width: 100%;
  transition: background .2s, color .2s;
}
.nav-btn:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.nav-btn.active { background: linear-gradient(135deg, rgba(76,201,240,0.16), rgba(155,93,229,0.16)); color: var(--text); border-color: var(--line); }
.nav-ico { width: 20px; text-align: center; flex: none; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--line); font-size: 13px; }
.side-user small { display: block; color: var(--muted); direction: ltr; text-align: end; }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; border-inline: none; border-top: none; border-radius: 0; gap: 10px; }
.tb-title { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; white-space: nowrap; }
.announce { margin: 0 20px; margin-top: 8px; padding: 8px 14px; border-radius: 12px; font-size: 13px; background: linear-gradient(135deg, rgba(76,201,240,0.12), rgba(241,91,181,0.1)); border: 1px solid var(--line); color: #cfe6ff; }
.view { flex: 1; overflow-y: auto; padding: 18px 20px 30px; animation: fadein .25s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } }

/* ---------- chat ---------- */
.chat-layout { display: grid; grid-template-columns: 250px 1fr; gap: 14px; height: 100%; min-height: 0; }
.room-col { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.room-chip {
  text-align: start; padding: 11px 13px; border-radius: 13px; cursor: pointer; background: rgba(255,255,255,0.03);
  border: 1px solid var(--line); color: var(--text); font-family: inherit; font-size: 13.5px; transition: border-color .2s, background .2s;
}
.room-chip:hover { background: rgba(255,255,255,0.07); }
.room-chip.active { border-color: var(--accent); background: linear-gradient(135deg, rgba(76,201,240,0.14), rgba(155,93,229,0.12)); }
.room-chip small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.conv { display: flex; flex-direction: column; min-height: 0; border-radius: var(--radius); overflow: hidden; }
.conv-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.conv-head .title { font-weight: 700; }
.msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; min-height: 220px; }
.msg { display: flex; gap: 10px; animation: fadein .2s ease; }
.msg .body { min-width: 0; }
.msg .meta { display: flex; align-items: baseline; gap: 8px; font-size: 12px; color: var(--muted); }
.msg .meta b { color: var(--text); font-size: 13.5px; }
.msg .bubble { background: rgba(255,255,255,0.05); border: 1px solid var(--line); padding: 8px 12px; border-radius: 4px 14px 14px 14px; font-size: 14px; word-break: break-word; white-space: pre-wrap; margin-top: 3px; }
[dir="ltr"] .msg .bubble { border-radius: 14px 4px 14px 14px; }
.msg.mine .bubble { background: linear-gradient(135deg, rgba(76,201,240,0.14), rgba(155,93,229,0.14)); border-color: rgba(76,201,240,0.3); }
.msg .flag { background: none; border: none; color: var(--muted); cursor: pointer; opacity: 0; transition: opacity .2s; font-size: 12px; }
.msg:hover .flag { opacity: 1; }
.msg .flag:hover { color: var(--danger); }
.composer { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.composer input { flex: 1; }
.char-count { font-size: 11px; color: var(--muted); align-self: center; flex: none; }

/* ---------- friends ---------- */
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.user-row { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--line); }
.user-row:last-child { border-bottom: none; }
.user-row .info { flex: 1; min-width: 0; }
.user-row .info b { display: block; font-size: 13.5px; }
.user-row .info small { color: var(--muted); font-size: 11.5px; direction: ltr; display: inline-block; }

/* ---------- community ---------- */
.comm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.comm-card { display: flex; flex-direction: column; gap: 8px; transition: transform .2s, box-shadow .2s; }
.comm-card:hover { transform: translateY(-3px); box-shadow: 0 14px 40px rgba(0,0,0,0.35); }
.comm-card h4 { font-size: 15px; }
.comm-card a { color: var(--accent); font-size: 12.5px; word-break: break-all; }

/* ---------- admin ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { text-align: center; padding: 14px 8px; }
.stat b { display: block; font-size: 24px; background: linear-gradient(90deg, var(--accent), var(--accent3)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat span { font-size: 12px; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 14px; }

/* ---------- settings ---------- */
.swatch { width: 34px; height: 34px; border-radius: 10px; cursor: pointer; border: 2px solid transparent; }
.swatch.active { border-color: #fff; }
.swatch[data-accent="blue"] { background: linear-gradient(135deg, #4cc9f0, #4361ee); }
.swatch[data-accent="purple"] { background: linear-gradient(135deg, #9b5de5, #6a2c93); }
.swatch[data-accent="pink"] { background: linear-gradient(135deg, #f15bb5, #c9184a); }

/* ---------- toast & modal ---------- */
#toasts { position: fixed; bottom: 20px; inset-inline-start: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: 320px; }
.toast { padding: 11px 16px; border-radius: 12px; font-size: 13.5px; background: var(--panel-solid); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0,0,0,0.4); animation: toastin .25s ease; }
.toast.ok { border-color: rgba(61,220,151,0.5); }
.toast.err { border-color: rgba(255,93,115,0.5); }
@keyframes toastin { from { opacity: 0; transform: translateY(10px); } }
.modal-overlay { position: fixed; inset: 0; background: rgba(3,5,15,0.7); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 90; padding: 18px; animation: fadein .2s ease; }
.modal { width: 440px; max-width: 100%; border-radius: 18px; padding: 22px; animation: pop .25s ease; max-height: 85vh; overflow-y: auto; }

/* ---------- maintenance ---------- */
.maint { height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.maint .card { text-align: center; max-width: 420px; padding: 36px; }
.maint .icon { font-size: 44px; margin-bottom: 10px; }

/* ---------- scrollbar ---------- */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(140,160,255,0.2); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(140,160,255,0.35); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .chat-layout { grid-template-columns: 1fr; }
  .room-col { flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .room-chip { min-width: 140px; }
  .cols { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; align-items: center; padding: 6px 10px; order: 2; border-top: 1px solid var(--line); }
  .sidebar .brand, .side-user { display: none; }
  .sidebar nav { flex-direction: row; overflow-x: auto; padding: 0; gap: 2px; }
  .nav-btn { flex-direction: column; gap: 2px; font-size: 10.5px; padding: 7px 10px; white-space: nowrap; }
  .main { order: 1; height: calc(100vh - 64px); }
}

@font-face {
  font-family: "Mikhak";
  src: url("/fonts/Mikhak[DSTY,KSHD,wght].woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

html,
body,
button,
input,
textarea,
select {
  font-family: "Mikhak", sans-serif;
}
