/* Rover — Property Chatbot frontend styles */
#idx-chatbot-root {
    /* These are overridden via JS from settings */
    --idx-color: #2563eb;
    --idx-color-text: #ffffff;
    --idx-user-bubble: #2563eb;
    --idx-user-text: #ffffff;
    --idx-bot-bubble: #f3f4f6;
    --idx-bot-text: #1f2937;
    --idx-chat-bg: #fafafa;
    --idx-border: #e5e7eb;

    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    color: var(--idx-bot-text);
}

/* Safety net: any SVG inside Rover gets a definite size + flex behavior.
   These are belt-and-suspenders backups for the explicit width/height
   attributes on each SVG; if a theme strips attributes or interferes
   with rendering, the icons still show at sensible sizes. */
#idx-chatbot-root svg { display: inline-block; flex-shrink: 0; }
#idx-chatbot-toggle svg { width: 32px; height: 32px; }
#idx-chatbot-header button svg { width: 16px; height: 16px; pointer-events: none; }
/* Also force pointer-events on header buttons themselves so nothing layered on
   top can accidentally swallow clicks. The close button has been reported as
   "not working" multiple times across versions, and pointer-events conflicts
   are the most common silent cause. */
#idx-chatbot-header button { pointer-events: auto !important; cursor: pointer; }
#idx-chatbot-form button[type="submit"] svg { width: 20px; height: 20px; }
.idx-bot-avatar svg { width: 18px; height: 18px; }
.idx-header-avatar svg { width: 22px; height: 22px; }

#idx-chatbot-toggle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--idx-color);
    color: var(--idx-color-text);
    /* Same white frame as the chat window — keeps the bubble visible
       against same-color page backgrounds. */
    border: 2px solid #ffffff;
    cursor: pointer;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12), 0 6px 18px rgba(0, 0, 0, 0.22);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: transform 0.2s, box-shadow 0.2s;
}
#idx-chatbot-toggle:hover {
    transform: scale(1.06);
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.22);
}
#idx-chatbot-toggle:focus-visible {
    outline: 3px solid rgba(0, 0, 0, 0.3);
    outline-offset: 3px;
}
.idx-toggle-mascot {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.idx-toggle-mascot img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}
.idx-toggle-initial {
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
}

#idx-chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 580px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 14px;
    /* Subtle frame so the chatbot stands out even when the host page uses
       the same color as Rover's brand. White ring (2px) plus a stronger
       drop shadow gives the window clear visual separation from the page. */
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12), 0 16px 48px rgba(0, 0, 0, 0.28);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.25s, height 0.25s;
}

/* CRITICAL: HTML5 `hidden` attribute uses `display: none` from the user-agent
   stylesheet — but the explicit `display: flex` above wins specificity. Without
   this rule, clicking the X button sets `win.hidden = true` but the chat
   window stays visible. This was the long-standing "close button doesn't work"
   bug. Apply `!important` because browser styles for `[hidden]` are weaker
   than any author rule. */
#idx-chatbot-window[hidden] {
    display: none !important;
}

/* Minimized — collapse to header strip; click to restore */
#idx-chatbot-window[data-state="minimized"] {
    height: 50px;
    cursor: pointer;
}
#idx-chatbot-window[data-state="minimized"] #idx-chatbot-messages,
#idx-chatbot-window[data-state="minimized"] #idx-chatbot-form {
    display: none;
}
#idx-chatbot-window[data-state="minimized"] #idx-chatbot-clear,
#idx-chatbot-window[data-state="minimized"] #idx-chatbot-maximize {
    display: none;
}

/* Maximized — wider/taller window. Buttons inside swap icons via JS */
#idx-chatbot-window[data-state="maximized"] {
    width: min(720px, calc(100vw - 32px));
    height: min(800px, calc(100vh - 100px));
}

#idx-chatbot-header {
    background: var(--idx-color);
    color: var(--idx-color-text);
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    flex-shrink: 0;
}
.idx-header-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.idx-header-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}
#idx-chatbot-title {
    flex: 1;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#idx-chatbot-clear,
#idx-chatbot-contact-btn,
#idx-chatbot-minimize,
#idx-chatbot-maximize,
#idx-chatbot-close {
    background: transparent;
    border: none;
    color: var(--idx-color-text);
    cursor: pointer;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.85;
    transition: background 0.15s, opacity 0.15s;
    padding: 0;
    flex-shrink: 0;
}
#idx-chatbot-clear:hover,
#idx-chatbot-contact-btn:hover,
#idx-chatbot-minimize:hover,
#idx-chatbot-maximize:hover,
#idx-chatbot-close:hover {
    background: rgba(255, 255, 255, 0.15);
    opacity: 1;
}

/* Contact form */
.idx-contact-form {
    align-self: stretch;
    margin-left: 34px;
    background: #fff;
    border: 1px solid var(--idx-border);
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.idx-contact-topic-label {
    font-size: 12px;
    color: var(--idx-bot-text);
    opacity: 0.75;
    margin: 0 0 4px;
}
.idx-contact-topic-label strong { color: var(--idx-color); }
.idx-contact-change-topic {
    margin-left: 6px;
    color: var(--idx-color);
    font-size: 11px;
    text-decoration: underline;
    cursor: pointer;
}
.idx-contact-form input[type="text"],
.idx-contact-form input[type="email"],
.idx-contact-form input[type="tel"],
.idx-contact-form textarea {
    padding: 8px 10px;
    border: 1px solid var(--idx-border);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    color: var(--idx-bot-text);
    background: #fff;
    width: 100%;
    box-sizing: border-box;
}
.idx-contact-form input:focus,
.idx-contact-form textarea:focus {
    outline: none;
    border-color: var(--idx-color);
}
.idx-contact-form textarea { resize: vertical; min-height: 60px; }
.idx-contact-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 4px;
}
.idx-contact-submit {
    background: var(--idx-color);
    color: var(--idx-color-text);
    border: none;
    padding: 9px 16px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    flex: 1;
}
.idx-contact-submit:hover { opacity: 0.92; }
.idx-contact-submit:disabled { opacity: 0.55; cursor: not-allowed; }
.idx-contact-cancel {
    background: transparent;
    border: none;
    color: var(--idx-bot-text);
    opacity: 0.6;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    text-decoration: underline;
}
.idx-contact-error {
    color: #dc2626;
    font-size: 12px;
    margin: 0;
}
/* Honeypot — hidden from real users */
.idx-honeypot {
    position: absolute !important;
    left: -10000px !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
}

#idx-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    background: var(--idx-chat-bg);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Bot row — avatar + bubble, aligned left */
.idx-row-bot {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    align-self: flex-start;
    max-width: 88%;
}
.idx-bot-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--idx-color);
    color: var(--idx-color-text);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-bottom: 2px;
}
.idx-bot-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}
.idx-msg-bot {
    background: var(--idx-bot-bubble);
    color: var(--idx-bot-text);
    padding: 10px 14px;
    border-radius: 14px 14px 14px 4px;
    line-height: 1.4;
}
.idx-msg-user {
    align-self: flex-end;
    background: var(--idx-user-bubble);
    color: var(--idx-user-text);
    padding: 10px 14px;
    border-radius: 14px 14px 4px 14px;
    line-height: 1.4;
    max-width: 88%;
    word-wrap: break-word;
}
.idx-msg-typing {
    align-self: flex-start;
    color: var(--idx-bot-text);
    opacity: 0.6;
    font-style: italic;
    padding: 6px 4px;
    margin-left: 34px;
}

/* Quick-reply chips */
.idx-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-self: stretch;
    margin-left: 34px;
    margin-top: 4px;
}
.idx-chip {
    background: #fff;
    border: 1.5px solid var(--idx-color);
    color: var(--idx-color);
    padding: 7px 12px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font-family: inherit;
}
.idx-chip:hover {
    background: var(--idx-color);
    color: var(--idx-color-text);
}
/* Primary chip variant — used for the "Yes, contact me" affirmative on
   the zero-result agent-contact prompt. Inverted styling so it reads as
   the recommended action, not just another tag. */
.idx-chip-primary {
    background: var(--idx-color);
    color: var(--idx-color-text);
    border-color: var(--idx-color);
}
.idx-chip-primary:hover {
    opacity: 0.9;
    background: var(--idx-color);
    color: var(--idx-color-text);
}

/* Inline link button (from canned responses with action_type=link) */
.idx-link-button {
    display: inline-block;
    margin-top: 8px;
    background: var(--idx-color);
    color: var(--idx-color-text);
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    font-size: 13px;
}
.idx-link-button:hover {
    opacity: 0.92;
    color: var(--idx-color-text);
}

/* Property cards */
.idx-properties {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-self: stretch;
    margin-left: 34px;
}
.idx-property {
    background: #fff;
    border: 1px solid var(--idx-border);
    border-radius: 10px;
    overflow: hidden;
    color: inherit;
    display: block;
    transition: transform 0.15s, box-shadow 0.15s;
}
.idx-property:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.idx-property-image-btn {
    border: 0;
    padding: 0;
    margin: 0;
    background: transparent;
    cursor: pointer;
    width: 100%;
    display: block;
    text-decoration: none;
}
.idx-property-image {
    width: 100%;
    height: 140px;
    object-fit: cover;
    background: #e5e7eb;
    display: block;
}
.idx-property-image-placeholder {
    width: 100%;
    height: 80px;
    background: linear-gradient(135deg, #e5e7eb, #f3f4f6);
}
.idx-property-body { padding: 10px 12px; }
.idx-property-price {
    font-size: 16px;
    font-weight: 700;
    color: var(--idx-color);
    margin: 0 0 4px 0;
}
/* When price isn't extractable server-side, render as a clickable link
   styled to read like a clear CTA — distinct font weight + underline so
   users immediately know they need to click to see the price */
a.idx-property-price-missing,
a.idx-detail-price.idx-property-price-missing {
    color: var(--idx-color);
    text-decoration: underline;
    cursor: pointer;
    display: inline-block;
}
a.idx-property-price-missing:hover {
    opacity: 0.8;
}
.idx-property-title {
    font-size: 13px;
    font-weight: 500;
    margin: 0 0 6px 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--idx-bot-text);
    text-decoration: none;
}
a.idx-property-title:hover { text-decoration: underline; }
.idx-property-meta {
    font-size: 12px;
    color: var(--idx-bot-text);
    opacity: 0.75;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

/* Action buttons inside property cards & detail view */
.idx-property-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}
.idx-property-action {
    flex: 1 1 0;
    min-width: 0;
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--idx-color);
    text-align: center;
    line-height: 1.2;
    text-decoration: none;
    font-family: inherit;
    transition: opacity 0.15s, background 0.15s;
}
.idx-property-action-primary {
    background: var(--idx-color);
    color: var(--idx-color-text, #fff);
}
.idx-property-action-primary:hover { opacity: 0.92; }
.idx-property-action-secondary {
    background: #fff;
    color: var(--idx-color);
}
.idx-property-action-secondary:hover { background: #f3f4f6; }

/* Mini detail view inside chat */
.idx-detail-card {
    align-self: stretch;
    background: #fff;
    border: 1px solid var(--idx-border);
    border-radius: 12px;
    overflow: hidden;
    margin: 4px 0;
}
.idx-detail-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: #e5e7eb;
    display: block;
}
.idx-detail-body { padding: 14px; }
.idx-detail-price {
    font-size: 22px;
    font-weight: 700;
    color: var(--idx-color);
    margin-bottom: 4px;
}
.idx-detail-address {
    font-size: 14px;
    color: var(--idx-bot-text);
    margin-bottom: 12px;
    line-height: 1.35;
}
.idx-detail-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
    gap: 8px;
    margin-bottom: 12px;
    padding: 10px;
    background: #f9fafb;
    border-radius: 8px;
}
.idx-detail-fact { display: flex; flex-direction: column; align-items: center; }
.idx-detail-fact-value { font-size: 16px; font-weight: 700; color: var(--idx-bot-text); }
.idx-detail-fact-label {
    font-size: 11px;
    color: var(--idx-bot-text);
    opacity: 0.6;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.idx-detail-description {
    font-size: 13px;
    line-height: 1.5;
    color: var(--idx-bot-text);
    margin: 0 0 12px 0;
}
.idx-detail-actions {
    display: flex;
    gap: 6px;
}
.idx-detail-actions .idx-property-action { padding: 9px 12px; font-size: 13px; }

/* Schedule-showing form */
.idx-schedule-form {
    align-self: stretch;
    background: #fff;
    border: 1px solid var(--idx-border);
    border-radius: 12px;
    padding: 14px;
    margin: 4px 0;
}
.idx-schedule-header {
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--idx-bot-text);
    font-size: 14px;
}
.idx-schedule-input {
    display: block;
    width: 100%;
    padding: 8px 10px;
    margin-bottom: 8px;
    border: 1px solid var(--idx-border);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    box-sizing: border-box;
    background: #fff;
    color: var(--idx-bot-text);
}
.idx-schedule-textarea { resize: vertical; min-height: 50px; }
.idx-schedule-actions { display: flex; gap: 6px; margin-top: 4px; }
.idx-schedule-status {
    margin-top: 8px;
    font-size: 12px;
    color: var(--idx-bot-text);
    opacity: 0.8;
}
.idx-schedule-success {
    padding: 12px;
    background: #ecfdf5;
    color: #047857;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
}

/* Input form */
#idx-chatbot-form {
    display: flex;
    border-top: 1px solid var(--idx-border);
    padding: 10px;
    gap: 8px;
    background: #fff;
    flex-shrink: 0;
}
#idx-chatbot-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--idx-border);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    color: var(--idx-bot-text);
    background: #fff;
}
#idx-chatbot-input:focus { border-color: var(--idx-color); }
#idx-chatbot-form button[type="submit"] {
    background: var(--idx-color);
    color: var(--idx-color-text);
    border: none;
    border-radius: 8px;
    width: 42px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
#idx-chatbot-form button[type="submit"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (max-width: 600px) {
    /* Make the ROOT container span the full bottom of the screen on mobile.
       This is the cleanest fix for the "window extends off-screen" bug:
       since #idx-chatbot-window is position:absolute, it positions itself
       relative to this root. By making root full-width, the window can
       comfortably sit anywhere within the visible viewport. The toggle
       bubble still floats in the bottom-right corner via its own positioning. */
    #idx-chatbot-root {
        bottom: 14px !important;
        right: 14px !important;
        left: auto !important;
    }

    /* Override the toggle position so it stays in the bottom-right and
       doesn't shift when we change the window anchor */
    #idx-chatbot-toggle {
        position: relative;
        z-index: 2;
    }

    /* Window: switch to position:fixed and anchor to the viewport edges
       directly. !important on the anchoring properties defeats any stale
       desktop rule the host might still be serving from CDN cache. */
    #idx-chatbot-root #idx-chatbot-window {
        position: fixed !important;
        left: 8px !important;
        right: 8px !important;
        bottom: 96px !important;
        top: auto !important;
        width: auto !important;
        max-width: none !important;
        height: auto !important;
        /* Cap height so we never push the header above the visible viewport.
           Reserve 96px below (bubble + breathing room) and 50px above
           (URL bar / notch margin). dvh adapts when the URL bar shows/hides;
           vh is the fallback for older browsers. */
        max-height: calc(100vh - 96px - 50px) !important;
        max-height: calc(100dvh - 96px - 50px) !important;
        border-radius: 12px !important;
        display: flex;
        flex-direction: column;
    }

    /* Tighter header */
    #idx-chatbot-header {
        padding: 6px 8px;
        gap: 2px;
        min-height: 48px;
        flex-shrink: 0;
    }
    #idx-chatbot-header .idx-bot-name {
        font-size: 14px;
        /* Truncate the bot name with ellipsis if header is crowded */
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 110px;
    }
    .idx-header-mascot { width: 24px !important; height: 24px !important; }

    /* Larger tap targets on mobile for header buttons */
    #idx-chatbot-clear,
    #idx-chatbot-contact-btn,
    #idx-chatbot-minimize,
    #idx-chatbot-maximize,
    #idx-chatbot-close {
        width: 38px !important;
        height: 38px !important;
        min-width: 38px;
        min-height: 38px;
        opacity: 1;
        pointer-events: auto !important;
        position: relative;
        z-index: 2;
    }
    #idx-chatbot-header button svg {
        width: 18px !important;
        height: 18px !important;
        pointer-events: none;
    }

    /* Hide ancillary buttons on mobile to keep the header roomy */
    #idx-chatbot-clear,
    #idx-chatbot-contact-btn,
    #idx-chatbot-minimize {
        display: none !important;
    }
    /* Show maximize on mobile so users can grow the window */
    #idx-chatbot-maximize {
        display: flex !important;
    }

    /* Mobile maximize state — fill viewport from bottom up, leaving 30px
       above for OS chrome / URL bar. */
    #idx-chatbot-root #idx-chatbot-window[data-state="maximized"] {
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        top: auto !important;
        width: 100vw !important;
        max-width: 100vw !important;
        height: auto !important;
        max-height: calc(100vh - 30px) !important;
        max-height: calc(100dvh - 30px) !important;
        border-radius: 12px 12px 0 0 !important;
    }

    /* Tighter messages list — less wasted gutter */
    #idx-chatbot-messages {
        padding: 8px 10px;
        gap: 8px;
    }

    /* Compact property cards on mobile — was 140px tall, now 110px */
    .idx-property-image { height: 110px; }
    .idx-property-body { padding: 8px 10px; }
    .idx-property-price { font-size: 15px; }
    .idx-property-title { font-size: 12px; }
    .idx-property-meta { font-size: 11px; gap: 8px; margin-bottom: 6px; }
    .idx-property-action { padding: 6px 8px; font-size: 11px; }

    /* Compact detail card on mobile */
    .idx-detail-image { height: 160px; }
    .idx-detail-body { padding: 12px; }
    .idx-detail-price { font-size: 18px; }
    .idx-detail-address { font-size: 13px; margin-bottom: 10px; }
    .idx-detail-facts { padding: 8px; gap: 6px; }
    .idx-detail-fact-value { font-size: 14px; }

    /* Compact form inputs */
    .idx-schedule-input { padding: 7px 9px; font-size: 13px; }

    /* Smaller toggle button */
    #idx-chatbot-toggle {
        width: 52px;
        height: 52px;
    }
    .idx-toggle-mascot { width: 28px; height: 28px; }
    #idx-chatbot-toggle svg { width: 26px; height: 26px; }

    /* Smaller bot/user message bubbles */
    .idx-message-bot, .idx-message-user {
        font-size: 13px;
        padding: 8px 10px;
        max-width: 88%;
    }

    /* Smaller input row */
    #idx-chatbot-form {
        padding: 8px;
        gap: 6px;
    }
    #idx-chatbot-input {
        font-size: 14px;
        padding: 8px 10px;
    }
    #idx-chatbot-send {
        width: 38px;
        height: 38px;
    }
}

/* Intro nudge — speech bubble next to the toggle button */
#idx-chatbot-intro {
    position: absolute;
    bottom: 80px;
    right: 0;
    background: #fff;
    color: var(--idx-bot-text);
    padding: 14px 38px 14px 16px;
    border-radius: 14px 14px 0 14px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.16);
    max-width: 260px;
    font-size: 13px;
    line-height: 1.45;
    cursor: pointer;
    animation: idx-nudge-in 0.5s ease;
}
#idx-chatbot-intro::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 22px;
    width: 0;
    height: 0;
    border: 8px solid transparent;
    border-top-color: #fff;
    border-bottom: 0;
    filter: drop-shadow(0 2px 1px rgba(0, 0, 0, 0.05));
}
.idx-intro-close {
    position: absolute;
    top: 6px;
    right: 6px;
    background: transparent;
    border: none;
    cursor: pointer;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.idx-intro-close:hover { background: rgba(0, 0, 0, 0.06); color: #1f2937; }
.idx-intro-text { color: var(--idx-bot-text); }

@keyframes idx-nudge-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Category landing page badge — used in place of the price element on rows
   that represent operator-curated category landing pages like /countryside/
   rather than individual property listings. The "Category page" label tells
   the visitor this is a navigation destination, not a single home. */
.idx-property-badge {
    display: inline-block;
    background: var(--idx-color);
    color: var(--idx-color-text);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 3px 10px;
    border-radius: 10px;
    margin-bottom: 4px;
}

/* Caption shown next to the toggle bubble on non-home pages.
   Quieter than the auto-opening intro popup — just a small label
   that says "Hi, I'm Rover — click me to find listings". Sits to
   the LEFT of the toggle bubble (since the toggle is bottom-right
   anchored), with a small triangle pointing at the dog. */
.idx-chatbot-caption {
    position: absolute;
    bottom: 14px;       /* aligns with the toggle's vertical center */
    right: 80px;        /* sits left of the 64px-wide bubble + 16px gap */
    background: #fff;
    color: #1f2937;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1), 0 6px 18px rgba(0, 0, 0, 0.18);
    border-radius: 12px;
    padding: 10px 14px;
    padding-right: 32px;
    font-size: 13px;
    line-height: 1.35;
    max-width: 240px;
    white-space: normal;
    cursor: pointer;
    user-select: none;
    /* Animate in: start invisible + slid right, fade in to visible */
    opacity: 0;
    transform: translateX(8px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 2;
}
.idx-chatbot-caption.is-visible {
    opacity: 1;
    transform: translateX(0);
}
.idx-chatbot-caption-text {
    display: inline;
}
/* Tiny pointer triangle on the right edge, pointing at the dog */
.idx-chatbot-caption::after {
    content: '';
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    border: 7px solid transparent;
    border-left-color: #fff;
    /* The shadow on the parent doesn't carry into the pseudo-element,
       so add a thin matching border below to give the triangle the
       same outline as the bubble. */
    filter: drop-shadow(1px 0 0 rgba(0, 0, 0, 0.1));
}
.idx-chatbot-caption-dismiss {
    position: absolute;
    top: 4px;
    right: 6px;
    background: transparent;
    border: 0;
    color: #6b7280;
    font-size: 18px;
    line-height: 1;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.idx-chatbot-caption-dismiss:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #1f2937;
}

/* On mobile, anchor the caption above the toggle so it doesn't push
   off the left edge of small screens. Also slightly smaller so it
   fits comfortably on phones. */
@media (max-width: 600px) {
    .idx-chatbot-caption {
        right: 14px !important;
        bottom: 86px !important;  /* above the toggle bubble */
        max-width: calc(100vw - 28px);
        font-size: 12.5px;
    }
    /* On mobile, the triangle should point DOWN toward the toggle
       below, not RIGHT (since on mobile the caption sits ABOVE the
       toggle, not beside it). */
    .idx-chatbot-caption::after {
        right: 28px;
        top: auto;
        bottom: -8px;
        transform: none;
        border-left-color: transparent;
        border-top-color: #fff;
    }
}
