/* fkcore public social UI (namespaced, minimal, theme-safe) */

/* --- Toast ---------------------------------------------------------------- */
.fkcore-toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%) translateY(12px);
  opacity: 0;
  pointer-events: none;
  z-index: 999999;
  background: rgba(20, 23, 28, 0.92);
  color: #fff;
  padding: 10px 12px;
  border-radius: 999px;
  font-size: 13px;
  line-height: 1.2;
  max-width: min(92vw, 520px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 160ms ease, transform 160ms ease;
}

.fkcore-toast.is-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* --- Muted helper ---------------------------------------------------------- */
.fkcore-muted {
  opacity: 0.75;
  font-size: 13px;
}

/* --- Notifications panel --------------------------------------------------- */
.fkcore-notifications-panel {
  position: fixed;
  right: 14px;
  bottom: 14px;
  width: min(92vw, 360px);
  max-height: min(72vh, 520px);
  z-index: 999998;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(0,0,0,0.18);
  overflow: hidden;
  transform: translateY(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

.fkcore-notifications-panel.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.fkcore-notifications-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 12px;
  background: #fcfcfd;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}

.fkcore-notifications-head strong {
  font-size: 14px;
}

.fkcore-notifications-close {
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 6px 8px;
  border-radius: 10px;
}

.fkcore-notifications-close:hover {
  background: rgba(0,0,0,0.06);
}

.fkcore-notifications-body {
  padding: 10px 12px;
  overflow: auto;
  max-height: calc(min(72vh, 520px) - 54px);
}

.fkcore-notifications-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.fkcore-notif-item {
  border: 1px solid rgba(0,0,0,0.10);
  border-radius: 14px;
  padding: 10px 10px;
  background: #fff;
}

.fkcore-notif-item.is-unread {
  border-color: rgba(34,113,177,0.35);
  box-shadow: 0 0 0 2px rgba(34,113,177,0.08) inset;
}

.fkcore-notif-text {
  font-size: 13px;
  line-height: 1.3;
  margin-bottom: 6px;
}

.fkcore-notif-date {
  font-size: 12px;
  opacity: 0.7;
}

.fkcore-notif-read {
  margin-top: 8px;
  border: 1px solid rgba(0,0,0,0.16);
  background: #fff;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}

.fkcore-notif-read:hover {
  background: rgba(0,0,0,0.04);
}

/* --- DM Modal -------------------------------------------------------------- */
.fkcore-dm-modal {
  position: fixed;
  inset: 0;
  z-index: 999997;
  background: rgba(0,0,0,0.42);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

.fkcore-dm-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

html.fkcore-modal-open,
html.fkcore-modal-open body {
  overflow: hidden;
}

.fkcore-dm-card {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: min(94vw, 520px);
  height: min(78vh, 640px);
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.22);
  overflow: hidden;
  display: grid;
  grid-template-rows: 52px 1fr 64px;
}

.fkcore-dm-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: #fcfcfd;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}

.fkcore-dm-title {
  font-size: 14px;
}

.fkcore-dm-close {
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 6px 8px;
  border-radius: 10px;
}

.fkcore-dm-close:hover {
  background: rgba(0,0,0,0.06);
}

.fkcore-dm-body {
  display: grid;
  grid-template-columns: 180px 1fr;
  min-height: 0; /* allows inner scroll */
}

.fkcore-dm-threadlist {
  border-right: 1px solid rgba(0,0,0,0.08);
  padding: 10px 10px;
  overflow: auto;
  min-height: 0;
}

.fkcore-dm-messages {
  padding: 10px 10px;
  overflow: auto;
  min-height: 0;
  background: #fff;
}

.fkcore-dm-threads {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.fkcore-dm-thread {
  border: 1px solid rgba(0,0,0,0.10);
  border-radius: 14px;
  padding: 8px 10px;
  cursor: pointer;
  background: #fff;
}

.fkcore-dm-thread:hover {
  background: rgba(0,0,0,0.03);
}

.fkcore-dm-thread.is-active {
  border-color: rgba(34,113,177,0.38);
  box-shadow: 0 0 0 2px rgba(34,113,177,0.08) inset;
}

.fkcore-dm-peer {
  font-size: 13px;
  line-height: 1.2;
  margin-bottom: 4px;
}

.fkcore-dm-last {
  font-size: 12px;
  opacity: 0.7;
}

.fkcore-dm-msglist {
  display: grid;
  gap: 8px;
}

.fkcore-dm-msg {
  display: grid;
  gap: 3px;
}

.fkcore-dm-msg.is-mine {
  justify-items: end;
}

.fkcore-dm-msg.is-theirs {
  justify-items: start;
}

.fkcore-dm-bubble {
  max-width: min(76%, 420px);
  padding: 8px 10px;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,0.10);
  font-size: 13px;
  line-height: 1.35;
  background: #fff;
}

.fkcore-dm-msg.is-mine .fkcore-dm-bubble {
  background: rgba(34,113,177,0.08);
  border-color: rgba(34,113,177,0.22);
}

.fkcore-dm-time {
  font-size: 11px;
  opacity: 0.65;
}

.fkcore-dm-foot {
  display: grid;
  grid-template-columns: 1fr 92px;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-top: 1px solid rgba(0,0,0,0.08);
  background: #fcfcfd;
}

.fkcore-dm-input {
  width: 100%;
  resize: none;
  border: 1px solid rgba(0,0,0,0.16);
  border-radius: 14px;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.3;
  outline: none;
}

.fkcore-dm-input:focus {
  border-color: rgba(34,113,177,0.55);
  box-shadow: 0 0 0 3px rgba(34,113,177,0.12);
}

.fkcore-dm-send {
  border: 1px solid rgba(0,0,0,0.16);
  background: #fff;
  border-radius: 999px;
  padding: 10px 12px;
  cursor: pointer;
  font-size: 13px;
}

.fkcore-dm-send:hover {
  background: rgba(0,0,0,0.04);
}

.fkcore-dm-send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* --- Responsive ------------------------------------------------------------ */
@media (max-width: 680px) {
  .fkcore-notifications-panel {
    right: 10px;
    left: 10px;
    width: auto;
  }

  .fkcore-dm-card {
    right: 10px;
    left: 10px;
    width: auto;
    bottom: 10px;
    height: min(82vh, 680px);
  }

  .fkcore-dm-body {
    grid-template-columns: 1fr;
  }

  .fkcore-dm-threadlist {
    display: none; /* mobile: keep minimal; threads still load, but hidden for space */
  }

  .fkcore-dm-foot {
    grid-template-columns: 1fr 84px;
  }
}
