/* MondoChat — WhatsApp-style chat layout
   Header above: 100px; footer below: 58.14px
   Override with the --hxb-mc-top and --hxb-mc-bottom CSS variables if needed. */

:root {
    --hxb-mc-top: 100px;
    --hxb-mc-bottom: 58.14px;
    --hxb-mc-bg: #efeae2;
    --hxb-mc-user-bubble: #d9fdd3;
    --hxb-mc-bot-bubble: #ffffff;
    --hxb-mc-text: #111b21;
    --hxb-mc-muted: #667781;
    --hxb-mc-accent: #00a884;
}

.hxb-mondochat-inline {
    width: 100%;
    /* Use small-viewport (svh) so the keyboard doesn't break layout on mobile.
       Fallback to vh for browsers that don't support svh yet. */
    height: calc(100vh - var(--hxb-mc-top) - var(--hxb-mc-bottom));
    height: calc(100svh - var(--hxb-mc-top) - var(--hxb-mc-bottom));
    display: flex;
    flex-direction: column;
    background: var(--hxb-mc-bg);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--hxb-mc-text);
    overflow: hidden;
}
.hxb-mondochat-inline * { box-sizing: border-box; }

/* Messages area — must be able to shrink */
.hxb-mc-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 16px 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* A "row" holds the avatar + bubble for one message */
.hxb-mc-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 100%;
}
.hxb-mc-row-user {
    flex-direction: row-reverse;
}

.hxb-mc-av {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    overflow: hidden;
    background: #cfd8dc;
    display: flex;
    align-items: center;
    justify-content: center;
}
.hxb-mc-av img { width:100%; height:100%; object-fit: cover; display:block; }
.hxb-mc-av svg { width:60%; height:60%; }

/* Spacer keeps bubbles aligned when avatar isn't shown for consecutive messages */
.hxb-mc-av-spacer { width: 36px; flex-shrink: 0; }

/* Speech bubbles */
.hxb-mc-bubble {
    max-width: calc(100% - 60px);
    padding: 7px 10px 8px;
    border-radius: 8px;
    font-size: .92rem;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    word-break: break-word;
    box-shadow: 0 1px 0.5px rgba(0,0,0,.13);
    position: relative;
}
.hxb-mc-bubble-bot {
    background: var(--hxb-mc-bot-bubble);
}
.hxb-mc-bubble-user {
    background: var(--hxb-mc-user-bubble);
}
.hxb-mc-bubble p { margin: 0 0 6px; }
.hxb-mc-bubble p:last-child { margin: 0; }
.hxb-mc-bubble ul, .hxb-mc-bubble ol { margin: 4px 0; padding-left: 18px; }
.hxb-mc-bubble strong { font-weight: 600; }
.hxb-mc-bubble a { color: var(--hxb-mc-accent); }

.hxb-mc-time {
    font-size: .65rem;
    color: var(--hxb-mc-muted);
    float: right;
    margin: 4px 0 -2px 8px;
    line-height: 1;
}

/* Suggestions / language buttons */
.hxb-mc-suggestions {
    padding: 8px 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    background: var(--hxb-mc-bg);
}
.hxb-mc-suggestion {
    background: #fff;
    border: 1px solid #d1d7db;
    border-radius: 18px;
    padding: 6px 12px;
    font-size: .82rem;
    color: var(--hxb-mc-text);
    cursor: pointer;
    font-family: inherit;
}
.hxb-mc-suggestion.hxb-mc-lang {
    font-weight: 600;
    padding: 8px 16px;
}

/* Typing dots */
.hxb-mc-typing {
    display: inline-flex;
    gap: 4px;
    padding: 6px 2px;
}
.hxb-mc-typing span {
    width: 7px; height: 7px;
    background: var(--hxb-mc-muted);
    border-radius: 50%;
    opacity: .35;
    animation: hxb-mc-bounce 1.2s infinite;
}
.hxb-mc-typing span:nth-child(2) { animation-delay: .15s; }
.hxb-mc-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes hxb-mc-bounce {
    0%, 60%, 100% { opacity: .35; transform: translateY(0); }
    30%           { opacity: 1;   transform: translateY(-4px); }
}

/* Input bar — pinned at the bottom of the chat container, fixed height */
.hxb-mc-input-bar {
    flex-shrink: 0;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 8px 10px;
    background: #f0f2f5;
    border-top: 1px solid #d1d7db;
}
.hxb-mc-input {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    border: none;
    background: #fff;
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 16px;
    font-family: inherit;
    line-height: 1.4;
    resize: none;
    outline: none;
    height: 40px;        /* default single-row height */
    min-height: 40px;
    max-height: 120px;
    overflow-y: auto;
    display: block;
}
.hxb-mc-input:focus { outline: none; box-shadow: 0 0 0 1px var(--hxb-mc-accent); }

.hxb-mc-send {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--hxb-mc-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
}
.hxb-mc-send svg { width: 18px; height: 18px; fill: #fff; }
.hxb-mc-send-arrow {
    color: #fff !important;
    font-size: 18px !important;
    line-height: 1 !important;
    display: inline-block !important;
    transform: translateX(1px);
    font-family: sans-serif;
}
.hxb-mc-send:disabled { opacity: .5; cursor: not-allowed; }
