/**
 * Kommentare (kommentar_gruppe, kommentar_mit_dateianhang) im aktuellen
 * Design: Stone/Gold-Tokens, schlanke Karte, Avatar mit Initialen, Gold-Links.
 * Betrifft Ticket-Kommentare, Gruppen-Kommentare und die Profil-Aktivität.
 */

/* --- Karte --- */
article.js-comment.box,
.box:has(.comment-box) {
  --bs-gutter-x: 0;
  margin: 0 0 14px;
  padding: 16px 18px;
  background: #fff;
  border: 1px solid var(--confidence-stone-200, #e7e5e4);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(28, 25, 23, .05);
  align-items: flex-start;
  gap: 6px 18px;
}
/* Der eigentliche Flex-Row ist bei der Profil-Aktivitäts-Ansicht der INNERE
   article (nicht die .box) — dort Abstand zwischen Avatar und Text setzen. */
article.js-comment,
.box:has(.comment-box) > article {
  margin-left: 0;
  margin-right: 0;
  align-items: flex-start;
  gap: 6px 18px;
}

/* --- Spalten: Avatar schmal, Inhalt füllt den Rest --- */
article.js-comment > div:first-child,
.comment-picture-wrapper {
  flex: 0 0 auto;
  width: auto;
  max-width: none;
  padding: 0;
}
.comment-box {
  flex: 1 1 300px;
  width: auto;
  max-width: 100%;
  padding: 0;
}
/* Ticket-Anhänge in eine eigene Zeile unter Avatar + Text. */
article.js-comment > .col:last-child {
  flex: 1 0 100%;
  margin-top: 12px;
  padding: 0;
}
article.js-comment > .col:last-child h3 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--confidence-stone-600, #79716b);
}

/* --- Avatar ---
   Selektoren decken die Varianten aus style.css ab (rounded-circle,
   center-block, img-circle), damit die alten 100–120px-#afa9ad-Regeln
   (inkl. top-Offset = „Doppelkreis") überschrieben werden. */
.comment-user-picture {
  display: flex;
}
.comment-user-picture .user-profile-image,
.comment-user-picture .user-profile-image.rounded-circle,
.comment-user-picture .user-profile-image.img-circle,
.comment-user-picture .user-profile-image.rounded-circle.center-block,
.comment-user-picture .user-profile-image.img-circle.center-block,
.comment-user-picture .profile-image {
  width: 52px;
  height: 52px;
  margin: 0;
  position: static;
  top: auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--confidence-stone-100, #f5f5f4);
  border: 1px solid var(--confidence-stone-200, #e7e5e4);
  color: var(--confidence-stone-950, #1c1917);
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  overflow: hidden;
}
.comment-user-picture .user-profile-image img,
.comment-user-picture img {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 50%;
}

/* --- Autor-Zeile --- */
.comment-box > span {
  display: block;
  color: var(--confidence-stone-500, #79716b);
  font-size: 13px;
}
.comment-box > span a {
  color: var(--confidence-stone-900, #292524);
  font-weight: 650;
  text-decoration: none;
}

/* --- Text --- */
.comment-text {
  margin: 6px 0 4px;
  color: var(--confidence-stone-800, #44403c);
  font-size: 15px;
  line-height: 1.6;
}

/* --- Links im Kommentar: Gold statt Blau --- */
.field--name-comment-body a,
.gruppen-inhalt a,
.comment-box .link,
.comment-box .link a,
.field--name-field-kommentar-text a,
.field--name-field-ticket-text a,
.comment-text a {
  color: var(--confidence-gold, #b07d1f) !important;
  text-decoration: underline;
}

/* --- Aktions-/Permalink-Zeile --- */
.comment-links {
  padding: 8px 0 0 !important;
}
.comment-links ul.inline,
.book ul.inline {
  margin: 0;
  padding: 0;
}
.comment-links ul.inline li,
.book ul.inline li {
  display: inline;
  padding: 0 12px 0 0;
  list-style-type: none;
  font-size: 13px;
}
.comment-links ul.inline li a,
.book ul.inline li a {
  color: var(--confidence-stone-500, #79716b);
  text-decoration: none;
}
.comment-links ul.inline li a:hover {
  color: var(--confidence-gold, #b07d1f);
}
.comment-box .link {
  margin: 6px 0 0;
  font-size: 13px;
}

.align-center {
  display: flex;
  justify-content: center;
}

/* --- Bild-Handling in Kommentaren (funktional) --- */
.field--name-comment-body img,
#comment-form img,
.cke_image_resizer_wrapper img,
.cke_widget_element {
  object-fit: scale-down !important;
  width: 100% !important;
  height: 100% !important;
}
.img-responsive,
.thumbnail > img,
.thumbnail a > img {
  display: block;
  max-width: 100%;
  height: auto;
}
img,
svg {
  vertical-align: middle;
}
img.img-fluid.image-style-large {
  padding: 15px;
}

/* --- Kommentar-Formular (funktional) --- */
.node-form .form-actions {
  text-align: inherit !important;
}
div#field_kommentar_media-media-library-wrapper--description {
  margin-top: 15px;
}
.form-item.js-form-item.form-type-textarea.js-form-type-textarea.form-item-field-kommentar-text-0-value.js-form-item-field-kommentar-text-0-value label {
  display: none;
}

/* --- Kommentar-Eingabeformular (CKEditor) --- */

/* Textformat-Auswahl ausblenden: lokal, bekanntes Team, full_html ist gesetzt.
   Generisch für alle Kommentar-Typen (Ticket, Gruppe …). */
.comment-form .js-filter-wrapper,
.comment-form .filter-wrapper,
.comment-form .filter-help,
div#edit-field-kommentar-text-0-format {
  display: none !important;
}

.comment-form {
  margin-top: 1rem;
}
.comment-form label {
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--confidence-stone-700, #44403c);
}

/* CKEditor im Stone-Stil: Toolbar grau, Inhaltsfläche weiß, Radius, Gold-Fokus. */
.comment-form .ck.ck-editor {
  border-radius: var(--confidence-radius, 8px);
}
.comment-form .ck.ck-editor__top .ck-toolbar,
.comment-form .ck.ck-toolbar {
  border-color: var(--confidence-stone-200, #e7e5e4);
  background: var(--confidence-stone-100, #f5f5f4);
  border-top-left-radius: var(--confidence-radius, 8px);
  border-top-right-radius: var(--confidence-radius, 8px);
}
.comment-form .ck.ck-editor__main > .ck-editor__editable,
.comment-form .ck-content {
  min-height: 120px;
  border-color: var(--confidence-stone-200, #e7e5e4);
  background: #fff;
  border-bottom-left-radius: var(--confidence-radius, 8px);
  border-bottom-right-radius: var(--confidence-radius, 8px);
}
.comment-form .ck.ck-editor__main > .ck-editor__editable.ck-focused {
  border-color: var(--confidence-gold, #b07d1f);
  box-shadow: 0 0 0 3px rgba(176, 125, 31, .16);
}

/* Fallback-Textarea (ohne JS) */
.comment-form textarea.form-textarea,
.comment-form .form-textarea {
  border: 1px solid var(--confidence-stone-200, #e7e5e4);
  border-radius: var(--confidence-radius, 8px);
  background: #fff;
}
.comment-form textarea:focus {
  outline: none;
  border-color: var(--confidence-gold, #b07d1f);
  box-shadow: 0 0 0 3px rgba(176, 125, 31, .16);
}

/* Absende-Button gold (Bootstrap-Variablen + Fallback). */
.comment-form .btn-primary,
.comment-form input[type="submit"],
.comment-form button[type="submit"] {
  --bs-btn-bg: var(--confidence-gold, #b07d1f);
  --bs-btn-border-color: var(--confidence-gold, #b07d1f);
  --bs-btn-color: #fff;
  --bs-btn-hover-bg: #946617;
  --bs-btn-hover-border-color: #946617;
  --bs-btn-hover-color: #fff;
  border-radius: var(--confidence-radius, 8px);
  background: var(--confidence-gold, #b07d1f) !important;
  border-color: var(--confidence-gold, #b07d1f) !important;
  color: #fff !important;
}
.comment-form .btn-primary:hover,
.comment-form .btn-primary:focus-visible,
.comment-form input[type="submit"]:hover,
.comment-form input[type="submit"]:focus-visible {
  background: #946617 !important;
  border-color: #946617 !important;
}
