/* ── Global ── */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  background: #f0f2f5;
  font-family: "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: #1c1e21;
}

a {
  color: #1877f2;
  text-decoration: none;
}
a:hover { text-decoration: underline; }

h1, h2 {
  font-weight: 700;
  color: #1c1e21;
}

/* ── Navbar ── */
nav.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: #ffffff !important;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#identity_div {
  font-size: 14px;
}

#identity_div button,
#identity_div a {
  background: #1877f2;
  color: #fff !important;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  font-size: 14px;
}
#identity_div button:hover,
#identity_div a:hover {
  background: #166fe5;
  text-decoration: none;
}

/* ── Page layout ── */
.page-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 80px 20px 40px;
}

h1 { font-size: 28px; margin-bottom: 4px; }
h2 { font-size: 20px; margin: 0 0 12px; }

/* ── Refresh button ── */
#posts_box + button,
button[onclick="loadPosts()"] {
  background: #e4e6eb;
  border: none;
  border-radius: 6px;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 14px;
  color: #1c1e21;
}
button[onclick="loadPosts()"]:hover { background: #d8dadf; }

/* ── Posts grid ── */
#posts_box {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 12px;
}

/* ── Post card ── */
.post {
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: box-shadow 0.2s;
}
.post:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* description sits at the top of the card */
.post > *:first-child {
  padding: 12px 14px 6px;
  font-weight: 600;
  font-size: 15px;
}

/* url preview iframe/content */
.post iframe,
.post .url-preview {
  border: none;
  border-top: 1px solid #e4e6eb;
}

/* meta line: username + date */
.post > div:not(.post-interactions):not(.comments-box) {
  padding: 6px 14px;
  font-size: 12px;
  color: #65676b;
}

/* ── Post interactions ── */
.post-interactions {
  padding: 8px 14px 10px;
  border-top: 1px solid #e4e6eb;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.post-interactions > div:first-child {
  display: flex;
  align-items: center;
  gap: 10px;
}

.post-interactions span[title] {
  font-size: 13px;
  color: #65676b;
}

/* ── Heart / like button ── */
.heart_button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: #e0245e;
  padding: 0;
  line-height: 1;
  transition: transform 0.15s;
}
.heart_button:hover { transform: scale(1.25); }

/* ── View/Hide comments button ── */
.post-interactions > button,
button[onclick^="toggleComments"] {
  background: #e4e6eb;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: #1c1e21;
  align-self: flex-start;
}
.post-interactions > button:hover,
button[onclick^="toggleComments"]:hover { background: #d8dadf; }

/* ── Comments box ── */
.comments-box {
  border-top: 1px solid #e4e6eb;
  background: #f7f8fa;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.comments-box button {
  background: none;
  border: none;
  color: #1877f2;
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  align-self: flex-start;
  font-weight: 600;
}
.comments-box button:hover { text-decoration: underline; }

/* ── Individual comment ── */
.individual-comment-box {
  background: #ffffff;
  border-radius: 8px;
  padding: 8px 10px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.07);
  font-size: 13px;
}
.individual-comment-box > div:last-child {
  font-size: 11px;
  color: #65676b;
  margin-top: 3px;
}

/* ── New comment area ── */
.new-comment-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}
.new-comment-box textarea {
  width: 100%;
  border: 1px solid #ccd0d5;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
  background: #fff;
}
.new-comment-box textarea:focus {
  outline: none;
  border-color: #1877f2;
  box-shadow: 0 0 0 2px rgba(24,119,242,0.2);
}
.new-comment-box button {
  background: #1877f2 !important;
  color: #fff !important;
  border: none;
  border-radius: 6px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  align-self: flex-start;
}
.new-comment-box button:hover { background: #166fe5 !important; text-decoration: none !important; }

/* ── Make post section ── */
#make_post_div {
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
  padding: 20px 24px;
  margin-top: 28px;
  max-width: 520px;
}
#make_post_div h2 { margin-bottom: 12px; }
#make_post_div p { margin: 10px 0 4px; font-size: 13px; color: #65676b; }
#make_post_div input[type="text"] {
  width: 100%;
  border: 1px solid #ccd0d5;
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  background: #f7f8fa;
}
#make_post_div input[type="text"]:focus {
  outline: none;
  border-color: #1877f2;
  box-shadow: 0 0 0 2px rgba(24,119,242,0.2);
  background: #fff;
}
#make_post_div button[onclick="postUrl()"] {
  margin-top: 14px;
  background: #1877f2;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 9px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
#make_post_div button[onclick="postUrl()"]:hover { background: #166fe5; }
#postStatus { font-size: 13px; color: #65676b; margin-left: 10px; }

/* ── Divider ── */
hr {
  border: none;
  border-top: 1px solid #e4e6eb;
  margin: 24px 0;
}

/* ── Error alert ── */
#errorInfo {
  font-size: 13px;
}

/* ── Utility ── */
.d-none { display: none !important; }

/* ── Deleted / unknown user ── */
.deleted-user {
  color: #8a8d91;
  font-style: italic;
  cursor: default;
}

/* ── User profile card ── */
.user-profile-card {
  display: flex;
  align-items: center;
  gap: 20px;
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
  padding: 20px 24px;
  margin-bottom: 20px;
  max-width: 520px;
}

.user-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #1877f2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
}

.user-profile-info h2 {
  margin: 0 0 4px;
  font-size: 20px;
}

.make-post-card {
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
  padding: 16px 24px;
  margin-bottom: 20px;
  max-width: 520px;
}