/* ============================================================
   KSA COMMUNITY — CHAT.CSS
   Khusus halaman chat.html (Chat List)
   ============================================================ */

/* ============================================================
   1. BODY
   ============================================================ */
body.kc-ch-body {
  background: var(--c-bg);
  padding-top: 56px;
  padding-bottom: var(--nav-height);
}

/* ============================================================
   2. HEADER — [←] Chat
   ============================================================ */
.kc-ch-hdr {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  z-index: 100;
  background: #FFFFFF;
  border-bottom: 1px solid var(--c-line);
  display: flex;
  align-items: center;
  padding: 0 6px;
  gap: 4px;
}

.kc-ch-hdr-back {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--c-text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: background .15s;
}
.kc-ch-hdr-back:active { background: var(--c-bg-soft); }
.kc-ch-hdr-back svg {
  width: 22px;
  height: 22px;
}

.kc-ch-hdr-title {
  flex: 1;
  text-align: center;
  font-size: 16px;
  font-weight: 800;
  color: var(--c-text);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kc-ch-hdr-spacer {
  width: 42px;
  flex-shrink: 0;
}

/* ============================================================
   3. WRAPPER (dengan padding bawah extra buat FAB)
   ============================================================ */
.kc-ch-wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 12px;
  padding-bottom: 90px;   /* extra space biar chat terakhir gak ketutupan FAB */
}

/* ============================================================
   4. ITEM CHAT (kartu)
   ============================================================ */
.kc-ch-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #FFFFFF;
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background .15s;
  position: relative;
}
.kc-ch-item:active { background: #F8F4EA; }

/* ===== Public KSA (warna khusus) ===== */
.kc-ch-item.public {
  background: linear-gradient(135deg, var(--c-primary-light), var(--c-primary));
  border-color: transparent;
  margin-bottom: 14px;
}

/* ============================================================
   5. AVATAR
   ============================================================ */
.kc-ch-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.kc-ch-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--c-primary-light), var(--c-primary));
  color: #FFFFFF;
  font-size: 18px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.kc-ch-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Public KSA — pakai logo */
.kc-ch-item.public .kc-ch-avatar {
  background: rgba(255,255,255,.2);
}
.kc-ch-item.public .kc-ch-avatar img {
  object-fit: contain;
  padding: 6px;
}

/* Dot online/offline */
.kc-ch-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2.5px solid #FFFFFF;
  z-index: 2;
}
.kc-ch-dot.online  { background: #25D366; }
.kc-ch-dot.offline { background: #C62828; }

/* Public KSA — gak perlu dot */
.kc-ch-item.public .kc-ch-dot { display: none; }

/* ============================================================
   6. INFO (nama + preview)
   ============================================================ */
.kc-ch-info {
  flex: 1;
  min-width: 0;
}

.kc-ch-nama {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--c-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kc-ch-item.public .kc-ch-nama { color: #FFFFFF; }

.kc-ch-last {
  font-size: 12px;
  color: var(--c-text-2);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kc-ch-item.public .kc-ch-last { color: rgba(255,255,255,.85); }

/* Bold kalau unread */
.kc-ch-item.unread .kc-ch-nama {
  color: var(--c-text);
}
.kc-ch-item.unread .kc-ch-last {
  color: var(--c-text);
  font-weight: 700;
}

/* ============================================================
   7. WAKTU & BADGE UNREAD
   ============================================================ */
.kc-ch-kanan {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.kc-ch-waktu {
  font-size: 10.5px;
  color: var(--c-text-2);
  white-space: nowrap;
}
.kc-ch-item.public .kc-ch-waktu { color: rgba(255,255,255,.8); }

.kc-ch-unread {
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 11px;
  background: #25D366;
  color: #FFFFFF;
  font-size: 11.5px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(37,211,102,.4);
}
.kc-ch-item.public .kc-ch-unread {
  background: #FFFFFF;
  color: var(--c-primary);
  box-shadow: none;
}

/* ============================================================
   8. TOMBOL TITIK TIGA (⋯)
   ============================================================ */
.kc-ch-more {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--c-text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  padding: 0;
  transition: background .15s;
  margin-left: 4px;
}
.kc-ch-more:active { background: var(--c-bg-soft); }
.kc-ch-more svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* ============================================================
   9. FAB (+ Chat Baru)
   ============================================================ */
.kc-ch-fab {
  position: fixed;
  right: 16px;
  bottom: calc(var(--nav-height) + 16px + env(safe-area-inset-bottom, 0px));
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--c-primary-light), var(--c-primary));
  color: #FFFFFF;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(26,58,143,.4);
  z-index: 80;
  transition: transform .15s;
}
.kc-ch-fab:active {
  transform: scale(.9);
}
.kc-ch-fab svg {
  width: 26px;
  height: 26px;
}

/* ============================================================
   10. RESPONSIVE
   ============================================================ */
@media (max-width: 380px) {
  .kc-ch-wrap {
    padding: 10px;
    padding-bottom: 90px;
  }
  .kc-ch-avatar {
    width: 44px;
    height: 44px;
    font-size: 16px;
  }
  .kc-ch-nama {
    font-size: 14px;
  }
  .kc-ch-fab {
    width: 52px;
    height: 52px;
    right: 14px;
  }
}