/* Yess.Chatbot - Messenger UI v1.3.4
   Loaded explicitly through <HeadContent>; uses host tokens where available.
   Chat-specific styles stay in the module; the shared layout and Telerik theme stay unchanged. */

.yess-chatbot-messenger {
    --chat-accent: var(--yess-primary, var(--kendo-color-primary, #2563eb));
    --chat-ink: var(--yess-text, #172b4d);
    --chat-surface: var(--yess-surface, #ffffff);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.yess-chatbot-messenger .yess-chatbot-shell__intro {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 1rem 1.15rem;
    border-radius: 1rem;
    background: var(--chat-surface);
    border: 1px solid var(--kendo-color-border, #e2e8f0);
}
.yess-chatbot-messenger .yess-chatbot-shell__intro h2 { margin: 0 0 .25rem; font-size: 1.18rem; }
.yess-chatbot-messenger .yess-chatbot-shell__intro p { margin: 0; font-size: .92rem; line-height: 1.5; }
.yess-chatbot-messenger .yess-chatbot-shell__intro-icon,
.yess-chatbot-messenger .yess-chatbot-empty-state__icon {
    display: grid; place-items: center; flex: 0 0 auto;
    width: 3rem; height: 3rem; border-radius: 50%;
    background: var(--chat-accent); color: #fff; font-size: 1.2rem;
}

.yess-chatbot-messenger .yess-chatbot-panel {
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden;
    min-height: 31rem;
    border: 1px solid var(--kendo-color-border, #e2e8f0);
    border-radius: 1.15rem;
    background: var(--chat-surface);
    box-shadow: 0 10px 30px rgba(15, 23, 42, .07);
}
.yess-chatbot-messenger .yess-chatbot-panel__body {
    display: flex !important;
    flex-direction: column !important;
    gap: 1.2rem;
    min-height: 18rem;
    max-height: min(50vh, 40rem);
    padding: 1.35rem;
    overflow-y: auto !important;
    overflow-x: hidden;
    overscroll-behavior: contain;
    background-color: var(--yess-chat-background, #f1f5f9);
    background-image: radial-gradient(rgba(148,163,184,.16) .8px, transparent .8px);
    background-size: 18px 18px;
}
.yess-chatbot-messenger .yess-chatbot-empty-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 13rem; max-width: 34rem; margin: auto; padding: 1rem;
    text-align: center; color: #475569;
}
.yess-chatbot-messenger .yess-chatbot-empty-state h3 { margin: .8rem 0 .25rem; }
.yess-chatbot-messenger .yess-chatbot-empty-state p { margin: 0; }

/* Explicit message alignment and bubble backgrounds: unlike the old patch,
   these are not dependent on Razor CSS isolation / scoped styles. */
.yess-chatbot-messenger .yess-chatbot-message {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-end;
    gap: .65rem;
    width: fit-content;
    max-width: min(86%, 46rem);
    margin: 0 auto 0 0;
}
.yess-chatbot-messenger .yess-chatbot-message--user {
    flex-direction: row-reverse !important;
    margin: 0 0 0 auto;
}
.yess-chatbot-messenger .yess-chatbot-message__avatar {
    display: grid; place-items: center; flex: 0 0 2.3rem;
    width: 2.3rem; height: 2.3rem;
    border-radius: 50%; color: #fff;
    background: #0f766e; font-size: .95rem;
    box-shadow: 0 2px 6px rgba(15,23,42,.1);
}
.yess-chatbot-messenger .yess-chatbot-message--user .yess-chatbot-message__avatar {
    background: var(--chat-accent);
}
.yess-chatbot-messenger .yess-chatbot-message__content {
    display: flex; flex-direction: column; min-width: 0; gap: .3rem;
}
.yess-chatbot-messenger .yess-chatbot-message__meta {
    display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
    font-size: .76rem; color: #64748b;
}
.yess-chatbot-messenger .yess-chatbot-message--user .yess-chatbot-message__meta {
    justify-content: flex-end;
}
.yess-chatbot-messenger .yess-chatbot-message__author { font-weight: 700; }
.yess-chatbot-messenger .yess-chatbot-message__source { font-size: .73rem; }
.yess-chatbot-messenger .yess-chatbot-message__bubble {
    position: relative;
    display: block !important;
    min-width: 3rem;
    padding: .85rem 1.05rem !important;
    background: #ffffff !important;
    color: #172b4d !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 1.1rem 1.1rem 1.1rem .25rem !important;
    box-shadow: 0 3px 12px rgba(15,23,42,.06);
    overflow-wrap: anywhere;
}
.yess-chatbot-messenger .yess-chatbot-message--user .yess-chatbot-message__bubble {
    background: var(--chat-accent) !important;
    color: #ffffff !important;
    border-color: transparent !important;
    border-radius: 1.1rem 1.1rem .25rem 1.1rem !important;
}
.yess-chatbot-messenger .yess-chatbot-message__bubble::after {
    content: "";
    position: absolute;
    bottom: .28rem; left: -.33rem; right: auto;
    width: .7rem; height: .7rem; transform: rotate(45deg);
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    border-left: 1px solid #e2e8f0;
    border-right: none;
}
.yess-chatbot-messenger .yess-chatbot-message--user .yess-chatbot-message__bubble::after {
    left: auto; right: -.33rem;
    background: var(--chat-accent);
    border: 0;
}
.yess-chatbot-messenger .yess-chatbot-message__bubble p {
    margin: 0; line-height: 1.52; white-space: pre-wrap; color: inherit;
}

/* Visible search animation + messaging typing dots. */
.yess-chatbot-messenger .yess-chatbot-message__bubble--typing {
    display: inline-flex !important;
    align-items: center;
    gap: .6rem;
    min-width: 12rem;
    color: #475569 !important;
}
.yess-chatbot-messenger .yess-chatbot-search-icon {
    color: var(--chat-accent);
    animation: yess-chatbot-search 1.8s ease-in-out infinite;
}
.yess-chatbot-messenger .yess-chatbot-search-label { font-size: .9rem; }
.yess-chatbot-messenger .yess-chatbot-typing-dots { display: inline-flex; align-items: center; gap: .23rem; }
.yess-chatbot-messenger .yess-chatbot-typing-dot {
    display: inline-block;
    width: .34rem; height: .34rem; flex: 0 0 auto;
    border-radius: 50%;
    background: #64748b;
    animation: yess-chatbot-dot 1.15s ease-in-out infinite;
}
.yess-chatbot-messenger .yess-chatbot-typing-dot:nth-child(2) { animation-delay: .18s; }
.yess-chatbot-messenger .yess-chatbot-typing-dot:nth-child(3) { animation-delay: .36s; }
@keyframes yess-chatbot-search {
    0%, 100% { transform: translate(-1px, 1px) rotate(-8deg); opacity: .75; }
    50% { transform: translate(2px, -2px) rotate(12deg); opacity: 1; }
}
@keyframes yess-chatbot-dot {
    0%, 70%, 100% { transform: translateY(0); opacity: .35; }
    35% { transform: translateY(-4px); opacity: 1; }
}

.yess-chatbot-messenger .yess-chatbot-panel__footer {
    padding: 1rem 1.25rem 1.1rem;
    border-top: 1px solid var(--kendo-color-border, #e2e8f0);
    background: var(--chat-surface);
}
.yess-chatbot-messenger .yess-chatbot-composer { display: flex; flex-direction: column; gap: .55rem; }
.yess-chatbot-messenger .yess-chatbot-composer__label { font-weight: 650; }
.yess-chatbot-messenger .yess-chatbot-composer__textarea {
    width: 100%; min-height: 4.7rem; padding: .75rem .9rem;
    border-radius: .85rem; resize: vertical;
}
.yess-chatbot-messenger .yess-chatbot-composer__actions,
.yess-chatbot-messenger .yess-chatbot-escalation__actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.yess-chatbot-messenger .yess-chatbot-alert,
.yess-chatbot-messenger .yess-chatbot-escalation {
    display: flex; align-items: flex-start; gap: .8rem;
    padding: 1rem; border-radius: 1rem;
    background: #eff6ff; border: 1px solid #bfdbfe;
}
.yess-chatbot-messenger .yess-chatbot-escalation__icon { font-size: 1.2rem; color: var(--chat-accent); }
.yess-chatbot-messenger .yess-chatbot-escalation__content h3 { margin: 0 0 .35rem; }
.yess-chatbot-messenger .yess-chatbot-escalation__content p { margin: 0 0 .7rem; }
.yess-chatbot-messenger .yess-chatbot-escalation__consent { display: flex; align-items: flex-start; gap: .5rem; margin: .5rem 0; }
.yess-chatbot-messenger .yess-chatbot-alert--success { background: #f0fdf4; border-color: #bbf7d0; }

@media (max-width: 640px) {
    .yess-chatbot-messenger .yess-chatbot-panel__body { max-height: min(53vh, 35rem); padding: .85rem; }
    .yess-chatbot-messenger .yess-chatbot-message { max-width: 94%; }
    .yess-chatbot-messenger .yess-chatbot-message__avatar { width: 2rem; height: 2rem; flex-basis: 2rem; }
    .yess-chatbot-messenger .yess-chatbot-message__bubble { padding: .7rem .85rem !important; }
    .yess-chatbot-messenger .yess-chatbot-message__bubble--typing { flex-wrap: wrap; }
    .yess-chatbot-messenger .yess-chatbot-shell__intro { align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
    .yess-chatbot-messenger .yess-chatbot-search-icon,
    .yess-chatbot-messenger .yess-chatbot-typing-dot { animation: none !important; }
}

/* Anne is shown only by the standalone host; shared image layout supports both hosts. */
.yess-chatbot-anne-avatar { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 32%; border-radius: 50%; background: #fff; }
.yess-chatbot-messenger .yess-chatbot-message--bot .yess-chatbot-message__avatar:has(.yess-chatbot-anne-avatar) { background: #fff; overflow: hidden; }
.yess-chatbot-answer-image { margin: 0.85rem 0 0; max-width: 22rem; }
.yess-chatbot-answer-image img { display: block; width: 100%; max-height: 18rem; object-fit: contain; background: #fff; border: 1px solid var(--kendo-color-border,#dbe2ea); border-radius: .7rem; }
.yess-chatbot-answer-image figcaption { margin-top: .35rem; font-size: .83rem; color: var(--yess-text,#475569); }
.yess-chatbot-knowledge-image { display: block; width: 100%; max-width: 230px; max-height: 180px; object-fit: contain; border-radius: .5rem; border: 1px solid var(--kendo-color-border,#dbe2ea); margin: .4rem 0; }

/* Ticket navigation belongs to the unanswered assistant message, not a detached toolbar. */
.yess-chatbot-messenger .yess-chatbot-message__ticket-action {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    margin-top: .85rem;
    max-width: 100%;
    white-space: normal;
    text-align: start;
    text-decoration: none;
}
.yess-chatbot-messenger .yess-chatbot-message__ticket-action:focus-visible {
    outline: 2px solid var(--kendo-color-primary, #2563eb);
    outline-offset: 3px;
}
