/* La conversación de la demo utiliza la misma ubicación que el chat de las
   landings. No ocupa espacio en el recorrido hasta que el visitante la abre. */
.bd-chat {
    position: fixed;
    z-index: 41;
    right: max(24px, env(safe-area-inset-right, 0px));
    bottom: max(22px, env(safe-area-inset-bottom, 0px));
    max-width: calc(100vw - 32px);
    color: var(--bd-ink);
    font: inherit;
}

.bd-chat-launcher {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 48px;
    margin-left: auto;
    padding: 11px 20px;
    border: 0;
    border-radius: 40px;
    background: var(--bd-green);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 6px 25px #123f3b30;
}
.bd-chat-launcher svg { flex: none; }
.bd-chat-launcher:hover:not(:disabled),
.bd-chat-launcher[aria-expanded="true"] { background: var(--bd-dark); }

.bd-chat-panel {
    position: absolute;
    bottom: calc(100% + 10px);
    right: 0;
    width: 420px;
    max-width: calc(100vw - 32px);
    max-height: min(690px, calc(100vh - 112px));
    max-height: min(690px, calc(100dvh - 112px));
    display: flex;
    flex-direction: column;
    border: 1px solid #dce9e7;
    border-radius: 17px;
    overflow: hidden;
    background: white;
    box-shadow: 0 14px 60px #153d3830;
}
.bd-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    gap: 12px;
    padding: 13px 16px;
    background: var(--bd-green);
    color: #fff;
}
.bd-chat-header h2 { color: inherit; font-size: 16px; font-weight: 700; line-height: 1.35; margin: 0; }
.bd-chat-header p { color: inherit; font-size: 12px; opacity: .92; margin: 2px 0 0; }
.bd-chat-header button {
    display: grid;
    flex: none;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #fff;
    font-size: 27px;
    line-height: 1;
}
.bd-chat-header button:hover { background: #ffffff18; border-color: #ffffff50; }
.bd-chat-header button:focus-visible { outline-color: #fff; outline-offset: 2px; }

.bd-chat .bd-chat-content {
    min-height: 0;
    padding: 13px 15px;
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 0;
}
.bd-chat-intro { margin: 0 0 10px; font-size: 12px; color: var(--bd-muted); }
.bd-chat .bd-history { margin-bottom: 12px; }
.bd-chat .bd-history summary { padding: 5px 0; }
.bd-chat .bd-messages {
    max-height: min(210px, 28vh);
    max-height: min(210px, 28dvh);
    padding: 10px;
    background: #f6faf9;
    overscroll-behavior: contain;
}
.bd-chat .bd-msg { border: 1px solid #d6e8e5; border-radius: 10px 10px 10px 2px; }
.bd-chat .bd-msg-user { border-color: #d1dfe9; border-radius: 10px 10px 2px 10px; }
.bd-chat .bd-quick-replies { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; margin-bottom: 0; }
.bd-chat .bd-quick-reply { min-width: 0; min-height: 38px; }
.bd-chat-note { margin: 10px 0 0; padding: 9px 10px; color: #63460e; background: #fff4de; border-radius: 6px; font-size: 12px; }

.bd-chat .bd-app-nav {
    display: flex;
    align-items: stretch;
    flex-wrap: wrap;
    gap: 5px;
    margin: 12px 0 0;
    padding: 10px 0 0;
    border: 0;
    border-top: 1px solid var(--bd-border);
    background: none;
}
.bd-chat .bd-app-nav p { display: block; margin: 0 0 3px; flex-basis: 100%; font-size: 11px; }
.bd-chat .bd-menu-button {
    flex: 1 1 105px;
    width: auto;
    min-height: 36px;
    padding: 6px 9px;
    border: 1px solid #b9d7d2;
    background: #f5faf9;
    text-align: center;
    font-size: 12px;
}
.bd-chat .bd-menu-button:hover:not(:disabled),
.bd-chat .bd-menu-button.bd-selected { background: var(--bd-green); color: #fff; border-color: var(--bd-green); }

.bd-chat .bd-chat-form {
    flex-shrink: 0;
    padding: 12px 15px;
    border-top: 1px solid var(--bd-border);
    background: #fff;
}
.bd-chat .bd-ask-row textarea { min-height: 50px; max-height: 112px; }
.bd-chat .bd-ask-row .bd-button { flex: none; }

@media (max-width: 480px) {
    .bd-chat {
        right: max(12px, env(safe-area-inset-right, 0px));
        bottom: max(12px, env(safe-area-inset-bottom, 0px));
        max-width: calc(100vw - 24px);
    }
    .bd-chat-panel {
        max-width: calc(100vw - 24px);
        max-height: calc(100vh - 91px);
        max-height: calc(100dvh - 91px);
    }
    .bd-chat-launcher { padding: 10px 15px; }
    .bd-chat .bd-messages { max-height: min(180px, 26vh); max-height: min(180px, 26dvh); }
    .bd-chat .bd-ask-row textarea { font-size: 16px; }
}
@media (max-height: 480px) {
    .bd-chat-panel { overflow-y: auto; }
    .bd-chat .bd-chat-content { flex-shrink: 0; }
    .bd-chat-header { padding: 8px 13px; }
}
