@layer components {
/* Chat input - composer bar at the bottom of the chat transcript.
   Figma:
     empty mobile background node 811:71350 - 375x56
     text desktop background node 1600:138979 - 375x56
     multiline desktop background node 1600:139080 - 375x152

   The textarea grows until the multiline state height, then scrolls.
   The send action is pinned 16px from the top and 24px from the right edge. */

.psw-chat-input {
    --psw-chat-input-button-size: 40px;
    --psw-chat-input-max-textarea-height: 120px;

    box-sizing: border-box;
    position: relative;
    display: flex;
    align-items: flex-start;
    width: 100%;
    min-height: calc(var(--space-4) + var(--psw-chat-input-button-size) + var(--space-4));
    padding: var(--space-4) calc(var(--space-6) + var(--psw-chat-input-button-size) + var(--space-3)) var(--space-4) var(--space-4);
    background: var(--color-white);
    font-family: var(--font-sans);
}

@media (min-width: 640px) {
    .psw-chat-input {
        --psw-chat-input-button-size: 48px;
    }
}

.psw-chat-input__textarea {
    box-sizing: border-box;
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    min-height: 40px;
    max-height: var(--psw-chat-input-max-textarea-height);
    margin: 0;
    padding: var(--space-2) 0;
    overflow-y: hidden;
    border: 0;
    background: transparent;
    color: var(--color-content-high);
    font-family: var(--font-sans);
    font-size: var(--text-paragraph-md);
    font-weight: var(--font-weight-regular);
    line-height: var(--text-paragraph-md--line-height);
    letter-spacing: 0;
    resize: none;
}

@media (min-width: 640px) {
    .psw-chat-input__textarea {
        min-height: 48px;
        padding-top: var(--space-3);
        padding-bottom: var(--space-3);
    }
}

.psw-chat-input__textarea::placeholder {
    color: var(--color-gray-400);
    opacity: 1;
}

.psw-chat-input__textarea:focus {
    outline: none;
}

.psw-chat-input__send {
    box-sizing: border-box;
    position: absolute;
    top: var(--space-4);
    right: var(--space-6);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--psw-chat-input-button-size);
    height: var(--psw-chat-input-button-size);
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: var(--radius-max);
    background: var(--theme-primary, var(--theme-primary-default));
    color: var(--color-content-inverse);
    cursor: pointer;
    transition: background-color 120ms ease, color 120ms ease, opacity 120ms ease;
}

@media (min-width: 640px) {
    .psw-chat-input__send {
        width: var(--psw-chat-input-button-size);
        height: var(--psw-chat-input-button-size);
    }
}

.psw-chat-input__send:hover {
    background-image: linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.1));
}

.psw-chat-input__send:focus-visible {
    outline: var(--border-width-md) solid var(--color-gray-700);
    outline-offset: var(--border-width-md);
}

.psw-chat-input__send:disabled {
    background: var(--color-gray-200);
    background-image: none;
    color: var(--color-gray-400);
    cursor: not-allowed;
}

.psw-chat-input__send .psw-icon {
    color: currentColor;
    margin-left: 2px;
}

.psw-chat-input__send-icon--desktop {
    display: none;
}

@media (min-width: 640px) {
    .psw-chat-input__send-icon--mobile {
        display: none;
    }

    .psw-chat-input__send-icon--desktop {
        display: block;
    }
}
}
