/* =========================================================
   PESBUK - tema ala Facebook (terang & gelap)
   ========================================================= */
:root {
  --blue: #1877f2;
  --blue-hover: #166fe5;
  --green: #42b72a;
  --green-hover: #36a420;
  --bg: #f0f2f5;
  --card: #ffffff;
  --text: #050505;
  --text2: #65676b;
  --border: #dadde1;
  --hover: #e4e6eb;
  --input: #f0f2f5;
  --link: #216fdb;
  --shadow: 0 1px 2px rgba(0, 0, 0, .18);
  --nav-h: 56px;
  --radius: 8px;
}
:root[data-theme="dark"] {
  --bg: #18191a;
  --card: #242526;
  --text: #e4e6eb;
  --text2: #b0b3b8;
  --border: #3e4042;
  --hover: #3a3b3c;
  --input: #3a3b3c;
  --link: #5aa2ff;
  --shadow: 0 1px 2px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; }
input, textarea { font: inherit; color: var(--text); }
h1, h2, h3, h4 { margin: 0; }
[hidden] { display: none !important; }
.muted { color: var(--text2); }
.small { font-size: 13px; }
.inline-form { display: inline-flex; margin: 0; }

.ic { width: 20px; height: 20px; fill: currentColor; flex: none; }
.plink { color: var(--link); word-break: break-word; overflow-wrap: anywhere; }
.plink:hover { text-decoration: underline; }

/* ---------- Tombol ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 6px; padding: 9px 16px; font-weight: 600; line-height: 1.2;
  transition: background .15s, opacity .15s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:not(:disabled):hover { background: var(--blue-hover); }
.btn-green { background: var(--green); color: #fff; }
.btn-green:not(:disabled):hover { background: var(--green-hover); }
.btn-secondary { background: var(--hover); color: var(--text); }
.btn-secondary:hover { filter: brightness(.96); }
.btn-block { width: 100%; font-size: 19px; padding: 12px; }
.btn-center { display: flex; width: fit-content; margin: 0 auto; font-size: 17px; padding: 12px 18px; }
.btn-link-center { display: block; text-align: center; color: var(--blue); font-weight: 600; }
.btn-link-center:hover { text-decoration: underline; }
.link-btn { color: var(--text2); font-weight: 600; font-size: 12px; }
.link-btn:hover { text-decoration: underline; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--hover); color: var(--text);
  transition: filter .15s;
}
.icon-btn:hover { filter: brightness(.93); }
:root[data-theme="dark"] .icon-btn:hover { filter: brightness(1.15); }

/* ---------- Avatar ---------- */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; object-fit: cover; flex: none;
  background: var(--hover); color: #fff; font-weight: 700; line-height: 1; user-select: none;
}

/* ---------- Navbar ---------- */
.navbar {
  position: sticky; top: 0; z-index: 50; height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 16px; background: var(--card);
  box-shadow: 0 2px 4px rgba(0, 0, 0, .1);
}
.nav-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo {
  font-weight: 800; font-size: 28px; letter-spacing: -.5px; line-height: 1;
  color: var(--blue);
}
.nav-search {
  display: flex; align-items: center; gap: 8px; margin: 0;
  height: 40px; padding: 0 14px; border-radius: 999px; background: var(--input); color: var(--text2);
}
.nav-search input {
  width: 220px; border: 0; outline: 0; background: transparent; color: var(--text);
}
.nav-right { display: flex; align-items: center; gap: 8px; }
.nav-searchlink { display: none; }
.nav-avatar { display: inline-flex; border-radius: 50%; }
.ic-sun { display: none; }
:root[data-theme="dark"] .ic-sun { display: block; }
:root[data-theme="dark"] .ic-moon { display: none; }

/* ---------- Layout ---------- */
.layout {
  display: grid; grid-template-columns: 280px minmax(0, 680px) 300px;
  gap: 24px; justify-content: center; align-items: start;
  padding: 16px;
}
.layout-2 { grid-template-columns: 280px minmax(0, 680px); }
.sidebar {
  position: sticky; top: calc(var(--nav-h) + 16px);
  max-height: calc(100vh - var(--nav-h) - 32px); overflow-y: auto;
}
.feed-col { min-width: 0; }
.narrow { max-width: 680px; margin: 16px auto; padding: 0 12px; }

.side-item {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 8px; border-radius: var(--radius); font-weight: 600; color: var(--text);
}
.side-item:hover { background: var(--hover); }
.side-item.active { color: var(--blue); }
.side-profile { font-size: 16px; }
.side-ic {
  width: 36px; height: 36px; border-radius: 50%; background: var(--hover);
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.side-item.active .side-ic { background: var(--blue); color: #fff; }
.side-foot { color: var(--text2); font-size: 12px; padding: 12px 8px; margin: 0; }

.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 16px;
}
.side-card { padding: 16px; }
.side-card h4 { font-size: 17px; margin-bottom: 8px; }
.person { display: flex; align-items: center; gap: 10px; padding: 8px; margin: 0 -8px; border-radius: var(--radius); }
.person:hover { background: var(--hover); }
.person span { display: flex; flex-direction: column; min-width: 0; }
.person small { color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-lg { padding: 10px 8px; }

.empty { padding: 28px 20px; text-align: center; }
.empty h3 { margin-bottom: 6px; }
.empty p { color: var(--text2); margin: 0 0 14px; }

/* ---------- Composer ---------- */
.composer { padding: 12px 16px; }
.composer-top { display: flex; gap: 10px; align-items: flex-start; }
.composer textarea {
  flex: 1; min-height: 40px; max-height: 300px; resize: none; overflow-y: auto;
  border: 0; outline: 0; border-radius: 20px; padding: 9px 14px;
  background: var(--input); font-size: 16px;
}
.composer textarea::placeholder, .field::placeholder, .nav-search input::placeholder { color: var(--text2); }
.img-preview { position: relative; margin-top: 12px; border-radius: var(--radius); overflow: hidden; background: var(--input); }
.img-preview img { display: block; width: 100%; max-height: 420px; object-fit: contain; }
.img-preview .icon-btn { position: absolute; top: 8px; right: 8px; width: 34px; height: 34px; background: var(--card); box-shadow: var(--shadow); }
.composer-actions {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border);
}
.composer-photo {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px;
  border-radius: var(--radius); font-weight: 600; color: var(--text2); cursor: pointer;
}
.composer-photo:hover { background: var(--hover); }
.composer-photo .ic { color: #45bd62; width: 24px; height: 24px; }

/* ---------- Postingan ---------- */
.post-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px 8px; }
.post-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.post-author { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-author:hover { text-decoration: underline; }
.post-time { color: var(--text2); font-size: 13px; }
.post-head .icon-btn { background: transparent; color: var(--text2); }
.post-head .icon-btn:hover { background: var(--hover); }
.post-text {
  padding: 4px 16px 12px; font-size: 15px; line-height: 1.4;
  white-space: normal; word-break: break-word; overflow-wrap: anywhere;
}
.post-text.big { font-size: 24px; line-height: 1.25; padding-top: 12px; padding-bottom: 24px; }
.post-img { background: var(--input); }
.post-img img {
  display: block; width: 100%; height: auto; max-height: 720px;
  object-fit: contain; cursor: zoom-in; background: var(--input);
}
.post-stats {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; color: var(--text2); font-size: 14px; min-height: 40px;
}
.post-stats:not(:has(> :not([hidden]))) { display: none; }
.stat-likes { display: inline-flex; align-items: center; gap: 6px; }
.like-badge {
  width: 20px; height: 20px; border-radius: 50%; background: var(--blue); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
}
.like-badge .ic { width: 12px; height: 12px; }
.stat-comments { margin-left: auto; color: var(--text2); }
.stat-comments:hover { text-decoration: underline; }
.post-actions { display: flex; gap: 4px; margin: 0 16px; padding: 4px 0; border-top: 1px solid var(--border); }
.act {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px; border-radius: 6px; font-weight: 600; color: var(--text2);
}
.act:hover { background: var(--hover); }
.act.liked { color: var(--blue); }
.act:disabled { opacity: .6; }

/* ---------- Komentar ---------- */
.comments { padding: 4px 16px 14px; border-top: 1px solid var(--border); margin-top: 4px; }
.comment-list:empty { display: none; }
.comment-list { padding-top: 10px; }
.comment { display: flex; gap: 8px; margin-bottom: 10px; }
.comment-body { min-width: 0; }
.bubble { display: inline-block; max-width: 100%; background: var(--input); border-radius: 18px; padding: 8px 12px; }
.comment-author { display: block; font-weight: 600; font-size: 13px; }
.comment-author:hover { text-decoration: underline; }
.comment-text { word-break: break-word; overflow-wrap: anywhere; }
.comment-meta { display: flex; gap: 12px; padding: 2px 12px 0; font-size: 12px; color: var(--text2); }
.comments-loading { padding: 10px 0; color: var(--text2); font-size: 14px; }
.comment-form { display: flex; align-items: center; gap: 8px; margin: 8px 0 0; }
.comment-form input {
  flex: 1; min-width: 0; height: 36px; border: 0; outline: 0; border-radius: 18px;
  padding: 0 14px; background: var(--input);
}
.comment-form .send { width: 36px; height: 36px; background: transparent; color: var(--blue); }
.comment-form .send:hover { background: var(--hover); }

/* ---------- Status feed ---------- */
.sentinel { height: 1px; }
.feed-status { display: flex; justify-content: center; align-items: center; gap: 10px; padding: 18px; color: var(--text2); }
.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--blue);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.post.removing { opacity: 0; transform: scale(.98); transition: .25s; }

/* ---------- Profil ---------- */
.profile-top { background: var(--card); box-shadow: var(--shadow); }
.profile-cover {
  height: 260px; max-width: 1000px; margin: 0 auto;
  background: linear-gradient(135deg, #1877f2 0%, #4f9bff 55%, #9cc8ff 100%);
  border-radius: 0 0 var(--radius) var(--radius);
}
.profile-head {
  max-width: 940px; margin: 0 auto; padding: 0 16px 16px;
  display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap;
}
.profile-avatar { margin-top: -74px; border: 4px solid var(--card); border-radius: 50%; background: var(--card); display: flex; }
.profile-info { flex: 1; min-width: 200px; padding-bottom: 6px; }
.profile-info h1 { font-size: 30px; line-height: 1.15; word-break: break-word; }
.profile-edit { margin-bottom: 8px; }
.profile-grid {
  display: grid; grid-template-columns: 360px minmax(0, 560px); gap: 16px;
  max-width: 940px; margin: 16px auto; padding: 0 16px; align-items: start;
}
.profile-side { position: sticky; top: calc(var(--nav-h) + 16px); }
.bio { margin: 0 0 12px; word-break: break-word; }

/* ---------- Form (settings, search) ---------- */
.form-card { padding: 20px; }
.form-card h2 { margin-bottom: 16px; font-size: 22px; }
.label { display: block; font-weight: 600; margin: 12px 0 6px; }
.field {
  width: 100%; padding: 12px 14px; margin-bottom: 12px;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--card); font-size: 16px; outline: 0; resize: vertical;
}
.field:focus { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(24, 119, 242, .25); }
.label + .field { margin-bottom: 4px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.settings-avatar { display: flex; align-items: center; gap: 16px; margin-bottom: 8px; }
.search-row { display: flex; gap: 8px; }
.search-row .field { margin: 0; }

/* ---------- Auth ---------- */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  gap: 72px; padding: 24px; flex-wrap: wrap;
}
.auth-hero { max-width: 480px; }
.auth-hero .logo { font-size: 64px; margin-bottom: 8px; }
.auth-hero p { font-size: 26px; line-height: 1.25; margin: 0; }
.auth-card {
  width: 396px; max-width: 100%; padding: 20px; border-radius: var(--radius);
  background: var(--card); box-shadow: 0 2px 4px rgba(0, 0, 0, .1), 0 8px 16px rgba(0, 0, 0, .1);
}
.auth-card .field { padding: 14px 16px; font-size: 17px; }
.auth-title { font-size: 28px; }
.auth-sub { margin: 2px 0 14px; }
.sep { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
.auth-theme { position: fixed; top: 14px; right: 14px; }
.alert { padding: 10px 12px; border-radius: 6px; margin-bottom: 12px; font-size: 14px; }
.alert-error { background: rgba(240, 40, 73, .1); color: #e0284a; border: 1px solid rgba(240, 40, 73, .4); }

/* ---------- Toast & Lightbox ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 200;
  max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 8px;
  background: #242526; color: #fff; box-shadow: 0 4px 16px rgba(0, 0, 0, .35); font-size: 14px;
}
.toast.error { background: #d8253f; }
.lightbox {
  position: fixed; inset: 0; z-index: 300; background: rgba(0, 0, 0, .92);
  display: flex; align-items: center; justify-content: center; padding: 16px; cursor: zoom-out;
}
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox .icon-btn { position: absolute; top: 14px; right: 14px; background: rgba(255, 255, 255, .15); color: #fff; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .layout { grid-template-columns: 260px minmax(0, 680px); }
  .sidebar.right { display: none; }
}
@media (max-width: 900px) {
  .layout, .layout-2 { grid-template-columns: minmax(0, 680px); gap: 0; padding: 8px 0; }
  .sidebar.left { display: none; }
  .profile-grid { grid-template-columns: minmax(0, 1fr); padding: 0; margin: 8px auto; }
  .profile-side { position: static; }
  .profile-grid .side-card { margin: 0 0 8px; border-radius: 0; }
  .nav-search { display: none; }
  .nav-searchlink { display: inline-flex; }
}
@media (max-width: 640px) {
  .navbar { padding: 0 10px; }
  .nav-right { gap: 6px; }
  .nav-right .icon-btn { width: 38px; height: 38px; }
  .logo { font-size: 24px; }
  .card { border-radius: 0; margin-bottom: 8px; }
  .composer, .form-card { padding: 12px; }
  .post-head { padding: 10px 12px 6px; }
  .post-text { padding: 4px 12px 10px; }
  .post-text.big { font-size: 21px; }
  .post-stats { padding: 8px 12px; }
  .post-actions, .comments { margin-left: 12px; margin-right: 12px; }
  .comments { margin-left: 0; margin-right: 0; padding-left: 12px; padding-right: 12px; }
  .profile-cover { height: 150px; border-radius: 0; }
  .profile-head { padding: 0 12px 12px; justify-content: center; text-align: center; }
  .profile-avatar { margin-top: -64px; }
  .profile-avatar .avatar { width: 128px !important; height: 128px !important; font-size: 54px !important; }
  .profile-info { flex-basis: 100%; }
  .profile-info h1 { font-size: 24px; }
  .auth-wrap { gap: 20px; padding: 16px; align-content: center; }
  .auth-hero { text-align: center; }
  .auth-hero .logo { font-size: 46px; }
  .auth-hero p { font-size: 18px; }
  .auth-card { box-shadow: var(--shadow); }
}

/* ---------- Tambahan: guest, share, logo dark ---------- */
:root[data-theme="dark"] .logo { color: #fff; }   /* dark mode: logo putih, light mode: biru */

.nav-auth { display: inline-flex; gap: 8px; }
.nav-auth .btn { padding: 8px 14px; }
.guest-card { margin-bottom: 8px; }
.guest-card p { margin: 0 0 12px; }
.btn-wide { display: flex; width: 100%; margin-top: 8px; }
.composer-guest { display: flex; align-items: center; gap: 10px; padding: 12px 16px; }
.composer-guest .fake-input {
  flex: 1; padding: 10px 14px; border-radius: 20px; background: var(--input);
  color: var(--text2); font-size: 15px; min-width: 0;
}
.composer-guest:hover .fake-input { filter: brightness(.96); }
.login-prompt { display: block; margin-top: 10px; color: var(--link); font-weight: 600; }
.login-prompt:hover { text-decoration: underline; }
.section-title { font-size: 15px; letter-spacing: .6px; font-weight: 700; margin: 4px 4px 12px; color: var(--text2); }
a.post-time:hover { text-decoration: underline; }
.act-share:active { transform: scale(.97); }

@media (max-width: 640px) {
  .nav-auth { gap: 6px; }
  .nav-auth .btn { padding: 7px 10px; font-size: 14px; }
  .nav-right .nav-home { display: none; }
  .act { gap: 6px; padding: 8px 4px; font-size: 14px; }
  .composer-guest { padding: 10px 12px; }
}
