@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --slate-900: #1e2430;
  --slate-700: #3c495e;
  --slate-500: #5c6c82;
  --slate-100: #f0f3f7;
  --accent-peach: #dfbead;
  --accent-sand: #c7b5a3;
  --accent-sage: #95b3aa;
  --ink: #1a202c;
  --muted: #718096;
  --paper: #ffffff;
  --bg-body: #edf2f7;
  --line: #e2e8f0;
  --shadow-hover: 0 8px 24px -10px rgba(30, 36, 48, 0.12);
  --radius-pill: 999px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

body.dark-theme {
  --slate-900: #ffffff;
  --slate-700: #a0aec0;
  --slate-500: #718096;
  --slate-100: #2a3441;
  --ink: #f0f3f7;
  --muted: #a0aec0;
  --paper: #1e2430;
  --bg-body: #0f131a;
  --line: #2d3748;
  --shadow-hover: 0 8px 24px -10px rgba(0, 0, 0, 0.4);
}

* { 
  box-sizing: border-box; 
  -webkit-tap-highlight-color: transparent; /* Menghilangkan bayangan biru saat disentuh di HP */
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-body);
  color: var(--ink);
  font-family: 'Inter', system-ui, sans-serif;
  height: 100dvh;
  width: 100vw;
  overflow: hidden; 
}

body {
  display: flex;
}

#partners-container {
  width: 100%;
  height: 100%;
  display: flex;
}

/* ---------- Kelas Sinkronisasi Transisi Mode Gelap ---------- */
.theme-transitioning, .theme-transitioning * {
  /* Transisi dipercepat sedikit agar tak tampak lag */
  transition: background 0.5s ease-in-out, color 0.5s ease-in-out, border-color 0.5s ease-in-out, box-shadow 0.5s ease-in-out, fill 0.5s ease-in-out !important;
}

/* ---------- Animasi Selimut (Menyapu) ---------- */
.theme-blanket {
  position: fixed;
  width: 100px; 
  height: 100px;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  /* PERBAIKAN: z-index negatif memastikan selimut di posisi terbawah / alas */
  z-index: -1; 
  pointer-events: none;
  transition: transform 0.8s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.3s ease;
}
.theme-blanket.expand {
  transform: translate(-50%, -50%) scale(60); 
}
.theme-blanket.fade-out {
  opacity: 0;
}
.card {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  background: var(--paper);
  border-radius: 0;
  overflow: hidden;
  isolation: isolate;
  opacity: 0;
  animation: cardFadeIn 0.7s var(--ease) forwards;
}

@keyframes cardFadeIn {
  to { opacity: 1; }
}

.hero {
  position: relative;
  flex: 0 0 350px; 
  background: radial-gradient(130% 130% at 20% 10%, #5c6c82 0%, #3c495e 45%, #1e2430 100%);
  padding: 50px 46px;
  color: #fff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.hero__blob {
  position: absolute;
  inset: -10% -10% 0 auto;
  width: 120%;
  height: 115%;
  background: inherit;
  border-radius: 44% 56% 62% 38% / 48% 42% 58% 52%;
  z-index: -1;
  animation: morphBlob 16s ease-in-out infinite alternate;
}

@keyframes morphBlob {
  0% { border-radius: 44% 56% 62% 38% / 48% 42% 58% 52%; transform: scale(1); }
  100% { border-radius: 64% 36% 42% 58% / 42% 62% 38% 58%; transform: scale(1.05); }
}

.hero__shape {
  position: absolute;
  filter: blur(0.5px);
  animation: float 6s ease-in-out infinite;
}
.hero__shape--cube {
  top: 10px; left: -14px;
  width: 70px; height: 70px;
  background: var(--accent-sand);
  border-radius: 20px;
  transform: rotate(-18deg);
  box-shadow: 0 14px 24px -10px rgba(0, 0, 0, 0.2);
  animation-delay: 0s;
}
.hero__shape--ball {
  top: 35px; right: -20px;
  width: 50px; height: 50px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff, var(--accent-sage) 70%);
  box-shadow: 0 12px 20px -8px rgba(0, 0, 0, 0.2);
  animation-delay: 2s;
}
.hero__shape--tri {
  bottom: 100px; left: -10px;
  width: 0; height: 0;
  border-left: 30px solid transparent;
  border-right: 30px solid transparent;
  border-bottom: 50px solid var(--accent-peach);
  transform: rotate(24deg);
  opacity: 0.85;
  animation-delay: 4s;
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(var(--rot, 0deg)); }
  50% { transform: translateY(-12px) rotate(calc(var(--rot, 0deg) + 5deg)); }
}

.hero__eyebrow {
  position: relative;
  z-index: 1;
  font-size: 14px;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.7);
  margin: 0 0 12px;
  line-height: 1.4;
}
.hero__title {
  position: relative;
  z-index: 1;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: clamp(32px, 4vw, 42px);
  line-height: 1.1;
  margin: 0;
  max-width: 9ch;
}
.hero__foot {
  margin-top: auto;
  position: relative;
  z-index: 1;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.5;
  background: rgba(255, 255, 255, 0.06);
  padding: 16px 20px;
  border-radius: 16px;
  backdrop-filter: blur(8px);
}
.hero__foot strong {
  display: block;
  color: #fff;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 4px;
}

.main {
  flex: 1;
  height: 100%;
  min-width: 0;
  min-height: 0; 
  padding: 40px 60px 30px;
  display: flex;
  flex-direction: column;
}

.main__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex: none; 
}
.main__title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 30px;
  margin: 0;
  color: var(--slate-900);
}
.badge {
  width: 48px; height: 48px;
  border-radius: 14px;
  background: var(--slate-100);
  color: var(--slate-700);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.col-labels {
  display: grid;
  grid-template-columns: 56px 1.5fr 2fr 90px;
  gap: 20px;
  padding: 0 16px 14px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  flex: none;
}

.list {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0; 
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: none; 
  -ms-overflow-style: none;
}
.list::-webkit-scrollbar { display: none; }

.state-msg {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
}
.state-msg.error { color: #d66455; }
.skeleton-load { animation: pulse 1.5s infinite; }
@keyframes pulse { 0%, 100% { opacity: 0.6; } 50% { opacity: 0.3; } }

.row {
  opacity: 0;
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease), background 0.2s ease, box-shadow 0.2s ease, border-color 0.3s;
  border-radius: 14px;
  margin-bottom: 4px;
  flex: none; 
}
.row.reveal-down { transform: translateY(-20px); }
.row.reveal-up { transform: translateY(20px); }
.row.is-visible { opacity: 1; transform: translateY(0); }
.row:hover {
  background: var(--slate-100);
  box-shadow: var(--shadow-hover);
  border-color: transparent;
}

.list:not(.layout-grid) .row {
  display: grid;
  grid-template-columns: 56px 1.5fr 2fr minmax(90px, auto);
  gap: 20px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}
.list:not(.layout-grid) .row__who, 
.list:not(.layout-grid) .row__role {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
}
.list:not(.layout-grid) .row__skills { margin-top: 6px; }
.list:not(.layout-grid) .row__actions { justify-content: flex-end; }

.list.layout-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  padding: 4px;
}
.list.layout-grid .row {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px 16px;
  gap: 12px;
  background: var(--paper);
  border: 1px solid var(--line);
}
.list.layout-grid .row:hover { background: var(--slate-100); }
.list.layout-grid .row__who { width: 100%; display: flex; flex-direction: column; align-items: center; }
.list.layout-grid .row__actions { margin-top: auto; }
.list.layout-grid .row__role,
.list.layout-grid .expand-btn,
.list.layout-grid .row__detail { display: none !important; }

.row__who, .row__role { 
  min-width: 0; 
  width: 100%; 
  overflow: hidden; 
}
.row__name, .row__specialty, .row__skills {
  max-width: 100%;
  white-space: nowrap; 
  overflow: hidden; 
  text-overflow: ellipsis;
}
.is-scrolling {
  text-overflow: clip !important;
  animation: slide-marquee 3.5s linear infinite alternate !important;
}
@keyframes slide-marquee {
  0%, 15% { transform: translateX(0); }
  85%, 100% { transform: translateX(var(--scroll-dist)); }
}

.row__avatar {
  width: 50px; height: 50px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; flex: none; overflow: hidden;
}
.row__avatar img { width: 100%; height: 100%; object-fit: cover; }
.row__avatar svg { width: 24px; height: 24px; }

.row__name { font-weight: 600; font-size: 15px; color: var(--ink); }
.row__username { font-size: 13px; color: var(--muted); margin-top: 2px; }

.row__specialty {
  display: inline-block;
  font-size: 13px; font-weight: 500;
  color: var(--slate-700);
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
}
.row:hover .row__specialty { border-color: transparent; background: var(--paper); }
.row__skills { font-size: 12.5px; color: var(--muted); }

.row__actions { display: flex; align-items: center; gap: 8px; }

/* Menggunakan flex-direction: row-reverse agar ikon sosmed terbuka mendorog ke arah kiri di Mode List */
.social-group { 
  display: flex; 
  align-items: center;
  flex-direction: row-reverse; 
  background: transparent;
  border-radius: 99px;
  transition: background 0.3s ease;
}

.social-group.is-active { 
  background: var(--slate-100);
  padding: 4px;
  margin: -4px; /* Menetralkan padding agar letak layout tidak melompat */
}

.social-toggle {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--slate-700);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  flex: none;
}
.social-toggle:hover { background: var(--slate-100); }
.social-toggle svg { width: 16px; height: 16px; }

/* Menghilangkan position: absolute; dan menggunakan max-width untuk memberi ruang statis baru */
.social-links {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 0; /* Tersembunyi pada awalnya */
  overflow: hidden;
  opacity: 0;
  padding-right: 0;
  transition: max-width 0.4s var(--ease), opacity 0.3s ease, padding 0.4s var(--ease);
}

.social-group.is-active .social-links {
  max-width: 150px; /* Melebar memberi ruang baru */
  opacity: 1;
  padding-right: 8px;
}

/* Modifikasi arah dorongan saat berada di Mode Grid */
.list.layout-grid .social-group {
  flex-direction: row; /* Di mode grid, sosmed melebar ke kanan */
  justify-content: center;
}
.list.layout-grid .social-links {
  padding-right: 0;
  padding-left: 0;
}
.list.layout-grid .social-group.is-active .social-links {
  padding-right: 0;
  padding-left: 8px;
}

.chan {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; flex: none;
  transition: transform 0.2s var(--ease);
}
.chan:hover { transform: scale(1.1); }
.chan svg { width: 16px; height: 16px; }

.expand-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--slate-700);
  font-size: 18px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex: none;
  transition: transform 0.3s var(--ease), background 0.2s ease, color 0.2s ease;
}
.expand-btn:hover { background: var(--slate-100); border-color: var(--slate-500); }
.row.is-open .expand-btn { transform: rotate(45deg); background: var(--slate-700); color: #fff; border-color: var(--slate-700); }

.row__detail {
  grid-column: 1 / -1;
  max-height: 0; overflow: hidden;
  transition: max-height 0.45s var(--ease), opacity 0.4s ease, margin 0.4s var(--ease);
  opacity: 0;
  font-size: 14px;
  color: var(--muted); line-height: 1.6;
}
.row.is-open .row__detail { max-height: 200px; opacity: 1; margin-top: 8px; }

.row__detail-inner {
  background: var(--bg-body);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  display: flex; flex-direction: column; gap: 10px;
}
.row__detail-inner b { color: var(--slate-900); }
.row__detail-link { font-size: 13.5px; font-weight: 600; color: var(--slate-700); text-decoration: none; align-self: flex-start; }
.row__detail-link:hover { text-decoration: underline; }

.toolbar {
  flex: none; 
  margin-top: 16px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--paper);
}
.tool-btn {
  width: 48px; height: 48px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--paper);
  display: flex; align-items: center; justify-content: center;
  color: var(--slate-700);
  cursor: pointer;
  flex: none;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s var(--ease);
}
.tool-btn:hover { background: var(--slate-100); border-color: var(--slate-500); transform: translateY(-2px); }
.tool-btn svg { width: 22px; height: 22px; }
.tool-btn.add-btn {
  background: var(--slate-900);
  color: var(--paper);
  border-color: transparent;
  text-decoration: none;
}
.tool-btn.add-btn:hover {
  background: var(--slate-700);
  box-shadow: 0 6px 16px -6px rgba(0,0,0,0.3);
}

.search-box {
  flex: 1; 
  display: flex;
  align-items: center;
  height: 48px;
  background: var(--slate-100);
  border-radius: 14px;
  padding: 0 16px;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  transition: background 0.3s;
}
.search-box:focus-within {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  background: var(--paper);
}
.search-box svg {
  width: 18px; height: 18px;
  color: var(--slate-500);
  flex: none;
}
.search-box input {
  flex: 1;
  border: none !important;
  background: transparent;
  outline: none !important;
  box-shadow: none !important;
  padding-left: 12px;
  font-size: 14px;
  color: var(--ink);
  font-family: inherit;
  width: 100%;
}
.search-box input:focus {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
}
.search-box input::placeholder { color: var(--muted); }

/* ---------- Responsiveness ---------- */
@media (max-width: 1024px) {
  .hero { flex-basis: 300px; padding: 40px 32px; }
  .main { padding: 40px 32px 30px; }
}

@media (max-width: 900px) {
  .card { flex-direction: column; }
  .hero { flex: none; padding: 30px 24px; }
  .main { padding: 24px 20px; }
  
  /* Sembunyikan judul kolom secara paksa di layar kecil */
  .col-labels { display: none !important; }
  
  /* Rombak layout daftar menjadi desain Kartu Profil */
  .list:not(.layout-grid) .row {
    grid-template-columns: 50px 1fr;
    grid-template-areas: 
      "avatar who"
      "avatar role"
      "actions actions";
    gap: 8px 16px; /* jarak baris 8px, jarak kolom 16px */
    padding: 18px 16px;
  }
  .list:not(.layout-grid) .row__avatar { grid-area: avatar; align-self: start; }
  .list:not(.layout-grid) .row__who { grid-area: who; }
  .list:not(.layout-grid) .row__role { grid-area: role; }
  
  /* Pindahkan grup kontak dan tombol tambah ke baris paling bawah */
  .list:not(.layout-grid) .row__actions { 
    grid-area: actions; 
    width: 100%;
    justify-content: space-between; /* Sosmed di kiri, tombol "+" di kanan */
    padding-top: 14px;
    border-top: 1px dashed var(--line);
    margin-top: 6px;
  }

  /* Ubah arah melebarnya sosmed di HP ke arah kanan, agar tidak terpotong layar */
  .list:not(.layout-grid) .social-group { flex-direction: row; }
  .list:not(.layout-grid) .social-links { padding-right: 0; padding-left: 0; }
  .list:not(.layout-grid) .social-group.is-active .social-links { padding-left: 8px; max-width: 150px; }
}

@media (max-width: 480px) {
  .hero { padding: 24px 20px; }
  .hero__title { font-size: 28px; }
  .hero__foot { margin-top: 16px; padding: 14px 16px; }
  .hero__shape--tri { display: none; }
  
  .main { padding: 20px 16px; }
  .toolbar { padding-bottom: 12px; gap: 8px; }
  .tool-btn { width: 44px; height: 44px; }
  .tool-btn svg { width: 20px; height: 20px; }
  .search-box { height: 44px; padding: 0 12px; }
  
  /* Mode Grid di HP dibuat lebih padat */
  .list.layout-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); } 
}

/* Aksesibilitas */
button:focus-visible, input:focus-visible, a:focus-visible {
  outline: 2px solid var(--slate-700);
  outline-offset: 2px;
}

/* ---------- Utility Sinkronisasi Gelombang ---------- */
.no-transitions, .no-transitions * {
  transition: none !important;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
  display: block;
  pointer-events: none;
}
::view-transition-old(root) { z-index: 1; }
::view-transition-new(root) { z-index: 2; }
  animation: none;
  mix-blend-mode: normal;
  display: block;
  pointer-events: none; /* Mencegah layar bergetar jika tersentuh saat animasi */
}
::view-transition-old(root) { z-index: 1; }
::view-transition-new(root) { z-index: 2; }