/* ================================================================
   chatbot.css — Blue Nook Realty
   Floating real estate assistant chatbot widget
   ================================================================ */

/* ── Toggle button ──────────────────────────────────────────── */
.bnr-chat-toggle {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 9990;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--Primary, #00B0F0);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 6px 24px rgba(0, 176, 240, .50);
    transition: transform .22s, box-shadow .22s;
    outline: none;
    padding: 0;
}
.bnr-chat-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 30px rgba(0, 176, 240, .65);
}
.bnr-chat-toggle:focus-visible {
    box-shadow: 0 0 0 3px rgba(0, 176, 240, .55), 0 6px 24px rgba(0, 176, 240, .40);
}
.bnr-chat-toggle svg { pointer-events: none; }

/* Notification dot (unread indicator) */
.bnr-chat-toggle-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ff4757;
    border: 2px solid #fff;
    display: none;
}
.bnr-chat-toggle-dot.bnr-has-unread {
    display: block;
}

/* ── Chat window ────────────────────────────────────────────── */
.bnr-chat-window {
    position: fixed;
    bottom: 100px;
    right: 28px;
    z-index: 9989;
    width: 360px;
    max-width: calc(100vw - 32px);
    height: 520px;
    max-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 60px rgba(0, 0, 0, .18);
    overflow: hidden;
    transform: scale(0.9) translateY(16px);
    transform-origin: bottom right;
    opacity: 0;
    pointer-events: none;
    transition: transform .28s cubic-bezier(.16, 1, .3, 1), opacity .22s ease;
}
.bnr-chat-window.bnr-chat-open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* ── Header ─────────────────────────────────────────────────── */
.bnr-chat-header {
    background: var(--Primary, #00B0F0);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.bnr-chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,.25);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}
.bnr-chat-header-info { flex: 1; min-width: 0; }
.bnr-chat-header-name {
    color: #fff;
    font-size: .95rem;
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 2px;
}
.bnr-chat-header-status {
    color: rgba(255,255,255,.80);
    font-size: .75rem;
    display: flex;
    align-items: center;
    gap: 5px;
}
.bnr-chat-header-status::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4cd137;
    flex-shrink: 0;
}
.bnr-chat-close {
    background: none;
    border: none;
    color: rgba(255,255,255,.75);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    line-height: 1;
    font-size: 1.1rem;
    transition: color .15s, background .15s;
    outline: none;
}
.bnr-chat-close:hover { color: #fff; background: rgba(255,255,255,.15); }
.bnr-chat-close:focus-visible { box-shadow: 0 0 0 2px rgba(255,255,255,.6); }

/* ── Messages area ──────────────────────────────────────────── */
.bnr-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f7f9fc;
    scroll-behavior: smooth;
}
.bnr-chat-messages::-webkit-scrollbar { width: 5px; }
.bnr-chat-messages::-webkit-scrollbar-track { background: transparent; }
.bnr-chat-messages::-webkit-scrollbar-thumb { background: #d0d8e4; border-radius: 4px; }

/* Individual message bubbles */
.bnr-msg {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 85%;
}
.bnr-msg--bot { align-self: flex-start; }
.bnr-msg--user { align-self: flex-end; flex-direction: row-reverse; }

.bnr-msg-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--Primary, #00B0F0);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: .8rem;
}
.bnr-msg--user .bnr-msg-icon { background: #e0f5ff; color: var(--Primary, #00B0F0); }

.bnr-msg-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: .875rem;
    line-height: 1.55;
    max-width: 100%;
    word-wrap: break-word;
}
.bnr-msg--bot .bnr-msg-bubble {
    background: #fff;
    color: #222;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.bnr-msg--user .bnr-msg-bubble {
    background: var(--Primary, #00B0F0);
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* Typing indicator */
.bnr-typing .bnr-msg-bubble {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 12px 16px;
}
.bnr-typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #aab4c0;
    animation: bnrTypingBounce 1.1s infinite ease-in-out;
}
.bnr-typing-dot:nth-child(2) { animation-delay: .18s; }
.bnr-typing-dot:nth-child(3) { animation-delay: .36s; }
@keyframes bnrTypingBounce {
    0%, 80%, 100% { transform: translateY(0); }
    40%            { transform: translateY(-6px); }
}

/* Quick reply chips */
.bnr-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 4px;
    padding-left: 38px; /* align with bot bubble */
}
.bnr-chip {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1.5px solid var(--Primary, #00B0F0);
    color: var(--Primary, #00B0F0);
    font-size: .8rem;
    font-weight: 600;
    background: #fff;
    cursor: pointer;
    transition: background .15s, color .15s;
    outline: none;
    line-height: 1;
}
.bnr-chip:hover, .bnr-chip:focus-visible {
    background: var(--Primary, #00B0F0);
    color: #fff;
}

/* ── Input area ─────────────────────────────────────────────── */
.bnr-chat-input-area {
    flex-shrink: 0;
    padding: 12px 14px;
    border-top: 1px solid #eef1f5;
    background: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}
.bnr-chat-input {
    flex: 1;
    border: 1.5px solid #e0e7ef;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: .875rem;
    line-height: 1.4;
    outline: none;
    resize: none;
    background: #f7f9fc;
    color: #222;
    transition: border-color .15s;
    font-family: inherit;
    max-height: 80px;
    overflow-y: auto;
}
.bnr-chat-input:focus { border-color: var(--Primary, #00B0F0); background: #fff; }
.bnr-chat-input::placeholder { color: #aab4c0; }

.bnr-chat-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--Primary, #00B0F0);
    border: none;
    cursor: pointer;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .15s, transform .15s;
    outline: none;
    padding: 0;
}
.bnr-chat-send:hover { background: var(--Hover, #0090c5); transform: scale(1.05); }
.bnr-chat-send:focus-visible { box-shadow: 0 0 0 3px rgba(0,176,240,.5); }
.bnr-chat-send:disabled { background: #d0d8e4; cursor: not-allowed; transform: none; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 480px) {
    .bnr-chat-window {
        bottom: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    .bnr-chat-toggle {
        bottom: 18px;
        right: 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .bnr-chat-window, .bnr-chat-toggle, .bnr-chip, .bnr-chat-send { transition: none; }
    .bnr-typing-dot { animation: none; opacity: .5; }
}
