:root { 
  --bg: #f8fafc; --card: #ffffff; --border: #e2e8f0; --text: #0f172a; 
  --muted: #64748b; --accent: #6366f1; --accent-hover: #4f46e5; 
  --accent-light: #e0e7ff; --danger: #ef4444; --shadow: 0 1px 3px rgba(0,0,0,0.05);
}
body.dark {
  --bg: #0f172a; --card: #1e293b; --border: #334155; --text: #f1f5f9; 
  --muted: #94a3b8; --accent: #818cf8; --accent-light: #312e81; --shadow: 0 1px 3px rgba(0,0,0,0.3);
}
* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter', sans-serif; }
body { background: var(--bg); color: var(--text); max-width: 640px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; padding-bottom: 60px; font-size: 15px; transition: background 0.3s, color 0.3s; }

header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; backdrop-filter: blur(10px); background: var(--bg); opacity: 0.95; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; }
header strong { font-family: 'Jura', sans-serif; font-size: 22px; font-weight: 700; letter-spacing: 1px; background: linear-gradient(to right, #6366f1, #a855f7); -webkit-background-clip: text; color: transparent; }
.header-actions { display: flex; gap: 8px; align-items: center; }
.btn-icon { background: transparent; border: none; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 50%; transition: 0.2s; }
.btn-icon:hover { background: var(--border); color: var(--text); }

.search-container { padding: 12px 16px 0; }
.search-box { display: flex; align-items: center; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; gap: 8px; box-shadow: var(--shadow); }
.search-box input { flex: 1; border: none; background: transparent; outline: none; color: var(--text); font-size: 14px; }
.search-box svg { color: var(--muted); width: 16px; height: 16px; }

main { flex: 1; padding: 12px 16px; }
.page { display: none; animation: fadeIn 0.2s ease; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

.compose { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-bottom: 16px; box-shadow: var(--shadow); }
.compose textarea { width: 100%; background: transparent; border: none; color: var(--text); font-size: 15px; outline: none; resize: none; min-height: 50px; }
.compose textarea::placeholder { color: var(--muted); }
.compose-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; border-top: 1px solid var(--border); padding-top: 8px; }
.char-count { font-size: 12px; font-weight: 500; color: var(--muted); }

button.btn-primary { background: var(--accent); color: white; border: none; padding: 6px 16px; border-radius: 20px; cursor: pointer; font-size: 14px; font-weight: 600; transition: 0.2s; }
button.btn-primary:hover { background: var(--accent-hover); }
button.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.user-info { display: flex; align-items: center; gap: 10px; }
.avatar-placeholder { width: 36px; height: 36px; border-radius: 50%; background: var(--accent-light); color: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; }
.name-area { display: flex; flex-direction: column; }
.name { font-weight: 600; font-size: 15px; }
.time { font-size: 12px; color: var(--muted); }
.card p { font-size: 15px; line-height: 1.5; color: var(--text); white-space: pre-wrap; word-break: break-word; margin-bottom: 12px; }

.card-actions { display: flex; gap: 16px; align-items: center; }
.btn-action { background: transparent; border: none; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--muted); display: flex; align-items: center; gap: 4px; transition: 0.2s; }
.btn-action:hover { color: var(--accent); }
.btn-like:hover { color: var(--danger); }
.btn-like.liked { color: var(--danger); }
.btn-like.liked svg { fill: var(--danger); }
.btn-action svg { width: 16px; height: 16px; }
.btn-hapus { color: var(--danger); margin-left: auto; }

@keyframes pop { 0% { transform: scale(1); } 50% { transform: scale(1.3); } 100% { transform: scale(1); } }
.animate-pop { animation: pop 0.3s ease; }

.reply-section { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); display: none; }
.reply-section.aktif { display: block; }
.reply-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.reply-item { display: flex; gap: 8px; }
.reply-item .avatar-placeholder { width: 28px; height: 28px; font-size: 12px; }
.reply-content { flex: 1; background: var(--bg); padding: 8px 10px; border-radius: 10px; }
.reply-author { font-weight: 600; font-size: 13px; display: block; margin-bottom: 2px; }
.reply-text { font-size: 14px; line-height: 1.4; color: var(--text); }
.reply-compose { display: flex; gap: 8px; margin-top: 8px; }
.reply-compose input { flex: 1; padding: 8px 12px; border: 1px solid var(--border); background: var(--bg); color: var(--text); border-radius: 16px; font-size: 13px; outline: none; }
.reply-compose input:focus { border-color: var(--accent); }
.reply-compose button { padding: 6px 14px; border-radius: 16px; border: none; background: var(--accent); color: white; font-weight: 600; font-size: 13px; cursor: pointer; }

.profile-cover { 
  height: 140px; 
  background: linear-gradient(135deg, #6366f1, #a855f7); 
  background-size: cover;
  background-position: center;
  border-radius: 12px 12px 0 0; 
  margin-bottom: -35px;
  position: relative;
}
.profile-info { padding: 0 16px 16px; background: var(--card); border: 1px solid var(--border); border-radius: 0 0 12px 12px; text-align: center; }
.profile-avatar { 
  width: 80px; 
  height: 80px; 
  border-radius: 50%; 
  border: 4px solid var(--card); 
  background: var(--accent-light); 
  color: var(--accent); 
  font-size: 28px; 
  font-weight: bold; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  margin: 0 auto 10px;
  position: relative;
  z-index: 2;
}
.profile-name { font-size: 18px; font-weight: 700; margin-bottom: 2px; }
.form-group { margin-bottom: 16px; text-align: left; }
.form-group label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; color: var(--muted); }
.form-group input { width: 100%; padding: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text); border-radius: 8px; font-size: 14px; outline: none; }
.form-group input:focus { border-color: var(--accent); }

nav { position: fixed; bottom: 0; left: 0; right: 0; max-width: 640px; margin: 0 auto; display: flex; justify-content: space-around; padding: 8px 12px; background: var(--card); border-top: 1px solid var(--border); z-index: 50; }
nav a { color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 600; padding: 6px 12px; border-radius: 10px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; transition: 0.2s; }
nav a.active { color: var(--accent); background: var(--accent-light); }
nav a svg { width: 20px; height: 20px; }

/* HEADER AVATAR */
.header-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  margin-right: 8px; /* Jarak dengan tombol moon */
  transition: transform 0.2s;
  user-select: none;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.header-avatar:hover {
  transform: scale(1.05);
}

.btn-attach { background: transparent; border: none; color: var(--muted); cursor: pointer; padding: 4px; border-radius: 6px; display: flex; align-items: center; justify-content: center; }
.btn-attach:hover { background: var(--border); color: var(--accent); }
.post-image { width: 100%; max-height: 400px; object-fit: cover; border-radius: 12px; margin-top: 10px; border: 1px solid var(--border); }

#page-auth { padding-bottom: 20px; }
#page-auth .card { width: 100%; max-width: 400px; margin: 0 auto; }

/* EFEK COMPOSE BOX COLLAPSE */
.compose { transition: all 0.3s ease; }
.compose:not(.focused) textarea { min-height: 40px; height: 40px; }
.compose:not(.focused) .compose-footer { display: none; }
.compose.focused { box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15); border-color: var(--accent); }

/* SEARCH BAR ANIMASI */
#search-container { animation: slideDown 0.3s ease; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* FIX LIKE BUTTON COLOR */
.btn-like.liked svg { fill: var(--danger) !important; stroke: var(--danger) !important; }
.btn-like.liked span { color: var(--danger) !important; }

/* BANNER PROFIL */
.profile-cover { 
  height: 140px; 
  background: linear-gradient(135deg, #6366f1, #a855f7); 
  background-size: cover;
  background-position: center;
  border-radius: 12px 12px 0 0; 
  margin-bottom: -35px;
  position: relative;
}
.btn-edit-banner {
  position: absolute; bottom: 10px; right: 10px;
  background: rgba(0,0,0,0.6); color: white; border: none;
  padding: 6px 12px; border-radius: 20px; cursor: pointer;
  font-size: 12px; font-weight: bold; display: flex; align-items: center; gap: 6px;
}
.btn-edit-banner:hover { background: rgba(0,0,0,0.8); }

/* FIX LIKE BUTTON COLOR */
.btn-like.liked svg { fill: var(--danger) !important; stroke: var(--danger) !important; }
.btn-like.liked span { color: var(--danger) !important; }

/* BANNER PROFIL */
.profile-cover { 
  height: 140px; 
  background: linear-gradient(135deg, #6366f1, #a855f7); 
  background-size: cover;
  background-position: center;
  border-radius: 12px 12px 0 0; 
  margin-bottom: -35px;
  position: relative;
}
.btn-edit-banner {
  position: absolute; bottom: 10px; right: 10px;
  background: rgba(0,0,0,0.6); color: white; border: none;
  padding: 6px 12px; border-radius: 20px; cursor: pointer;
  font-size: 12px; font-weight: bold; display: flex; align-items: center; gap: 6px;
}
.btn-edit-banner:hover { background: rgba(0,0,0,0.8); }
