/* AConfession messages module - isolated mobile private/anonymous UI */
:root {
  --acf-vv-height: 100dvh;
  --acf-chat-bottom: 0px;
}

body.acf-message-thread-active,
body.acf-anonymous-inbox-active,
body.acf-anonymous-compose-active {
  height: var(--acf-vv-height) !important;
  overflow: hidden !important;
  background: #05070d;
}

body.acf-message-thread-active .mobile-shell,
body.acf-anonymous-inbox-active .mobile-shell,
body.acf-anonymous-compose-active .mobile-shell {
  height: var(--acf-vv-height) !important;
  min-height: var(--acf-vv-height) !important;
  overflow: hidden !important;
}

body.acf-message-thread-active .app-content,
body.acf-anonymous-inbox-active .app-content,
body.acf-anonymous-compose-active .app-content {
  height: calc(var(--acf-vv-height) - var(--topbar)) !important;
  min-height: 0 !important;
  overflow: hidden !important;
  padding: 6px 6px 0 !important;
}

body.acf-message-thread-active .tabbar,
body.acf-anonymous-inbox-active .tabbar,
body.acf-anonymous-compose-active .tabbar {
  display: none !important;
}

.acf-messages-page { display: grid; gap: 10px; }

.acf-messages-head {
  padding: 13px;
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,.10);
  background: linear-gradient(150deg, rgba(124,58,237,.14), rgba(6,182,212,.08));
}

.acf-messages-head h1 { margin: 0 0 4px; font-size: 23px; }
.acf-messages-head p { margin: 0; color: #aab5c8; line-height: 1.7; }

.acf-conversation-card,
.acf-anon-inbox-card {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
}

.acf-conversation-card span,
.acf-conversation-card small,
.acf-anon-inbox-card span { color: #9aa7bd; line-height: 1.55; }

.acf-private-chat {
  height: calc(var(--acf-vv-height) - var(--topbar) - 8px) !important;
  min-height: 0 !important;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 24px 24px 0 0;
  border: 1px solid rgba(255,255,255,.08);
  background:
    radial-gradient(520px 300px at 110% -40px, rgba(6,182,212,.12), transparent 68%),
    radial-gradient(420px 300px at -40px 30px, rgba(124,58,237,.13), transparent 68%),
    linear-gradient(180deg, #09111d, #05070d 48%, #04060b);
}

.acf-private-header {
  flex: 0 0 auto;
  min-height: 54px;
  padding: 7px 8px;
  display: grid;
  grid-template-columns: auto auto minmax(0,1fr) auto;
  gap: 8px;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,.075);
  background: rgba(7,10,18,.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.acf-anonymous-inbox-active .acf-private-header { grid-template-columns: auto auto minmax(0,1fr); }

.acf-private-back {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.055);
  font-size: 28px;
  line-height: 1;
}

.acf-private-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--brand2));
  color: #fff;
  font-weight: 950;
}

.acf-private-title { min-width: 0; text-align: right; }
.acf-private-title h1 { margin: 0; font-size: 14.5px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acf-private-title p { margin: 2px 0 0; color: #a8b3c7; font-size: 10.8px; }
.acf-private-header-action form { margin: 0; }

.acf-private-stream {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 12px 10px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.acf-private-stream::-webkit-scrollbar { display: none; }

.acf-private-msg {
  direction: rtl;
  text-align: right;
  width: max-content;
  max-width: 80%;
  min-width: 54px;
  padding: 7px 10px 6px;
  border-radius: 18px;
  color: #f8fafc;
  box-shadow: 0 3px 9px rgba(0,0,0,.20);
  word-break: break-word;
  overflow-wrap: anywhere;
}

.acf-private-msg.is-mine { align-self: auto; margin-left: auto; margin-right: 0; background: linear-gradient(135deg,#0e957f,#087765); border-bottom-right-radius: 5px; }
.acf-private-msg.is-theirs { align-self: auto; margin-right: auto; margin-left: 0; background: linear-gradient(180deg,#182235,#111a2b); border-bottom-left-radius: 5px; }
.acf-private-msg.is-anon { align-self: auto; margin-right: auto; margin-left: 0; background: linear-gradient(180deg,rgba(236,72,153,.22),rgba(124,58,237,.18)); border-bottom-left-radius: 5px; }
.acf-private-msg.is-pending { opacity: .72; border: 1px dashed rgba(255,255,255,.18); }
.acf-private-msg.is-failed { background: rgba(239,68,68,.16); }

.acf-private-meta { margin: 0 0 2px; color: #bfe7ff; font-size: 10.5px; font-weight: 900; }
.acf-private-msg p { margin: 0; white-space: pre-line; line-height: 1.55; font-size: 13.8px; }
.acf-private-msg small { display: block; margin-top: 2px; color: rgba(255,255,255,.68); font-size: 9.5px; direction: ltr; text-align: left; }
.acf-private-msg.is-theirs small, .acf-private-msg.is-anon small { text-align: right; }
.acf-private-report { margin-top: 2px; border: 0; background: transparent; color: rgba(255,255,255,.48); font-size: 9px; padding: 0; }
.acf-private-unread { align-self: center; margin: 8px auto; padding: 5px 10px; border-radius: 999px; background: rgba(6,182,212,.13); border: 1px solid rgba(6,182,212,.28); color: #bff3ff; font-size: 11px; font-weight: 900; }

.acf-private-composer {
  flex: 0 0 auto;
  direction: ltr;
  display: grid;
  grid-template-columns: 42px minmax(0,1fr);
  gap: 8px;
  align-items: end;
  padding: 8px 9px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255,255,255,.08);
  background: rgba(7,10,18,.97);
}

.acf-private-composer textarea { grid-column: 2; }

.acf-private-composer textarea,
.acf-anon-compose-form textarea {
  direction: rtl;
  text-align: right;
  width: 100%;
  min-height: 42px;
  max-height: 118px;
  resize: none;
  overflow-y: hidden;
  border-radius: 23px;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.48;
  color: white;
  background: rgba(255,255,255,.072);
  border: 1px solid rgba(255,255,255,.10);
  outline: none;
  -webkit-user-select: text;
  user-select: text;
  touch-action: auto;
}

.acf-private-composer textarea:focus,
.acf-anon-compose-form textarea:focus { border-color: rgba(6,182,212,.46); background: rgba(255,255,255,.095); }

.acf-private-send {
  grid-column: 1;
  grid-row: 1;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  color: white;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg,var(--brand),var(--brand2));
}

.acf-private-send:before { content: ""; width: 18px; height: 18px; display: block; background: currentColor; clip-path: polygon(100% 45%,0 0,36% 100%,54% 58%); }
.acf-private-send:disabled { opacity: .72; cursor: wait; }
.acf-private-send.is-sending:before { width: 17px; height: 17px; border: 2px solid rgba(255,255,255,.36); border-top-color: #fff; border-radius: 999px; background: transparent; clip-path: none; animation: acfPrivateSending .72s linear infinite; }
@keyframes acfPrivateSending { to { transform: rotate(360deg); } }

.acf-anon-compose-card {
  height: calc(var(--acf-vv-height) - var(--topbar) - 8px) !important;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 24px 24px 0 0;
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
}

.acf-anon-compose-card h1 { margin: 0; font-size: 20px; }
.acf-anon-compose-card p { color: #aab5c8; line-height: 1.7; margin: 0; }
.acf-anon-compose-form { display: flex; flex-direction: column; gap: 10px; min-height: 0; flex: 1; }
.acf-anon-compose-form textarea { flex: 1; max-height: none; border-radius: 20px; }

@media (max-width: 420px) {
  .acf-private-chat,
  .acf-anon-compose-card {
    height: calc(var(--acf-vv-height) - var(--topbar) - 6px) !important;
    border-radius: 20px 20px 0 0;
  }
  .acf-private-msg { max-width: 84%; }
  .acf-private-msg p { font-size: 13.4px; }
}


/* Private chat restrictions */
.acf-private-restriction {
  flex: 0 0 auto;
  margin: 8px;
  padding: 9px 10px;
  border-radius: 16px;
  border: 1px solid rgba(239,68,68,.28);
  background: rgba(239,68,68,.105);
  color: #fecaca;
  font-size: 12px;
  line-height: 1.65;
  direction: rtl;
  text-align: right;
}

.acf-private-stream .chat-empty {
  order: 999;
}

/* =========================================================
   Private messages context menu patch
   ========================================================= */
.acf-private-report {
  display: none !important;
}

.acf-chat-context-menu {
  position: fixed;
  z-index: 99999;
  min-width: 178px;
  max-width: min(250px, calc(100vw - 16px));
  direction: rtl;
  text-align: right;
}

.acf-chat-context-menu[hidden] {
  display: none !important;
}

.acf-chat-context-card {
  overflow: hidden;
  padding: 5px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.13);
  background: rgba(7,10,18,.96);
  box-shadow: 0 18px 50px rgba(0,0,0,.45);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.acf-chat-context-card button {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: #e5e7eb;
  padding: 8px 10px;
  font-size: 12.7px;
  font-weight: 850;
  text-align: right;
}

.acf-chat-context-card button:active,
.acf-chat-context-card button:hover {
  background: rgba(255,255,255,.075);
}

.acf-chat-context-card button.danger {
  color: #fecaca;
}

.acf-chat-context-card button.danger:active,
.acf-chat-context-card button.danger:hover {
  background: rgba(239,68,68,.12);
}

body.acf-chat-menu-open .acf-private-stream {
  -webkit-user-select: none;
  user-select: none;
}
