/* ============================================================
   BaziGap — user-facing styles (RTL, gaming dark theme)
   ============================================================ */

:root {
  --bg:          #0e1117;
  --bg-soft:     #161b22;
  --bg-card:     #1c2331;
  --bg-input:    #0c1118;
  --bg-glass:    rgba(28, 35, 49, .55);
  --line:        #2a3346;
  --line-soft:   #1d2433;

  --text:        #e6edf3;
  --text-dim:    #9aa6b2;
  --text-muted:  #6b7785;

  --accent:      #8b5cf6;   /* neon purple */
  --accent-2:    #38bdf8;   /* electric blue */
  --accent-glow: rgba(139,92,246,.45);
  --ok:          #22c55e;
  --warn:        #f59e0b;
  --err:         #ef4444;

  --radius:      14px;
  --radius-sm:   10px;
  --shadow-card: 0 8px 30px rgba(0,0,0,.35);
  --maxw:        1180px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: Tahoma, 'Segoe UI', Arial, sans-serif;
  font-size: 14px; line-height: 1.6;
  color: var(--text);
  background:
    radial-gradient(900px 500px at 5% -10%, rgba(139,92,246,.10), transparent 60%),
    radial-gradient(900px 500px at 95% -10%, rgba(56,189,248,.08), transparent 60%),
    var(--bg);
  min-height: 100vh;
  padding-bottom: 80px; /* bottom-nav space on mobile */
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { color: var(--accent); }
img { max-width: 100%; display: block; }
button, input, textarea, select { font-family: inherit; font-size: 14px; color: var(--text); }
.hidden { display: none !important; }
.muted { color: var(--text-muted); }
code { background: var(--bg-input); padding: 1px 6px; border-radius: 5px; color: var(--text-dim); }

/* ─── Layout helpers ──────────────────────────────────────── */
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.row { display: grid; gap: 16px; }
.row.cols-2 { grid-template-columns: 2fr 1fr; }
.row.cols-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 920px) {
  .row.cols-2, .row.cols-3 { grid-template-columns: 1fr; }
}

/* ─── Top bar ─────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 22px;
  padding: 12px 24px;
  background: rgba(14,17,23,.85);
  backdrop-filter: blur(10px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.brand .logo-mark {
  width: 36px; height: 36px; border-radius: 9px;
  display: grid; place-items: center; font-size: 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 18px var(--accent-glow);
  color: #fff;
}
.brand .logo-text {
  font-size: 18px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.top-nav { display: flex; gap: 6px; flex: 1; }
.top-nav a {
  padding: 8px 14px; border-radius: 10px; color: var(--text-dim);
  font-weight: 500;
}
.top-nav a:hover { background: var(--bg-card); color: var(--text); }
.top-nav a.active {
  background: linear-gradient(90deg, rgba(139,92,246,.18), rgba(56,189,248,.05));
  color: var(--text);
}
.top-actions { display: flex; align-items: center; gap: 10px; }
.guest-actions, .auth-actions { display: flex; align-items: center; gap: 8px; }
.me-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px; border-radius: 999px;
  background: var(--bg-card); border: 1px solid var(--line);
  color: var(--text);
}
.me-chip:hover { border-color: var(--accent); color: var(--text); }
.avatar-sm { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; background: var(--bg-input); }
.icon-btn {
  position: relative; width: 38px; height: 38px;
  display: grid; place-items: center; border-radius: 10px;
  background: var(--bg-card); border: 1px solid var(--line); color: var(--text-dim);
}
.icon-btn:hover { color: var(--text); border-color: var(--accent); }
.badge-dot {
  position: absolute; top: -4px; left: -4px;
  background: var(--err); color: #fff; font-size: 10px;
  min-width: 16px; height: 16px; border-radius: 999px;
  display: grid; place-items: center; padding: 0 4px;
}

/* ─── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  padding: 8px 16px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg-card);
  color: var(--text); cursor: pointer; font-weight: 500;
  transition: transform .1s ease, background .15s ease, color .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-color: transparent; color: #fff;
  box-shadow: 0 4px 18px rgba(139,92,246,.35);
}
.btn-primary:hover { color: #fff; }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--err); border-color: var(--err); }
.btn-danger:hover { background: rgba(239,68,68,.12); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ─── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow-card);
}
.card.glass {
  background: linear-gradient(180deg, rgba(28,35,49,.7), rgba(28,35,49,.4));
  backdrop-filter: blur(6px);
}
.card h3 {
  margin: 0 0 12px; font-size: 15px; color: var(--text-dim);
  display: flex; align-items: center; justify-content: space-between;
}
.card h3 a { font-size: 12px; color: var(--accent-2); }

/* ─── View container ──────────────────────────────────────── */
.view {
  max-width: var(--maxw); margin: 0 auto;
  padding: 24px 20px;
}

/* ─── Hero ────────────────────────────────────────────────── */
.hero {
  position: relative; overflow: hidden;
  background:
    linear-gradient(135deg, rgba(139,92,246,.25), rgba(56,189,248,.18)),
    var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 40px 28px; margin-bottom: 24px;
}
.hero h1 {
  margin: 0 0 8px; font-size: 32px; line-height: 1.3;
  background: linear-gradient(90deg, #fff, #cdd6f4);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { color: var(--text-dim); margin: 0 0 20px; max-width: 600px; }
.hero .cta { display: flex; flex-wrap: wrap; gap: 10px; }

/* ─── Section header ──────────────────────────────────────── */
.section-h {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 22px 0 12px;
}
.section-h h2 { margin: 0; font-size: 18px; }
.section-h .more { color: var(--text-muted); font-size: 12px; }

/* ─── Grids ───────────────────────────────────────────────── */
.grid { display: grid; gap: 14px; }
.grid.cols-auto { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.grid.cols-2    { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3    { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4    { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) {
  .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
}

/* ─── Game card ───────────────────────────────────────────── */
.game-card {
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.game-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 8px 25px var(--accent-glow);
}
.game-cover {
  width: 100%; aspect-ratio: 16/9; object-fit: cover;
  background: linear-gradient(135deg, #2c1755, #1a2950);
}
.game-card .meta { padding: 12px 14px; }
.game-card .title { font-weight: 600; }
.game-card .sub { color: var(--text-muted); font-size: 12px; margin-top: 4px; }
.game-card .tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 8px; }

/* ─── Tags ────────────────────────────────────────────────── */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 999px;
  background: var(--bg-input);
  border: 1px solid var(--line);
  color: var(--text-dim); font-size: 11px;
}
.tag.ok   { color: var(--ok);    border-color: rgba(34,197,94,.4); }
.tag.warn { color: var(--warn);  border-color: rgba(245,158,11,.4); }
.tag.err  { color: var(--err);   border-color: rgba(239,68,68,.4); }
.tag.accent { color: var(--accent); border-color: rgba(139,92,246,.45); background: rgba(139,92,246,.08); }
.dot {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block;
  background: var(--text-muted); margin-inline-end: 6px;
}
.dot.online { background: var(--ok); box-shadow: 0 0 8px rgba(34,197,94,.6); }

/* ─── Room / matchmaking list rows ────────────────────────── */
.list-card {
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px;
  display: flex; gap: 14px; align-items: center;
  transition: border-color .15s ease;
}
.list-card:hover { border-color: var(--accent); }
.list-card .cover {
  width: 56px; height: 56px; border-radius: 10px;
  object-fit: cover; background: var(--bg-input); flex-shrink: 0;
}
.list-card .body { flex: 1; min-width: 0; }
.list-card .title { font-weight: 600; }
.list-card .sub { color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.list-card .meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.list-card .actions { display: flex; gap: 6px; }

/* ─── Forms ───────────────────────────────────────────────── */
.form-wrap {
  max-width: 420px; margin: 30px auto; padding: 28px;
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-card);
}
.form-wrap h1 {
  margin: 0 0 6px; text-align: center; font-size: 22px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.form-wrap .lead { text-align: center; color: var(--text-dim); margin-bottom: 22px; }
.field { margin-bottom: 14px; }
.field label { display: block; color: var(--text-dim); font-size: 12px; margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 10px 12px;
  background: var(--bg-input); border: 1px solid var(--line);
  border-radius: 10px; outline: none;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); }
.field textarea { min-height: 90px; resize: vertical; }
.field .hint { color: var(--text-muted); font-size: 11px; margin-top: 4px; }
.form-error {
  margin-top: 8px; color: var(--err); font-size: 12px; min-height: 18px; text-align: center;
}
.form-divider {
  text-align: center; color: var(--text-muted); font-size: 12px;
  margin: 18px 0; position: relative;
}
.form-divider::before, .form-divider::after {
  content: ''; position: absolute; top: 50%;
  width: 40%; height: 1px; background: var(--line);
}
.form-divider::before { right: 0; }
.form-divider::after  { left: 0; }

/* ─── Profile ─────────────────────────────────────────────── */
.profile-hero {
  background:
    linear-gradient(180deg, rgba(139,92,246,.10), transparent 60%),
    var(--bg-card);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; display: flex; gap: 20px; align-items: center; flex-wrap: wrap;
}
.profile-hero .avatar {
  width: 96px; height: 96px; border-radius: 50%;
  border: 3px solid var(--accent); object-fit: cover; background: var(--bg-input);
  box-shadow: 0 0 24px var(--accent-glow);
}
.profile-hero h1 { margin: 0 0 4px; font-size: 22px; }
.profile-hero .sub { color: var(--text-dim); }
.trust-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 999px;
  background: linear-gradient(90deg, rgba(139,92,246,.18), rgba(56,189,248,.10));
  border: 1px solid var(--accent);
  font-weight: 600; color: var(--text);
}
.trust-pill .pct { color: var(--accent-2); }

/* ─── Chat ────────────────────────────────────────────────── */
.chat-wrap {
  display: grid; grid-template-columns: 280px 1fr;
  gap: 14px; height: calc(100vh - 200px); min-height: 480px;
}
@media (max-width: 800px) {
  .chat-wrap { grid-template-columns: 1fr; height: auto; }
  .chat-list { max-height: 240px; overflow: auto; }
}
.chat-list, .chat-thread {
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--radius); display: flex; flex-direction: column;
  overflow: hidden;
}
.chat-list .head, .chat-thread .head {
  padding: 12px 14px; border-bottom: 1px solid var(--line);
  font-weight: 600;
}
.chat-list .item {
  padding: 10px 12px; display: flex; gap: 10px; cursor: pointer;
  border-bottom: 1px solid var(--line-soft);
}
.chat-list .item:hover { background: var(--bg-soft); }
.chat-list .item.active { background: rgba(139,92,246,.08); }
.chat-list .item .name { font-weight: 600; }
.chat-list .item .preview { color: var(--text-muted); font-size: 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-list .item .badge {
  margin-inline-start: auto; background: var(--accent);
  color: #fff; font-size: 11px; padding: 1px 8px; border-radius: 999px;
}

.chat-thread .messages {
  flex: 1; overflow-y: auto; padding: 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.bubble {
  max-width: 70%; padding: 8px 12px;
  border-radius: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  line-height: 1.5;
  word-break: break-word;
}
.bubble.mine {
  align-self: flex-start;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent; color: #fff;
}
.bubble.system {
  align-self: center;
  font-size: 12px; color: var(--text-muted);
  background: transparent; border: 1px dashed var(--line);
}
.bubble .ts { color: rgba(255,255,255,.5); font-size: 10px; margin-top: 4px; display: block; }
.chat-thread .input {
  display: flex; gap: 8px; padding: 10px 12px;
  border-top: 1px solid var(--line); background: var(--bg-soft);
}
.chat-thread .input input {
  flex: 1; padding: 10px 12px; border-radius: 10px;
  background: var(--bg-input); border: 1px solid var(--line); color: var(--text);
}

/* ─── Empty / loading ─────────────────────────────────────── */
.empty {
  padding: 40px 20px; text-align: center; color: var(--text-muted);
  background: var(--bg-card); border: 1px dashed var(--line);
  border-radius: var(--radius);
}
.loading {
  padding: 40px 20px; text-align: center; color: var(--text-dim);
}
.spinner {
  display: inline-block; width: 22px; height: 22px;
  border: 3px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Pager ───────────────────────────────────────────────── */
.pager { display: flex; gap: 6px; justify-content: center; margin-top: 16px; }
.pager button {
  background: var(--bg-card); border: 1px solid var(--line); color: var(--text);
  padding: 6px 12px; border-radius: 8px; cursor: pointer;
}
.pager button:disabled { opacity: .4; }

/* ─── Toast ───────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%);
  background: var(--bg-card); border: 1px solid var(--line);
  padding: 10px 18px; border-radius: 10px;
  box-shadow: var(--shadow-card); z-index: 9999;
}
.toast.ok  { border-color: var(--ok);  color: var(--ok); }
.toast.err { border-color: var(--err); color: var(--err); }

/* ─── Modal ───────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(4px); }
.modal-card {
  position: relative; z-index: 1; background: var(--bg-card);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; width: min(440px, 92vw);
  box-shadow: var(--shadow-card);
}
.modal-card h2 { margin: 0 0 12px; font-size: 18px; }

/* ─── Bottom nav (mobile) ─────────────────────────────────── */
.bottom-nav {
  display: none;
}
@media (max-width: 760px) {
  .top-nav { display: none; }
  .topbar { padding: 10px 14px; gap: 10px; }
  .brand .logo-text { display: none; }
  .bottom-nav {
    display: flex; justify-content: space-around;
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    background: rgba(14,17,23,.95);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--line);
    padding: 8px 0;
  }
  .bottom-nav a {
    flex: 1; text-align: center; padding: 6px 4px;
    color: var(--text-dim); font-size: 12px;
  }
  .bottom-nav a.active {
    color: var(--accent);
  }
}

/* ─── Footer ──────────────────────────────────────────────── */
.site-footer {
  margin: 40px auto 0; max-width: var(--maxw); padding: 24px 20px;
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  color: var(--text-muted); font-size: 12px;
}

/* ─── Member chips ────────────────────────────────────────── */
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.member-chip {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-input); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 10px 4px 4px;
  font-size: 12px;
}
.member-chip img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }

/* ─── OTP / OTP code box ──────────────────────────────────── */
.otp-box {
  margin: 18px 0; padding: 14px;
  background: rgba(139,92,246,.08);
  border: 1px dashed var(--accent); border-radius: 10px;
  text-align: center; color: var(--accent); font-size: 13px;
}
.otp-box code { font-size: 18px; letter-spacing: 4px; }

/* ─── Trust traits bars ───────────────────────────────────── */
.trait-row { display: grid; grid-template-columns: 1fr 60px; gap: 10px; align-items: center; margin: 6px 0; }
.trait-row .bar { background: var(--bg-input); border-radius: 999px; height: 8px; overflow: hidden; }
.trait-row .fill {
  height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.trait-row .num { font-size: 12px; color: var(--text-dim); text-align: left; }
