/* ===========================================================
   ADDAA — Design System
   Concept: "adda" (Bengali/Hindi) = an easy, unhurried gathering
   of friends to talk. The signature visual idea is warm amber
   lamplight glowing against a deep night backdrop — like a
   circle of people talking after dark — rather than the generic
   neon-on-black look. Communities render as a glowing "ring" of
   circular nodes instead of rectangular carousel cards.
   =========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* --- Color tokens --- */
  --bg: #0a0a10;
  --bg-elevated: #101018;
  --glass: rgba(255, 255, 255, 0.045);
  --glass-strong: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.09);
  --border-soft: rgba(255, 255, 255, 0.05);

  --amber: #f2a53c;       /* lamplight — primary accent */
  --amber-soft: #f2a53c33;
  --violet: #8b6cf2;      /* dusk sky — secondary accent */
  --violet-soft: #8b6cf233;

  --text: #f4f1ea;
  --text-dim: #a7a6ae;
  --text-faint: #6b6a74;

  --danger: #f2593c;
  --success: #5cc98a;

  /* --- Type --- */
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* --- Layout --- */
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --shell-max: 1100px;
}

* { box-sizing: border-box; }
html { -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  background: radial-gradient(120% 60% at 50% -10%, #17131c 0%, var(--bg) 55%);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  padding-bottom: 78px; /* room for mobile bottom nav */
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

::selection { background: var(--amber-soft); color: var(--text); }

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

/* ---------------------------------------------------------
   Glass primitive
   --------------------------------------------------------- */
.glass {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

/* ---------------------------------------------------------
   Header
   --------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: rgba(10, 10, 16, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-soft);
}

.brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: 0.2px;
  background: linear-gradient(120deg, var(--amber), #ffd48a 55%, var(--violet));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  flex-shrink: 0;
}

.header-search {
  flex: 1;
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 16px;
  color: var(--text-dim);
}
.header-search input {
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 14px;
  width: 100%;
}
.header-search input::placeholder { color: var(--text-faint); }

.header-icons {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}
.icon-btn {
  position: relative;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-dim);
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.icon-btn:hover { background: var(--glass-strong); color: var(--text); border-color: var(--border); }
.icon-badge {
  position: absolute;
  top: 4px; right: 4px;
  min-width: 15px; height: 15px;
  padding: 0 3px;
  border-radius: 999px;
  background: var(--amber);
  color: #1a1206;
  font-size: 10px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
}

@media (max-width: 640px) {
  .header-search { display: none; }
  .brand { font-size: 19px; }
}

/* ---------------------------------------------------------
   Shell / layout
   --------------------------------------------------------- */
.shell {
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: 20px 16px 40px;
}

/* ---------------------------------------------------------
   Community slider — the "Adda Ring"
   Circular glowing nodes rather than rectangular cards, to
   embody "adda": a circle of people gathered to talk.
   --------------------------------------------------------- */
.adda-ring-section { margin-bottom: 28px; }
.section-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 0 12px 4px;
}

.adda-ring {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  padding: 10px 4px 16px;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}
.adda-ring::-webkit-scrollbar { display: none; }

.adda-node {
  scroll-snap-align: start;
  flex-shrink: 0;
  width: 108px;
  text-align: center;
}
.adda-node-glow {
  width: 88px;
  height: 88px;
  margin: 0 auto 10px;
  border-radius: 50%;
  padding: 3px;
  background: conic-gradient(from 200deg, var(--amber), var(--violet), var(--amber));
  box-shadow: 0 0 22px -4px var(--amber-soft);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.adda-node:hover .adda-node-glow {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 0 30px -2px var(--amber-soft);
}
.adda-node-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-elevated);
  border: 2px solid var(--bg);
}
.adda-node-img img { width: 100%; height: 100%; object-fit: cover; }
.adda-node-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.adda-node-meta {
  font-size: 11px;
  color: var(--text-faint);
  font-family: var(--font-mono);
}

/* ---------------------------------------------------------
   Post feed
   --------------------------------------------------------- */
.feed { display: flex; flex-direction: column; gap: 14px; max-width: 620px; margin: 0 auto; }

.post-card {
  padding: 16px 18px;
}
.post-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.avatar-img { border-radius: 50%; object-fit: cover; }
.post-head-meta { display: flex; flex-direction: column; line-height: 1.2; }
.user-name { font-weight: 600; font-size: 14px; }
.username-sub { font-size: 12.5px; color: var(--text-faint); }
.verified-badge { color: var(--amber); font-size: 12px; }
.post-time {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-faint);
  font-family: var(--font-mono);
}

.post-content { font-size: 14.5px; margin: 0 0 10px; white-space: pre-wrap; }

.post-media {
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 10px;
  display: grid;
  gap: 2px;
}
.post-media img, .post-media video { width: 100%; max-height: 520px; object-fit: cover; }
.post-media.count-2 { grid-template-columns: 1fr 1fr; }
.post-media.count-3 { grid-template-columns: 1fr 1fr; }
.post-media.count-3 > *:first-child { grid-row: span 2; }

.post-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-top: 6px;
  border-top: 1px solid var(--border-soft);
}
.action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.action-btn:hover { background: var(--glass-strong); color: var(--text); }
.action-btn.liked { color: var(--amber); }
.action-btn.liked i { font-weight: 900; }

/* ---------------------------------------------------------
   Buttons
   --------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  border: 1px solid transparent;
  transition: transform 0.12s ease, filter 0.15s ease, background 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(120deg, var(--amber), #e08a2e);
  color: #1a1206;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-outline {
  background: var(--glass);
  border-color: var(--border);
  color: var(--text);
}
.btn-outline:hover { background: var(--glass-strong); }
.btn-ghost { background: none; color: var(--text-dim); }
.btn-block { width: 100%; }

/* ---------------------------------------------------------
   Forms / auth
   --------------------------------------------------------- */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  padding: 32px 28px;
  text-align: center;
}
.auth-card .brand { display: block; margin-bottom: 4px; }
.auth-tagline { color: var(--text-faint); font-size: 13px; margin: 0 0 24px; }

.field {
  text-align: left;
  margin-bottom: 14px;
}
.field label {
  display: block;
  font-size: 12.5px;
  color: var(--text-dim);
  margin-bottom: 6px;
  font-weight: 500;
}
.field input, .field textarea {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.field input:focus, .field textarea:focus { border-color: var(--amber); }

.form-error {
  background: rgba(242, 89, 60, 0.12);
  border: 1px solid rgba(242, 89, 60, 0.35);
  color: #ff9d84;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
  text-align: left;
}
.auth-switch { margin-top: 18px; font-size: 13px; color: var(--text-faint); }
.auth-switch a { color: var(--amber); font-weight: 600; }

/* ---------------------------------------------------------
   Mobile bottom nav
   --------------------------------------------------------- */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 40;
  display: none;
  justify-content: space-around;
  align-items: center;
  padding: 10px 6px calc(10px + env(safe-area-inset-bottom));
  background: rgba(10, 10, 16, 0.85);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--border-soft);
}
.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  color: var(--text-faint);
  width: 56px;
}
.bottom-nav a i { font-size: 19px; }
.bottom-nav a.active { color: var(--amber); }

@media (max-width: 780px) {
  .bottom-nav { display: flex; }
}

/* ---------------------------------------------------------
   Story tray states (no-story / viewed rings)
   --------------------------------------------------------- */
.adda-node-glow.no-story {
  background: var(--border);
  box-shadow: none;
  position: relative;
}
.add-story-plus {
  position: absolute;
  bottom: -2px; right: -2px;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--amber);
  color: #1a1206;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  border: 3px solid var(--bg);
}
.adda-node-glow.viewed {
  background: var(--border);
  box-shadow: none;
}
.story-node { cursor: pointer; }

/* ---------------------------------------------------------
   Create Post composer
   --------------------------------------------------------- */
.composer {
  max-width: 620px;
  margin: 0 auto 24px;
  padding: 18px 20px;
}
.composer-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.composer-head textarea {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  resize: none;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.4;
}
.composer-head textarea::placeholder { color: var(--text-faint); }

.media-preview {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0 0 52px;
}
.preview-item {
  position: relative;
  width: 84px; height: 84px;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.preview-item img, .preview-item video { width: 100%; height: 100%; object-fit: cover; }
.preview-remove {
  position: absolute;
  top: 4px; right: 4px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: none;
  font-size: 10px;
  display: flex; align-items: center; justify-content: center;
}

.composer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}
.composer-attach {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-dim);
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--glass-strong);
  cursor: pointer;
}
.composer-attach:hover { color: var(--amber); }
.visibility-select {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 12.5px;
  border-radius: 999px;
  padding: 8px 10px;
}
.composer-actions .btn { margin-left: auto; }
.composer-error { color: #ff9d84; font-size: 12.5px; margin: 8px 0 0; min-height: 1em; }

/* ---------------------------------------------------------
   Full-screen story viewer
   --------------------------------------------------------- */
.story-viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000;
  display: flex;
  flex-direction: column;
}
.story-viewer-bars {
  display: flex;
  gap: 4px;
  padding: 10px 10px 0;
}
.story-bar {
  flex: 1;
  height: 3px;
  background: rgba(255,255,255,0.25);
  border-radius: 999px;
  overflow: hidden;
}
.story-bar-fill { height: 100%; width: 0; background: #fff; }

.story-viewer-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  color: #fff;
}
.story-viewer-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.story-viewer-meta { display: flex; flex-direction: column; line-height: 1.2; font-size: 13px; font-weight: 600; }
.story-viewer-meta .username-sub { color: rgba(255,255,255,0.6); font-weight: 400; }
.story-viewer-head .icon-btn { color: #fff; margin-left: auto; }
.story-viewer-head .icon-btn:hover { background: rgba(255,255,255,0.12); }

.story-viewer-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.story-viewer-stage img, .story-viewer-stage video {
  max-width: 100%; max-height: 100%; object-fit: contain;
}
.story-viewer-caption {
  color: #fff;
  text-align: center;
  font-size: 13.5px;
  padding: 10px 24px calc(20px + env(safe-area-inset-bottom));
}
.story-nav {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  color: #fff;
  border: none;
  display: none;
  align-items: center; justify-content: center;
}
.story-nav-prev { left: 14px; }
.story-nav-next { right: 14px; }

@media (min-width: 640px) {
  .story-viewer { align-items: center; }
  .story-viewer-stage { max-width: 420px; margin: 0 auto; width: 100%; border-radius: var(--radius-lg); }
  .story-nav { display: flex; }
}

/* ---------------------------------------------------------
   Comments & replies
   --------------------------------------------------------- */
.comments-section { margin-top: 4px; }
.comment-composer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.comment-composer input {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 16px;
  color: var(--text);
  font-size: 13.5px;
  outline: none;
}
.comment-composer input:focus { border-color: var(--amber); }

.comments-list { display: flex; flex-direction: column; gap: 14px; }
.comment-item { display: flex; gap: 10px; align-items: flex-start; }
.comment-body { flex: 1; min-width: 0; }
.comment-bubble {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  display: inline-block;
  max-width: 100%;
}
.comment-bubble .user-name { font-size: 12.5px; display: block; margin-bottom: 2px; }
.comment-bubble p { margin: 0; font-size: 13.5px; word-wrap: break-word; }

.comment-meta {
  display: flex;
  gap: 12px;
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--text-faint);
}
.comment-meta button {
  background: none; border: none; color: inherit;
  font-size: 11.5px; font-weight: 600; padding: 0;
}
.comment-meta button:hover { color: var(--amber); }

.replies { margin-top: 10px; padding-left: 8px; border-left: 2px solid var(--border-soft); display: flex; flex-direction: column; gap: 10px; }
.reply-item .comment-bubble { padding: 6px 10px; }

.reply-form { display: flex; gap: 8px; margin-top: 8px; }
.reply-form input {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 14px;
  color: var(--text);
  font-size: 13px;
  outline: none;
}

/* ---------------------------------------------------------
   Profile — FB-style cover + X-style header/stats
   --------------------------------------------------------- */
.profile-cover { padding: 0 0 20px; overflow: hidden; margin-bottom: 4px; }
.cover-photo {
  height: 180px;
  background: linear-gradient(120deg, var(--violet-soft), var(--amber-soft)), var(--bg-elevated);
  background-size: cover;
  background-position: center;
  position: relative;
}
.cover-edit-btn, .cover-remove-btn {
  position: absolute;
  top: 12px;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  border: none;
}
.cover-edit-btn { right: 12px; }
.cover-remove-btn { right: 56px; }

.profile-header-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 20px;
  margin-top: -44px;
}
.profile-avatar-wrap { position: relative; }
.profile-avatar-wrap img {
  width: 92px; height: 92px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--bg-elevated);
  background: var(--bg-elevated);
}
.avatar-edit-btn {
  position: absolute;
  bottom: 2px; right: 2px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--amber);
  color: #1a1206;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  cursor: pointer;
  border: 3px solid var(--bg-elevated);
}
.profile-actions { display: flex; gap: 8px; padding-bottom: 6px; }

.profile-info { padding: 14px 20px 0; }
.profile-name { font-family: var(--font-display); font-size: 21px; margin: 0; font-weight: 600; }
.profile-username { color: var(--text-faint); font-size: 13.5px; margin: 2px 0 10px; }
.profile-bio { font-size: 14px; margin: 0 0 10px; white-space: pre-wrap; }
.profile-meta-row {
  display: flex; flex-wrap: wrap; gap: 14px;
  font-size: 12.5px; color: var(--text-dim); margin-bottom: 12px;
}
.profile-meta-row a { color: var(--amber); }
.profile-stats { display: flex; gap: 20px; font-size: 13.5px; color: var(--text-dim); }
.profile-stats strong { color: var(--text); font-family: var(--font-mono); font-weight: 600; }

.profile-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border-soft);
  padding: 0 4px;
}
.profile-tabs a {
  padding: 12px 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-faint);
  border-bottom: 2px solid transparent;
}
.profile-tabs a.active { color: var(--amber); border-bottom-color: var(--amber); }

/* ---------------------------------------------------------
   Modal (edit profile, etc.)
   --------------------------------------------------------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-card { width: 100%; max-width: 420px; padding: 20px 22px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.modal-head h3 { font-family: var(--font-display); font-weight: 500; margin: 0; }

/* ---------------------------------------------------------
   Messenger — two-pane desktop, stacked mobile
   --------------------------------------------------------- */
.messenger {
  display: grid;
  grid-template-columns: 320px 1fr;
  height: calc(100vh - 140px);
  min-height: 480px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  gap: 0;
}
.conv-pane, .chat-pane { border-radius: 0; display: flex; flex-direction: column; min-height: 0; }
.conv-pane { border-right: 1px solid var(--border-soft); }

.conv-pane-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px 10px;
}
.conv-pane-head h2 { font-family: var(--font-display); font-size: 18px; font-weight: 600; margin: 0; }

.conv-search {
  margin: 0 14px 10px;
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  color: var(--text-faint);
  position: relative;
}
.conv-search input { flex: 1; background: none; border: none; outline: none; color: var(--text); font-size: 13.5px; }

.user-search-results {
  margin: -4px 14px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  max-height: 220px;
  overflow-y: auto;
  position: relative;
  z-index: 5;
}
.user-search-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer; }
.user-search-item:hover { background: var(--glass-strong); }
.user-search-item div { display: flex; flex-direction: column; line-height: 1.2; font-size: 13px; }

.conversation-list { flex: 1; overflow-y: auto; padding: 4px 8px 10px; }
.conv-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.conv-item:hover, .conv-item.active { background: var(--glass-strong); }
.conv-avatar-wrap { position: relative; flex-shrink: 0; }
.online-dot {
  position: absolute; bottom: 0; right: 0;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--success); border: 2px solid var(--bg-elevated);
}
.conv-item-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.conv-last-msg { font-size: 12.5px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-item-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.conv-time { font-size: 11px; color: var(--text-faint); font-family: var(--font-mono); }
.conv-unread { position: static; }

.chat-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--text-faint); text-align: center; padding: 20px;
}
.chat-empty i { font-size: 30px; margin-bottom: 12px; }
.chat-empty h3 { font-family: var(--font-display); color: var(--text); font-weight: 500; margin: 0 0 4px; }

#chat-active { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border-soft); }
.chat-back-btn { display: none; }
.chat-head-meta { display: flex; flex-direction: column; line-height: 1.2; }

.chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.msg-row { display: flex; }
.msg-row.mine { justify-content: flex-end; }
.msg-bubble {
  position: relative;
  max-width: 70%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: 16px 16px 16px 4px;
  padding: 9px 13px;
}
.msg-row.mine .msg-bubble {
  background: linear-gradient(120deg, var(--amber), #d98a2e);
  color: #1a1206;
  border-radius: 16px 16px 4px 16px;
  border: none;
}
.msg-bubble p { margin: 0; font-size: 13.5px; word-wrap: break-word; white-space: pre-wrap; }
.msg-media { max-width: 220px; border-radius: 10px; margin-bottom: 4px; }
.msg-time { display: block; font-size: 10px; opacity: 0.6; margin-top: 3px; font-family: var(--font-mono); }
.msg-delete {
  position: absolute; top: -8px; left: -8px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--bg-elevated); border: 1px solid var(--border);
  color: var(--text-faint); font-size: 10px;
  display: none; align-items: center; justify-content: center;
}
.msg-bubble:hover .msg-delete { display: flex; }

.chat-composer {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--border-soft);
}
.chat-composer input[type="text"] {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 16px;
  color: var(--text);
  font-size: 13.5px;
  outline: none;
}
.chat-composer input[type="text"]:focus { border-color: var(--amber); }
.chat-composer #chat-send-btn { color: var(--amber); }
.chat-attach-preview {
  display: flex; align-items: center; gap: 8px;
  padding: 0 16px 10px;
  font-size: 12px; color: var(--text-dim);
}
.chat-attach-preview button { background: none; border: none; color: var(--text-faint); }

@media (max-width: 780px) {
  .messenger { grid-template-columns: 1fr; height: calc(100vh - 130px); border-radius: 0; }
  .conv-pane { border-right: none; }
  .chat-pane { display: none; }
  .messenger.chat-open .conv-pane { display: none; }
  .messenger.chat-open .chat-pane { display: flex; }
  .chat-back-btn { display: flex; }
}

/* ---------------------------------------------------------
   Communities — browse grid + wall
   --------------------------------------------------------- */
.section-head-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.section-head-row .btn { font-size: 13px; padding: 9px 16px; }

.community-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.community-card { overflow: hidden; display: block; }
.community-card-cover {
  height: 100px;
  background: linear-gradient(120deg, var(--violet-soft), var(--amber-soft)), var(--bg-elevated);
  background-size: cover; background-position: center;
}
.community-card-body { padding: 14px 16px; }
.community-card-body h3 { font-family: var(--font-display); font-size: 16px; margin: 0 0 4px; font-weight: 600; }
.community-card-body p { font-size: 12.5px; color: var(--text-dim); margin: 0 0 10px; }
.community-card-meta { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; color: var(--text-faint); }
.joined-pill {
  background: var(--amber-soft); color: var(--amber);
  padding: 3px 10px; border-radius: 999px; font-weight: 600; font-size: 11px;
}

/* ---------------------------------------------------------
   Notifications
   --------------------------------------------------------- */
.notif-item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px;
  margin-bottom: 8px;
  position: relative;
}
.notif-item.unread { border-color: var(--amber-soft); background: rgba(242,165,60,0.05); }
.notif-type-icon {
  position: absolute;
  left: 38px; bottom: 12px;
  width: 20px; height: 20px;
  background: var(--amber);
  color: #1a1206;
  border-radius: 50%;
  font-size: 9px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg-elevated);
}
.notif-text { font-size: 13.5px; color: var(--text-dim); line-height: 1.4; }

/* ---------------------------------------------------------
   Empty states
   --------------------------------------------------------- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-faint);
}
.empty-state i { font-size: 28px; margin-bottom: 12px; color: var(--text-dim); }
.empty-state h3 { font-family: var(--font-display); color: var(--text); margin: 0 0 6px; font-weight: 500; }
.empty-state p { margin: 0; font-size: 13.5px; }
