* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: Arial, Helvetica, sans-serif;
}

body {
  background: #f0f2f5;
  color: #1c1e21;
}

/* =========================
   AUTH PAGES
========================= */
.auth-body {
  min-height: 100vh;
  background: #f0f2f5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-container {
  width: 100%;
  max-width: 1100px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
  flex-wrap: wrap;
}

.auth-left {
  flex: 1;
  min-width: 280px;
}

.fb-logo {
  color: #1877f2;
  font-size: 58px;
  font-weight: 800;
  margin-bottom: 10px;
}

.auth-tagline {
  font-size: 24px;
  line-height: 1.4;
  max-width: 500px;
}

.auth-right {
  flex: 1;
  display: flex;
  justify-content: center;
  min-width: 280px;
}

.auth-card {
  background: #fff;
  width: 100%;
  max-width: 420px;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.12);
  padding: 28px;
}

.auth-card h2 {
  margin-bottom: 18px;
  text-align: center;
  color: #1877f2;
}

.auth-card input,
.auth-card textarea {
  width: 100%;
  padding: 14px;
  margin-bottom: 14px;
  border: 1px solid #ccd0d5;
  border-radius: 10px;
  font-size: 15px;
  outline: none;
}

.auth-card textarea {
  min-height: 100px;
  resize: vertical;
}

.auth-card input:focus,
.auth-card textarea:focus {
  border-color: #1877f2;
}

.auth-btn {
  width: 100%;
  margin-top: 4px;
}

.auth-link-text {
  text-align: center;
  margin-top: 14px;
  font-size: 14px;
}

.auth-link-text a {
  color: #1877f2;
  text-decoration: none;
  font-weight: 600;
}

/* =========================
   TOPBAR
========================= */
.fb-body {
  min-height: 100vh;
  background: #f0f2f5;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: #fff;
  border-bottom: 1px solid #ddd;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 18px;
  gap: 15px;
  flex-wrap: wrap;
}

.topbar-left,
.topbar-center,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  font-size: 30px;
  font-weight: 800;
  color: #1877f2;
}

.search-box {
  padding: 10px 14px;
  border-radius: 999px;
  border: none;
  background: #f0f2f5;
  min-width: 220px;
  outline: none;
}

.nav-link {
  text-decoration: none;
  color: #555;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: 10px;
  transition: 0.2s;
}

.nav-link:hover {
  background: #f0f2f5;
}

.nav-link.active {
  color: #1877f2;
  background: #e7f3ff;
}

.topbar-right span {
  font-weight: 700;
}

/* =========================
   LAYOUT
========================= */
.main-layout {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 280px;
  gap: 20px;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.feed {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sidebar-card,
.create-post-card,
.post-card,
.section-card,
.profile-card,
.chat-window-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.08);
  padding: 18px;
}

.section-subtitle {
  color: #666;
  margin-top: 8px;
}

.section-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* =========================
   PROFILE MINI
========================= */
.profile-mini {
  text-align: center;
}

.large-avatar {
  width: 80px !important;
  height: 80px !important;
  font-size: 28px !important;
  margin: 0 auto 12px;
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-menu a {
  text-decoration: none;
  color: #222;
  background: #f7f8fa;
  padding: 12px 14px;
  border-radius: 12px;
  font-weight: 600;
  transition: 0.2s;
}

.sidebar-menu a:hover {
  background: #e7f3ff;
  color: #1877f2;
}

/* =========================
   AVATAR
========================= */
.avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1877f2, #42a5f5);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}

/* =========================
   BUTTONS
========================= */
.btn-primary,
.logout-btn {
  border: none;
  cursor: pointer;
  padding: 11px 16px;
  border-radius: 10px;
  font-weight: 700;
  transition: 0.2s;
}

.btn-primary {
  background: #1877f2;
  color: white;
}

.btn-primary:hover {
  background: #1669d9;
}

.logout-btn {
  background: #e4e6eb;
  color: #111;
}

.logout-btn:hover {
  background: #d8dbe0;
}

.small-btn {
  padding: 9px 12px;
  font-size: 14px;
}

/* =========================
   HOME / POSTS
========================= */
.create-post-top {
  display: flex;
  gap: 12px;
  align-items: center;
}

#create-post-input,
#postInput {
  width: 100%;
}

.create-post-card input {
  flex: 1;
  border: none;
  background: #f0f2f5;
  border-radius: 999px;
  padding: 14px 16px;
  outline: none;
}

.post-btn {
  margin-top: 14px;
  width: 100%;
}

.post-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.post-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.post-time {
  color: #777;
  font-size: 13px;
  margin-top: 2px;
}

.post-content {
  font-size: 15px;
  line-height: 1.6;
  word-break: break-word;
}

.post-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  border-top: 1px solid #eee;
  padding-top: 12px;
}

.post-actions button {
  flex: 1;
  min-width: 90px;
  border: none;
  background: #f7f8fa;
  padding: 10px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
}

.post-actions button:hover {
  background: #edf2f7;
}

/* =========================
   CONTACTS
========================= */
.contact-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

/* =========================
   PROFILE PAGE
========================= */
.profile-header {
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
}

.profile-avatar {
  width: 100px;
  height: 100px;
  font-size: 34px;
}

.form-group {
  margin-top: 14px;
}

.form-group label {
  display: block;
  font-weight: 700;
  margin-bottom: 8px;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid #ccd0d5;
  border-radius: 10px;
  outline: none;
}

.form-group textarea {
  min-height: 100px;
  resize: vertical;
}

/* =========================
   FRIENDS PAGE
========================= */
.friends-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

.friend-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.08);
  padding: 18px;
}

.friend-top {
  display: flex;
  gap: 12px;
  align-items: center;
}

.friend-top h3 {
  margin-bottom: 4px;
}

.friend-top p {
  color: #666;
  font-size: 14px;
}

.friend-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

/* =========================
   MESSAGES PAGE
========================= */
.messages-layout {
  grid-template-columns: 320px minmax(0, 1fr);
}

.chat-sidebar {
  display: flex;
  flex-direction: column;
}

.chat-user-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.chat-user {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f7f8fa;
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  transition: 0.2s;
}

.chat-user:hover,
.chat-user.active {
  background: #e7f3ff;
}

.chat-main {
  display: flex;
  flex-direction: column;
}

.chat-window-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 70vh;
}

.chat-header {
  border-bottom: 1px solid #eee;
  padding-bottom: 14px;
}

.chat-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-status {
  color: #4caf50;
  font-size: 14px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.message-bubble {
  max-width: 75%;
  padding: 12px 14px;
  border-radius: 16px;
  line-height: 1.5;
  word-break: break-word;
}

.message-bubble.you {
  align-self: flex-end;
  background: #1877f2;
  color: white;
  border-bottom-right-radius: 4px;
}

.message-bubble.other {
  align-self: flex-start;
  background: #f0f2f5;
  color: #111;
  border-bottom-left-radius: 4px;
}

.chat-input-box {
  display: flex;
  gap: 10px;
  border-top: 1px solid #eee;
  padding-top: 14px;
}

.chat-input-box input {
  flex: 1;
  padding: 13px 14px;
  border-radius: 999px;
  border: 1px solid #ccd0d5;
  outline: none;
}

/* =========================
   NOTIFICATIONS PAGE
========================= */
.notifications-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.notification-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.08);
  padding: 16px;
  border-left: 5px solid transparent;
}

.notification-card.unread {
  border-left-color: #1877f2;
  background: #f8fbff;
}

/* =========================
   DARK MODE
========================= */
body.dark-mode {
  background: #18191a;
  color: #e4e6eb;
}

body.dark-mode .topbar,
body.dark-mode .sidebar-card,
body.dark-mode .create-post-card,
body.dark-mode .post-card,
body.dark-mode .section-card,
body.dark-mode .profile-card,
body.dark-mode .chat-window-card,
body.dark-mode .friend-card,
body.dark-mode .notification-card,
body.dark-mode .auth-card {
  background: #242526;
  color: #e4e6eb;
  box-shadow: none;
}

body.dark-mode .search-box,
body.dark-mode .create-post-card input,
body.dark-mode .chat-input-box input,
body.dark-mode .form-group input,
body.dark-mode .form-group textarea,
body.dark-mode .auth-card input,
body.dark-mode .auth-card textarea {
  background: #3a3b3c;
  color: #fff;
  border-color: #555;
}

body.dark-mode .sidebar-menu a,
body.dark-mode .chat-user,
body.dark-mode .post-actions button,
body.dark-mode .logout-btn {
  background: #3a3b3c;
  color: #e4e6eb;
}

body.dark-mode .nav-link {
  color: #ddd;
}

body.dark-mode .nav-link.active {
  background: #263951;
  color: #7fb4ff;
}

body.dark-mode .notification-card.unread {
  background: #1e2b38;
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 1200px) {
  .main-layout {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .right-sidebar {
    display: none;
  }
}

@media (max-width: 900px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-left,
  .topbar-center,
  .topbar-right {
    justify-content: center;
    flex-wrap: wrap;
  }

  .main-layout,
  .messages-layout {
    grid-template-columns: 1fr;
  }

  .left-sidebar,
  .chat-sidebar {
    order: 1;
  }

  .feed,
  .chat-main {
    order: 2;
  }
}

@media (max-width: 600px) {
  .auth-tagline {
    font-size: 18px;
  }

  .fb-logo {
    font-size: 44px;
  }

  .search-box {
    min-width: 100%;
  }

  .main-layout {
    padding: 12px;
  }

  .topbar {
    padding: 12px;
  }

  .nav-link {
    padding: 8px 10px;
    font-size: 14px;
  }

  .friend-actions,
  .chat-input-box,
  .section-header-row {
    flex-direction: column;
    align-items: stretch;
  }

  .post-actions {
    flex-direction: column;
  }

  .message-bubble {
    max-width: 90%;
  }
}