/* Attachments in live chat — pictures, voice messages and documents inside bubbles (ChatAttachmentView) and the attach /
   record controls of the composers (ChatAttachBar). Shared by the public widget and the agent inbox, so colours come
   from currentColor and the surrounding bubble rather than from either theme. */

/* ---- In a bubble ------------------------------------------------------------------------------------------------- */

.has-attachment {
    white-space: normal !important;
}

.has-attachment .chat-att + .chat-att-caption {
    margin-block-start: 0.4rem;
}

.chat-att-caption {
    display: block;
    white-space: pre-wrap;
}

.chat-att {
    color: inherit;
    display: block;
    max-width: 100%;
    text-decoration: none;
}

.chat-att-image img {
    background: rgba(127, 127, 127, 0.15);
    border-radius: 10px;
    display: block;
    max-height: 240px;
    max-width: min(100%, 260px);
    min-height: 60px;
    min-width: 60px;
    object-fit: cover;
}

.chat-att-voice {
    align-items: center;
    display: flex;
    gap: 0.5rem;
}

.chat-att-voice audio {
    height: 36px;
    max-width: 100%;
    min-width: 0;
    width: 220px;
}

.chat-att-file {
    align-items: center;
    background: rgba(127, 127, 127, 0.16);
    border-radius: 10px;
    display: flex;
    gap: 0.6rem;
    padding: 0.5rem 0.65rem;
}

.chat-att-file svg {
    flex: none;
}

.chat-att-file:hover .chat-att-name,
.chat-att-file:focus-visible .chat-att-name {
    text-decoration: underline;
}

.chat-att-file-text {
    display: grid;
    min-width: 0;
}

.chat-att-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 14rem;
}

.chat-att-meta {
    font-size: 0.72rem;
    opacity: 0.75;
}

/* ---- Composer controls ------------------------------------------------------------------------------------------- */

.chat-attbar {
    align-items: center;
    display: inline-flex;
    flex: none;
    gap: 0.15rem;
}

.chat-att-hidden {
    border: 0;
    clip: rect(0, 0, 0, 0);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

.chat-att-btn {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 50%;
    color: inherit;
    cursor: pointer;
    display: inline-flex;
    height: 2.25rem;
    justify-content: center;
    opacity: 0.75;
    position: relative;
    width: 2.25rem;
}

.chat-att-btn:hover:not(:disabled):not(.is-disabled),
.chat-att-btn:focus-within {
    background: rgba(127, 127, 127, 0.18);
    opacity: 1;
}

.chat-att-btn:focus-visible,
.chat-att-btn:focus-within:has(:focus-visible) {
    outline: 2px solid currentColor;
    outline-offset: 1px;
}

.chat-att-btn:disabled,
.chat-att-btn.is-disabled {
    cursor: not-allowed;
    opacity: 0.35;
}

.chat-att-btn-send {
    background: #1f9d55;
    color: #fff;
    opacity: 1;
}

.chat-att-btn-send:hover:not(:disabled) {
    background: #17803f;
}

.is-recording {
    gap: 0.4rem;
}

.chat-att-rec-dot {
    animation: chat-att-pulse 1.1s ease-in-out infinite;
    background: #d93025;
    border-radius: 50%;
    flex: none;
    height: 0.7rem;
    width: 0.7rem;
}

.chat-att-rec-time {
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
}

@keyframes chat-att-pulse {
    50% { opacity: 0.25; }
}

@media (prefers-reduced-motion: reduce) {
    .chat-att-rec-dot { animation: none; }
}

.chat-att-error {
    color: #b3261e;
    flex-basis: 100%;
    font-size: 0.78rem;
    margin: 0;
}
