/* WebChat UI - mobile-first. Isolato dal tema XAF Fluent del portale.
   Variabili tema sovrascrivibili dal host con :root o classe wrapper. */
.vp-chat-root {
    --vp-chat-bg: #ffffff;
    --vp-chat-fg: #1f1f1f;
    --vp-chat-muted: #6f6f6f;
    --vp-chat-border: #e1e1e1;
    --vp-chat-accent: #0078d4;
    --vp-chat-accent-fg: #ffffff;
    --vp-chat-bubble-other: #f1f3f5;
    --vp-chat-bubble-mine: #e7f1fb;

    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 320px;
    background: var(--vp-chat-bg);
    color: var(--vp-chat-fg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
}

.vp-chat-topbar {
    flex: 0 0 auto;
    padding: 8px 10px;
    border-bottom: 1px solid var(--vp-chat-border);
    background: var(--vp-chat-bg);
}

.vp-chat-topic-combo {
    width: 100%;
    height: 38px;
    padding: 6px 10px;
    border: 1px solid var(--vp-chat-border);
    border-radius: 6px;
    background: var(--vp-chat-bg);
    color: var(--vp-chat-fg);
    font-size: 14px;
}

.vp-chat-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #fafafa;
}

.vp-chat-empty,
.vp-chat-loading {
    color: var(--vp-chat-muted);
    font-style: italic;
    text-align: center;
    margin-top: 16px;
}

.vp-chat-bubble {
    max-width: 80%;
    padding: 8px 10px;
    border-radius: 12px;
    line-height: 1.35;
    word-break: break-word;
}

.vp-chat-bubble-other {
    align-self: flex-start;
    background: var(--vp-chat-bubble-other);
    border-bottom-left-radius: 4px;
}

.vp-chat-bubble-mine {
    align-self: flex-end;
    background: var(--vp-chat-bubble-mine);
    border-bottom-right-radius: 4px;
}

.vp-chat-bubble-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 11px;
    color: var(--vp-chat-muted);
    margin-bottom: 2px;
}

.vp-chat-bubble-sender {
    font-weight: 600;
}

.vp-chat-bubble-body {
    white-space: pre-wrap;
}

.vp-chat-bubble-attachments {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 4px;
}

.vp-chat-attachment-link {
    color: var(--vp-chat-accent);
    text-decoration: none;
    font-size: 12px;
}

.vp-chat-attachment-link:hover {
    text-decoration: underline;
}

.vp-chat-composer {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-end;
    gap: 6px;
    padding: 8px;
    border-top: 1px solid var(--vp-chat-border);
    background: var(--vp-chat-bg);
}

.vp-chat-textarea {
    flex: 1 1 auto;
    min-height: 38px;
    max-height: 140px;
    padding: 8px 10px;
    border: 1px solid var(--vp-chat-border);
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
}

.vp-chat-send-button {
    height: 38px;
    padding: 0 14px;
    background: var(--vp-chat-accent);
    color: var(--vp-chat-accent-fg);
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

.vp-chat-send-button:disabled {
    opacity: 0.5;
    cursor: default;
}

.vp-chat-attach-button {
    width: 38px;
    height: 38px;
    border: 1px solid var(--vp-chat-border);
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    color: var(--vp-chat-accent);
    background: var(--vp-chat-bg);
}

.vp-chat-attach-input {
    display: none;
}

@media (min-width: 720px) {
    .vp-chat-root { font-size: 15px; }
    .vp-chat-bubble { max-width: 70%; }
}
