:root {
  --primary-color: #2a7854;
  --secondary-color: #d9eee1;
  --background-color: #f0f4f2;
  --text-color: #333333;
  --subtle-text-color: #888;
  --white-color: #ffffff;
  --trend-up-color: #28a745;
  --trend-down-color: #dc3545;
  --border-color: #e0e0e0;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Poppins", sans-serif;
  background-color: #e9ecef; /* Latar belakang luar kontainer */
  color: var(--text-color);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100dvh;
  overflow: hidden;
    
}

a {
  text-decoration: none;
  color: inherit;
}

/* ================================== */
/* LAYOUT UTAMA                     */
/* ================================== */
.mobile-container {
  width: 100%;
  max-width: 420px;
  height: 100dvh;
  background-color: var(--background-color);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

.main-content {
  flex-grow: 1;
  overflow-y: auto;
  padding: 1.5rem;
  /* 90px untuk nav-bottom + ruang aman di bawahnya */
  padding-bottom: calc(90px + env(safe-area-inset-bottom));
}

.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

/* ================================== */
/* FILTER BUTTONS (CHIPS)             */
/* ================================== */
.filter-container {
  display: flex;
  gap: 10px;
  margin-bottom: 1.5rem;
  padding-bottom: 5px;
  overflow-x: auto; /* Agar bisa di-scroll horizontal jika layar kecil */
  white-space: nowrap;
  scrollbar-width: none; /* Sembunyikan scrollbar di Firefox */
}

.filter-container::-webkit-scrollbar {
  display: none; /* Sembunyikan scrollbar di Chrome/Safari */
}

.filter-btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--primary-color);
  background-color: var(--white-color);
  color: var(--primary-color);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-btn:hover {
  background-color: #eaf6f0; /* Warna hijau muda transparan */
}

/* Gaya untuk tombol yang sedang aktif/dipilih */
.filter-btn.active {
  background-color: var(--primary-color);
  color: var(--white-color);
  box-shadow: 0 4px 10px rgba(42, 120, 84, 0.3);
}

/* Pencarian & Filter */
.search-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background-color: var(--secondary-color);
  border-radius: 2rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}
.search-bar iconify-icon {
  font-size: 1.4rem;
  color: var(--subtle-text-color);
}
.search-bar input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-family: "Poppins", sans-serif;
  font-size: 1rem;
}
.filter-group {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.filter-group label {
  font-weight: 500;
}
.select-wrapper {
  flex-grow: 1;
  position: relative;
}
.select-wrapper::after {
  content: "\25BC";
  position: absolute;
  top: 50%;
  right: 1rem;
  transform: translateY(-50%);
  font-size: 0.8rem;
  pointer-events: none;
  color: var(--subtle-text-color);
}
.select-wrapper select {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 2rem;
  background-color: var(--white-color);
}

/* ================================== */
/* KARTU POSTINGAN                    */
/* ================================== */
.post-card {
  background-color: var(--white-color);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);
}

.post-header {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}
.post-meta {
  display: grid;
  grid-template-columns: 1fr;
  font-size: 0.8rem;
}
.author-name {
  font-weight: 600;
  font-size: 0.9rem;
}
.timestamp {
  color: var(--subtle-text-color);
}
.post-category {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.post-category iconify-icon {
  font-size: 0.9rem;
}

.post-body p {
  margin-bottom: 1rem;
  line-height: 1.6;
}
.post-image {
  width: 100%;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.post-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid #f0f0f0;
  padding-top: 1rem;
}
.post-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--subtle-text-color);
}
.post-actions span {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.read-more {
  font-weight: 600;
  color: var(--primary-color);
  font-size: 13px;
}

/* ================================== */
/* ELEMEN TETAP (FAB & NAV BAWAH)     */
/* ================================== */
.fab-create-post {
  position: absolute;
  bottom: 90px;
  right: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--primary-color);
  color: var(--white-color);
  padding: 0.75rem 1.25rem;
  border-radius: 2rem;
  font-weight: 500;
  box-shadow: 0 4px 15px rgba(42, 120, 84, 0.4);
  z-index: 10;
}
.fab-create-post iconify-icon {
  font-size: 1.4rem;
}

/* ================================== */
/* BOTTOM NAVIGATION                */
/* ================================== */
.bottom-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  display: flex;
  justify-content: space-around;
  padding: 0.5rem 0;
  background-color: var(--white-color);
  border-top: 1px solid var(--border-color);
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 16px;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  color: var(--subtle-text-color);
  padding: 0.5rem;
  border-radius: 8px;
}

.nav-item span {
  font-size: 0.75rem;
  font-weight: 500;
}

.nav-item iconify-icon {
  font-size: 1.5rem;
}

.nav-item.active {
  color: var(--primary-color);
  background-color: var(--secondary-color);
}

/* ================================== */
/* GAYA HALAMAN DETAIL POSTINGAN      */
/* ================================== */

/* Tata Letak Header di Halaman Detail */
.inner-header {
  padding: 1.5rem;
}
.inner-header .back-button {
  font-size: 1.8rem;
}
.inner-header h1 {
  font-size: 1.25rem;
}

/* Transisi untuk Teks Postingan (Lihat Semua) */
.post-text-wrapper {
  position: relative;
}
.post-text {
  line-height: 1.7;
  transition: max-height 0.5s ease-in-out;
}
.post-text.collapsed {
  max-height: 120px; /* Batasi tinggi awal, sekitar 5-6 baris */
  overflow: hidden;
}
.expand-text-btn {
  background: linear-gradient(to top, var(--white-color) 60%, transparent);
  border: none;
  color: var(--primary-color);
  font-weight: 600;
  cursor: pointer;
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  text-align: left;
  padding-top: 2rem;
  padding-left: 0;
}
.post-text:not(.collapsed) + .expand-text-btn {
  display: none; /* Sembunyikan tombol jika teks sudah terbuka */
}

/* Tombol Aksi di Bawah Postingan */
.full-post-actions {
  display: flex;
  justify-content: space-around;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  margin: 1rem 0;
  padding: 0.5rem 0;
}
.full-post-actions button {
  background: none;
  border: none;
  color: var(--subtle-text-color);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 8px;
  flex: 1;
  justify-content: center;
}
.full-post-actions button:hover {
  background-color: #f0f0f0;
}

/* Bagian Komentar */
.post-comments-section h2 {
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
}
.comment-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.comment-item {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}
.comment-avatar {
  width: 40px;
  height: 40px;
}
.comment-content {
  flex-grow: 1;
}
.comment-bubble {
  background-color: var(--secondary-color);
  border-radius: 12px;
  padding: 0.75rem;
  margin-bottom: 0.25rem;
}
.comment-bubble p {
  margin-top: 0.25rem;
}
.comment-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--subtle-text-color);
  margin-left: 0.75rem;
}
.reply-btn {
  background: none;
  border: none;
  font-weight: 500;
  cursor: pointer;
  color: var(--subtle-text-color);
  padding: 0;
}
.comment-likes {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: var(--trend-down-color);
}
.view-replies-btn {
  background: none;
  border: none;
  font-weight: 600;
  color: var(--subtle-text-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  font-size: 0.8rem;
  margin-left: 0.75rem;
}
.view-replies-btn iconify-icon {
  transition: transform 0.3s ease;
}

/* Animasi untuk Balasan Komentar (Sama seperti sebelumnya) */
.replies-container {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease-in-out;
  padding-left: 1rem;
  margin-top: 1rem;
}
.comment-item.replies-visible .replies-container {
  max-height: 500px;
}
.comment-item.replies-visible .view-replies-btn iconify-icon {
  transform: rotate(180deg);
}

/* Footer Input Komentar */
.comment-input-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  background-color: var(--white-color);
  border-top: 1px solid var(--border-color);
  z-index: 50;
}
.comment-input-footer input {
  flex-grow: 1;
  border: 1px solid var(--border-color);
  background-color: #f5f5f5;
  border-radius: 2rem;
  padding: 0.75rem 1rem;
}
.comment-input-footer button {
  background: none;
  border: none;
  font-size: 1.8rem;
  color: var(--primary-color);
  cursor: pointer;
}

/* ================================== */
/* GAYA INTERAKSI TOMBOL SUKA         */
/* ================================== */

/* State ketika tombol disukai */
.like-btn.liked {
  color: var(--trend-down-color); /* Warna merah untuk hati dan teks */
  font-weight: 600;
}

/* Gaya khusus untuk tombol suka di komentar */
.comment-like {
  padding: 0;
  color: var(--primary-color);
  font-weight: 500;
  border: none;
  cursor: pointer;
}

.comment-like.liked {
  color: var(--trend-down-color);
}

/* Animasi saat tombol diklik */
@keyframes like-animation {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.3);
  }
  100% {
    transform: scale(1);
  }
}

.like-btn.liked-animation {
  animation: like-animation 0.3s ease-in-out;
}

/* ================================== */
/* GAYA HALAMAN BUAT POSTINGAN        */
/* ================================== */

/* Grup Form dan Elemen Input (Bisa digunakan ulang) */
.upload-form {
  padding-bottom: 90px;
} /* Ruang untuk footer */

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

.form-group input[type="text"],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.8rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-family: "Poppins", sans-serif;
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input[type="text"]:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(42, 120, 84, 0.1);
}

.form-group textarea {
  resize: vertical;
}

/* Area Upload Gambar */
.image-upload-box {
  background-color: #f0f0f0;
  border-radius: 12px;
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.image-upload-box iconify-icon {
  font-size: 4rem;
  color: var(--subtle-text-color);
  margin-bottom: 1rem;
}

.btn-upload {
  background-color: var(--primary-color);
  color: var(--white-color);
  border: none;
  border-radius: 2rem;
  padding: 0.6rem 1.2rem;
  font-family: "Poppins", sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: background-color 0.2s ease;
}

.btn-upload:hover {
  background-color: #225e43;
}

/* Footer dan Tombol Submit (Bisa digunakan ulang) */
.form-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 1rem 1.5rem;
  background-color: var(--white-color);
  border-top: 1px solid var(--border-color);
  z-index: 50;
}

.btn-submit {
  width: 100%;
  padding: 1rem;
  background-color: var(--primary-color);
  color: var(--white-color);
  border: none;
  border-radius: 8px;
  font-family: "Poppins", sans-serif;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.btn-submit:hover {
  background-color: #225e43;
}

/* ================================== */
/* GAYA MODAL PROFIL PENGGUNA         */
/* ================================== */

/* Jadikan avatar bisa diklik */
.avatar.js-profile-trigger {
  cursor: pointer;
}

/* Lapisan Overlay */
.profile-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;

  /* State awal (tersembunyi) */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

/* State saat terlihat */
.profile-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

/* Kartu Profil */
.profile-card {
  background-color: var(--white-color);
  border-radius: 16px;
  padding: 1.5rem;
  width: 100%;
  max-width: 320px;
  box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
  text-align: center;
  position: relative;

  /* Animasi pop-in */
  transform: scale(0.95);
  transition: transform 0.3s ease;
}

.profile-overlay.visible .profile-card {
  transform: scale(1);
}

.close-modal-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  font-size: 1.8rem;
  color: var(--subtle-text-color);
  cursor: pointer;
}

.profile-avatar {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 4px solid var(--white-color);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  margin-top: -65px; /* Trik agar avatar menjorok ke atas */
  margin-bottom: 0.75rem;
}

.profile-name {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.profile-meta {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  color: var(--subtle-text-color);
  margin-bottom: 1.5rem;
}

.profile-meta span {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.profile-actions {
  display: flex;
  gap: 1rem;
}

.profile-actions button {
  flex: 1;
  padding: 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background-color: transparent;
  font-family: "Poppins", sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.btn-block {
  background-color: #fbecec;
  border-color: #f7d1d1;
  color: #c72a2a;
}
.profile-actions button:hover {
  background-color: #f0f0f0;
}
.btn-block:hover {
  background-color: #f7d1d1;
}

/* ================================== */
/* PERBAIKAN FOTO PROFIL KOMENTAR     */
/* ================================== */

.comment-item .avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

/* ================================== */
/* GAYA BALASAN KOMENTAR              */
/* ================================== */

/* Kontainer untuk form balasan */
.reply-form-container {
  margin-top: 0.75rem;
  margin-left: -48px; /* Sesuaikan agar form sejajar dengan avatar */
  padding-left: 48px;
}

.reply-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

.reply-form input[type="text"] {
  flex-grow: 1;
  border: 1px solid var(--border-color);
  background-color: #f5f5f5;
  border-radius: 2rem;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}

.reply-form button {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--primary-color);
  cursor: pointer;
  flex-shrink: 0;
}

.reply-form .cancel-reply-btn {
  color: var(--subtle-text-color);
}

/* Kontainer untuk daftar balasan */
.replies-container {
  margin-top: 1rem;
  padding-left: 48px; /* Memberi indentasi pada balasan */
  border-left: 2px solid var(--secondary-color);
}

.comment-item.reply-item {
  margin-bottom: 0.75rem; /* Kurangi margin untuk balasan */
}

/* ================================== */
/* GAYA UNTUK MENAMPILKAN BALASAN     */
/* ================================== */

/* Tombol untuk melihat balasan */
.view-replies-btn {
  background: none;
  border: none;
  font-weight: 600;
  color: var(--primary-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.75rem;
  margin-left: 0.75rem;
  font-size: 0.85rem;
}

.view-replies-btn iconify-icon {
  transition: transform 0.3s ease;
}

/* Aturan untuk menampilkan kontainer balasan saat class 'replies-visible' ditambahkan */
.comment-content.replies-visible .replies-container {
  max-height: 1000px; /* Nilai besar agar semua konten muat */
}

/* Aturan untuk memutar ikon panah */
.comment-content.replies-visible .view-replies-btn iconify-icon {
  transform: rotate(180deg);
}

/* ================================== */
/* GAYA MENU AKSI KOMENTAR (HAPUS)    */
/* ================================== */
.comment-item {
  position: relative;
}

.comment-actions {
  position: absolute;
  top: 0;
  right: 0;
}

.action-btn {
  background: none;
  border: none;
  color: var(--subtle-text-color);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  font-size: 1.2rem;
}
.action-btn:hover {
  background-color: var(--secondary-color);
}

.comment-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background-color: var(--white-color);
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border-color);
  z-index: 10;
  overflow: hidden;
  width: 150px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
}

.comment-menu.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.comment-menu a {
  display: block;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  color: #c72a2a;
}
.comment-menu a:hover {
  background-color: #f5f5f5;
}
