:root {
  --bg: #f0f2f5;
  --card: #ffffff;
  --text: #000000;
  --primary: #1877f2;
  --muted: #65676b;
  --border: #d9dde3;
  --soft: #eef3ff;
}

.dark {
  --bg: #18191a;
  --card: #242526;
  --text: #e4e6eb;
  --muted: #b0b3b8;
  --border: #3a3b3c;
  --soft: #303234;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

input,
textarea,
button {
  box-sizing: border-box;
  font: inherit;
}

button {
  cursor: pointer;
  transition: 0.2s;
}

button:hover {
  opacity: 0.8;
}

.app {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 60px;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 15px;
  box-shadow: 0 8px 22px rgba(24, 119, 242, 0.2);
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-link {
  color: #fff;
  font-weight: 700;
}

.logo {
  font-size: 20px;
  font-weight: 700;
}

.search {
  width: 300px;
  padding: 8px 14px;
  border-radius: 20px;
  border: none;
  outline: none;
  background: rgba(255, 255, 255, 0.92);
  color: #1c1e21;
}

.user-chip {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
}

.theme-toggle {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 18px 15px 28px;
  display: flex;
  gap: 18px;
  align-items: flex-start;
}

.sidebar,
.rightbar {
  width: 20%;
  position: sticky;
  top: 78px;
}

.feed {
  width: 60%;
}

.card,
.create-post,
.post {
  background: var(--card);
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.card {
  padding: 16px;
  margin-bottom: 16px;
}

.nav-card {
  background: var(--card);
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  padding: 10px;
  margin-bottom: 16px;
}

.nav-card a {
  display: block;
  padding: 12px 14px;
  border-radius: 10px;
  font-weight: 700;
}

.nav-card a:hover {
  background: var(--soft);
  text-decoration: none;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-avatar,
.avatar,
.profile-avatar,
.post-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  background: #d9e7ff;
}

.profile-avatar {
  width: 150px;
  height: 150px;
  display: block;
  margin-bottom: 16px;
}

.avatar-small {
  width: 36px;
  height: 36px;
}

.meta,
.muted {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.accent-card,
.upsell-panel {
  background: linear-gradient(135deg, #ffffff, #eaf2ff);
}

.create-post {
  padding: 16px;
  margin-bottom: 16px;
}

.create-post form,
.comment-form {
  margin: 0;
}

.create-post textarea,
textarea {
  width: 100%;
  min-height: 90px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  resize: vertical;
  background: var(--card);
  color: var(--text);
}

.composer-actions,
.button-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}

button,
.action-button {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
}

.ghost-button,
.secondary-button {
  background: var(--soft);
  color: var(--primary);
}

.post {
  padding: 16px;
  margin-bottom: 16px;
  animation: fadeIn 0.4s ease;
  transition: 0.2s;
}

.post:hover {
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  transform: translateY(-3px);
}

.post-top,
.post-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.post-header {
  margin-bottom: 12px;
}

.post-author {
  color: var(--text);
}

.post-content,
.post-body {
  margin: 14px 0;
  line-height: 1.55;
  white-space: pre-wrap;
}

.post-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  color: var(--muted);
}

.inline-form {
  margin: 0;
}

.action-button {
  padding: 8px 12px;
}

.action-label {
  font-size: 14px;
  color: var(--muted);
}

.comments {
  margin-top: 12px;
}

.comment {
  background: color-mix(in srgb, var(--card) 82%, var(--bg) 18%);
  padding: 10px 12px;
  border-radius: 12px;
  margin-top: 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.comment-form {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.comment-form input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="file"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
}

.comment-form button {
  white-space: nowrap;
}

.request-item,
.online-user,
.suggested-user,
.friend-request {
  display: block;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.online-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.request-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.ad-post {
  background: linear-gradient(135deg, #fff5dc, #ffe3ba);
  color: #8a4b00;
}

.premium-link {
  display: inline-block;
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
}

.premium-badge {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: #fff0c2;
  color: #8a5a00;
  font-weight: 700;
}

.success {
  color: #157347;
}

.error {
  color: #b42318;
}

.container {
  max-width: 900px;
  margin: 24px auto;
  padding: 0 16px 32px;
}

.panel {
  background: var(--card);
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  padding: 16px;
  margin-bottom: 16px;
}

.menu-link {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 700;
}

.menu-link:hover {
  background: var(--soft);
  text-decoration: none;
}

.chat-box {
  border: 1px solid var(--border);
  height: 420px;
  overflow: auto;
  padding: 12px;
  border-radius: 12px;
  background: var(--card);
}

.chat-message {
  max-width: 75%;
  padding: 10px 12px;
  border-radius: 12px;
  margin: 8px 0;
}

.chat-message.mine {
  margin-left: auto;
  background: #dce9ff;
}

.chat-message.theirs {
  background: #eef1f4;
}

.chat-shell {
  background: var(--card);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.chat-header h1 {
  margin: 0;
}

.chat-footer {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  align-items: center;
}

.chat-footer input[type="text"],
.chat-footer input[type="file"],
.chat-footer input:not([type]) {
  border-radius: 12px;
}

.typing-indicator {
  min-height: 20px;
  margin: 8px 2px 0;
  color: var(--muted);
}

.chat-attachment {
  display: inline-block;
  margin-top: 8px;
  color: var(--primary);
  font-weight: 700;
}

.read-status {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.ai-badge {
  display: inline-block;
  margin-bottom: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #ffe5b4;
  color: #8a4b00;
  font-size: 12px;
  font-weight: 700;
}

.message-thread {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.message-thread:hover {
  text-decoration: none;
  transform: translateY(-2px);
}

.thread-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.thread-main small {
  color: var(--muted);
}

.unread-pill {
  margin-left: auto;
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.skeleton {
  height: 80px;
  margin-bottom: 16px;
  border-radius: 14px;
  background: linear-gradient(90deg, #eee, #ddd, #eee);
  background-size: 400px 80px;
  animation: load 1.2s infinite;
}

.dark .skeleton {
  background: linear-gradient(90deg, #2a2b2d, #3a3b3d, #2a2b2d);
  background-size: 400px 80px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes load {
  0% {
    background-position: -200px 0;
  }

  100% {
    background-position: 200px 0;
  }
}

@media (max-width: 768px) {
  .sidebar,
  .rightbar {
    display: none;
  }

  .feed {
    width: 100%;
  }

  .main {
    padding: 12px;
  }

  .search {
    width: 150px;
  }

  .composer-actions,
  .comment-form,
  .post-actions,
  .button-row,
  .request-actions,
  .chat-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .post-actions {
    gap: 8px;
  }
}
