/* ═══════════════════════════════════════════════════════════
   ChurchHub — chat-features.css
   Styles for advanced chat features
═══════════════════════════════════════════════════════════ */

/* ── EMOJI REACTION PICKER ────────────────────────────── */
.ch-reaction-picker {
  position: fixed;
  z-index: 9999;
  background: var(--glass-2, rgba(20,15,40,.95));
  border: 1px solid var(--glass-border, rgba(255,255,255,.09));
  border-radius: 14px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  padding: .35rem;
  box-shadow: 0 16px 48px rgba(0,0,0,.55);
  min-width: 200px;
  animation: ch-pop .15s cubic-bezier(.34,1.56,.64,1);
}

@keyframes ch-pop {
  from { transform: scale(.8); opacity: 0; }
  to   { transform: scale(1);  opacity: 1; }
}

.ch-reaction-emoji-row {
  display: flex;
  gap: .2rem;
  padding: .3rem .2rem;
  justify-content: space-around;
}

.ch-reaction-emoji-row button {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  border-radius: 8px;
  padding: .25rem .3rem;
  transition: background .15s, transform .1s;
  line-height: 1;
}

.ch-reaction-emoji-row button:hover,
.ch-reaction-emoji-row button:active {
  background: rgba(255,255,255,.08);
  transform: scale(1.25);
}

.ch-ctx-actions {
  display: flex;
  flex-direction: column;
  gap: .1rem;
}

.ch-ctx-actions button {
  background: none;
  border: none;
  color: var(--tx-1, #e2e0f0);
  font-size: .82rem;
  padding: .5rem .6rem;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .55rem;
  width: 100%;
  text-align: left;
  transition: background .12s;
  font-family: var(--f-body, system-ui);
}

.ch-ctx-actions button:hover,
.ch-ctx-actions button:active {
  background: rgba(255,255,255,.07);
}

.ch-ctx-actions button span:first-child { font-size: 1rem; flex-shrink: 0; }

/* Reaction chip on bubble */
.ch-rxn-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
  margin-top: .2rem;
}

.ch-rxn-chip {
  background: var(--glass, rgba(255,255,255,.06));
  border: 1px solid var(--glass-border, rgba(255,255,255,.09));
  border-radius: 20px;
  padding: .15rem .45rem;
  font-size: .85rem;
  cursor: pointer;
  line-height: 1.4;
  animation: ch-pop .2s ease;
}


/* ── REPLY QUOTE BAR ──────────────────────────────────── */
.ch-reply-bar {
  display: none;
  padding: .45rem .75rem;
  background: var(--glass, rgba(255,255,255,.06));
  border-top: 1px solid var(--glass-border, rgba(255,255,255,.09));
  border-left: none;
  border-right: none;
  animation: ch-slide-up .18s ease;
}

@keyframes ch-slide-up {
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: translateY(0);   opacity: 1; }
}

.ch-reply-bar-inner {
  display: flex;
  align-items: center;
  gap: .6rem;
}

.ch-reply-bar-line {
  width: 3px;
  min-height: 32px;
  border-radius: 3px;
  background: var(--violet, #7C3AED);
  flex-shrink: 0;
}

.ch-reply-bar-body { flex: 1; min-width: 0; }

.ch-reply-bar-author {
  font-size: .68rem;
  font-weight: 700;
  color: var(--violet, #7C3AED);
  margin-bottom: .1rem;
}

.ch-reply-bar-text {
  font-size: .78rem;
  color: var(--tx-2, rgba(220,215,255,.7));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ch-reply-bar-close {
  background: none;
  border: none;
  color: var(--tx-3, rgba(180,175,220,.5));
  font-size: .9rem;
  cursor: pointer;
  padding: .2rem;
  flex-shrink: 0;
}

/* Quote bubble inside message */
.ch-quote-block {
  background: rgba(124,58,237,.1);
  border-left: 3px solid var(--violet, #7C3AED);
  border-radius: 0 8px 8px 0;
  padding: .35rem .55rem;
  margin-bottom: .35rem;
}

.ch-quote-author {
  font-size: .62rem;
  font-weight: 700;
  color: var(--violet, #7C3AED);
  margin-bottom: .1rem;
}

.ch-quote-text {
  font-size: .78rem;
  color: var(--tx-2, rgba(220,215,255,.7));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* ── DATE SEPARATORS ──────────────────────────────────── */
.ch-date-sep {
  text-align: center;
  margin: .75rem 0 .4rem;
  position: relative;
}

.ch-date-sep::before {
  content: '';
  position: absolute;
  left: 0; right: 0;
  top: 50%;
  height: 1px;
  background: var(--glass-border, rgba(255,255,255,.09));
}

.ch-date-sep span,
.ch-date-sep {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--tx-3, rgba(180,175,220,.5));
  background: var(--bg, #05030F);
  padding: 0 .75rem;
  position: relative;
  z-index: 1;
}


/* ── VOICE NOTE UI ────────────────────────────────────── */
.ch-voice-ui {
  display: none;
  align-items: center;
  gap: .5rem;
  padding: .55rem .75rem;
  background: rgba(239,68,68,.08);
  border-top: 1px solid rgba(239,68,68,.2);
  animation: ch-slide-up .18s ease;
}

.ch-voice-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #EF4444;
  animation: ch-pulse-red 1s infinite;
  flex-shrink: 0;
}

@keyframes ch-pulse-red {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .5; transform: scale(1.3); }
}

#ch-voice-timer {
  font-size: .85rem;
  font-weight: 700;
  color: #EF4444;
  font-family: monospace;
  flex-shrink: 0;
}

.ch-voice-cancel {
  background: var(--glass-2, rgba(255,255,255,.06));
  border: 1px solid var(--glass-border, rgba(255,255,255,.09));
  color: var(--tx-2, rgba(220,215,255,.7));
  border-radius: 20px;
  padding: .25rem .65rem;
  font-size: .75rem;
  cursor: pointer;
  white-space: nowrap;
}

.ch-voice-send {
  background: rgba(239,68,68,.15);
  border: 1px solid rgba(239,68,68,.35);
  color: #F87171;
  border-radius: 20px;
  padding: .25rem .65rem;
  font-size: .75rem;
  cursor: pointer;
  white-space: nowrap;
}

/* Voice message bubble */
.ch-voice-msg {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.ch-voice-msg audio {
  max-width: 180px;
  height: 32px;
}

/* Voice button in input bar */
.ch-voice-btn {
  background: var(--glass-2, rgba(255,255,255,.06));
  border: 1px solid var(--glass-border, rgba(255,255,255,.09));
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--tx-2, rgba(220,215,255,.7));
  flex-shrink: 0;
  transition: background .15s, color .15s;
}

.ch-voice-btn:active {
  background: rgba(239,68,68,.2);
  border-color: rgba(239,68,68,.4);
  color: #F87171;
}


/* ── EMOJI PICKER ─────────────────────────────────────── */
.ch-emoji-btn {
  background: var(--glass-2, rgba(255,255,255,.06));
  border: 1px solid var(--glass-border, rgba(255,255,255,.09));
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: .95rem;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}

.ch-emoji-btn:hover { background: rgba(255,255,255,.1); }

.ch-emoji-picker {
  display: none;
  position: absolute;
  bottom: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--glass-2, rgba(20,15,40,.98));
  border: 1px solid var(--glass-border, rgba(255,255,255,.09));
  border-radius: 14px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 -8px 32px rgba(0,0,0,.4);
  z-index: 500;
  overflow: hidden;
  animation: ch-slide-up .18s ease;
}

/* Make the chat-input-bar position:relative so picker positions correctly */
.chat-input-bar {
  position: relative;
}

.ch-ep-tabs {
  display: flex;
  gap: .1rem;
  padding: .4rem .4rem 0;
  border-bottom: 1px solid var(--glass-border, rgba(255,255,255,.09));
  overflow-x: auto;
  scrollbar-width: none;
}

.ch-ep-tabs::-webkit-scrollbar { display: none; }

.ch-ep-tab {
  background: none;
  border: none;
  padding: .4rem .55rem;
  font-size: 1.1rem;
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  transition: background .12s;
  flex-shrink: 0;
}

.ch-ep-tab.active { background: rgba(124,58,237,.15); }

.ch-ep-tab:hover { background: rgba(255,255,255,.06); }

.ch-ep-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: .15rem;
  padding: .5rem;
  max-height: 180px;
  overflow-y: auto;
}

@media (max-width: 400px) {
  .ch-ep-grid { grid-template-columns: repeat(7, 1fr); }
}

.ch-ep-emoji {
  background: none;
  border: none;
  font-size: 1.35rem;
  cursor: pointer;
  border-radius: 8px;
  padding: .25rem;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .1s, transform .1s;
  line-height: 1;
}

.ch-ep-emoji:hover,
.ch-ep-emoji:active {
  background: rgba(255,255,255,.08);
  transform: scale(1.2);
}


/* ── MESSAGE SEARCH BAR ───────────────────────────────── */
.ch-search-bar {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .45rem .75rem;
  background: var(--glass, rgba(255,255,255,.06));
  border-bottom: 1px solid var(--glass-border, rgba(255,255,255,.09));
  animation: ch-slide-up .18s ease;
}

.ch-search-input {
  flex: 1;
  background: var(--glass-2, rgba(255,255,255,.06));
  border: 1px solid var(--glass-border, rgba(255,255,255,.09));
  border-radius: 20px;
  padding: .4rem .8rem;
  color: var(--tx-1, #e2e0f0);
  font-size: .84rem;
  outline: none;
  font-family: var(--f-body, system-ui);
}

.ch-search-input:focus { border-color: var(--violet, #7C3AED); }

.ch-search-count {
  font-size: .72rem;
  color: var(--tx-3, rgba(180,175,220,.5));
  white-space: nowrap;
  flex-shrink: 0;
}

.ch-search-close {
  background: none;
  border: none;
  color: var(--tx-3, rgba(180,175,220,.5));
  cursor: pointer;
  font-size: .9rem;
  padding: .2rem;
  flex-shrink: 0;
}

/* Highlighted search match */
.msg-bubble.ch-search-match {
  outline: 2px solid var(--gold, #F59E0B);
  outline-offset: 2px;
  border-radius: 10px;
  animation: ch-flash .4s ease;
}

@keyframes ch-flash {
  0% { outline-color: transparent; }
  50% { outline-color: var(--gold, #F59E0B); }
  100% { outline-color: var(--gold, #F59E0B); }
}


/* ── SEEN BY TAG ──────────────────────────────────────── */
.ch-seen-tag {
  font-size: .6rem;
  color: var(--tx-3, rgba(180,175,220,.5));
  display: inline-flex;
  align-items: center;
  gap: .15rem;
  margin-left: .4rem;
}


/* ── PINNED MESSAGE BANNER ────────────────────────────── */
.ch-pinned-banner {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem .75rem;
  background: rgba(245,158,11,.07);
  border-bottom: 1px solid rgba(245,158,11,.2);
  cursor: pointer;
  animation: ch-slide-up .18s ease;
  flex-shrink: 0;
}


/* ── CHAT MENU (⋮) ───────────────────────────────────── */
.ch-chat-menu {
  position: fixed;
  z-index: 8000;
  background: var(--glass-2, rgba(20,15,40,.97));
  border: 1px solid var(--glass-border, rgba(255,255,255,.09));
  border-radius: 12px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 12px 40px rgba(0,0,0,.5);
  overflow: hidden;
  min-width: 180px;
  animation: ch-pop .15s cubic-bezier(.34,1.56,.64,1);
}

.ch-chat-menu button {
  display: block;
  width: 100%;
  background: none;
  border: none;
  padding: .65rem .9rem;
  font-size: .84rem;
  color: var(--tx-1, #e2e0f0);
  cursor: pointer;
  text-align: left;
  font-family: var(--f-body, system-ui);
  border-bottom: 1px solid var(--glass-border, rgba(255,255,255,.06));
  transition: background .12s;
}

.ch-chat-menu button:last-child { border-bottom: none; }
.ch-chat-menu button:hover { background: rgba(255,255,255,.06); }


/* ── FORWARD MODAL ────────────────────────────────────── */
.ch-forward-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .55rem 0;
  border-bottom: 1px solid var(--glass-border, rgba(255,255,255,.09));
  cursor: pointer;
}

.ch-forward-av {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.ch-forward-av-init {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--violet, #7C3AED), #0EA5E9);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .62rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}


/* ── GROUP INFO EXTRAS ────────────────────────────────── */
.ch-group-ext {
  margin-top: .75rem;
}


/* ── TYPING INDICATOR PULSE ───────────────────────────── */
#chatConvoStatus {
  transition: color .3s;
}
