/* ============================================================
   AlibrainHub — Main Stylesheet
   Design: Dark Navy + Electric Blue | Font: Syne + DM Sans
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=DM+Sans:ital,wght@0,300;0,400;0,500;0,600;1,400&display=swap');

/* ── CSS Variables ── */
:root {
  --primary: #0066FF;
  --primary-light: #3385FF;
  --primary-dark: #0044CC;
  --accent: #00D4FF;
  --accent-2: #FF6B35;
  --bg: #080D1A;
  --bg-2: #0D1525;
  --bg-3: #111827;
  --surface: #141E30;
  --surface-2: #1C2A40;
  --surface-3: #243348;
  --border: rgba(255,255,255,0.07);
  --border-2: rgba(0,102,255,0.25);
  --text: #F0F4FF;
  --text-muted: #7A8BA8;
  --text-dim: #4A5A70;
  --success: #10D981;
  --error: #EF4444;
  --warning: #F59E0B;
  --verified: #00BFFF;
  --font-display: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 30px rgba(0,102,255,0.2);
  --transition: 0.2s cubic-bezier(0.4,0,0.2,1);
  --nav-width: 260px;
  --right-width: 300px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: var(--font-body); border: none; outline: none; }
input, textarea, select {
  font-family: var(--font-body);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--transition);
}
input:focus, textarea:focus { border-color: var(--primary); }

/* ── Loading Splash ── */
#splash-screen {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
#splash-screen.hidden { opacity: 0; visibility: hidden; pointer-events: none; }

.splash-logo {
  width: 140px; height: 140px;
  object-fit: contain;
  animation: splashBounce 0.8s cubic-bezier(0.36,0.07,0.19,0.97) infinite alternate;
}
@keyframes splashBounce {
  0% { transform: translateY(-18px) scale(1.05); }
  100% { transform: translateY(18px) scale(0.95); }
}
.splash-title {
  font-family: var(--font-display);
  font-size: 2rem; font-weight: 800;
  margin-top: 24px;
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}
.splash-dots {
  display: flex; gap: 8px; margin-top: 20px;
}
.splash-dots span {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--primary);
  animation: dotPulse 1.2s ease-in-out infinite;
}
.splash-dots span:nth-child(2) { animation-delay: 0.2s; }
.splash-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotPulse {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* ── Offline Page ── */
#offline-screen {
  position: fixed; inset: 0;
  display: none; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 9998;
  background: var(--bg);
  overflow: hidden;
}
#offline-screen.visible { display: flex; }
.offline-bg {
  position: absolute; inset: 0;
  object-fit: cover; width: 100%; height: 100%;
  opacity: 0.15; filter: grayscale(0.3);
}
.offline-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(8,13,26,0.3), rgba(8,13,26,0.85));
}
.offline-content {
  position: relative; z-index: 1;
  text-align: center; padding: 40px;
}
.offline-icon { font-size: 4rem; margin-bottom: 20px; }
.offline-title {
  font-family: var(--font-display); font-size: 2rem; font-weight: 800;
  margin-bottom: 12px;
}
.offline-msg { color: var(--text-muted); font-size: 1rem; margin-bottom: 28px; }

/* Animated typing hand via CSS pseudo on image */
.offline-person {
  width: 280px; border-radius: var(--radius);
  position: relative; margin: 0 auto 24px;
}
.offline-hand-layer {
  position: absolute; bottom: 25%; right: 20%;
  width: 60px; height: 30px;
  animation: typeHand 0.4s steps(2) infinite;
}
@keyframes typeHand {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-4px); }
  100% { transform: translateY(0px); }
}

/* ── App Layout ── */
#app { display: none; min-height: 100vh; }
#app.active { display: block; }

/* ── Topbar ── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: 62px; z-index: 100;
  background: rgba(8,13,26,0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 20px; gap: 16px;
}
.topbar-logo {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-weight: 800; font-size: 1.3rem;
  text-decoration: none;
}
.topbar-logo img { width: 36px; height: 36px; object-fit: contain; }
.topbar-logo-text {
  background: linear-gradient(135deg, #fff 40%, var(--accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.topbar-search {
  flex: 1; max-width: 360px;
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border-radius: var(--radius-full);
  padding: 8px 16px; border: 1px solid var(--border);
  transition: border-color var(--transition);
}
.topbar-search:focus-within { border-color: var(--primary); }
.topbar-search input {
  flex: 1; background: none; border: none; font-size: 0.9rem;
  color: var(--text);
}
.topbar-search input::placeholder { color: var(--text-dim); }
.topbar-actions {
  margin-left: auto; display: flex; align-items: center; gap: 8px;
}
.icon-btn {
  width: 40px; height: 40px; border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  background: transparent; color: var(--text-muted); font-size: 1.1rem;
  transition: background var(--transition), color var(--transition);
  position: relative;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.badge {
  position: absolute; top: 4px; right: 4px;
  min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--primary); color: #fff;
  border-radius: var(--radius-full); font-size: 0.65rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.avatar-btn {
  width: 36px; height: 36px; border-radius: 50%;
  overflow: hidden; cursor: pointer;
  border: 2px solid var(--border-2);
  transition: border-color var(--transition);
}
.avatar-btn:hover { border-color: var(--primary); }
.avatar-btn img { width: 100%; height: 100%; object-fit: cover; }

/* ── Layout Shell ── */
.layout {
  display: flex;
  padding-top: 62px;
  min-height: 100vh;
}

/* ── Left Sidebar ── */
.sidebar-left {
  width: var(--nav-width);
  position: fixed; left: 0; top: 62px; bottom: 0;
  overflow-y: auto; overflow-x: hidden;
  padding: 20px 12px;
  border-right: 1px solid var(--border);
  background: var(--bg);
}
.sidebar-left::-webkit-scrollbar { width: 4px; }
.sidebar-left::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 4px; }

.nav-section { margin-bottom: 28px; }
.nav-section-title {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--text-dim);
  padding: 0 12px; margin-bottom: 8px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: var(--radius-sm);
  color: var(--text-muted); font-size: 0.95rem; font-weight: 500;
  transition: all var(--transition); cursor: pointer;
  position: relative;
}
.nav-item i { font-size: 1.1rem; width: 20px; text-align: center; }
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active {
  background: linear-gradient(135deg, rgba(0,102,255,0.15), rgba(0,212,255,0.08));
  color: var(--primary-light); font-weight: 600;
}
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 20%; bottom: 20%;
  width: 3px; border-radius: 0 3px 3px 0;
  background: linear-gradient(to bottom, var(--primary), var(--accent));
}
.nav-badge {
  margin-left: auto; background: var(--primary);
  color: #fff; font-size: 0.7rem; font-weight: 700;
  padding: 2px 7px; border-radius: var(--radius-full);
}

/* ── Main Content ── */
.main-content {
  flex: 1;
  margin-left: var(--nav-width);
  margin-right: var(--right-width);
  min-height: calc(100vh - 62px);
  padding: 24px;
  max-width: 680px;
}

/* ── Right Sidebar ── */
.sidebar-right {
  width: var(--right-width);
  position: fixed; right: 0; top: 62px; bottom: 0;
  overflow-y: auto; padding: 20px 16px;
  border-left: 1px solid var(--border);
  background: var(--bg);
}

/* ── Cards & Feed ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--transition);
}
.card:hover { border-color: var(--border-2); }

.post-card {
  padding: 20px;
  margin-bottom: 12px;
}
.post-header {
  display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px;
}
.post-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0;
  background: var(--surface-2);
}
.post-meta { flex: 1; }
.post-author {
  font-weight: 600; font-size: 0.95rem;
  display: flex; align-items: center; gap: 6px;
}
.post-author .verified {
  color: var(--verified); font-size: 0.85rem;
}
.post-username { color: var(--text-muted); font-size: 0.82rem; }
.post-time { color: var(--text-dim); font-size: 0.78rem; }
.post-more {
  width: 32px; height: 32px; border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  background: transparent; color: var(--text-muted); font-size: 1rem;
  transition: background var(--transition);
}
.post-more:hover { background: var(--surface-2); }

.post-body { margin-bottom: 14px; line-height: 1.7; font-size: 0.95rem; }
.post-body .hashtag { color: var(--accent); cursor: pointer; }
.post-body .mention { color: var(--primary-light); cursor: pointer; }

.post-media {
  border-radius: var(--radius-sm);
  overflow: hidden; margin-bottom: 14px;
}
.post-media img { width: 100%; max-height: 400px; object-fit: cover; }
.post-media video { width: 100%; border-radius: var(--radius-sm); }

.post-actions {
  display: flex; align-items: center; gap: 4px;
  padding-top: 12px; border-top: 1px solid var(--border);
}
.action-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: var(--radius-full);
  background: transparent; color: var(--text-muted);
  font-size: 0.88rem; transition: all var(--transition);
}
.action-btn:hover { background: var(--surface-2); color: var(--text); }
.action-btn.liked { color: #EF4444; }
.action-btn.liked i { animation: likePopBig 0.3s ease; }
.action-btn.reshared { color: var(--success); }
@keyframes likePopBig {
  0% { transform: scale(1); }
  50% { transform: scale(1.4); }
  100% { transform: scale(1); }
}
.action-btn i { font-size: 1rem; }
.action-spacer { flex: 1; }

/* ── Signal Card (short post) ── */
.signal-card {
  padding: 16px 20px;
  margin-bottom: 10px;
  border-left: 3px solid var(--primary);
}
.signal-char-count {
  font-size: 0.78rem; color: var(--text-dim);
  text-align: right; margin-top: 6px;
}
.signal-char-count.near { color: var(--warning); }
.signal-char-count.over { color: var(--error); }

/* ── Video Card ── */
.video-card { margin-bottom: 12px; }
.video-thumbnail {
  position: relative; aspect-ratio: 16/9;
  overflow: hidden; cursor: pointer;
  background: var(--surface-3);
}
.video-thumbnail img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.3s ease;
}
.video-card:hover .video-thumbnail img { transform: scale(1.03); }
.video-play-btn {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.35);
  transition: background var(--transition);
}
.video-play-btn i {
  font-size: 3rem; color: #fff;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5));
  transition: transform var(--transition);
}
.video-thumbnail:hover .video-play-btn i { transform: scale(1.1); }
.video-duration {
  position: absolute; bottom: 10px; right: 10px;
  background: rgba(0,0,0,0.75); color: #fff;
  font-size: 0.75rem; font-weight: 600; padding: 2px 7px;
  border-radius: 4px;
}
.video-info { padding: 14px 16px; }
.video-title {
  font-weight: 600; font-size: 0.95rem; margin-bottom: 8px;
  line-height: 1.4; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.video-meta { display: flex; align-items: center; gap: 8px; }
.video-views { color: var(--text-muted); font-size: 0.82rem; }

/* ── Compose Box ── */
.compose-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px;
}
.compose-top {
  display: flex; gap: 14px; align-items: flex-start;
}
.compose-avatar {
  width: 42px; height: 42px; border-radius: 50%; object-fit: cover;
  background: var(--surface-2); flex-shrink: 0;
}
.compose-input {
  flex: 1; background: transparent; border: none;
  color: var(--text); font-size: 1rem; resize: none;
  min-height: 60px; line-height: 1.5;
}
.compose-input::placeholder { color: var(--text-dim); }
.compose-actions {
  display: flex; align-items: center; gap: 8px;
  padding-top: 12px; border-top: 1px solid var(--border);
  margin-top: 12px;
}
.compose-tool {
  width: 36px; height: 36px; border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  background: transparent; color: var(--text-muted); font-size: 1.05rem;
  transition: all var(--transition);
}
.compose-tool:hover { background: var(--surface-2); color: var(--primary-light); }
.compose-submit {
  margin-left: auto; padding: 9px 22px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; border-radius: var(--radius-full);
  font-weight: 600; font-size: 0.9rem;
  transition: all var(--transition); box-shadow: 0 4px 12px rgba(0,102,255,0.3);
}
.compose-submit:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(0,102,255,0.4); }
.compose-submit:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ── Profile Page ── */
.profile-cover {
  height: 220px; background: linear-gradient(135deg, var(--primary-dark), var(--surface-3));
  position: relative; overflow: hidden; border-radius: var(--radius) var(--radius) 0 0;
}
.profile-cover img { width: 100%; height: 100%; object-fit: cover; }
.profile-cover-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, transparent 50%, rgba(8,13,26,0.6));
}
.profile-pic {
  width: 88px; height: 88px; border-radius: 50%;
  border: 4px solid var(--bg); object-fit: cover;
  position: absolute; bottom: -44px; left: 24px;
  background: var(--surface-2);
}
.profile-info { padding: 60px 24px 24px; }
.profile-name {
  font-family: var(--font-display); font-size: 1.4rem; font-weight: 800;
  display: flex; align-items: center; gap: 8px;
}
.profile-handle { color: var(--text-muted); font-size: 0.9rem; margin-top: 2px; }
.profile-bio { margin: 12px 0; font-size: 0.95rem; line-height: 1.6; }
.profile-stats {
  display: flex; gap: 24px; margin: 16px 0;
}
.stat { cursor: pointer; }
.stat-num { font-weight: 700; font-size: 1.05rem; }
.stat-label { color: var(--text-muted); font-size: 0.82rem; }
.profile-actions { display: flex; gap: 10px; }

/* ── Buttons ── */
.btn {
  padding: 9px 20px; border-radius: var(--radius-full);
  font-weight: 600; font-size: 0.9rem;
  transition: all var(--transition); cursor: pointer;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; box-shadow: 0 4px 12px rgba(0,102,255,0.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(0,102,255,0.4); }
.btn-outline {
  background: transparent; color: var(--text);
  border: 1.5px solid var(--border-2);
}
.btn-outline:hover { background: var(--surface); border-color: var(--primary); color: var(--primary-light); }
.btn-danger {
  background: rgba(239,68,68,0.1); color: var(--error);
  border: 1px solid rgba(239,68,68,0.3);
}
.btn-danger:hover { background: rgba(239,68,68,0.2); }
.btn-ghost {
  background: transparent; color: var(--text-muted);
}
.btn-ghost:hover { background: var(--surface); color: var(--text); }
.btn-sm { padding: 6px 14px; font-size: 0.82rem; }
.btn-lg { padding: 13px 28px; font-size: 1rem; }
.btn-full { width: 100%; text-align: center; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ── Forms & Auth ── */
.auth-wrapper {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 40px 20px;
  background: radial-gradient(ellipse at 20% 50%, rgba(0,102,255,0.08) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 20%, rgba(0,212,255,0.05) 0%, transparent 50%);
}
.auth-card {
  width: 100%; max-width: 440px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 40px;
}
.auth-logo {
  display: flex; flex-direction: column; align-items: center; margin-bottom: 32px;
}
.auth-logo img { width: 56px; margin-bottom: 12px; }
.auth-logo-name {
  font-family: var(--font-display); font-size: 1.6rem; font-weight: 800;
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.auth-title { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; margin-bottom: 8px; }
.auth-subtitle { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 28px; }

.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 7px; color: var(--text-muted); }
.form-input {
  width: 100%; padding: 11px 14px; border-radius: var(--radius-sm);
  background: var(--bg-2); border: 1px solid var(--border);
  color: var(--text); font-size: 0.95rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,102,255,0.1); }
.form-input.error { border-color: var(--error); }
.form-error { color: var(--error); font-size: 0.8rem; margin-top: 5px; }
.form-hint { color: var(--text-dim); font-size: 0.8rem; margin-top: 5px; }

.password-group { position: relative; }
.password-toggle {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; color: var(--text-dim); font-size: 0.95rem;
  transition: color var(--transition);
}
.password-toggle:hover { color: var(--text); }

.auth-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 20px 0; color: var(--text-dim); font-size: 0.85rem;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.auth-link { color: var(--primary-light); font-weight: 600; cursor: pointer; }
.auth-link:hover { text-decoration: underline; }

.google-btn {
  width: 100%; padding: 11px; display: flex; align-items: center; justify-content: center;
  gap: 10px; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-weight: 600; font-size: 0.9rem;
  transition: all var(--transition);
}
.google-btn:hover { background: var(--surface-2); border-color: var(--border-2); }

/* ── Notification ── */
.notif-item {
  display: flex; gap: 12px; padding: 14px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background var(--transition);
  border-radius: var(--radius-sm); padding: 12px;
}
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { background: rgba(0,102,255,0.05); }
.notif-avatar {
  width: 44px; height: 44px; border-radius: 50%; object-fit: cover;
  background: var(--surface-2); flex-shrink: 0;
}
.notif-icon {
  position: absolute; bottom: -2px; right: -2px;
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.6rem; border: 2px solid var(--bg);
}
.notif-text { flex: 1; font-size: 0.88rem; line-height: 1.5; }
.notif-time { color: var(--text-dim); font-size: 0.78rem; margin-top: 4px; }

/* ── Messages ── */
.chat-layout { display: flex; gap: 0; height: calc(100vh - 62px); }
.chat-list {
  width: 320px; border-right: 1px solid var(--border);
  overflow-y: auto; flex-shrink: 0;
}
.chat-list-header {
  padding: 20px 16px 12px; font-family: var(--font-display);
  font-weight: 700; font-size: 1.1rem;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--bg); z-index: 1;
}
.chat-item {
  display: flex; gap: 12px; padding: 14px 16px; cursor: pointer;
  transition: background var(--transition); align-items: center;
}
.chat-item:hover { background: var(--surface); }
.chat-item.active { background: rgba(0,102,255,0.1); }
.chat-avatar {
  width: 46px; height: 46px; border-radius: 50%; object-fit: cover;
  background: var(--surface-2); flex-shrink: 0; position: relative;
}
.online-dot {
  position: absolute; bottom: 1px; right: 1px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--success); border: 2px solid var(--bg);
}
.chat-info { flex: 1; min-width: 0; }
.chat-name { font-weight: 600; font-size: 0.92rem; }
.chat-preview {
  color: var(--text-muted); font-size: 0.82rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px;
}
.chat-time { color: var(--text-dim); font-size: 0.75rem; flex-shrink: 0; }

.chat-window {
  flex: 1; display: flex; flex-direction: column;
}
.chat-header {
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  background: var(--bg);
}
.chat-messages {
  flex: 1; overflow-y: auto; padding: 20px;
  display: flex; flex-direction: column; gap: 12px;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 4px; }

.msg-bubble {
  max-width: 68%; padding: 10px 14px; border-radius: 18px;
  font-size: 0.92rem; line-height: 1.5;
}
.msg-sent {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; border-bottom-right-radius: 4px;
  align-self: flex-end;
}
.msg-received {
  background: var(--surface-2);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}
.msg-time { color: rgba(255,255,255,0.6); font-size: 0.7rem; margin-top: 4px; text-align: right; }
.msg-received .msg-time { color: var(--text-dim); text-align: left; }

.chat-input-area {
  padding: 14px 20px; border-top: 1px solid var(--border);
  display: flex; gap: 10px; align-items: center;
}
.chat-input {
  flex: 1; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-full); padding: 10px 16px;
  color: var(--text); font-size: 0.92rem;
  transition: border-color var(--transition);
}
.chat-input:focus { border-color: var(--primary); }
.chat-send {
  width: 42px; height: 42px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 1rem; transition: all var(--transition);
}
.chat-send:hover { transform: scale(1.08); }

.chat-blocked {
  padding: 16px 20px; text-align: center;
  background: rgba(239,68,68,0.05); border-top: 1px solid rgba(239,68,68,0.15);
  color: var(--text-muted); font-size: 0.88rem;
}

/* ── Right Sidebar Widgets ── */
.widget { margin-bottom: 20px; }
.widget-title {
  font-family: var(--font-display); font-weight: 700; font-size: 1rem;
  margin-bottom: 14px; display: flex; align-items: center; gap: 8px;
}
.widget-title::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

.trend-item {
  padding: 10px 0; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: padding-left var(--transition);
}
.trend-item:hover { padding-left: 4px; }
.trend-category { color: var(--text-dim); font-size: 0.75rem; }
.trend-tag { font-weight: 600; font-size: 0.9rem; margin: 2px 0; }
.trend-count { color: var(--text-muted); font-size: 0.78rem; }

.suggest-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 0;
}
.suggest-avatar {
  width: 40px; height: 40px; border-radius: 50%; object-fit: cover;
  background: var(--surface-2); flex-shrink: 0;
}
.suggest-info { flex: 1; min-width: 0; }
.suggest-name {
  font-weight: 600; font-size: 0.88rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: flex; align-items: center; gap: 4px;
}
.suggest-handle { color: var(--text-dim); font-size: 0.78rem; }
.follow-btn-small {
  padding: 5px 14px; border-radius: var(--radius-full);
  background: var(--primary); color: #fff; font-size: 0.8rem; font-weight: 600;
  transition: all var(--transition);
}
.follow-btn-small:hover { background: var(--primary-dark); }
.follow-btn-small.following {
  background: transparent; border: 1px solid var(--border-2); color: var(--text-muted);
}

/* ── Tabs ── */
.tabs {
  display: flex; border-bottom: 1px solid var(--border); margin-bottom: 20px;
}
.tab {
  padding: 12px 20px; font-weight: 600; font-size: 0.9rem;
  color: var(--text-muted); cursor: pointer; position: relative;
  transition: color var(--transition);
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary-light); }
.tab.active::after {
  content: ''; position: absolute; bottom: -1px; left: 0; right: 0;
  height: 2px; background: var(--primary); border-radius: 2px;
}

/* ── Explore / Search ── */
.explore-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px;
}
.explore-item {
  aspect-ratio: 1; overflow: hidden; cursor: pointer; position: relative;
}
.explore-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s ease; }
.explore-item:hover img { transform: scale(1.05); }
.explore-overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,0);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.3s ease;
}
.explore-item:hover .explore-overlay { background: rgba(0,0,0,0.3); }

/* ── Settings ── */
.settings-layout { display: flex; gap: 24px; }
.settings-nav { width: 200px; flex-shrink: 0; }
.settings-nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  border-radius: var(--radius-sm); font-size: 0.9rem; color: var(--text-muted);
  cursor: pointer; transition: all var(--transition);
}
.settings-nav-item:hover { background: var(--surface); color: var(--text); }
.settings-nav-item.active { background: rgba(0,102,255,0.1); color: var(--primary-light); font-weight: 600; }
.settings-content { flex: 1; }
.settings-section { margin-bottom: 32px; }
.settings-section-title {
  font-family: var(--font-display); font-weight: 700; font-size: 1rem;
  margin-bottom: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0; border-bottom: 1px solid var(--border);
}
.settings-row-label { font-size: 0.92rem; font-weight: 500; }
.settings-row-desc { color: var(--text-muted); font-size: 0.82rem; margin-top: 2px; }
.toggle {
  width: 46px; height: 26px; background: var(--surface-3);
  border-radius: var(--radius-full); position: relative; cursor: pointer;
  transition: background var(--transition);
}
.toggle.on { background: var(--primary); }
.toggle::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%; background: #fff;
  transition: transform var(--transition);
}
.toggle.on::after { transform: translateX(20px); }

/* ── Toast Notifications ── */
.toast-container {
  position: fixed; top: 80px; right: 20px; z-index: 9000;
  display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.toast {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 18px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: var(--shadow); min-width: 280px; max-width: 380px;
  animation: toastSlide 0.3s ease; pointer-events: all;
}
.toast.success { border-color: rgba(16,217,129,0.3); }
.toast.error { border-color: rgba(239,68,68,0.3); }
.toast.info { border-color: var(--border-2); }
@keyframes toastSlide {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.toast-icon { font-size: 1.1rem; }
.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--error); }
.toast.info .toast-icon { color: var(--primary-light); }
.toast-msg { flex: 1; font-size: 0.88rem; }
.toast-close { background: none; color: var(--text-muted); font-size: 0.9rem; padding: 2px; }

/* ── Modal ── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px); z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  animation: modalUp 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes modalUp {
  from { transform: translateY(30px) scale(0.97); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.modal-title { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ── Dropdown ── */
.dropdown {
  position: absolute; top: 100%; right: 0; margin-top: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 6px;
  min-width: 200px; z-index: 500;
  box-shadow: var(--shadow);
  animation: fadeIn 0.15s ease;
}
.dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; border-radius: var(--radius-sm);
  font-size: 0.9rem; cursor: pointer; color: var(--text);
  transition: background var(--transition);
}
.dropdown-item:hover { background: var(--surface-2); }
.dropdown-item.danger { color: var(--error); }
.dropdown-item i { width: 16px; color: var(--text-muted); }
.dropdown-divider { height: 1px; background: var(--border); margin: 6px 0; }

/* ── Empty States ── */
.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 3.5rem; margin-bottom: 16px; opacity: 0.4; }
.empty-state-title { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; margin-bottom: 8px; color: var(--text); }
.empty-state-text { font-size: 0.9rem; }

/* ── Spinner ── */
.spinner {
  width: 32px; height: 32px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--primary);
  animation: spin 0.7s linear infinite; margin: 0 auto;
}
.spinner-sm { width: 18px; height: 18px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-state { padding: 40px; display: flex; justify-content: center; }

/* ── Landing Page ── */
.landing {
  min-height: 100vh;
  background: radial-gradient(ellipse at 10% 20%, rgba(0,102,255,0.12) 0%, transparent 50%),
              radial-gradient(ellipse at 90% 80%, rgba(0,212,255,0.07) 0%, transparent 50%);
}
.landing-hero {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; padding: 100px 20px 80px;
}
.landing-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 16px; border-radius: var(--radius-full);
  background: rgba(0,102,255,0.1); border: 1px solid rgba(0,102,255,0.25);
  color: var(--primary-light); font-size: 0.82rem; font-weight: 600;
  margin-bottom: 28px;
}
.landing-title {
  font-family: var(--font-display); font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 800; line-height: 1.1; margin-bottom: 20px;
  letter-spacing: -2px;
}
.landing-title span {
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.landing-subtitle {
  font-size: 1.1rem; color: var(--text-muted); max-width: 540px;
  line-height: 1.7; margin-bottom: 36px;
}
.landing-cta { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.landing-features {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
  padding: 40px 60px; max-width: 1100px; margin: 0 auto;
}
.feature-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px; text-align: center;
  transition: all var(--transition);
}
.feature-card:hover {
  border-color: var(--border-2); transform: translateY(-3px);
  box-shadow: var(--shadow-glow);
}
.feature-icon {
  width: 52px; height: 52px; border-radius: var(--radius);
  background: rgba(0,102,255,0.1); display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; margin: 0 auto 16px; color: var(--primary-light);
}
.feature-title { font-family: var(--font-display); font-weight: 700; font-size: 1rem; margin-bottom: 8px; }
.feature-desc { color: var(--text-muted); font-size: 0.88rem; line-height: 1.6; }

/* ── Mobile Bottom Nav ── */
.mobile-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(8,13,26,0.95); backdrop-filter: blur(20px);
  border-top: 1px solid var(--border); z-index: 100;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
}
.mobile-nav-items { display: flex; justify-content: space-around; }
.mobile-nav-btn {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 16px; color: var(--text-muted); font-size: 0.65rem;
  cursor: pointer; transition: color var(--transition);
}
.mobile-nav-btn i { font-size: 1.3rem; }
.mobile-nav-btn.active { color: var(--primary-light); }

/* ── Verified Badge ── */
.verified-badge { color: var(--verified); font-size: 0.9em; }

/* ── Official AI Badge ── */
.ai-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: var(--radius-full); font-size: 0.68rem; font-weight: 700;
  color: #fff; letter-spacing: 0.5px;
}

/* ── Skeleton Loaders ── */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes skeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Responsive ── */
@media (max-width: 1100px) {
  .sidebar-right { display: none; }
  .main-content { margin-right: 0; }
}
@media (max-width: 768px) {
  .sidebar-left { display: none; }
  .main-content { margin-left: 0; padding: 16px; }
  .mobile-nav { display: block; }
  .landing-features { grid-template-columns: 1fr; padding: 20px; }
  .auth-card { padding: 28px 20px; }
  .chat-list { width: 100%; }
  .main-content { padding-bottom: 80px; }
}
@media (max-width: 480px) {
  .topbar-search { display: none; }
  .landing-title { font-size: 2rem; }
}

/* ── Animations ── */
.fade-in { animation: fadeInUp 0.4s ease; }
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.scale-in { animation: scaleIn 0.3s cubic-bezier(0.34,1.56,0.64,1); }
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}
.slide-right { animation: slideRight 0.3s ease; }
@keyframes slideRight {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--surface-2); }

/* ── Utility ── */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary-light); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.p-16 { padding: 16px; }
.relative { position: relative; }
.full-w { width: 100%; }
.section-title {
  font-family: var(--font-display); font-weight: 800; font-size: 1.4rem;
  margin-bottom: 20px; display: flex; align-items: center; gap: 10px;
}
