/* ================================================================
   KuKirin Social — Global Styles
   social.kugoo-kirin.com
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Rajdhani:wght@500;600;700&display=swap');

/* ── CSS Variables ─────────────────────────────────────────────── */
:root {
  --bg-base:       #050505;
  --bg-surface:    #0a0a0a;
  --bg-card:       rgba(20, 20, 20, 0.75);
  --bg-card-hover: rgba(30, 30, 30, 0.9);
  --bg-input:      #141414;
  --bg-overlay:    rgba(5, 5, 5, 0.94);

  --border:        rgba(255, 255, 255, 0.05);
  --border-strong: rgba(255, 255, 255, 0.1);

  --text-primary:  #ffffff;
  --text-secondary:#a0a0a0;
  --text-muted:    #707070;

  --accent:        #ff6600;
  --accent-hover:  #e65c00;
  --accent-light:  rgba(255, 102, 0, 0.15);
  --accent-glow:   rgba(255, 102, 0, 0.4);

  --cyan:          #00e5ff;
  --cyan-light:    rgba(0, 229, 255, 0.15);

  --green:         #22c55e;
  --green-light:   rgba(34, 197, 94, 0.15);
  --red:           #ef4444;
  --orange:        #ff6600;

  --radius-sm:     6px;
  --radius-md:     10px;
  --radius-lg:     14px;
  --radius-xl:     20px;
  --radius-full:   9999px;

  --shadow-sm:     0 2px 8px rgba(0,0,0,0.5);
  --shadow-md:     0 4px 24px rgba(0,0,0,0.7);
  --shadow-lg:     0 8px 48px rgba(0,0,0,0.9);
  --shadow-accent: 0 4px 24px rgba(255, 102, 0, 0.25);

  --topnav-height: 64px;
  --sidebar-width: 240px;
  --sidebar-right-width: 280px;
}

/* ── Base Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Rajdhani', -apple-system, sans-serif;
  font-size: 17px;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

h1, h2, h3, .nav-brand, .profile-name, .brand-icon {
  font-family: 'Orbitron', sans-serif;
}

a { text-decoration: none; color: inherit; cursor: pointer; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, textarea, select {
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
img { max-width: 100%; display: block; }

.hidden { display: none !important; }

/* ── Utility ───────────────────────────────────────────────────── */
.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.posts-loading {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 48px 24px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ── Auth Screen ──────────────────────────────────────────────── */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.auth-bg-orbs {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.25;
}

.orb-1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, #7c3aed, transparent);
  top: -150px; left: -100px;
  animation: float1 8s ease-in-out infinite alternate;
}

.orb-2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, #06b6d4, transparent);
  bottom: -100px; right: -100px;
  animation: float2 10s ease-in-out infinite alternate;
}

.orb-3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, #f97316, transparent);
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  animation: float3 12s ease-in-out infinite alternate;
}

@keyframes float1 { from { transform: translate(0, 0); } to { transform: translate(40px, 60px); } }
@keyframes float2 { from { transform: translate(0, 0); } to { transform: translate(-50px, -40px); } }
@keyframes float3 { from { transform: translate(-50%, -50%); } to { transform: translate(-40%, -60%); } }

.auth-card {
  position: relative; z-index: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%; max-width: 440px;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(124, 58, 237, 0.08);
  backdrop-filter: blur(20px);
}

.auth-brand {
  text-align: center;
  margin-bottom: 32px;
}

.brand-icon {
  font-size: 2.5rem;
  margin-bottom: 10px;
  display: block;
  filter: drop-shadow(0 0 16px rgba(124, 58, 237, 0.8));
}

.auth-brand h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  background: linear-gradient(135deg, #a78bfa, #60a5fa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.auth-brand p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 4px;
}

.auth-tabs {
  display: flex;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 28px;
  gap: 4px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  border-radius: calc(var(--radius-md) - 2px);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.2s;
}

.auth-tab.active {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-accent);
}

.auth-form { display: flex; flex-direction: column; gap: 18px; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 0.85rem; font-weight: 500; color: var(--text-secondary); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.input-with-icon { position: relative; }
.input-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}
.input-with-icon input { padding: 12px 14px 12px 42px; }

input[type="email"],
input[type="password"],
input[type="text"],
input[type="number"] {
  padding: 12px 16px;
}

.auth-error {
  font-size: 0.85rem;
  color: var(--red);
  min-height: 18px;
  padding: 0 2px;
}

.btn-auth {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  background: linear-gradient(135deg, var(--accent), #5b21b6);
  color: #fff;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  transition: all 0.2s;
  box-shadow: var(--shadow-accent);
}
.btn-auth:hover { transform: translateY(-1px); box-shadow: 0 6px 32px var(--accent-glow); }
.btn-auth:active { transform: translateY(0); }
.btn-auth:disabled { opacity: 0.6; pointer-events: none; }
.btn-auth svg { width: 18px; height: 18px; }

/* ── Top Navigation ────────────────────────────────────────────── */
.topnav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topnav-height);
  background: rgba(17, 18, 24, 0.95);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
  gap: 16px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  white-space: nowrap;
  transition: opacity 0.2s;
}
.nav-brand:hover { opacity: 0.85; }

.brand-bolt {
  font-size: 1.3rem;
  filter: drop-shadow(0 0 8px rgba(124, 58, 237, 0.8));
}

.topnav-search {
  flex: 1;
  max-width: 480px;
}

.search-bar {
  position: relative;
}

.search-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-bar input {
  padding: 10px 16px 10px 42px;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  height: 40px;
  background: var(--bg-input);
  border: 1px solid var(--border);
}

.search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  overflow: hidden;
  max-height: 320px;
  overflow-y: auto;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.15s;
}
.search-result-item:hover { background: var(--bg-card-hover); }

.topnav-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-icon-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  transition: all 0.2s;
}
.nav-icon-btn:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.nav-icon-btn svg { width: 20px; height: 20px; }

.notif-badge {
  position: absolute;
  top: 4px; right: 4px;
  background: var(--red);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  border: 2px solid var(--bg-surface);
}

.nav-avatar-wrap {
  position: relative;
  cursor: pointer;
  transition: transform 0.2s;
}
.nav-avatar-wrap:hover { transform: scale(1.05); }

.nav-avatar {
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--accent), #5b21b6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  overflow: hidden;
  border: 2px solid var(--border-strong);
}

.online-dot-nav {
  position: absolute;
  bottom: 0; right: 0;
  width: 10px; height: 10px;
  background: var(--green);
  border-radius: 50%;
  border: 2px solid var(--bg-surface);
}

/* Notifications Panel */
.notif-panel {
  position: fixed;
  top: calc(var(--topnav-height) + 8px);
  right: 16px;
  width: 360px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 150;
  overflow: hidden;
}

.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.notif-header h3 { font-size: 1rem; font-weight: 600; }
.mark-read-btn { font-size: 0.8rem; color: var(--accent); font-weight: 500; }
.mark-read-btn:hover { text-decoration: underline; }

.notif-list { max-height: 400px; overflow-y: auto; }

.notif-item {
  display: flex;
  gap: 12px;
  padding: 14px 20px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid var(--border);
}
.notif-item:hover { background: var(--bg-card-hover); }
.notif-item.unread { background: rgba(124, 58, 237, 0.05); }

.notif-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 32px;
  font-size: 0.9rem;
}

/* ── Main Layout ───────────────────────────────────────────────── */
.app {
  min-height: 100vh;
  background: var(--bg-base);
}

.main-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr var(--sidebar-right-width);
  gap: 0;
  max-width: 1400px;
  margin: 0 auto;
  padding-top: var(--topnav-height);
  min-height: 100vh;
}

/* ── Left Sidebar ──────────────────────────────────────────────── */
.sidebar-left {
  position: sticky;
  top: var(--topnav-height);
  height: calc(100vh - var(--topnav-height));
  overflow-y: auto;
  padding: 20px 12px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.side-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}
.side-nav-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}
.side-nav-item.active {
  background: var(--accent-light);
  color: #a78bfa;
}
.side-nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }

.side-badge {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.sidebar-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0 4px;
  margin-bottom: 10px;
}

.online-friends-box {
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.online-friends-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.online-friend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s;
}
.online-friend-item:hover { background: var(--bg-card-hover); }

.friend-avatar-wrap { position: relative; flex-shrink: 0; }

.small-avatar {
  width: 32px; height: 32px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--accent), #5b21b6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  overflow: hidden;
}
.small-avatar img { width: 100%; height: 100%; object-fit: cover; }

.status-dot-small {
  position: absolute;
  bottom: -1px; right: -1px;
  width: 9px; height: 9px;
  border-radius: 50%;
  border: 2px solid var(--bg-base);
}
.status-dot-small.online { background: var(--green); }
.status-dot-small.offline { background: var(--text-muted); }

.friend-name-small {
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-empty-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 8px 10px;
}

/* ── Content Area ──────────────────────────────────────────────── */
.content-area {
  min-height: calc(100vh - var(--topnav-height));
  padding: 20px 24px;
  border-right: 1px solid var(--border);
}

.view { animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.view-header {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.view-header h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
}
.view-header h2 svg { width: 24px; height: 24px; color: var(--accent); }
.view-header p { color: var(--text-muted); font-size: 0.9rem; margin-top: 4px; }

/* ── Create Post Card ──────────────────────────────────────────── */
.create-post-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 20px;
  transition: border-color 0.2s;
}
.create-post-card:hover { border-color: var(--border-strong); }

.create-post-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.create-post-trigger {
  flex: 1;
  padding: 10px 16px;
  background: var(--bg-input);
  border-radius: var(--radius-full);
  text-align: left;
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: all 0.2s;
  border: 1px solid var(--border);
}
.create-post-trigger:hover {
  background: var(--bg-card-hover);
  color: var(--text-secondary);
  border-color: var(--accent);
}

.create-post-actions {
  display: flex;
  gap: 8px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.create-action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.15s;
}
.create-action-btn:hover { background: var(--bg-card-hover); color: var(--accent); }
.create-action-btn svg { width: 16px; height: 16px; }

/* ── Post Card ─────────────────────────────────────────────────── */
.posts-container { display: flex; flex-direction: column; gap: 16px; }

.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
  animation: postSlideIn 0.3s ease;
}
@keyframes postSlideIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.post-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }

.post-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 0;
}

.post-avatar {
  width: 44px; height: 44px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--accent), #5b21b6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
  border: 2px solid var(--border);
  transition: border-color 0.2s;
}
.post-avatar:hover { border-color: var(--accent); }
.post-avatar img { width: 100%; height: 100%; object-fit: cover; }

.post-author { flex: 1; }
.post-author-name {
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: color 0.15s;
  display: inline-block;
}
.post-author-name:hover { color: var(--accent); }
.post-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.post-visibility-tag {
  display: flex;
  align-items: center;
  gap: 3px;
  background: var(--bg-input);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
}

.post-menu-btn {
  color: var(--text-muted);
  padding: 6px;
  border-radius: var(--radius-md);
  transition: all 0.15s;
  position: relative;
}
.post-menu-btn:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.post-menu-btn svg { width: 18px; height: 18px; }

.post-content {
  padding: 14px 16px;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
}

.post-image {
  width: 100%;
  max-height: 520px;
  object-fit: cover;
  display: block;
  cursor: pointer;
  transition: opacity 0.2s;
}
.post-image:hover { opacity: 0.95; }

.post-stats {
  display: flex;
  justify-content: space-between;
  padding: 8px 16px;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}
.post-stats span { cursor: pointer; }
.post-stats span:hover { color: var(--text-primary); }

.post-actions {
  display: flex;
  padding: 4px 8px 12px;
  gap: 4px;
}

.post-action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.15s;
}
.post-action-btn:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.post-action-btn.liked { color: var(--red); }
.post-action-btn svg { width: 18px; height: 18px; }

.post-action-btn.like-btn.liked svg { fill: var(--red); }

/* ── Messenger Layout ──────────────────────────────────────────── */
.view#view-messages { padding: 0; }

.messenger-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  height: calc(100vh - var(--topnav-height));
}

.convo-sidebar {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.convo-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.convo-sidebar-header h3 { font-size: 1.1rem; font-weight: 700; }

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: all 0.15s;
}
.icon-btn:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.icon-btn svg { width: 16px; height: 16px; }

.convo-search-box {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.convo-search-box input { padding: 8px 14px; font-size: 0.875rem; }

#convo-search-results {
  margin-top: 8px;
  max-height: 200px;
  overflow-y: auto;
}

.conversations-list {
  flex: 1;
  overflow-y: auto;
}

.convo-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
  border-bottom: 1px solid var(--border);
}
.convo-item:hover { background: var(--bg-card-hover); }
.convo-item.active { background: var(--accent-light); }

.convo-avatar-wrap { position: relative; flex-shrink: 0; }

.convo-avatar {
  width: 48px; height: 48px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--accent), #5b21b6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  overflow: hidden;
}
.convo-avatar img { width: 100%; height: 100%; object-fit: cover; }

.status-dot {
  position: absolute;
  bottom: 0; right: 0;
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 2px solid var(--bg-surface);
}
.status-dot.online { background: var(--green); }
.status-dot.offline { background: var(--text-muted); }

.convo-info { flex: 1; min-width: 0; }
.convo-name {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.convo-last-msg {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.convo-time {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  align-self: flex-start;
  margin-top: 2px;
}

.convo-unread-badge {
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ── Chat Window ───────────────────────────────────────────────── */
.chat-window {
  display: flex;
  flex-direction: column;
  background: var(--bg-base);
}

.chat-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted);
  padding: 48px;
}
.chat-empty-state h3 { font-size: 1.1rem; color: var(--text-secondary); }
.chat-empty-state p { font-size: 0.875rem; }

.active-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  flex-shrink: 0;
}

.chat-header-avatar {
  width: 40px; height: 40px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--accent), #5b21b6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  overflow: hidden;
  flex-shrink: 0;
}
.chat-header-avatar img { width: 100%; height: 100%; object-fit: cover; }

.chat-header-info { flex: 1; }
.chat-header-name { font-weight: 600; font-size: 0.95rem; }
.chat-header-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}
#chat-status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}
#chat-status-dot.online { background: var(--green); }

.chat-header-actions { display: flex; gap: 4px; }
.back-btn { color: var(--text-muted); padding: 4px; }
.back-btn svg { width: 20px; height: 20px; }

.messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-base);
}

.message-bubble {
  display: flex;
  flex-direction: column;
  max-width: 68%;
  animation: msgIn 0.2s ease;
}
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.message-bubble.sent { align-self: flex-end; align-items: flex-end; }
.message-bubble.received { align-self: flex-start; align-items: flex-start; }

.bubble-content {
  padding: 10px 15px;
  border-radius: 18px;
  font-size: 0.9rem;
  line-height: 1.5;
  word-break: break-word;
  position: relative;
}
.sent .bubble-content {
  background: linear-gradient(135deg, var(--accent), #5b21b6);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.received .bubble-content {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.bubble-deleted { opacity: 0.5; font-style: italic; }
.bubble-deleted .bubble-content { background: var(--bg-input); }

.bubble-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 3px;
  padding: 0 4px;
}

.date-separator {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 8px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}
.date-separator::before, .date-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.chat-input-area {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  flex-shrink: 0;
}

.chat-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 8px 8px 8px 16px;
  transition: border-color 0.2s;
}
.chat-input-wrap:focus-within { border-color: var(--accent); }

#chat-input {
  flex: 1;
  background: none;
  border: none;
  box-shadow: none;
  border-radius: 0;
  padding: 4px 0;
  resize: none;
  max-height: 120px;
  font-size: 0.9rem;
  line-height: 1.5;
  width: auto;
}

.send-btn {
  width: 36px; height: 36px;
  flex-shrink: 0;
  background: var(--accent);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: all 0.15s;
}
.send-btn:hover { background: var(--accent-hover); transform: scale(1.05); }
.send-btn svg { width: 16px; height: 16px; }

/* ── Friends View ──────────────────────────────────────────────── */
.friends-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 6px;
  margin-bottom: 20px;
}
.friends-tab {
  flex: 1;
  padding: 10px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.15s;
}
.friends-tab.active {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-accent);
}

.friends-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

.friend-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  text-align: center;
  transition: all 0.2s;
}
.friend-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); transform: translateY(-2px); }

.friend-card-avatar {
  width: 64px; height: 64px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--accent), #5b21b6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.5rem;
  overflow: hidden;
  margin: 0 auto 12px;
  border: 3px solid var(--border);
  position: relative;
}
.friend-card-avatar img { width: 100%; height: 100%; object-fit: cover; }

.friend-card-name {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 4px;
  cursor: pointer;
}
.friend-card-name:hover { color: var(--accent); }
.friend-card-sub { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 14px; }

.friend-card-actions {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.btn-sm {
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-input); color: var(--text-secondary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.btn-danger { background: rgba(239, 68, 68, 0.1); color: var(--red); border: 1px solid rgba(239, 68, 68, 0.2); }
.btn-danger:hover { background: rgba(239, 68, 68, 0.2); }
.btn-success { background: rgba(34, 197, 94, 0.1); color: var(--green); border: 1px solid rgba(34, 197, 94, 0.2); }
.btn-success:hover { background: rgba(34, 197, 94, 0.2); }

/* ── Profile View ──────────────────────────────────────────────── */
.profile-cover {
  height: 240px;
  background: linear-gradient(135deg, #1e1030, #0a1628, #06101e);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  position: relative;
  overflow: hidden;
}
.profile-cover img { width: 100%; height: 100%; object-fit: cover; }
.profile-cover-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(10,11,15,0.8), transparent);
}

.profile-header {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: none;
  padding: 0 24px 24px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  margin-bottom: 20px;
}

.profile-avatar-row {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  margin-top: -40px;
  margin-bottom: 16px;
}

.profile-avatar {
  width: 100px; height: 100px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--accent), #5b21b6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 2rem;
  overflow: hidden;
  border: 4px solid var(--bg-card);
  flex-shrink: 0;
  box-shadow: var(--shadow-md);
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }

.profile-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.profile-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.profile-nickname { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 8px; }
.profile-bio { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.6; margin-bottom: 12px; }

.profile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.profile-meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
}
.profile-meta-item svg { width: 14px; height: 14px; }

.profile-stats {
  display: flex;
  gap: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.profile-stat { text-align: center; }
.profile-stat-val { font-size: 1.2rem; font-weight: 700; font-family: 'Space Grotesk', sans-serif; }
.profile-stat-label { font-size: 0.75rem; color: var(--text-muted); }

/* ── Right Sidebar ─────────────────────────────────────────────── */
.sidebar-right {
  position: sticky;
  top: var(--topnav-height);
  height: calc(100vh - var(--topnav-height));
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.suggested-card,
.stats-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.suggested-rider-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.suggested-rider-item:last-child { border-bottom: none; }

.suggested-rider-info { flex: 1; min-width: 0; }
.suggested-rider-name {
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.suggested-rider-name:hover { color: var(--accent); }
.suggested-rider-sub { font-size: 0.75rem; color: var(--text-muted); }

.my-stats-box {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  text-align: center;
  margin-top: 12px;
}
.stat-item { }
.stat-val { font-size: 1.3rem; font-weight: 700; font-family: 'Space Grotesk', sans-serif; color: var(--accent); }
.stat-label { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

/* ── Modals ────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: overlayIn 0.2s ease;
}
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--shadow-lg);
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.92) translateY(20px); } to { opacity: 1; transform: scale(1) translateY(0); } }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
}
.modal-header h3 { font-size: 1.05rem; font-weight: 700; }
.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: var(--radius-full);
  color: var(--text-muted);
  transition: all 0.15s;
}
.modal-close:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.modal-close svg { width: 18px; height: 18px; }

/* Create Post Modal */
.post-modal-card { max-width: 600px; }

.create-post-author {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 24px;
}

.visibility-select {
  margin-top: 4px;
  padding: 4px 10px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  width: auto;
}

.post-textarea {
  width: 100%;
  padding: 0 24px 16px;
  background: transparent;
  border: none;
  border-radius: 0;
  resize: none;
  font-size: 1rem;
  line-height: 1.6;
  min-height: 100px;
  box-shadow: none;
}
.post-textarea:focus { box-shadow: none; border-color: transparent; }

.post-image-preview {
  position: relative;
  margin: 0 24px 12px;
  border-radius: var(--radius-md);
  overflow: hidden;
}
.post-image-preview img { width: 100%; max-height: 300px; object-fit: cover; }
.remove-img-btn {
  position: absolute;
  top: 8px; right: 8px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  border-radius: var(--radius-full);
  width: 28px; height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.remove-img-btn svg { width: 14px; height: 14px; }

.post-modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px 20px;
  border-top: 1px solid var(--border);
}

.post-media-btns { display: flex; gap: 8px; }
.media-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  transition: all 0.15s;
}
.media-btn:hover { background: var(--accent-light); color: var(--accent); border-color: var(--accent); }
.media-btn svg { width: 16px; height: 16px; }

.btn-post-submit {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  background: linear-gradient(135deg, var(--accent), #5b21b6);
  color: #fff;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s;
  box-shadow: var(--shadow-accent);
}
.btn-post-submit:hover { transform: translateY(-1px); box-shadow: 0 6px 24px var(--accent-glow); }
.btn-post-submit svg { width: 16px; height: 16px; }

/* Comments Modal */
.comments-modal-card { max-width: 600px; }
.comments-list {
  max-height: 400px;
  overflow-y: auto;
  padding: 12px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.comment-item {
  display: flex;
  gap: 12px;
  animation: msgIn 0.2s ease;
}
.comment-avatar {
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--accent), #5b21b6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  overflow: hidden;
  flex-shrink: 0;
}
.comment-avatar img { width: 100%; height: 100%; object-fit: cover; }
.comment-body { flex: 1; }
.comment-bubble {
  background: var(--bg-input);
  border-radius: 0 var(--radius-md) var(--radius-md) var(--radius-md);
  padding: 10px 14px;
  display: inline-block;
  max-width: 100%;
}
.comment-author-name {
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 4px;
  cursor: pointer;
}
.comment-author-name:hover { color: var(--accent); }
.comment-text { font-size: 0.875rem; color: var(--text-primary); word-break: break-word; }
.comment-time { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; padding: 0 2px; }

.comment-input-area {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border);
}
.comment-input-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 6px 8px 6px 16px;
}
.comment-input-wrap:focus-within { border-color: var(--accent); }
#comment-input {
  flex: 1;
  background: none;
  border: none;
  box-shadow: none;
  border-radius: 0;
  padding: 4px 0;
  font-size: 0.875rem;
  width: auto;
}

/* Edit Profile Modal */
.edit-profile-card { max-width: 500px; }
.edit-profile-form { padding: 24px; display: flex; flex-direction: column; gap: 18px; }

/* ── Toast Notifications ───────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
}

.toast {
  padding: 12px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: toastIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 320px;
}
.toast.success { border-color: rgba(34, 197, 94, 0.3); }
.toast.error   { border-color: rgba(239, 68, 68, 0.3); }
.toast.info    { border-color: rgba(6, 182, 212, 0.3); }
.toast-icon-s  { color: var(--green); }
.toast-icon-e  { color: var(--red); }
.toast-icon-i  { color: var(--cyan); }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateX(40px); } }

/* ── Scrollbar ─────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ── Post Context Menu ─────────────────────────────────────────── */
.post-context-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  min-width: 160px;
  box-shadow: var(--shadow-md);
  z-index: 50;
  overflow: hidden;
  animation: dropIn 0.15s ease;
}
@keyframes dropIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.context-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.15s;
}
.context-menu-item:hover { background: var(--bg-card-hover); }
.context-menu-item.danger { color: var(--red); }
.context-menu-item svg { width: 15px; height: 15px; }

.mobile-only { display: none; }

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .sidebar-right { display: none; }
  .main-layout { grid-template-columns: var(--sidebar-width) 1fr; }
}

@media (max-width: 900px) {
  :root { --sidebar-width: 60px; }
  .side-nav-item span:not(.side-badge),
  .online-friends-box h4,
  .online-friend-item .friend-name-small,
  .online-friends-box { display: none; }
  .side-nav-item { justify-content: center; padding: 12px; }
  .sidebar-left { gap: 8px; }
}

@media (max-width: 720px) {
  :root { --topnav-height: 56px; }
  .sidebar-left { display: none; }
  .main-layout { grid-template-columns: 1fr; }
  .topnav-search { display: none; }

  .messenger-layout { grid-template-columns: 1fr; }
  .convo-sidebar { display: none; }
  .convo-sidebar.shown { display: flex; position: fixed; inset: var(--topnav-height) 0 0 0; z-index: 50; }
  .mobile-only { display: flex; }
  .chat-window { display: flex; }

  .content-area { padding: 14px 12px; }
  .auth-card { padding: 28px 20px; }
}
