:root {
    --sharp-corner: 6px;
    --round-corner: 18px;
    --spacing: .25rem;
}

.messages {
    /*padding-top: 20px;*/
    /*padding-bottom: 12px;*/
    /*border-radius: 12px;*/
    /*border-top-left-radius: 0px;*/
    /*border-top-right-radius: 0px;*/
    /*font-family: 'Montserrat', serif;*/
    font-size: 18px;
    font-weight: 500;
}

p.message-text {
    margin-top: 0;
    margin-bottom: 0;
    white-space: pre-wrap;
}
.ios-imessage {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 17px;
    line-height: 1.4;
    font-weight: 400;
    /*color: #000000;*/
}

.avatar-container.outgoing .avatar-name {
    float: right;
    margin-top: 10px;
    margin-bottom: 0;
    margin-right: 10px;
}

.avatar-container.incoming .avatar-name {
    float: left;
    margin-top: 10px;
    margin-bottom: 0;
    margin-left: 10px;
}
.avatar-container {
    display: flow-root;
    width: 100%;
}

.message-bubble-container {
    width: 100%;
    float: right;
}

.bubble-wrapper {
    width: 100%;
    float: left;
}

.speech-bubble {
    position: relative;
    background: #f8f9fa; /* light gray like Bootstrap cards */
    border: 1px solid #dee2e6; /* subtle border */
    border-radius: 10px;
    padding: 6px 10px;
    max-width: 220px;
    font-size: 0.8rem;
}

/* Inner triangle (bubble background) */
.speech-bubble::before {
    content: "";
    position: absolute;
    bottom: -8px; /* position below the bubble */
    right: 10px; /* keep it on the right side */
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid #f8f9fa; /* point tail downward */
}

/* Outer triangle (border) */
.speech-bubble::after {
    content: "";
    position: absolute;
    bottom: -9px; /* slightly lower to appear behind */
    right: 10px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid #dee2e6; /* outline for tail */
    z-index: -1;
}

/*------*/

.message-bubble.outgoing, .avatar-bubble.outgoing {
    float: right;
}

.message-bubble.outgoing {
    background-color: #007AFF;
    color: white;
}

.message-bubble.incoming, .avatar-bubble.incoming {
    float: left;
}
/**/

/* Message bubble style */
.message-bubble {
    background-color: rgba(233, 233, 233, 0.5); /* #E0E0E0; */
    padding: 12px 16px 12px 16px;
    border-radius: 20px;
    margin-bottom: 4px;
    max-width: 90%;
    align-self: flex-start;
    font-family: ui-sans-serif, system-ui, -apple-system, "system-ui", "Segoe UI";
    color: #242424;
    font-size: 18px;
    font-weight: 500;
    box-sizing: border-box;
    white-space: normal;
    /*white-space: pre-wrap;*/
    overflow-wrap: break-word;
    text-align: start;

    padding-block: calc(var(--spacing) * 3);
    padding-inline: calc(var(--spacing) * 4);

    /*box-shadow: rgba(32, 33, 36, 0.08) 0px 2px 11px 0px;*/
    /*box-shadow: rgba(32, 33, 36, 0.22) 0px 10px 26px 0px*/

}

.avatar-bubble {
    background-color: #FFCC00;
    /*padding: 12px 12px 12px 12px;*/
    width: 40px;
    height: 40px;
    border-radius: 20px;
    margin-bottom: 4px;
    align-self: flex-start;
    font-family: ui-sans-serif, system-ui, -apple-system, "system-ui", "Segoe UI";
    color: #242424;
    display: grid;
    align-items: center;
    text-align: center;
}

/**/

.br-topleft-sharp {
    border-top-left-radius: var(--sharp-corner) !important;
}
.br-topright-sharp {
    border-top-right-radius: var(--sharp-corner) !important;
}
.br-bottomleft-sharp {
    border-bottom-left-radius: var(--sharp-corner) !important;
}
.br-bottomright-sharp {
    border-bottom-right-radius: var(--sharp-corner) !important;
}

.br-topleft-round {
    border-top-left-radius: var(--round-corner) !important;
}
.br-topright-round {
    border-top-right-radius: var(--round-corner) !important;
}
.br-bottomleft-round {
    border-bottom-left-radius: var(--round-corner) !important;
}
.br-bottomright-round {
    border-bottom-right-radius: var(--round-corner) !important;
}

/**/

.message-bubble.incoming.start.end {
    border-top-left-radius: var(--sharp-corner) !important;
    border-bottom-left-radius: var(--sharp-corner) !important;
}
.message-bubble.incoming.middle {
    border-top-left-radius: var(--sharp-corner) !important;
    border-bottom-left-radius: var(--sharp-corner) !important;
}
.message-bubble.incoming.end {
    border-top-left-radius: var(--sharp-corner) !important;
}
/*---*/
.message-bubble.outgoing.start.end {
    border-top-right-radius: var(--sharp-corner) !important;
    border-bottom-right-radius: var(--sharp-corner) !important;
}
.message-bubble.outgoing.middle {
    border-top-right-radius: var(--sharp-corner) !important;
    border-bottom-right-radius: var(--sharp-corner) !important;
}
.message-bubble.outgoing.end {
    border-top-right-radius: var(--sharp-corner) !important;
}

/**/
.character-counter {
    float: right;
    text-align: right;
    width: 100%;
    color: #9E9E9E;
    margin-top: 2px;
    margin-right: 5px;
    font-size: 10px;
    font-weight: normal;
    padding: 4px 12px;
}

.chat-input-tip-below-left {
    float: left;
    text-align: left;
    width: 100%;
    color: #9E9E9E;
    margin-top: 2px;
    margin-right: 5px;
    font-size: 10px;
    font-weight: normal;
    padding: 4px 12px;
}

.character-counter.limit {
    color: red;
}
/**/

/**/

.bubble-wrapper {
    animation: fadeInUp 0.3s ease forwards;
}

/*   CHAT MESSAGES */

.messages-scrollview {
    width: 100% !important;
    height: 100% !important;
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column-reverse;
    justify-content: flex-start;
    overflow: auto;
}
.messages-wrap {
    min-height: unset !important;
    height: auto !important;
    align-items: center;
    padding-top: 84px;
    /*display: flex;*/
    /*flex-direction: column;*/
    /*min-height: 100%;  !* let it expand naturally *!*/
    /*flex-direction: column-reverse !important; !* newest at bottom *!*/
    /*justify-content: flex-start !important;*/
    /* keeps items anchored from bottom */
    /*padding-bottom: 45px;*/
    /*overflow: auto !important;*/
}

#messages {
    /*flex: 1 1 auto;    !* grow to fill remaining space *!*/
    /*overflow-y: auto;*/
    /*margin-top: 1rem;*/

    width: 100%;
    max-width: 860px;
    padding: 0 12px;

    display: flex;
    flex-direction: column; /* newest at bottom */
    /*justify-content: flex-start;*/
    /* keeps items anchored from bottom */
    overflow-y: auto;
    flex: 1 1 auto;
    /*gap: 8px;*/
}

.chat-inputs-wrap{
    width:100%;
    max-width:640px;
    margin-top:12px;
    padding:0 12px;
}
.chatbox {
    display:flex;
    align-items:center;
    gap:12px;
    border-radius:24px;
    border:1px solid #dfe1e5;
    /*height:48px;*/
    padding:6px 12px;
    box-shadow: rgba(32, 33, 36, 0.18) 0px 1px 6px 0px;
    transition: box-shadow .14s ease, transform .08s ease;
    background: #fff;
}
.chatbox textarea{
    border:0;
    outline:0;
    font-size:16px;
    flex:1;
    min-width:0;
    height: 35px;
    min-height: 35px;
    padding:6px 4px;
    max-height: 200px;   /* cap */
    overflow-y: auto;    /* scrollbar after cap */
}

.chat-input {
    /*border: 1px solid #dfe1e5;*/
    border-radius: 24px;
    padding: 6px 12px;
    font-size: 16px;
    min-height: 35px;
    max-height: 200px;
    overflow-y: auto;
    outline: none;
    width: 100%;
    white-space: pre-wrap; /* allow line breaks */
    word-break: break-word;
    line-height: 1.4;
}

[contenteditable][data-placeholder]::before {
    content: attr(data-placeholder);
    color: #5f6368;
    pointer-events: none;
    display: block;
}

[contenteditable][data-placeholder].has-text::before {
    content: '';
}

/* Grayed out when disabled */
[contenteditable="false"] {
    /*background: #f0f0f0;*/
    color: #888;
    pointer-events: none; /* prevent clicks and caret */
    user-select: none;    /* optional: block text selection */
}

/* Normal editable state */
[contenteditable="true"] {
    /*background: #fff;*/
}

/**/

.chatbox.insert-mode {
    background-color: #fff3cd36 !important;
}

/*!* placeholder styling *!*/
/*.chat-input:empty::before {*/
/*    content: attr(data-placeholder);*/
/*    color: #5f6368;*/
/*    pointer-events: none;*/
/*    display: block;*/
/*}*/

/*.chat-input.has-content::before {*/
/*    content: '';*/
/*}*/

.chatbox .material-icons{ color:#5f6368; font-size:22px; cursor:pointer }
.chatbox:focus-within{ box-shadow: 0 4px 20px rgba(32,33,36,0.12), 0 0 0 3px var(--ntp-focus-shadow-color); }



section.bottom-inputs {
    position: fixed;
    bottom: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 10px;
    background: linear-gradient(to top, white 70%, rgba(255,255,255,0) 100%);
    z-index: 10;
}