/* obin-chat (.obc-*) — Vanilla-JS-Widget für PHP-Proxy-Chat über matrix.obin.life
 * Design-Sprache: obin.life Pill-Buttons, DM Sans, var(--off)/var(--black)
 * Drei Modi: public (Luna-FAB-Popup), profil (/profil/chat), admin (/admin/chat) */

.obc-wrap {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  font-family: 'DM Sans', system-ui, sans-serif;
  color: var(--text, #0e0d0c);
}

.obc-hd {
  padding: .9rem 1.1rem;
  border-bottom: 1px solid rgba(0,0,0,.06);
  display: flex; align-items: center; gap: .7rem;
  background: var(--off, #f5f4f2);
}
.obc-hd-name { font-weight: 500; font-size: .9rem; }
.obc-hd-sub  { font-size: .72rem; color: var(--muted, #756f66); }

.obc-messages {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: .55rem;
  background: #fff;
}

.obc-bubble {
  max-width: 78%;
  padding: .55rem .85rem;
  border-radius: 16px;
  font-size: .88rem;
  font-weight: 300;
  line-height: 1.4;
  word-wrap: break-word;
  position: relative;
}

.obc-bubble-in {
  align-self: flex-start;
  background: var(--off, #f5f4f2);
  color: var(--text, #0e0d0c);
  border-bottom-left-radius: 4px;
}

.obc-bubble-out {
  align-self: flex-end;
  background: var(--black, #0e0d0c);
  color: #f5f4f2;
  border-bottom-right-radius: 4px;
}

.obc-label {
  font-size: .68rem;
  opacity: .65;
  margin-bottom: .15rem;
  font-weight: 400;
}

.obc-body { white-space: pre-wrap; }

.obc-time {
  font-size: .65rem;
  opacity: .55;
  margin-top: .25rem;
}

.obc-bubble-out .obc-time { text-align: right; }

.obc-input-bar {
  padding: .65rem .8rem;
  border-top: 1px solid rgba(0,0,0,.06);
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: .45rem;
}

.obc-name-field {
  width: 100%;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 999px;
  padding: .42rem .9rem;
  font-size: .8rem;
  font-family: inherit;
  background: var(--off, #f5f4f2);
  color: var(--text, #0e0d0c);
  outline: none;
}
.obc-name-field::placeholder { color: var(--muted, #756f66); }
.obc-name-field:focus { border-color: var(--black, #0e0d0c); }

.obc-input-row {
  display: flex;
  gap: .5rem;
  align-items: flex-end;
  background: var(--off, #f5f4f2);
  border-radius: 22px;
  padding: .35rem .35rem .35rem 1rem;
}

.obc-input {
  flex: 1;
  border: 0;
  background: transparent;
  outline: none;
  font-family: inherit;
  font-size: .88rem;
  font-weight: 300;
  line-height: 1.4;
  resize: none;
  min-height: 1.4em;
  max-height: 6em;
  padding: .5rem 0;
  color: var(--text, #0e0d0c);
}
.obc-input::placeholder { color: var(--muted, #756f66); }

.obc-send-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 0;
  background: var(--black, #0e0d0c);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: transform .12s ease, opacity .12s ease;
}
.obc-send-btn:hover { transform: scale(1.04); }
.obc-send-btn:active { transform: scale(.96); }
.obc-send-btn svg { width: 16px; height: 16px; }

.obc-status {
  font-size: .7rem;
  color: var(--muted, #756f66);
  padding: 0 .4rem;
  min-height: 1em;
}

.obc-privacy {
  font-size: .68rem;
  color: var(--muted, #756f66);
  padding: 0 .4rem;
  line-height: 1.35;
}

/* === Public FAB-Popup-Variante === */
.obc-popup {
  position: fixed;
  bottom: 5.5rem;
  right: 1.5rem;
  width: min(380px, calc(100vw - 2rem));
  height: min(640px, calc(100dvh - 8rem));
  display: none;
  flex-direction: column;
  z-index: 9999;
  box-shadow: 0 24px 60px -10px rgba(0,0,0,.35);
  border: 1px solid rgba(0,0,0,.08);
}
.obc-popup.is-open { display: flex; }

.obc-close-btn {
  margin-left: auto;
  background: transparent;
  border: 0;
  color: var(--muted, #756f66);
  cursor: pointer;
  font-size: 1.1rem;
  padding: .2rem .4rem;
  line-height: 1;
}
.obc-close-btn:hover { color: var(--text, #0e0d0c); }

/* === Admin-Splitview === */
.obc-admin-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 0;
  height: calc(100dvh - 180px);
  min-height: 520px;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
}

.obc-admin-list {
  border-right: 1px solid rgba(0,0,0,.06);
  background: var(--off, #f5f4f2);
  overflow-y: auto;
}
.obc-admin-list-item {
  padding: .85rem 1rem;
  border-bottom: 1px solid rgba(0,0,0,.04);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: .15rem;
  text-decoration: none;
  color: inherit;
}
.obc-admin-list-item:hover { background: rgba(0,0,0,.03); }
.obc-admin-list-item.is-active { background: #fff; border-left: 3px solid var(--black, #0e0d0c); padding-left: calc(1rem - 3px); }
.obc-admin-list-name { font-size: .85rem; font-weight: 500; display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.obc-admin-list-sub  { font-size: .72rem; color: var(--muted, #756f66); }
.obc-admin-list-preview { font-size: .75rem; color: var(--muted, #756f66); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: .2rem; }
.obc-unread-dot { display: inline-flex; min-width: 18px; height: 18px; padding: 0 6px; border-radius: 999px; background: var(--black, #0e0d0c); color: #fff; font-size: .65rem; align-items: center; justify-content: center; }

.obc-admin-pane {
  display: flex;
  flex-direction: column;
  background: #fff;
  min-width: 0;
  min-height: 0;          /* damit child flex-1 mit overflow:auto scrollen kann */
  overflow: hidden;        /* container clip; messages scrollt selbst */
  position: relative;     /* fuer obc-actions-panel overlay */
}
.obc-admin-pane .obc-messages { flex: 1 1 0; min-height: 0; }

.obc-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  color: var(--muted, #756f66);
  font-size: .85rem;
  padding: 2rem;
}

/* === Profil-Variante === */
.obc-profil-wrap {
  max-width: 760px;
  margin: 0 auto;
  height: calc(100dvh - 240px);
  min-height: 520px;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  display: flex;
  flex-direction: column;
}
.obc-profil-wrap .obc-messages { min-height: 0; flex: 1 1 0; }
