/*
 * Copyright (c) 2026, Salesforce, Inc.,
 * All rights reserved.
 * For full license text, see the LICENSE.txt file
 */

/**
 * Initializes a publisher
 */
.slds-publisher {
  display: flex;

  &.slds-is-active {
    display: block;
  }

  &.slds-is-active .slds-publisher__toggle-visibility {
    display: inherit;
    height: auto;
    overflow: visible;
    width: auto;
  }

  &.slds-is-active .slds-publisher__input {
    line-height: var(--slds-g-font-lineheight-base);
    height: auto;
    max-height: 10rem;
    resize: vertical;
    padding-block-start: var(--slds-g-spacing-3);
    padding-block-end: var(--slds-g-spacing-3);
  }

  .slds-publisher__toggle-visibility {
    display: block;
    height: 0;
    overflow: hidden;
    width: 0;
    color: var(--slds-s-label-color, var(--slds-g-color-on-surface-2));
  }
}

/**
  * Abstraction of the text input styles
  */
.slds-publisher__input {
  line-height: calc(var(--slds-g-sizing-9) - var(--slds-g-sizing-1));
  padding-block: 0;
  padding-inline: var(--slds-g-spacing-4);
  resize: none;
  max-height: calc(var(--slds-g-sizing-9) - var(--slds-g-sizing-1) + 2px);
  width: 100%;
  border-radius: var(--slds-g-radius-border-2);
  font-family: inherit;
}

/**
  * Bottom row of actionable items
  */
.slds-publisher__actions > .slds-button {
  margin-inline-start: var(--slds-g-spacing-3);
}

/**
 * Initiates publisher that is specific to commenting in threads
 */
.slds-publisher_comment {
  background-color: var(--slds-g-color-surface-container-1);
  border: var(--slds-g-sizing-border-1) solid var(--slds-g-color-border-2);
  border-radius: var(--slds-g-radius-border-2);
  width: 100%;
  position: relative;
  min-height: calc(var(--slds-g-sizing-9) - var(--slds-g-sizing-1) + 2px);
  max-height: calc(var(--slds-g-sizing-9) - var(--slds-g-sizing-1) + 2px);

  &.slds-is-active {
    min-height: calc(var(--slds-g-sizing-10) + var(--slds-g-sizing-9));
    max-height: var(--slds-g-sizing-14);

    .slds-publisher__input:focus-visible {
      border-bottom-left-radius: 0;
      border-bottom-right-radius: 0;
    }
  }

  .slds-publisher__input:focus-visible {
    box-shadow: var(--slds-g-shadow-outline-focus-1);
  }

  &.slds-is-active .slds-publisher__actions {
    display: flex;
  }

  /**
   * Applies focus to comment publisher container when inside `textarea`
   */
  &.slds-has-focus {
    box-shadow: var(--slds-g-shadow-outline-focus-1);
    outline: 0;
    border-color: transparent;
    background-color: var(--slds-g-color-surface-container-1);
  }

  &.slds-has-focus .slds-publisher__input {
    line-height: var(--slds-g-font-lineheight-6);
  }

  .slds-publisher__actions {
    display: none;
    padding-block: 0 var(--slds-g-spacing-3);
    padding-inline: var(--slds-g-spacing-3);
  }

  .slds-attachments {
    padding-block: var(--slds-g-spacing-2);
    padding-inline: var(--slds-g-spacing-3);
  }
}
