/* ========================================================================== 
   OW Onboarding Tool 0.101.0
   Chat-Komposer, neue Nachrichten und Review-Dateianhänge
   ========================================================================== */

/* --------------------------------------------------------------------------
   Gemeinsame Chat-Grundlagen
   -------------------------------------------------------------------------- */
.cm-review-chat-message-meta > span,
body.content-review-mode .owr-chat-message-meta > span {
  display: none !important;
}

.cm-review-chat-bubble,
body.content-review-mode .owr-chat-bubble {
  overflow: hidden;
}

.cm-review-chat-bubble > p + .cm-review-message-attachments,
body.content-review-mode .owr-chat-bubble > p + .owr-chat-attachments {
  margin-top: 10px;
}

/* --------------------------------------------------------------------------
   Editor: normaler Chat-Komposer ohne fremde Textfelder
   -------------------------------------------------------------------------- */
.cm-review-conversation-composer.cm-review-chat-composer {
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 10px 14px 11px;
  border-top: 1px solid #e4e6e1;
  background: rgba(255, 255, 255, .98);
}

.cm-review-chat-compose-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: end;
  gap: 6px;
  border: 1px solid #d9dcd5;
  border-radius: 15px;
  background: #f8f9f7;
  padding: 5px;
  box-shadow: 0 1px 2px rgba(26, 28, 27, .025);
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.cm-review-chat-compose-row:focus-within {
  border-color: #86a0e8;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(83, 116, 211, .1), 0 4px 16px rgba(28, 32, 29, .045);
}

/* Browser-Erweiterungen und Autofill dürfen hier kein zusätzliches Textfeld
   neben der Nachricht einfügen. Das einzige Input im Komposer ist der
   unsichtbare Datei-Picker. */
.cm-review-chat-compose-row > input:not([type="file"]),
.cm-review-chat-compose-row > input:not([type]),
.cm-review-chat-compose-row > select,
.cm-review-chat-compose-row > [data-lastpass-icon-root],
.cm-review-chat-compose-row > [data-1password-root] {
  display: none !important;
}

.cm-review-chat-compose-row > input[type="file"] {
  display: none !important;
}

.cm-review-chat-compose-row textarea {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  max-height: 144px;
  box-sizing: border-box;
  resize: vertical;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 8px 7px 7px;
  color: #272a27;
  -webkit-text-fill-color: #272a27;
  font: inherit;
  font-size: 11px;
  line-height: 1.45;
}

.cm-review-chat-compose-row textarea::placeholder {
  color: #92968f;
  -webkit-text-fill-color: #92968f;
}

.cm-review-attach-button,
.cm-review-send-button {
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  font: inherit;
  cursor: pointer;
}

.cm-review-attach-button {
  width: 38px;
  border-radius: 11px;
  background: transparent;
  color: #666b64;
}

.cm-review-attach-button:hover {
  background: #eceee9;
  color: #2f342f;
}

.cm-review-send-button {
  min-width: 92px;
  gap: 7px;
  border-radius: 11px;
  background: #202320;
  padding: 0 14px;
  color: #fff;
  -webkit-text-fill-color: #fff;
  font-size: 10px;
  font-weight: 720;
}

.cm-review-send-button:hover:not(:disabled) {
  background: #121412;
}

.cm-review-send-button:disabled {
  opacity: .55;
  cursor: wait;
}

.cm-review-attach-button svg,
.cm-review-send-button svg {
  width: 15px;
  height: 15px;
}

.cm-review-composer-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px;
  color: #969a93;
  font-size: 8px;
  line-height: 1.3;
}

.cm-review-chat-composer .cm-review-reply-error {
  grid-column: auto;
  width: 100%;
  margin: 0;
  color: #a24848;
  font-size: 9px;
}

/* Editor: ausgewählte Dateien */
.cm-review-pending-files,
body.content-review-mode .owr-chat-pending-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cm-review-pending-files > span,
body.content-review-mode .owr-chat-pending-files > span {
  min-width: 0;
  max-width: min(100%, 290px);
  height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #dfe2dc;
  border-radius: 10px;
  background: #f7f8f6;
  padding: 0 4px 0 8px;
  color: #424642;
}

.cm-review-pending-files > span > span,
body.content-review-mode .owr-chat-pending-files > span > span {
  display: inline-flex;
  color: #72776f;
}

.cm-review-pending-files svg,
body.content-review-mode .owr-chat-pending-files svg {
  width: 13px;
  height: 13px;
}

.cm-review-pending-files strong,
body.content-review-mode .owr-chat-pending-files strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 9px;
  font-weight: 680;
}

.cm-review-pending-files small,
body.content-review-mode .owr-chat-pending-files small {
  flex: 0 0 auto;
  color: #949890;
  font-size: 8px;
}

.cm-review-pending-files button,
body.content-review-mode .owr-chat-pending-files button {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #8a8e87;
  cursor: pointer;
}

.cm-review-pending-files button:hover,
body.content-review-mode .owr-chat-pending-files button:hover {
  background: #e7e9e4;
  color: #444844;
}

/* Editor: gespeicherte Dateianhänge */
.cm-review-message-attachments,
body.content-review-mode .owr-chat-attachments {
  min-width: min(260px, 100%);
  display: grid;
  gap: 6px;
}

.cm-review-attachment,
body.content-review-mode .owr-chat-attachment {
  min-width: 0;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 14px;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(44, 48, 44, .1);
  border-radius: 11px;
  background: rgba(246, 248, 245, .92);
  padding: 7px 8px;
  color: #373b37;
  text-decoration: none;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}

.cm-review-attachment:hover,
body.content-review-mode .owr-chat-attachment:hover {
  border-color: rgba(83, 114, 202, .28);
  background: #fff;
  transform: translateY(-1px);
}

.cm-review-attachment-icon,
body.content-review-mode .owr-chat-attachment-icon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: #e9ece7;
  color: #626861;
}

.cm-review-attachment-icon svg,
body.content-review-mode .owr-chat-attachment-icon svg {
  width: 15px;
  height: 15px;
}

.cm-review-attachment > span:not(.cm-review-attachment-icon),
body.content-review-mode .owr-chat-attachment > span:not(.owr-chat-attachment-icon) {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.cm-review-attachment strong,
body.content-review-mode .owr-chat-attachment strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 9px;
  font-weight: 700;
}

.cm-review-attachment small,
body.content-review-mode .owr-chat-attachment small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #898e86;
  font-size: 8px;
}

.cm-review-attachment > svg,
body.content-review-mode .owr-chat-attachment > svg {
  width: 14px;
  height: 14px;
  color: #7e837b;
}

.cm-review-attachment.is-image,
body.content-review-mode .owr-chat-attachment.is-image {
  display: block;
  padding: 4px;
  overflow: hidden;
}

.cm-review-attachment.is-image img,
body.content-review-mode .owr-chat-attachment.is-image img {
  width: 100%;
  max-width: 330px;
  max-height: 210px;
  display: block;
  object-fit: cover;
  border-radius: 8px;
  background: #eceeea;
}

.cm-review-attachment.is-image > span,
body.content-review-mode .owr-chat-attachment.is-image > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 5px 3px;
}

.cm-review-chat-message.role-team .cm-review-attachment {
  border-color: rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .08);
  color: #fff;
}

.cm-review-chat-message.role-team .cm-review-attachment:hover {
  border-color: rgba(255, 255, 255, .24);
  background: rgba(255, 255, 255, .13);
}

.cm-review-chat-message.role-team .cm-review-attachment-icon {
  background: rgba(255, 255, 255, .11);
  color: #fff;
}

.cm-review-chat-message.role-team .cm-review-attachment small,
.cm-review-chat-message.role-team .cm-review-attachment > svg {
  color: rgba(255, 255, 255, .68);
}

/* --------------------------------------------------------------------------
   Öffentlicher Review: neuer, einfacher Chat-Komposer
   -------------------------------------------------------------------------- */
body.content-review-mode .owr-chat-composer.owr-chat-composer-v101 {
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  border-top: 1px solid #e4e6e1;
  background: rgba(255, 255, 255, .98);
  padding: 10px 13px 11px;
}

body.content-review-mode .owr-chat-author-row {
  display: flex;
  align-items: center;
}

body.content-review-mode .owr-chat-author-row label {
  width: min(280px, 100%);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

body.content-review-mode .owr-chat-author-row label > span {
  color: #777c74;
  font-size: 8px;
  font-weight: 680;
}

body.content-review-mode .owr-chat-author-row input {
  min-width: 0;
  height: 32px;
  border: 1px solid #dfe2dc;
  border-radius: 9px;
  background: #f8f9f7;
  padding: 0 9px;
  color: #2b2f2b;
  font: inherit;
  font-size: 9px;
}

body.content-review-mode .owr-chat-compose-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: end;
  gap: 6px;
  border: 1px solid #d9dcd5;
  border-radius: 15px;
  background: #f8f9f7;
  padding: 5px;
  box-shadow: 0 1px 2px rgba(25, 28, 26, .025);
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

body.content-review-mode .owr-chat-compose-row:focus-within {
  border-color: #86a0e8;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(83, 116, 211, .1), 0 4px 16px rgba(28, 32, 29, .045);
}

body.content-review-mode .owr-chat-compose-row > input:not([type="file"]),
body.content-review-mode .owr-chat-compose-row > input:not([type]),
body.content-review-mode .owr-chat-compose-row > select,
body.content-review-mode .owr-chat-compose-row > [data-lastpass-icon-root],
body.content-review-mode .owr-chat-compose-row > [data-1password-root] {
  display: none !important;
}

body.content-review-mode .owr-chat-compose-row > input[type="file"] {
  display: none !important;
}

body.content-review-mode .owr-chat-compose-row textarea {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  max-height: 144px;
  box-sizing: border-box;
  resize: vertical;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 8px 7px 7px;
  color: #272a27;
  -webkit-text-fill-color: #272a27;
  font: inherit;
  font-size: 10px;
  line-height: 1.45;
}

body.content-review-mode .owr-chat-compose-row textarea::placeholder {
  color: #92968f;
  -webkit-text-fill-color: #92968f;
}

body.content-review-mode .owr-chat-attach-button,
body.content-review-mode .owr-chat-send-button {
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  font: inherit;
  cursor: pointer;
}

body.content-review-mode .owr-chat-attach-button {
  width: 38px;
  border-radius: 11px;
  background: transparent;
  color: #666b64;
}

body.content-review-mode .owr-chat-attach-button:hover {
  background: #eceee9;
  color: #2f342f;
}

body.content-review-mode .owr-chat-send-button {
  min-width: 84px;
  gap: 6px;
  border-radius: 11px;
  background: #202320;
  padding: 0 12px;
  color: #fff;
  -webkit-text-fill-color: #fff;
  font-size: 9px;
  font-weight: 720;
}

body.content-review-mode .owr-chat-send-button:hover:not(:disabled) {
  background: #111311;
}

body.content-review-mode .owr-chat-send-button:disabled {
  opacity: .55;
  cursor: wait;
}

body.content-review-mode .owr-chat-attach-button svg,
body.content-review-mode .owr-chat-send-button svg {
  width: 14px;
  height: 14px;
}

body.content-review-mode .owr-chat-composer-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 4px;
  color: #969a93;
  font-size: 8px;
  line-height: 1.3;
}

body.content-review-mode .owr-chat-composer-v101 .owr-chat-reply-error {
  grid-column: auto;
  margin: 0;
  color: #a24848;
  font-size: 8px;
}

/* Eigene dunkle Nachrichten: Text und Dateikarten bleiben kontrastsicher. */
body.content-review-mode .owr-chat-message.is-owned .owr-chat-attachment {
  border-color: rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .08);
  color: #fff;
  -webkit-text-fill-color: #fff;
}

body.content-review-mode .owr-chat-message.is-owned .owr-chat-attachment:hover {
  border-color: rgba(255, 255, 255, .24);
  background: rgba(255, 255, 255, .13);
}

body.content-review-mode .owr-chat-message.is-owned .owr-chat-attachment-icon {
  background: rgba(255, 255, 255, .11);
  color: #fff;
}

body.content-review-mode .owr-chat-message.is-owned .owr-chat-attachment small,
body.content-review-mode .owr-chat-message.is-owned .owr-chat-attachment > svg {
  color: rgba(255, 255, 255, .68);
  -webkit-text-fill-color: rgba(255, 255, 255, .68);
}

/* --------------------------------------------------------------------------
   Neue Nachrichten: Badge, Sortierung und dezente Animation
   -------------------------------------------------------------------------- */
body.content-review-mode .owr-chat-fab {
  overflow: visible;
}

body.content-review-mode .owr-chat-fab-unread {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 23px;
  height: 23px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #31a56e;
  padding: 0 5px;
  color: #fff;
  font-size: 8px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 5px 14px rgba(32, 135, 88, .32);
}

body.content-review-mode .owr-chat-fab-unread[hidden] {
  display: none !important;
}

body.content-review-mode .owr-chat-fab.has-unread {
  border-color: rgba(72, 195, 132, .45);
  box-shadow: 0 16px 42px rgba(20, 22, 21, .24), 0 0 0 4px rgba(57, 181, 117, .12);
}

body.content-review-mode .owr-chat-fab.has-unread .owr-chat-fab-icon {
  background: rgba(73, 195, 133, .18);
  color: #baf1d2;
}

body.content-review-mode .owr-chat-fab.just-received {
  animation: owr-chat-fab-received 1.1s cubic-bezier(.2, .75, .2, 1);
}

body.content-review-mode .owr-chat-fab.just-received::after {
  content: '';
  position: absolute;
  inset: -7px;
  z-index: -1;
  border: 2px solid rgba(55, 185, 119, .52);
  border-radius: 24px;
  animation: owr-chat-ring 1.35s ease-out;
  pointer-events: none;
}

@keyframes owr-chat-fab-received {
  0%, 100% { transform: translateY(0) scale(1); }
  30% { transform: translateY(-4px) scale(1.025); }
  58% { transform: translateY(0) scale(.992); }
  78% { transform: translateY(-1px) scale(1.008); }
}

@keyframes owr-chat-ring {
  0% { opacity: .8; transform: scale(.96); }
  100% { opacity: 0; transform: scale(1.12); }
}

body.content-review-mode .owr-chat-thread-item.has-unread {
  position: relative;
  background: #f5fbf7;
}

body.content-review-mode .owr-chat-thread-item.has-unread::before {
  content: '';
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 0;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: #36aa73;
}

body.content-review-mode .owr-chat-thread-item.has-unread:not(.active) {
  border-color: #cae7d7;
}

body.content-review-mode .owr-chat-new-badge {
  min-height: 21px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #dcf5e7;
  padding: 3px 8px;
  color: #1e7b50;
  font-size: 8px;
  font-weight: 760;
}

/* --------------------------------------------------------------------------
   Feedbackformular und Inline-Antwort mit Dateiupload
   -------------------------------------------------------------------------- */
body.content-review-mode .owr-feedback-submit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

body.content-review-mode .owr-feedback-submit-row > button {
  margin: 0;
}

body.content-review-mode .owr-feedback-submit-row .owr-feedback-attach {
  min-width: 0;
  width: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid #dfe2dc;
  border-radius: 10px;
  background: #fff;
  padding: 0 11px;
  color: #62675f;
}

body.content-review-mode .owr-feedback-submit-row .owr-feedback-attach:hover {
  border-color: #cfd4cb;
  background: #f5f7f3;
}

body.content-review-mode .owr-feedback-submit-row .owr-feedback-attach svg {
  width: 14px;
  height: 14px;
}

body.content-review-mode .owr-inline-chat-composer {
  gap: 8px;
}

body.content-review-mode .owr-inline-chat-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 38px;
  align-items: end;
  gap: 5px;
  border: 1px solid #d9dcd5;
  border-radius: 14px;
  background: #f8f9f7;
  padding: 5px;
}

body.content-review-mode .owr-inline-chat-row:focus-within {
  border-color: #86a0e8;
  box-shadow: 0 0 0 3px rgba(83, 116, 211, .1);
}

body.content-review-mode .owr-inline-chat-row > input:not([type="file"]),
body.content-review-mode .owr-inline-chat-row > select {
  display: none !important;
}

body.content-review-mode .owr-inline-chat-row textarea {
  width: 100%;
  min-height: 40px;
  max-height: 130px;
  resize: vertical;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 7px;
  color: #282c28;
  -webkit-text-fill-color: #282c28;
  font: inherit;
  font-size: 10px;
  line-height: 1.45;
}

body.content-review-mode .owr-inline-chat-row > button {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #636861;
  cursor: pointer;
}

body.content-review-mode .owr-inline-chat-row > button.primary {
  background: #202320;
  color: #fff;
}

body.content-review-mode .owr-inline-chat-row svg {
  width: 14px;
  height: 14px;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 860px) {
  .cm-review-conversation-composer.cm-review-chat-composer,
  body.content-review-mode .owr-chat-composer.owr-chat-composer-v101 {
    padding: 9px 10px 10px;
  }

  .cm-review-chat-compose-row,
  body.content-review-mode .owr-chat-compose-row {
    grid-template-columns: 40px minmax(0, 1fr) 42px;
  }

  .cm-review-send-button,
  body.content-review-mode .owr-chat-send-button {
    width: 42px;
    min-width: 42px;
    padding: 0;
  }

  .cm-review-send-button span,
  body.content-review-mode .owr-chat-send-button span {
    display: none;
  }

  .cm-review-composer-hint,
  body.content-review-mode .owr-chat-composer-hint {
    font-size: 7px;
  }

  body.content-review-mode .owr-chat-fab-unread {
    top: -7px;
    right: -7px;
  }

  .cm-review-message-attachments,
  body.content-review-mode .owr-chat-attachments {
    min-width: min(220px, 100%);
  }

  .cm-review-attachment.is-image img,
  body.content-review-mode .owr-chat-attachment.is-image img {
    max-width: 100%;
    max-height: 190px;
  }
}

@media (max-width: 520px) {
  .cm-review-composer-hint span:first-child,
  body.content-review-mode .owr-chat-composer-hint span:first-child {
    display: none;
  }

  .cm-review-composer-hint,
  body.content-review-mode .owr-chat-composer-hint {
    justify-content: flex-end;
  }

  .cm-review-pending-files > span,
  body.content-review-mode .owr-chat-pending-files > span {
    max-width: 100%;
    flex: 1 1 100%;
  }

  body.content-review-mode .owr-feedback-submit-row {
    align-items: stretch;
    flex-direction: column;
  }

  body.content-review-mode .owr-feedback-submit-row > button {
    width: 100%;
  }

  body.content-review-mode .owr-chat-author-row label {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.content-review-mode .owr-chat-fab.just-received,
  body.content-review-mode .owr-chat-fab.just-received::after,
  body.content-review-mode .owr-chat-thread-item.has-unread {
    animation: none !important;
    transition: none !important;
  }
}
