/* =========================================================================
   BANKPEDIAA UNION — DESIGN SYSTEM
   Signature idea: the "roll call" — every member is a named, numbered
   presence (Member ID badges, level insignia) inside a disciplined black
   field. The union's strength is legibility and order, not decoration.
   ========================================================================= */

:root {
  /* ---- Color tokens ---- */
  --ink:        #08090a;   /* page background */
  --panel:      #131518;   /* card background */
  --panel-2:    #1a1d21;   /* raised / hover panel */
  --stroke:     #262a2f;   /* soft hairline border */
  --stroke-2:   #34383e;   /* stronger border, focus */
  --text-hi:    #f3f5f4;   /* headline text */
  --text-md:    #b7bcc2;   /* body text */
  --text-lo:    #74797f;   /* captions / meta */
  --union-green:      #35c47a; /* primary accent — brand green */
  --union-green-dim:  #23a366;
  --union-green-tint: rgba(53, 196, 122, 0.12);
  --amber:      #e0a940;   /* leaderboard / rank highlight only */
  --danger:     #e0554f;

  /* ---- Type ---- */
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, monospace;

  /* ---- Layout ---- */
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-card: 0 1px 0 rgba(255,255,255,0.02) inset, 0 8px 24px rgba(0,0,0,0.35);
  --nav-h: 64px;
  --sidebar-w: 248px;
  --max-content: 720px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--ink);
  color: var(--text-md);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(600px circle at 10% -10%, rgba(53,196,122,0.05), transparent 60%);
}

h1, h2, h3, h4 { font-family: var(--font-display); color: var(--text-hi); margin: 0 0 8px; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 28px; line-height: 1.2; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
p { margin: 0 0 12px; color: var(--text-md); }
a { color: var(--union-green); text-decoration: none; }
a:hover { color: var(--union-green-dim); }

::selection { background: var(--union-green-tint); color: var(--text-hi); }

:focus-visible {
  outline: 2px solid var(--union-green);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---- Layout shells ---- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  display: none;
}

.main-col {
  flex: 1;
  min-width: 0;
  padding-bottom: calc(var(--nav-h) + 24px);
}

.content {
  max-width: var(--max-content);
  margin: 0 auto;
  padding: 20px 16px 40px;
}

@media (min-width: 900px) {
  .sidebar {
    display: flex;
    flex-direction: column;
    width: var(--sidebar-w);
    flex-shrink: 0;
    border-right: 1px solid var(--stroke);
    padding: 24px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
  }
  .main-col { padding-bottom: 40px; }
  .content { padding: 32px 32px 48px; }
  .bottom-nav { display: none; }
}

/* ---- Topbar (mobile) ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--stroke);
  position: sticky;
  top: 0;
  background: rgba(8,9,10,0.92);
  backdrop-filter: blur(8px);
  z-index: 20;
}
@media (min-width: 900px) { .topbar { display: none; } }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--text-hi);
  font-size: 16px;
  letter-spacing: -0.01em;
}
.brand-mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: linear-gradient(160deg, var(--union-green), var(--union-green-dim));
  display: flex; align-items: center; justify-content: center;
  color: #05130b;
  font-weight: 900;
  font-size: 15px;
}

/* ---- Sidebar nav (desktop) ---- */
.nav-list { list-style: none; margin: 24px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-md);
  font-weight: 600;
  font-size: 14px;
}
.nav-item svg { width: 19px; height: 19px; flex-shrink: 0; }
.nav-item:hover { background: var(--panel); color: var(--text-hi); }
.nav-item.active { background: var(--union-green-tint); color: var(--union-green); }

/* ---- Bottom tab nav (mobile) ---- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex;
  background: rgba(19,21,24,0.96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--stroke);
  z-index: 30;
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 4px 8px;
  color: var(--text-lo);
  font-size: 11px;
  font-weight: 600;
}
.bottom-nav a svg { width: 21px; height: 21px; }
.bottom-nav a.active { color: var(--union-green); }

/* ---- Cards ---- */
.card {
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 20px;
}
.card + .card { margin-top: 14px; }
.card-flat { border-radius: var(--radius-md); padding: 16px; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: var(--radius-sm);
  padding: 11px 18px;
  font-weight: 700;
  font-size: 14px;
  font-family: var(--font-body);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
  text-align: center;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--union-green); color: #05130b; }
.btn-primary:hover { background: var(--union-green-dim); color: #05130b; }
.btn-outline { background: transparent; border-color: var(--stroke-2); color: var(--text-hi); }
.btn-outline:hover { border-color: var(--union-green); color: var(--union-green); }
.btn-ghost { background: transparent; color: var(--text-md); }
.btn-ghost:hover { color: var(--text-hi); }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 13px; }

/* ---- Forms ---- */
label { display: block; font-size: 13px; font-weight: 600; color: var(--text-hi); margin-bottom: 6px; }
.field { margin-bottom: 16px; }
input, textarea, select {
  width: 100%;
  background: var(--ink);
  border: 1px solid var(--stroke);
  color: var(--text-hi);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 14px;
  font-family: var(--font-body);
}
input:focus, textarea:focus, select:focus { border-color: var(--union-green); outline: none; }
textarea { resize: vertical; min-height: 90px; }
.help-text { font-size: 12px; color: var(--text-lo); margin-top: 6px; }
.error-text { font-size: 12px; color: var(--danger); margin-top: 6px; }

/* ---- Badges / pills ---- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.badge-member-id {
  font-family: var(--font-mono);
  background: var(--panel-2);
  color: var(--union-green);
  border: 1px solid var(--stroke-2);
}
.badge-level { background: var(--union-green-tint); color: var(--union-green); }
.badge-free { background: rgba(255,255,255,0.06); color: var(--text-lo); }
.badge-locked { background: rgba(224,169,64,0.12); color: var(--amber); }

/* ---- Avatar ---- */
.avatar {
  border-radius: 50%;
  background: var(--panel-2);
  border: 1px solid var(--stroke);
  object-fit: cover;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-md); font-weight: 700;
}

/* ---- Alerts / flash ---- */
.alert {
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 13.5px;
  margin-bottom: 16px;
  border: 1px solid;
}
.alert-error { background: rgba(224,85,79,0.08); border-color: rgba(224,85,79,0.3); color: #f0928d; }
.alert-success { background: var(--union-green-tint); border-color: rgba(53,196,122,0.3); color: var(--union-green); }

/* ---- Locked content teaser ---- */
.locked-panel {
  position: relative;
  border-radius: var(--radius-md);
  padding: 22px 18px;
  text-align: center;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px dashed var(--stroke-2);
}
.locked-panel .lock-icon {
  width: 34px; height: 34px; margin: 0 auto 10px;
  color: var(--amber);
}

/* ---- Auth screens ---- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.auth-card {
  width: 100%;
  max-width: 400px;
}
.auth-hero {
  text-align: center;
  margin-bottom: 28px;
}
.auth-hero .brand-mark { width: 44px; height: 44px; font-size: 20px; margin: 0 auto 14px; }
.auth-hero h1 { font-size: 22px; margin-bottom: 6px; }
.auth-hero p { font-size: 13.5px; color: var(--text-lo); max-width: 320px; margin: 0 auto; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--text-lo); font-size: 12px; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--stroke); }
.auth-switch { text-align: center; font-size: 13.5px; margin-top: 18px; color: var(--text-lo); }

/* ---- Feed ---- */
.post-card { padding: 16px; }
.post-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.post-meta { display: flex; flex-direction: column; }
.post-meta .name { font-weight: 700; color: var(--text-hi); font-size: 14px; }
.post-meta .sub { font-size: 12px; color: var(--text-lo); }
.post-body { font-size: 14.5px; color: var(--text-md); white-space: pre-wrap; word-break: break-word; }
.post-actions { display: flex; gap: 18px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--stroke); }
.post-action {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-lo); font-weight: 600;
  background: none; border: none; cursor: pointer; padding: 4px;
}
.post-action svg { width: 17px; height: 17px; }
.post-action.liked { color: var(--union-green); }
.post-action:hover { color: var(--text-hi); }

.composer { margin-bottom: 18px; }
.char-count { text-align: right; font-size: 11.5px; color: var(--text-lo); margin-top: -8px; margin-bottom: 12px; }
.char-count.warn { color: var(--danger); }

.comment { padding: 10px 0; border-top: 1px solid var(--stroke); font-size: 13.5px; }
.comment .name { font-weight: 700; color: var(--text-hi); }

/* ---- Directory ---- */
.directory-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (min-width: 640px) { .directory-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1100px) { .directory-grid { grid-template-columns: repeat(4, 1fr); } }
.member-tile { text-align: center; padding: 18px 12px; }
.member-tile .avatar { width: 56px; height: 56px; font-size: 18px; margin: 0 auto 10px; }
.member-tile .name { font-size: 13.5px; font-weight: 700; color: var(--text-hi); margin-bottom: 2px; }
.member-tile .role { font-size: 11.5px; color: var(--text-lo); margin-bottom: 8px; min-height: 14px; }

/* ---- Classroom ---- */
.module-card { padding: 0; overflow: hidden; }
.module-head { padding: 16px 18px; border-bottom: 1px solid var(--stroke); }
.lesson-row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--stroke);
}
.lesson-row:last-child { border-bottom: none; }
.lesson-row .idx { color: var(--text-lo); font-family: var(--font-mono); font-size: 12px; width: 20px; }
.lesson-row .title { flex: 1; font-size: 13.5px; color: var(--text-hi); font-weight: 600; }
.lesson-row svg { width: 16px; height: 16px; color: var(--text-lo); }
.lesson-row.locked .title { color: var(--text-lo); }

/* ---- Leaderboard ---- */
.rank-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--stroke);
}
.rank-row:last-child { border-bottom: none; }
.rank-num { width: 24px; font-family: var(--font-mono); font-weight: 700; color: var(--text-lo); font-size: 13px; }
.rank-num.top3 { color: var(--amber); }
.rank-row .avatar { width: 34px; height: 34px; font-size: 13px; }
.rank-row .name { font-size: 13.5px; font-weight: 700; color: var(--text-hi); }
.rank-row .pts { margin-left: auto; font-family: var(--font-mono); font-size: 13px; color: var(--union-green); font-weight: 700; }

/* ---- Section header ---- */
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.eyebrow { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-lo); font-weight: 700; margin-bottom: 4px; }

/* ---- Empty state ---- */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-lo); }
.empty-state svg { width: 36px; height: 36px; margin-bottom: 12px; color: var(--stroke-2); }

/* ---- Pagination ---- */
.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 20px; }

/* ---- Utility ---- */
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.flex { display: flex; } .items-center { align-items: center; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.small { font-size: 12.5px; color: var(--text-lo); }
