/* =========================================================
   Bella Lash chat inside the agency's bubble (.bella-hero__chat,
   styled in _general.css). Closed state keeps the designed size/style: the
   "Typing..." line is now the input: an empty line with a blinking cursor.
   Once a conversation exists the bubble keeps its width and grows
   upwards; messages scroll beyond a max height.
   ========================================================= */

/* keep the bubble's designed width while chatting (agency max-width still applies) */
#modContainer .bella-hero__chat.rc-bella .bella-hero__chat-bubble {
    width: 260px;
    box-sizing: border-box;
    cursor: text;
}

/* original "Typing..." span is replaced by the input */
#modContainer .bella-hero__chat.rc-bella .bella-hero__chat-typing.rc-bella__replaced {
    display: none;
}

/* ── Conversation ───────────────────────────────────────── */

#modContainer .rc-bella__msgs {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: min(50vh, 380px);
    overflow-y: auto;
    overscroll-behavior: contain;
    margin: 6px -6px 2px 0;
    padding-right: 6px;
}

#modContainer .rc-bella__msgs:empty {
    display: none;
}

#modContainer .rc-bella__msg {
    font-size: 14px;
    line-height: 1.5;
    color: #111;
    overflow-wrap: break-word;
    hyphens: manual;
    -webkit-hyphens: manual;
    cursor: auto;
}

/* _general.css sets "* { font-size: 16px }"; keep everything inside a
   message (p, li, strong, a, ...) at the message's 14px like the CTA */
#modContainer .rc-bella__msg * {
    font-size: inherit;
    line-height: inherit;
}

#modContainer .rc-bella__msg--user {
    align-self: flex-end;
    max-width: 90%;
    padding: 6px 10px;
    background: #000;
    color: #fff;
    border-radius: 12px;
    border-bottom-right-radius: 4px;
    white-space: pre-wrap;
}

#modContainer .rc-bella__msg p,
#modContainer .rc-bella__msg ul,
#modContainer .rc-bella__msg ol {
    margin: 0 0 6px;
}

#modContainer .rc-bella__msg > :last-child {
    margin-bottom: 0;
}

#modContainer .rc-bella__msg ul,
#modContainer .rc-bella__msg ol {
    padding-left: 16px;
}

#modContainer .rc-bella__msg li {
    margin: 2px 0;
}

#modContainer .rc-bella__msg a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

#modContainer .rc-bella__msg hr {
    border: 0;
    border-top: 1px solid #e6e6e6;
    margin: 8px 0;
}

/* waiting for Bella */
#modContainer .rc-bella__dots {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

#modContainer .rc-bella__dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #777;
    animation: rc-bella-dot 1.2s infinite ease-in-out;
}

#modContainer .rc-bella__dots span:nth-child(2) { animation-delay: 0.15s; }
#modContainer .rc-bella__dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes rc-bella-dot {
    0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-3px); }
}

/* ── Input (where "Typing..." was) ──────────────────────── */

#modContainer .rc-bella__form {
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 6px;
    margin: 0;
}

/* blinking cursor on the empty line = "you can type here"; hidden once the
   input has focus (the real caret takes over) or contains text */
#modContainer .rc-bella__caret {
    display: none;
    position: absolute;
    left: 0;
    bottom: 1px;
    width: 1px;
    height: 13px;
    background: #777;
    pointer-events: none;
    animation: rc-bella-caret 1.06s steps(1, end) infinite;
}

#modContainer .rc-bella__input:placeholder-shown:not(:focus) + .rc-bella__caret {
    display: block;
}

@keyframes rc-bella-caret {
    0%, 50% { opacity: 1; }
    50.01%, 100% { opacity: 0; }
}

#modContainer .rc-bella--active .rc-bella__form {
    border-top: 1px solid #e6e6e6;
    padding-top: 8px;
    margin-top: 2px;
}

#modContainer .rc-bella__input {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
    outline: none;
    background: transparent;
    resize: none;
    overflow-y: auto;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    color: #111;
    box-shadow: none;
}

/* while empty, take exactly the space of the designed "Typing..." line */
#modContainer .rc-bella__input:placeholder-shown {
    font-size: 12px;
    line-height: normal;
}

/* the placeholder is a single space (only used to detect "empty") */
#modContainer .rc-bella__input::placeholder {
    color: transparent;
}

#modContainer .rc-bella__input:focus-visible {
    outline: none;
}

#modContainer .rc-bella__send {
    display: none;
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: #000;
    color: #fff;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

#modContainer .rc-bella--has-text .rc-bella__send {
    display: inline-flex;
}

#modContainer .rc-bella__send:disabled {
    opacity: 0.35;
    cursor: default;
}

/* ── Close / new conversation (only once a chat exists) ─── */

#modContainer .bella-hero__chat.rc-bella--active .bella-hero__chat-bubble {
    padding-top: 22px;
}

#modContainer .bella-hero__chat.rc-bella .rc-bella__reset {
    display: none;
}

#modContainer .bella-hero__chat.rc-bella--active .rc-bella__reset {
    position: absolute;
    top: 4px;
    right: 26px;
    width: 18px;
    height: 18px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #777;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    pointer-events: auto;
}

#modContainer .rc-bella__reset:hover {
    color: #111;
}

/* touch devices: 16px input text so iOS doesn't zoom on focus
   (the empty line is a few px taller than the design there) */
@media (pointer: coarse) {
    #modContainer .rc-bella__input,
    #modContainer .rc-bella__input:placeholder-shown {
        font-size: 16px;
    }

    #modContainer .rc-bella__caret {
        bottom: 2px;
        height: 15px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #modContainer .rc-bella__caret {
        animation: none;
    }

    #modContainer .rc-bella__dots span {
        animation: none;
        opacity: 0.6;
    }
}
