:root {
  --bg: #0a0a0f;
  --bg2: #111118;
  --bg3: #1a1a24;
  --border: #2a2a38;
  --accent: #7c5cfc;
  --accent2: #a78bfa;
  --accent-glow: rgba(124, 92, 252, 0.25);
  --text: #e8e8f0;
  --text2: #9090a8;
  --text3: #5a5a72;
  --danger: #f43f5e;
  --success: #10b981;
  --like: #f43f5e;
  --repost: #10b981;
  --radius: 12px;
  --radius-sm: 8px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
input, textarea { font: inherit; color: inherit; background: none; border: none; outline: none; }

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

.sidebar {
  width: 260px;
  padding: 20px 16px;
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex; flex-direction: column;
  background: var(--bg);
  z-index: 100;
}

.main-content {
  margin-left: 260px;
  flex: 1;
  max-width: 640px;
  border-right: 1px solid var(--border);
  min-height: 100vh;
}

.right-panel {
  width: 340px;
  padding: 20px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  margin-left: 640px;
  position: fixed;
  right: 0;
}

/* Logo */
.logo {
  display: flex; align-items: center; gap: 10px;
  font-size: 22px; font-weight: 800;
  color: var(--accent2);
  margin-bottom: 28px;
  padding: 8px;
}
.logo-icon { font-size: 28px; }

/* Nav */
.nav-item {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 17px; font-weight: 500;
  color: var(--text2);
  transition: all .15s;
  margin-bottom: 4px;
}
.nav-item:hover, .nav-item.active {
  background: var(--bg3);
  color: var(--text);
}
.nav-item.active { color: var(--accent2); }
.nav-icon { font-size: 20px; width: 24px; text-align: center; }

.post-btn {
  display: block;
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: #fff;
  font-size: 16px; font-weight: 700;
  border-radius: 50px;
  text-align: center;
  margin-top: 16px;
  transition: opacity .15s;
}
.post-btn:hover { opacity: .88; }

.sidebar-user {
  margin-top: auto;
  display: flex; align-items: center; gap: 10px;
  padding: 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .15s;
}
.sidebar-user:hover { background: var(--bg3); }

/* Feed */
.feed-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 18px; font-weight: 700;
  position: sticky; top: 0;
  background: rgba(10,10,15,.9);
  backdrop-filter: blur(12px);
  z-index: 10;
  display: flex; gap: 0;
}
.tab-btn {
  flex: 1; padding: 14px; text-align: center;
  font-size: 15px; font-weight: 600;
  color: var(--text2);
  border-bottom: 3px solid transparent;
  transition: all .15s;
}
.tab-btn.active { color: var(--text); border-color: var(--accent); }
.tab-btn:hover { background: var(--bg3); }

/* Compose */
.compose {
  display: flex; gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.compose-body { flex: 1; }
.compose textarea {
  width: 100%;
  min-height: 80px;
  resize: none;
  font-size: 17px;
  color: var(--text);
  background: transparent;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  margin-bottom: 10px;
}
.compose textarea::placeholder { color: var(--text3); }
.compose-actions { display: flex; align-items: center; gap: 10px; }
.compose-actions label {
  cursor: pointer;
  color: var(--accent2);
  font-size: 20px;
  display: flex; align-items: center;
}
.video-preview {
  width: 100%;
  max-height: 200px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  display: none;
}
.video-preview.show { display: block; }
.video-name {
  font-size: 13px; color: var(--text2);
  margin-bottom: 8px;
  display: none;
}
.video-name.show { display: block; }

/* Buttons */
.btn {
  padding: 8px 18px;
  border-radius: 50px;
  font-size: 14px; font-weight: 700;
  transition: all .15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { opacity: .88; }
.btn-outline { border: 1px solid var(--border); color: var(--text2); }
.btn-outline:hover { background: var(--bg3); color: var(--text); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-danger { background: var(--danger); color: #fff; }

/* Post Card */
.post-card {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.post-card:hover { background: rgba(255,255,255,.02); }

.repost-label {
  font-size: 13px; color: var(--text3);
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 8px;
  margin-left: 52px;
}

.post-header { display: flex; gap: 12px; }
.post-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg3);
  flex-shrink: 0;
  cursor: pointer;
}
.post-avatar-placeholder {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700;
  color: var(--accent2);
  flex-shrink: 0;
  cursor: pointer;
}
.post-meta { flex: 1; }
.post-names { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.post-display-name { font-weight: 700; }
.post-username { color: var(--text3); font-size: 14px; }
.post-time { color: var(--text3); font-size: 13px; margin-left: auto; }
.post-content { margin-top: 8px; font-size: 15px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }

.post-video {
  width: 100%;
  max-height: 400px;
  border-radius: var(--radius);
  margin-top: 10px;
  background: #000;
}

.quoted-post {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-top: 10px;
  cursor: pointer;
}
.quoted-post:hover { background: var(--bg3); }

.post-actions {
  display: flex; gap: 0;
  margin-top: 12px;
  margin-left: -8px;
}
.action-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px;
  border-radius: 50px;
  font-size: 14px;
  color: var(--text3);
  transition: all .15s;
}
.action-btn:hover { color: var(--accent2); background: var(--accent-glow); }
.action-btn.liked { color: var(--like); }
.action-btn.liked:hover { background: rgba(244,63,94,.15); }
.action-btn.reposted { color: var(--repost); }
.action-btn.reposted:hover { background: rgba(16,185,129,.15); }

/* Avatar */
.avatar {
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg3);
}
.avatar-placeholder {
  border-radius: 50%;
  background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: var(--accent2);
  flex-shrink: 0;
}

/* Modal */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
  animation: fadeIn .15s;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 90%; max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp .2s;
}
.modal-header {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-close {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--text2);
  transition: background .15s;
}
.modal-close:hover { background: var(--bg3); }
.modal-title { font-size: 18px; font-weight: 700; }
.modal-body { padding: 20px; }

@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0 } to { transform: translateY(0); opacity: 1 } }

/* Auth forms */
.auth-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.auth-box {
  width: 90%; max-width: 440px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 36px;
}
.auth-logo { text-align: center; font-size: 40px; margin-bottom: 8px; }
.auth-title { text-align: center; font-size: 22px; font-weight: 800; margin-bottom: 28px; }
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; color: var(--text2); margin-bottom: 6px; font-weight: 600; }
.form-input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  color: var(--text);
  transition: border-color .15s;
}
.form-input:focus { border-color: var(--accent); }
.auth-switch { text-align: center; margin-top: 20px; color: var(--text2); font-size: 14px; }
.auth-switch a { color: var(--accent2); font-weight: 600; }

/* Profile */
.profile-banner {
  height: 180px;
  background: linear-gradient(135deg, #1a1040, #2d1b69);
  position: relative;
  overflow: hidden;
}
.profile-banner img { width: 100%; height: 100%; object-fit: cover; }
.profile-info { padding: 16px 20px; }
.profile-avatar-wrap {
  margin-top: -52px;
  margin-bottom: 12px;
  position: relative;
  width: fit-content;
}
.profile-avatar {
  width: 88px; height: 88px;
  border-radius: 50%;
  border: 4px solid var(--bg);
  object-fit: cover;
  background: var(--bg3);
}
.profile-avatar-placeholder {
  width: 88px; height: 88px;
  border-radius: 50%;
  border: 4px solid var(--bg);
  background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
  font-size: 36px; font-weight: 700; color: var(--accent2);
}
.profile-name { font-size: 20px; font-weight: 800; }
.profile-username { color: var(--text3); font-size: 15px; margin-top: 2px; }
.profile-bio { margin-top: 10px; color: var(--text); line-height: 1.5; }
.profile-stats { display: flex; gap: 20px; margin-top: 12px; font-size: 14px; }
.profile-stat span { font-weight: 700; color: var(--text); }
.profile-stat { color: var(--text2); }
.profile-tabs { display: flex; border-bottom: 1px solid var(--border); margin-top: 16px; }
.profile-tab { flex: 1; padding: 14px; text-align: center; color: var(--text2); font-weight: 600; border-bottom: 3px solid transparent; transition: all .15s; }
.profile-tab.active { color: var(--text); border-color: var(--accent); }
.profile-tab:hover { background: var(--bg3); }

/* Edit profile modal */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s;
}
.upload-zone:hover { border-color: var(--accent); }
.upload-zone img { max-height: 80px; border-radius: 6px; margin-top: 8px; }

/* Search */
.search-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 10px 16px;
  margin-bottom: 16px;
  transition: border-color .15s;
}
.search-bar:focus-within { border-color: var(--accent); }
.search-bar input { flex: 1; font-size: 15px; }
.search-bar .search-icon { color: var(--text3); }

/* Reply thread */
.reply-thread {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; gap: 12px;
}
.thread-line {
  width: 2px; background: var(--border);
  margin: 4px auto;
  flex-shrink: 0;
  align-self: stretch;
}

/* Toast */
.toast {
  position: fixed; bottom: 30px; left: 50%;
  transform: translateX(-50%);
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 12px 24px;
  font-size: 14px; font-weight: 600;
  z-index: 9999;
  animation: toastIn .3s;
  white-space: nowrap;
}
.toast.error { border-color: var(--danger); color: var(--danger); }
.toast.success { border-color: var(--success); color: var(--success); }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(20px) } to { opacity: 1; transform: translateX(-50%) translateY(0) } }

/* Loading spinner */
.spinner {
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  width: 32px; height: 32px;
  animation: spin .7s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg) } }

/* Repost modal */
.repost-options { display: flex; flex-direction: column; gap: 10px; }
.repost-option {
  display: flex; align-items: center; gap: 12px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 16px; font-weight: 600;
  transition: all .15s;
}
.repost-option:hover { background: var(--bg3); border-color: var(--accent); }
.repost-option .icon { font-size: 22px; }

/* Empty state */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text3); }
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }

/* Right panel suggestions */
.suggestion-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  transition: background .15s;
}
.suggestion-card:hover { background: var(--bg3); }
.suggestion-info { flex: 1; min-width: 0; }
.suggestion-name { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggestion-username { font-size: 13px; color: var(--text3); }

/* Responsive */
@media (max-width: 1200px) { .right-panel { display: none; } }
@media (max-width: 768px) {
  .sidebar { width: 72px; padding: 16px 8px; }
  .sidebar .nav-label, .sidebar .logo-text, .sidebar-user-info, .post-btn span { display: none; }
  .post-btn { padding: 14px; width: 48px; height: 48px; margin: 8px auto; display: flex; align-items: center; justify-content: center; }
  .main-content { margin-left: 72px; }
  .logo { justify-content: center; }
  .nav-item { justify-content: center; padding: 12px; }
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0 !important; border-right: none; padding-bottom: 72px; max-width: 100%; }

  .bottom-nav {
    display: flex !important;
    position: fixed; bottom: 0; left: 0; right: 0;
    height: 60px;
    background: rgba(10,10,15,.97);
    border-top: 1px solid var(--border);
    z-index: 200;
    align-items: center;
    justify-content: space-around;
    backdrop-filter: blur(12px);
  }
  .bottom-nav-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    font-size: 22px; padding: 8px 0;
    color: var(--text3);
    transition: color .15s;
    cursor: pointer;
  }
  .bottom-nav-item.active { color: var(--accent2); }
  .bottom-nav-item .nav-label-sm { font-size: 10px; margin-top: 2px; }

  .fab {
    display: flex !important;
    position: fixed; bottom: 72px; right: 18px;
    width: 54px; height: 54px;
    background: var(--accent);
    border-radius: 50%;
    align-items: center; justify-content: center;
    font-size: 26px;
    box-shadow: 0 4px 16px rgba(124,92,252,.5);
    z-index: 199;
    cursor: pointer;
  }

  .feed-header { font-size: 16px; padding: 12px 14px; }
  .tab-btn { padding: 10px; font-size: 14px; }
  .post-card { padding: 12px 14px; }
  .post-avatar, .post-avatar-placeholder { width: 38px !important; height: 38px !important; font-size: 15px !important; }
  .post-video { max-height: 260px; }
  .post-content { font-size: 14px; }
  .action-btn { padding: 6px 8px; font-size: 13px; }
  .compose { padding: 12px 14px; }
  .compose textarea { font-size: 15px; }
  .modal-overlay { align-items: flex-end; }
  .modal { width: 100%; max-width: 100% !important; border-radius: 20px 20px 0 0; max-height: 92vh; }
  .profile-banner { height: 120px; }
  .profile-avatar { width: 72px !important; height: 72px !important; }
  .profile-avatar-placeholder { width: 72px !important; height: 72px !important; font-size: 28px !important; }
  .profile-avatar-wrap { margin-top: -40px; }
  .profile-name { font-size: 17px; }
  .profile-stats { gap: 14px; font-size: 13px; }
  .auth-box { padding: 28px 20px; border-radius: 16px; }
  .reply-thread { padding: 12px 14px; }
  .post-time { display: none; }
}

.bottom-nav { display: none; }
.fab { display: none; }
