/* ─── Composer layout (collapsible formatting bar + “A” toggle) ─── */
.chat-composer-stack {
  display: flex;
  flex-direction: column;
  width: 100%;
  flex: 1;
  min-width: 0;
}

.subCont2Child > .chat-composer-stack {
  flex: 1 1 auto;
  min-width: 0;
}

.subCont2Child > .sendSpan {
  flex: 0 0 auto;
  align-self: center;
}

.subCont2Child .chat-input-wrapper .chat-composer-stack {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
}

.chat-input-wrapper .chat-composer-stack {
  flex: 1;
  min-width: 0;
}

/* No extra “card” — keep the same look as legacy .subCont2Child .chatInputField */
.chat-composer-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  background: transparent;
  border: none;
  box-shadow: none;
  overflow: visible;
}

/* Toolbar hidden by default; when open, match white field + black border (same as input) */
.chat-format-toolbar.chat-format-toolbar--collapsible {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  padding: 0 8px;
  pointer-events: none;
  background: #fff;
  border: 1px solid transparent;
  border-bottom: none;
  transition:
    max-height 0.28s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.22s ease,
    padding 0.22s ease;
}

.chat-composer-stack.chat-fmt-open .chat-format-toolbar.chat-format-toolbar--collapsible {
  max-height: 160px;
  opacity: 1;
  padding: 8px 10px 10px;
  pointer-events: auto;
  border-color: #000;
  border-radius: 19px 19px 0 0;
  border-bottom: none;
}

.chat-format-toolbar .chat-fmt-sep {
  width: 1px;
  height: 20px;
  background: #dadce0;
  margin: 0 4px;
  flex-shrink: 0;
}

.chat-format-toolbar .chat-fmt-btn {
  border: none;
  background: transparent;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  padding: 0;
  cursor: pointer;
  color: #3c4043;
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.chat-format-toolbar .chat-fmt-btn:hover {
  background: rgba(60, 64, 67, 0.09);
}

.chat-format-toolbar .chat-fmt-btn:active {
  transform: scale(0.96);
}

.chat-format-toolbar .chat-fmt-btn.chat-fmt-btn--active {
  background: rgba(26, 115, 232, 0.16);
  color: #1967d2;
}

.chat-format-toolbar .chat-fmt-btn i {
  font-size: 15px;
  pointer-events: none;
}

.chat-format-toolbar .chat-fmt-btn .fmt-underline {
  text-decoration: underline;
  font-weight: 600;
}

.chat-composer-editor-wrap {
  position: relative;
  min-height: 48px;
}

/* Match assets/css/chat.css .subCont2Child .chatInputField — white bg, black border, rounded */
.subCont2Child .chatInputField.chat-composer-editor,
.subCont2Child #myMsg.chat-composer-editor,
.chat-composer-shell .chat-composer-editor {
  width: 100%;
  min-height: 64px;
  max-height: 120px;
  overflow-y: auto;
  overflow-x: hidden;
  margin: 0 0 10px 0 !important;
  padding: 17px 52px 17px 55px !important;
  background-color: #fff !important;
  border: 1px solid #000 !important;
  border-radius: 19px !important;
  font-size: 20px !important;
  line-height: 1.4;
  color: #111827 !important;
  caret-color: #111827 !important;
  -webkit-user-select: text !important;
  user-select: text !important;
  word-wrap: break-word;
  white-space: pre-wrap;
  outline: none;
  box-sizing: border-box;
}

/* When formatting row is open, attach field to toolbar (shared border) */
.chat-composer-stack.chat-fmt-open .chat-composer-shell .chat-composer-editor {
  border-top: none !important;
  border-radius: 0 0 19px 19px !important;
  margin-top: 0 !important;
}

.chat-composer-editor:focus {
  outline: none;
  caret-color: #111827 !important;
  color: #111827 !important;
}

/* Pasted rich HTML must not steal caret/text color */
.chat-composer-editor *,
#myMsg.chat-composer-editor *,
.chatInputField.chat-composer-editor * {
  caret-color: #111827 !important;
  -webkit-text-fill-color: inherit;
  color: inherit;
}

.chat-composer-editor:empty:before {
  content: attr(data-placeholder);
  color: #80868b;
  pointer-events: none;
}

/* Same vertical axis as .emoji-container (match top:50% + translate, not bottom:Npx) */
.chat-composer-editor-wrap .chat-fmt-toggle {
  position: absolute;
  right: 10px;
  top: 45%;
  bottom: auto;
  transform: translateY(-50%);
  z-index: 3;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: #5f6368;
  transition: background 0.18s ease, color 0.18s ease;
}

.chat-fmt-toggle:hover {
  background: rgba(60, 64, 67, 0.08);
  color: #3c4043;
}

.chat-fmt-toggle:focus-visible {
  outline: 2px solid #1a73e8;
  outline-offset: 2px;
}

.chat-fmt-toggle__icon {
  width: 20px;
  height: 20px;
  display: block;
  object-fit: contain;
  pointer-events: none;
}

.chat-fmt-toggle.chat-fmt-toggle--active {
  background: rgba(26, 115, 232, 0.18);
  color: #1967d2;
  box-shadow: inset 0 0 0 1px rgba(26, 115, 232, 0.25);
}

/* Bubble rendering helpers */
.textmsg .chat-md-bq,
.message-text .chat-md-bq {
  margin: 0.25em 0 0.25em 0.5em;
  padding-left: 0.65em;
  border-left: 3px solid #dadce0;
  color: inherit;
}

.message-text pre.chat-md-pre,
.textmsg pre.chat-md-pre {
  margin: 0.35em 0;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 8px;
  font-size: 0.9em;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.textmsg u,
.message-text u {
  text-decoration: underline;
}

/* ─── Embedded meeting chat (chat_internal.php iframe): narrow panel, avoid clipping & tall “card” toolbar ─── */
body.chat-internal-page #chatArea .subCont2Child .chatInputField.chat-composer-editor,
body.chat-internal-page #chatArea .subCont2Child #myMsg.chat-composer-editor,
body.chat-internal-page #chatArea .chat-composer-shell .chat-composer-editor {
  min-height: 40px !important;
  max-height: 88px !important;
  padding: 10px 74px 10px 11px !important;
  font-size: 16px !important;
  margin: 0 0 6px 0 !important;
  line-height: 1.35;
}

body.chat-internal-page #chatArea .chat-composer-editor-wrap {
  min-height: 0;
}

body.chat-internal-page #chatArea .chat-format-toolbar.chat-format-toolbar--collapsible {
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  gap: 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  box-shadow: none;
}

body.chat-internal-page #chatArea .chat-composer-stack.chat-fmt-open .chat-format-toolbar.chat-format-toolbar--collapsible {
  max-height: 46px;
  padding: 3px 6px 4px;
  border-radius: 14px 14px 0 0;
}

body.chat-internal-page #chatArea .chat-format-toolbar .chat-fmt-btn {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  font-size: 13px;
}

body.chat-internal-page #chatArea .chat-format-toolbar .chat-fmt-btn i {
  font-size: 14px;
}

body.chat-internal-page #chatArea .chat-format-toolbar .chat-fmt-sep {
  height: 18px;
  margin: 0 3px;
  flex-shrink: 0;
}

body.chat-internal-page #chatArea .chat-composer-editor-wrap .chat-fmt-toggle {
  top: 45%;
  bottom: auto;
  transform: translateY(-50%);
  right: 8px;
  width: 32px;
  height: 32px;
}

body.chat-internal-page #chatArea .chat-fmt-toggle__icon {
  width: 18px;
  height: 18px;
}

body.chat-internal-page #chatArea .subCont2Child .emoji-container {
  right: 42px;
}

body.chat-internal-page #chatArea .subCont2Child .chat-composer-editor-wrap .emoji-container {
  right: 42px;
}
