/* Wise Homes — floating chat widget (self-contained, shared across project pages) */
#whChatWidget {
    --whc-deep: #2C2C2C;
    --whc-dark: #1F1F1F;
    --whc-mid: #3A3A3A;
    --whc-accent: #C9A961;
    --whc-gold: #C9A961;
    --whc-gold-dk: #A8893F;
    --whc-cream: #F5F5F5;
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 9990;
    font-family: 'Montserrat', Arial, sans-serif;
}

/* Pages that already have their own floating brochure/call buttons in the
   same corner (see .sticky-button / .desktop-brochure-btn detection in
   chatbot-widget.js) — stack the widget above them instead of overlapping. */
#whChatWidget.wh-stacked {
    bottom: 170px;
}
@media (min-width: 992px) {
    #whChatWidget.wh-stacked {
        bottom: 140px;
    }
}

#whChatBubble {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--whc-gold) 0%, var(--whc-gold-dk) 100%);
    color: #2C2C2C;
    font-size: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 28px rgba(44, 44, 44, 0.35);
    transition: transform 0.25s ease;
}
#whChatBubble:hover { transform: translateY(-3px); }
#whChatBubble .wh-close-icon { display: none; }
#whChatWidget.wh-open #whChatBubble .wh-chat-icon { display: none; }
#whChatWidget.wh-open #whChatBubble .wh-close-icon { display: inline-block; }

.wh-chat-panel {
    position: absolute;
    right: 0;
    bottom: 76px;
    width: 340px;
    max-width: calc(100vw - 32px);
    height: 480px;
    max-height: calc(100vh - 140px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(44, 44, 44, 0.35);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(201, 169, 97, 0.25);
}
#whChatWidget.wh-open .wh-chat-panel { display: flex; }

.wh-chat-header {
    background: linear-gradient(135deg, var(--whc-deep) 0%, var(--whc-dark) 100%);
    color: #fff;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.wh-chat-header-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.wh-chat-avatar {
    position: relative;
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--whc-gold) 0%, var(--whc-gold-dk) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2C2C2C;
    font-size: 19px;
    overflow: hidden;
}
.wh-chat-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transform: scale(1.22);
    display: block;
}
.wh-chat-online-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #3fcf6e;
    border: 2px solid var(--whc-deep);
}
.wh-chat-header-title { font-size: 14px; font-weight: 700; line-height: 1.4; min-width: 0; }
.wh-chat-header-title small { display: block; font-weight: 400; font-size: 11px; color: var(--whc-gold); letter-spacing: 0.5px; }
.wh-chat-header button {
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wh-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    background: var(--whc-cream);
}

.wh-messages { display: flex; flex-direction: column; gap: 10px; }
.wh-msg { max-width: 84%; padding: 9px 13px; border-radius: 14px; font-size: 13px; line-height: 1.55; word-wrap: break-word; }
.wh-msg-bot { align-self: flex-start; background: #fff; border: 1px solid rgba(44, 44, 44, 0.12); color: #2C2C2C; border-bottom-left-radius: 4px; }
.wh-msg-bot a { color: var(--whc-gold-dk); font-weight: 600; text-decoration: underline; word-break: break-all; }
.wh-msg-bot a:hover { color: var(--whc-gold); }
.wh-msg-user { align-self: flex-end; background: linear-gradient(135deg, var(--whc-mid) 0%, var(--whc-deep) 100%); color: #fff; border-bottom-right-radius: 4px; }

.wh-input-err {
    color: #dc3545;
    font-size: 11px;
    padding: 0 14px;
    margin: 6px 0 0;
    display: none;
    background: #fff;
}
.wh-input-err.show { display: block; }

.wh-resend-inline {
    text-align: center;
    font-size: 11.5px;
    color: #888888;
    padding: 6px 0 0;
    background: #fff;
}
.wh-resend-inline button {
    -webkit-appearance: none;
    appearance: none;
    background: none;
    border: none;
    outline: none;
    box-shadow: none;
    border-radius: 0;
    color: var(--whc-gold-dk);
    font-weight: 700;
    cursor: pointer;
    font-size: 11.5px;
    line-height: 1.4;
    padding: 0;
    margin: 0;
    font-family: inherit;
    text-decoration: underline;
}
.wh-resend-inline button:hover { color: var(--whc-gold); }

.wh-chat-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid rgba(44, 44, 44, 0.1);
    background: #fff;
    flex-shrink: 0;
}
.wh-mobile-code {
    display: none;
    flex-shrink: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--whc-deep);
    background: var(--whc-cream);
    border: 2px solid rgba(44, 44, 44, 0.15);
    border-radius: 20px;
    padding: 9px 12px;
}
.wh-chat-input-row input {
    flex: 1;
    min-width: 0;
    border: 2px solid rgba(44, 44, 44, 0.15);
    border-radius: 20px;
    padding: 9px 14px;
    font-size: 13px;
    outline: none;
    font-family: inherit;
}
.wh-chat-input-row input:focus { border-color: var(--whc-accent); }
.wh-chat-input-row input:disabled { opacity: 0.6; }
.wh-chat-input-row button {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--whc-gold) 0%, var(--whc-gold-dk) 100%);
    color: #2C2C2C;
    font-size: 15px;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.wh-chat-input-row button:disabled { opacity: 0.5; cursor: not-allowed; }

.wh-typing { align-self: flex-start; font-size: 12px; color: #999999; font-style: italic; }

.wh-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px 0 2px;
}
.wh-quick-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 1.5px solid rgba(201, 169, 97, 0.55);
    color: var(--whc-deep);
    border-radius: 20px;
    padding: 7px 12px;
    font-size: 11.5px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.wh-quick-btn i { font-size: 13px; color: var(--whc-gold-dk); }
.wh-quick-btn:hover { background: var(--whc-gold); border-color: var(--whc-gold); color: #2C2C2C; }
.wh-quick-btn:hover i { color: #2C2C2C; }

@media (max-width: 420px) {
    #whChatWidget { right: 12px; bottom: 12px; }
    .wh-chat-panel { width: calc(100vw - 24px); }
}
/* Floating button column: the chat bubble (60px) and the page's back-to-top
   button (40px) share one vertical centre line so they never overlap.
   Plain pages: chat at the bottom, back-to-top above it.
   Stacked pages (own brochure/call buttons): those at the bottom,
   back-to-top above them, chat on top. */
body.wh-chat-on .back-to-top { right: 30px; bottom: 92px; }
@media (max-width: 420px) {
    body.wh-chat-on .back-to-top { right: 22px; bottom: 84px; }
}

/* Stacked, phones & tablets: centre the column on the 68px call button (right 24px). */
#whChatWidget.wh-stacked { right: 28px; bottom: 168px; }
body.wh-chat-stacked .back-to-top { right: 38px; bottom: 116px; }

/* Stacked, desktop: brochure pill (44px tall, right 20px) at the bottom. */
@media (min-width: 992px) {
    #whChatWidget.wh-stacked { right: 20px; bottom: 128px; }
    body.wh-chat-stacked .back-to-top { right: 30px; bottom: 76px; }
}
