// ============================================================================
// Chatbot Message
// ============================================================================
.pf-chatbot__message {
  display: flex;
  align-items: flex-start;
  gap: var(--pf-t--global--spacer--lg);
  padding-bottom: var(--pf-t--global--spacer--lg);

  // Avatar
  // --------------------------------------------------------------------------
  &-avatar.pf-v6-c-avatar {
    --pf-v6-c-avatar--BorderRadius: 0;
    position: sticky;
    top: var(--pf-t--global--spacer--md);
    object-fit: cover;
    pointer-events: none; // prevent dragging - interferes with FileDropZone
  }

  &-avatar.pf-chatbot__message-avatar--round.pf-v6-c-avatar {
    &:not(.pf-m-xl, .pf-m-lg, .pf-m-md, .pf-m-sm) {
      --pf-v6-c-avatar--Width: 3rem;
      --pf-v6-c-avatar--Height: 3rem;
    }
    --pf-v6-c-avatar--BorderRadius: var(--pf-t--global--border--radius--pill);
  }

  // Name
  // --------------------------------------------------------------------------
  .pf-v6-c-truncate {
    --pf-v6-c-truncate--MinWidth: 0ch;
    --pf-v6-c-truncate__start--MinWidth: 0ch;
  }

  // Contents
  // --------------------------------------------------------------------------
  &-contents {
    display: flex;
    flex-direction: column;
    gap: var(--pf-t--global--spacer--sm);
    width: 100%;
  }

  // Meta data
  // --------------------------------------------------------------------------
  &-meta {
    display: flex;
    align-items: center;
    gap: var(--pf-t--global--spacer--sm);

    // Author name
    .pf-chatbot__message-name {
      font-family: var(
        --pf-v6-c-content--heading--FontFamily,
        redhatdisplayvf,
        redhatdisplay,
        helvetica,
        arial,
        sans-serif
      );
      font-weight: 600;
      font-size: var(--pf-t--global--font--size--sm);
    }

    // Badge
    .pf-v6-c-label {
      --pf-v6-c-label--FontSize: var(--pf-t--global--font--size--xs);
      font-weight: var(--pf-t--global--font--weight--body--bold);
    }

    // Timestamp
    .pf-v6-c-timestamp {
      flex: 1 0 max-content;
    }
    time {
      font-size: var(--pf-t--global--font--size--xs);
    }
  }

  // Response content
  // --------------------------------------------------------------------------
  &-response {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--pf-t--global--font--size--sm);
    color: var(--pf-t--global--text--color--regular);
  }

  &-and-actions {
    display: grid;
    gap: var(--pf-t--global--spacer--sm);
  }

  // targets footnotes specifically
  .footnotes,
  .pf-chatbot__message-text.footnotes {
    padding: var(--pf-t--global--spacer--sm) var(--pf-t--global--spacer--sm) 0 var(--pf-t--global--spacer--sm);
    --pf-chatbot-message-text-font-size: var(--pf-t--global--font--size--xs);
    --pf-chatbot-message-text-inline-code-font-size: var(--pf-t--global--font--size--xs);

    .pf-chatbot__message-text h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
      --pf-v6-c-content--h1--FontSize: var(--pf-t--global--font--size--md);
      --pf-v6-c-content--h2--FontSize: var(--pf-t--global--font--size--md);
      --pf-v6-c-content--h3--FontSize: var(--pf-t--global--font--size--md);
      --pf-v6-c-content--h4--FontSize: var(--pf-t--global--font--size--md);
      --pf-v6-c-content--h5--FontSize: var(--pf-t--global--font--size--md);
      --pf-v6-c-content--h6--FontSize: var(--pf-t--global--font--size--md);
    }
    .pf-chatbot__message-text .pf-v6-c-content,
    .pf-chatbot__message-text .pf-v6-c-content--small,
    .pf-chatbot__message-text .pf-v6-c-content--blockquote,
    .pf-chatbot__message-text p,
    .pf-chatbot__message-text a {
      --pf-v6-c-content--FontSize: var(--pf-t--global--font--size--xs);
    }
    .pf-chatbot__message-inline-code,
    .pf-chatbot__message-text .pf-v6-c-button.pf-m-link,
    .pf-chatbot__message-ordered-list .pf-v6-c-list,
    .pf-chatbot__message-ordered-list ul,
    .pf-chatbot__message-ordered-list li,
    .pf-chatbot__message-unordered-list .pf-v6-c-list,
    .pf-chatbot__message-unordered-list ul,
    .pf-chatbot__message-unordered-list li {
      font-size: var(--pf-t--global--font--size--xs);
    }
  }

  .footnotes {
    background-color: var(--pf-t--global--background--color--tertiary--default);
  }
}

// Attachments
// --------------------------------------------------------------------------
.pf-chatbot__message-attachments-container {
  display: flex;
  gap: var(--pf-t--global--spacer--md);
  flex-wrap: wrap;
}

.pf-chatbot__message-edit-buttons {
  --pf-v6-c-form__group--m-action--MarginBlockStart: 0;
}

@import './MessageLoading';
@import './CodeBlockMessage/CodeBlockMessage';
@import './TextMessage/TextMessage';
@import './SuperscriptMessage/SuperscriptMessage.scss';

// ============================================================================
// Information density styles
// ============================================================================
.pf-chatbot.pf-m-compact {
  .pf-chatbot__message {
    gap: var(--pf-t--global--spacer--sm);
    padding-bottom: var(--pf-t--global--spacer--md);

    .pf-chatbot__message-contents  {
      gap: var(--pf-t--global--spacer--xs);
    }
  }

  .pf-chatbot__message-name {
    font-size: var(--pf-t--global--font--size--xs);
  }

  .pf-chatbot__message-avatar.pf-chatbot__message-avatar--round.pf-v6-c-avatar {
    &:not(.pf-m-xl, .pf-m-lg, .pf-m-md, .pf-m-sm) {
      --pf-v6-c-avatar--Width: 1.5rem;
      --pf-v6-c-avatar--Height: 1.5rem;
    }
  }

  .pf-chatbot__message-contents {
    gap: var(--pf-t--global--spacer--xs);
  }
}
