@layer components {
/* Chat bubble — a single message row with optional timestamp.
   Figma:
     desktop client node 1600:138791
     mobile client node 811:71356
     mobile pro/payee node 811:71366

   Sender alignment is semantic:
     pro/payee left, neutral bubble
     client    right, themed primary bubble

   The timestamp sits below the bubble content: 6px on mobile, 8px on
   desktop. */

.psw-chat-bubble {
    --psw-chat-bubble-timestamp-gap: 6px;

    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--psw-chat-bubble-timestamp-gap);
    width: 100%;
    font-family: var(--font-sans);
}

@media (min-width: 640px) {
    .psw-chat-bubble {
        --psw-chat-bubble-timestamp-gap: var(--space-2);
    }
}

.psw-chat-bubble--client {
    align-items: flex-end;
}

.psw-chat-bubble__content {
    box-sizing: border-box;
    max-width: min(240px, 100%);
    padding: var(--space-3) var(--space-4);
    overflow: hidden;
    border-radius: calc(var(--radius-lg) * 2);
}

@media (min-width: 640px) {
    .psw-chat-bubble__content {
        max-width: min(460px, 100%);
    }
}

.psw-chat-bubble--primary .psw-chat-bubble__content {
    background: var(--theme-primary, var(--theme-primary-default));
    color: var(--color-content-inverse);
}

.psw-chat-bubble--neutral .psw-chat-bubble__content {
    background: var(--color-gray-200);
    color: var(--color-content-high);
}

.psw-chat-bubble__message {
    margin: 0;
    overflow-wrap: anywhere;
    font-size: var(--text-paragraph-md);
    font-weight: var(--font-weight-regular);
    line-height: var(--text-paragraph-md--line-height);
    letter-spacing: 0;
}

.psw-chat-bubble__image {
    display: block;
    max-width: 100%;
    border-radius: var(--radius-lg);
}

.psw-chat-bubble__timestamp {
    box-sizing: border-box;
    display: flex;
    justify-content: flex-start;
    width: 100%;
    padding: 0 var(--space-4);
    color: var(--color-content-medium);
    font-size: var(--text-paragraph-xs);
    font-weight: var(--font-weight-regular);
    line-height: var(--text-paragraph-xs--line-height);
    letter-spacing: 0;
}

.psw-chat-bubble--client .psw-chat-bubble__timestamp {
    justify-content: flex-end;
}
}
