/* =================================================================== */
/* 1. DEFINISI VARIABEL WARNA (LIGHT & DARK MODE)
/* =================================================================== */
:root {
  --bg-color: #ecf0f5ff;
  --card-bg-color: #ffffff;
  --text-color: #1c1e21;
  --text-secondary-color: #65676b;
  --border-color: #dddfe2;
  --primary-color: #1877f2;
  --primary-text-color: #ffffff;
  --link-color: #1877f2;
  --header-bg: #ffffff;
  --input-bg: #f5f6f7;
  --error-bg: rgba(231, 76, 60, 0.1);
  --error-border: #e74c3c;
}

body.dark {
  --bg-color: #18191a;
  --card-bg-color: #242526;
  --text-color: #e4e6eb;
  --text-secondary-color: #b0b3b8;
  --border-color: #3e4042;
  --primary-color: #2d88ff;
  --primary-text-color: #ffffff;
  --link-color: #2d88ff;
  --header-bg: #242526;
  --input-bg: #3a3b3c;
  --error-bg: rgba(231, 76, 60, 0.2);
  --error-border: #e74c3c;
}

/* =================================================================== */
/* 2. STYLE DASAR & LAYOUT
/* =================================================================== */
* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica,
    Arial, sans-serif;
  margin: 0;
  background-color: var(--bg-color);
  color: var(--text-color);
  transition: background-color 0.2s, color 0.2s;
}

main.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 20px;
}

/* =================================================================== */
/* 3. PARTIALS (HEADER & FOOTER)
/* =================================================================== */
.main-header {
  /* background-color: var(--header-bg); */
  padding: 10px 0;
  /* border-bottom: 1px solid var(--border-color); */
  /* box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05); */
  /* margin-bottom: 20px; */
  position: sticky;
  top: 0;
  z-index: 100;
}

.dark .search-icon {
  color: white;
}

.search-icon {
  color: black;
  opacity: 0.6;
}

.main-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 980px;
  margin: 0 auto;
  padding: 0 20px;
}

.main-nav .logo {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary-color);
  text-decoration: none;
}

.main-nav .nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

footer {
  text-align: center;
  padding: 20px;
  font-size: 0.9rem;
  color: var(--text-secondary-color);
  margin-top: 40px;
}

/* =================================================================== */
/* 4. KOMPONEN (CARD, BUTTON, FORM)
/* =================================================================== */
.card {
  background-color: var(--card-bg-color);
  border-radius: 8px;
  border: 0px solid var(--border-color);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(142, 157, 190, 0.14);
}

.btn {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  font-weight: bold;
  border: none;
  font-size: 0.95rem;
  transition: opacity 0.2s;
}
.btn:hover {
  opacity: 0.85;
}

.btn-primary {
  background-color: var(--primary-color);
  color: var(--primary-text-color);
}

.btn-secondary {
  background-color: var(--border-color);
  color: var(--text-color);
}

/* Modern Follow / Unfollow / Edit Profile button variants */
.btn-follow-modern, .btn-unfollow-modern, .btn-edit-profile-modern {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 9999px;
  border: 1px solid transparent;
  cursor: pointer;
  line-height: 1;
  text-decoration: none;
  transition: background-color .25s ease, box-shadow .25s ease, transform .2s ease, border-color .25s ease, color .25s ease;
  user-select: none;
  -webkit-user-select: none;
}

/* Follow (outline accent -> fill on hover) */
.btn-follow-modern {
  background: linear-gradient(135deg, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0.75) 100%);
  color: #1d4ed8;
  border-color: #3b82f6;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}
.btn-follow-modern:hover {
  background: linear-gradient(135deg,#3b82f6 0%,#2563eb 100%);
  color: #fff;
  box-shadow: 0 6px 18px rgba(59,130,246,0.35);
}
.dark .btn-follow-modern {
  background: linear-gradient(135deg, rgba(30,41,59,0.65) 0%, rgba(15,23,42,0.60) 100%);
  color: #60a5fa;
  border-color: #2563eb;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.dark .btn-follow-modern:hover {
  background: linear-gradient(135deg,#2563eb 0%,#1d4ed8 100%);
  color: #fff;
  box-shadow: 0 6px 20px rgba(37,99,235,0.5);
}

/* Unfollow (soft danger -> stronger hover) */
.btn-unfollow-modern {
  background: linear-gradient(135deg, rgba(255,255,255,0.92) 0%, rgba(255,255,255,0.78) 100%);
  color: #dc2626;
  border-color: #f87171;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}
.btn-unfollow-modern:hover {
  background: linear-gradient(135deg,#dc2626 0%,#ef4444 100%);
  color: #fff;
  box-shadow: 0 6px 18px rgba(220,38,38,0.3);
}
.dark .btn-unfollow-modern {
  background: linear-gradient(135deg, rgba(50,35,35,0.55) 0%, rgba(35,25,25,0.55) 100%);
  color: #fca5a5;
  border-color: #dc2626;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.dark .btn-unfollow-modern:hover {
  background: linear-gradient(135deg,#b91c1c 0%,#dc2626 100%);
  color: #fff;
  box-shadow: 0 6px 20px rgba(185,28,28,0.45);
}

/* Edit Profile (accent gradient) */
.btn-edit-profile-modern {
  background: #fbbf24; /* flat accent color (no strong gradient) */
  color: #1f2937;
  /* border: 1px solid #f59e0b; */
  box-shadow: 0 4px 10px rgba(245,158,11,0.05);
}
.btn-edit-profile-modern:hover {
  filter: brightness(1.04);
  box-shadow: 0 6px 16px rgba(245,158,11,0.15);
}
.dark .btn-edit-profile-modern {
  background: #d97706; /* deeper flat accent in dark mode */
  color: #1f2937;
  /* border: 1px solid #b45309; */
  box-shadow: 0 4px 12px rgba(180,83,9,0.20);
}
.dark .btn-edit-profile-modern:hover {
  filter: brightness(1.06);
  box-shadow: 0 6px 18px rgba(180,83,9,0.30);
}

/* Shared subtle press effect */
.btn-follow-modern:active, .btn-unfollow-modern:active, .btn-edit-profile-modern:active {
  transform: translateY(1px);
  box-shadow: 0 2px 10px rgba(0,0,0,0.18) !important;
}

.btn-full {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
}

.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
  font-size: 0.9rem;
}

.form-control {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-color);
  background-color: var(--input-bg);
  border-radius: 6px;
  color: var(--text-color);
  font-size: 1rem;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(24, 119, 242, 0.2);
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

.text-center {
  text-align: center;
}

.form-link {
  color: var(--link-color);
  text-decoration: none;
  font-weight: 600;
}
.form-link:hover {
  text-decoration: underline;
}

.error-message {
  color: var(--error-border);
  background-color: var(--error-bg);
  border: 1px solid var(--error-border);
  padding: 10px 15px;
  border-radius: 6px;
  margin-bottom: 15px;
  text-align: center;
}

/* =================================================================== */
/* 5. STYLE SPESIFIK (POST, TOGGLE)
/* =================================================================== */
.post-list .card {
  padding: 15px 20px;
}
.post-item .post-author {
  font-weight: bold;
  font-size: 1.1rem;
  margin: 0;
}
.post-item .post-meta {
  font-size: 0.75rem;
  color: var(--text-secondary-color);
  margin-top: 4px;
  margin-bottom: 10px;
}
.post-item .post-content {
  line-height: 1.5;
  font-size: 1rem;
  margin: 0;
}
.post-item form {
  margin-top: 15px;
}
/* 👇 MEDIA PLACEHOLDER (ASPEK RASIO 1:1) 👇 */
.post-media-container {
  /* Atur 1:1 Aspect Ratio menggunakan Padding Hack */
  width: 100%;
  padding-bottom: 100%; /* 1:1 (100% dari width) */
  position: relative;
  
  /* Gaya Placeholder (Latarnya akan menutupi ikon gambar rusak) */
  background-color: #f2f4f7ff; 
  border-radius: 6px; 
  margin-bottom: 10px;
  display: block; 
  overflow: hidden; 
  border: none !important;
}

/* Style untuk Ikon Placeholder di tengah */
.media-placeholder-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 3.5rem; 
  color: var(--text-secondary-color);
  opacity: 0.5;
  z-index: 5;
}

.post-media-container img,
.post-media-container video {
  /* Ini memastikan media (atau ikon rusak) mengisi seluruh area dan tertutup jika gagal */
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover; 
  display: block;
  max-height: none !important; 
  margin-bottom: 0 !important;
  border-radius: 6px; 
  z-index: 10;
  border: none !important;
}

.dark #theme-toggle {
  background: #14223F;
  color: var(--text-color);
  border: none;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #dddfe218;
}

#theme-toggle {
  background: #F8F9FA;
  color: var(--text-color);
  border: none;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #dddfe26c;
}

/* =================================================================== */
/* 6. STYLE SPESIFIK HALAMAN (PROFIL, DLL)
/* =================================================================== */

/* --- STYLE UNTUK HALAMAN PROFIL --- */

.profile-header {
  text-align: center;
  padding-top: 30px; /* Padding atas agar tidak terlalu mepet */
  padding-bottom: 30px;
}

/* Style untuk container foto profil di halaman profil */
.profile-pic-container {
  position: relative;
  width: 150px; 
  height: 150px; 
  margin: 0 auto 15px auto; /* Sesuai style inline di .hbs */
}

/* Style untuk gambar profil (menggantikan inline style) */
.profile-pic {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  /* Tambahan: border agar terlihat lebih premium */
  border: 4px solid var(--card-bg-color); 
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Tombol upload foto profil (style ini sudah ada di file Anda) */
.btn-upload-pic {
  position: absolute;
  bottom: 5px;
  right: 5px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0; /* Sembunyikan secara default */
  transition: opacity 0.2s ease;
  z-index: 20; /* Pastikan di atas gambar */
}

/* Tampilkan tombol upload saat hover di container-nya */
.profile-pic-container:hover .btn-upload-pic {
  opacity: 1;
}

/* Efek loading pada gambar saat mengunggah */
.profile-pic.loading {
  opacity: 0.5;
  filter: blur(2px);
}

/* Style untuk nama profil */
.profile-name {
  margin-top: 10px;
  margin-bottom: 15px;
  font-size: 1.8rem;
  font-weight: 600;
}

/* Container untuk statistik */
.profile-stats {
  display: flex;
  justify-content: center;
  gap: 30px; /* Jarak antar item statistik */
  margin-top: 20px;
}

/* Style untuk tiap item statistik (angka dan label) */
.profile-stat-item {
  text-align: center;
  line-height: 1.3;
}

.profile-stat-item .stat-count {
  display: block;
  font-size: 1.2rem;
  font-weight: bold;
}

.profile-stat-item .stat-label {
  display: block;
  font-size: 0.9rem;
  color: var(--text-secondary-color);
}

/* Container untuk tombol action (follow/edit) */
.profile-actions {
  margin-top: 25px;
}

/* Pastikan form di dalam actions sejajar */
.profile-actions form {
  display: inline-block;
  margin: 0 5px;
}

/* Style untuk judul "Postingan:" */
.section-title {
  font-size: 1.3rem;
  font-weight: 600;
  margin-top: 10px; /* Beri jarak dari card profil */
  margin-bottom: 20px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.section-title-modern {
  font-size: 1.3rem;
  font-weight: 600;
  margin-top: 10px; /* Beri jarak dari card profil */
  margin-bottom: 20px;
  padding-bottom: 8px;
  /* border-bottom: 1px solid var(--border-color); */
}



/* --- STYLE UNTUK HALAMAN EDIT PROFIL --- */
.profile-edit-page {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Header biru di atas */
.profile-edit-header {
  width: 100%;
  background: linear-gradient(135deg, #12a8f3, #00c4ff);
  color: white;
  text-align: center;
  padding: 20px 0 60px 0;
  position: relative;
  border-radius: 0 0 25px 25px;
}

.profile-edit-header h2 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 600;
}

.profile-edit-header .back-button {
  position: absolute;
  left: 25px;
  top: 22px;
  color: white;
  text-decoration: none;
  font-size: 1.4rem;
}

/* Avatar */
.avatar-section {
  margin-top: -45px;
  text-align: center;
}

.avatar-wrapper {
  width: 110px;
  height: 110px;
  margin: 0 auto;
  border-radius: 50%;
  border: 4px solid #fff;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-placeholder {
  width: 100%;
  height: 100%;
  background-color: #fbb03b;
  color: white;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
}

.change-photo-btn {
  margin-top: 10px;
  background: none;
  border: none;
  color: #0d9edf;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
}

/* Card untuk form */
.profile-edit-card {
  max-width: 600px;
  width: 100%;
  background: white;
  border-radius: 15px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  margin: 30px auto;
  padding: 25px 30px;
}

/* Label & input */
.profile-edit-card label {
  font-weight: 500;
  display: block;
  margin-bottom: 6px;
}

.profile-edit-card textarea {
  resize: none;
}

.profile-edit-card .form-group {
  margin-bottom: 20px;
}

.profile-edit-card small {
  display: block;
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--text-secondary-color, #777);
}

/* Tombol */
.profile-edit-card .form-actions {
  display: flex;
  gap: 12px;
  margin-top: 25px;
}

.profile-edit-card .form-actions .btn {
  flex: 1;
  text-align: center;
  padding-top: 12px;
  padding-bottom: 12px;
  border-radius: 10px;
}

.btn-primary {
  background-color: #12a8f3;
  color: white;
  border: none;
  font-weight: 500;
}

.btn-secondary {
  background-color: #f5f7fa;
  color: #333;
  border: 1px solid #ddd;
}

.btn-primary:hover {
  background-color: #0b95db;
}

.btn-secondary:hover {
  background-color: #ebedf0;
}

/* ============================= */
/* === STYLE BARU HALAMAN PROFIL === */
/* ============================= */

.profile-page {
  background: var(--background-color);
  padding-top: 0;
}

/* Header biru di atas profil */
.profile-cover {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  /* Light mode: brighter via white-lift overlay (not just bluer) */
  background:
    linear-gradient(135deg, rgba(255,255,255,0.85) 0%, rgba(255,255,255,0.65) 40%, rgba(255,255,255,0.45) 100%),
    linear-gradient(135deg, #0a3e8c 0%, #2563eb 45%, #3b82f6 100%);
  height: 300px;
  border-radius: 0 0 40px 40px;
}

/* Dark mode: slightly darker blue */
.dark .profile-cover {
  background: linear-gradient(135deg, #041c3b 0%, #062b59 45%, #0a3e8c 100%);
}

/* Card profil utama */
.profile-card {
  max-width: 600px;
  margin: 0px auto 30px auto;
  background: var(--card-bg-color);
  border-radius: 16px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  padding: 20px 25px 25px;
  text-align: center;
  position: relative;
}

/* Foto profil bulat */
.profile-avatar-container {
  position: relative;
  margin: 0 auto;
  width: 120px;
  height: 120px;
}

.profile-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid #fff;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Tombol kamera upload */
.btn-upload-pic {
  position: absolute;
  bottom: 5px;
  right: 5px;
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.profile-avatar-container:hover .btn-upload-pic {
  opacity: 1;
}

/* Nama dan username */
.profile-info {
  margin-top: 10px;
}
.profile-name {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0;
}
.profile-username {
  font-size: 0.95rem;
  color: var(--text-secondary-color);
  margin-top: 2px;
}

/* Statistik modern */
.profile-stats.modern {
  display: flex;
  justify-content: space-around;
  margin-top: 18px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  /* background: #fff; */
  padding: 12px 0;
}
.profile-stats.modern div {
  text-align: center;
}
.profile-stats.modern span {
  display: block;
  font-size: 1.2rem;
  font-weight: 600;
}
.profile-stats.modern p {
  font-size: 0.9rem;
  color: var(--text-secondary-color);
  margin: 0;
}

/* Tombol Follow/Edit */
.profile-actions.modern {
  margin-top: 20px;
}
.profile-actions.modern form,
.profile-actions.modern a {
  display: inline-block;
}

/* Section Postingan */
.profile-posts {
  max-width: 650px;
  margin: 0 auto 50px auto;
}
.section-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 15px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 6px;
}