/* Equivest concierge chatbot — sits over a blurred portal background.
   Aussie-homeowner audience. */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Equivest brand */
    --emerald-700: #047857;
    --emerald-600: #059669;
    --emerald-500: #10B981;
    --emerald-50:  #ECFDF5;

    --primary: var(--emerald-700);
    --primary-dark: #065f46;
    --primary-light: var(--emerald-500);

    --ink:        #0F1116;
    --ink-soft:   #2B2F36;
    --muted:      #5A5F69;
    --muted-soft: #8A8F99;

    --paper:      #FAFAF7;     /* the warm off-white used across Equivest */
    --card:       #FFFFFF;
    --line:       rgba(15, 17, 22, 0.10);
    --line-soft:  rgba(15, 17, 22, 0.06);

    --user-bubble: var(--emerald-700);
    --bot-bubble:  #F3F4F2;
    --bot-text:    #0F1116;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--paper);
    color: var(--ink);
    min-height: 100vh;
    overflow: hidden;
}

/* =========================================================
   Blurred mock-portal background
   ========================================================= */

.portal-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    background: var(--paper);
    /* We layer a soft white tint AND a heavy blur over the mock portal
       so it feels like the user is "looking through frosted glass" at
       a portal full of properties they can't quite read yet. */
}

.portal-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.55) 0%, rgba(255,255,255,0.78) 100%);
    z-index: 2;
    pointer-events: none;
}

.portal-bg-inner {
    position: absolute;
    inset: 0;
    filter: blur(8px) saturate(0.85);
    transform: scale(1.04); /* hide the blur edge */
    z-index: 1;
}

.portal-topbar {
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    background: #fff;
    border-bottom: 1px solid var(--line-soft);
}
.portal-topbar .topbar-logo {
    height: 28px;
    opacity: 0.9;
}
.portal-topbar .topbar-nav {
    display: flex;
    gap: 28px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 500;
}
.portal-topbar .topbar-right {
    display: flex;
    gap: 12px;
}
.portal-topbar .topbar-right .pill {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #ECECE8;
}

.portal-page-title {
    padding: 28px 32px 12px;
    font-size: 22px;
    font-weight: 700;
}

.portal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
    padding: 0 32px 32px;
}

.portal-card {
    background: var(--card);
    border: 1px solid var(--line-soft);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 18px rgba(15,17,22,0.04);
}
.portal-card .card-img {
    aspect-ratio: 16 / 10;
    background-color: #d8ddd9;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}
.portal-card .card-body {
    padding: 14px 16px 18px;
}
.portal-card .card-title {
    font-size: 14px;
    font-weight: 700;
    color: #4a4f57;
}
.portal-card .card-meta {
    margin-top: 6px;
    font-size: 12px;
    color: #8a8f99;
}
.portal-card .card-figures {
    margin-top: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.portal-card .figure-block {
    display: flex;
    flex-direction: column;
}
.portal-card .figure-label {
    font-size: 10px;
    color: #a3a8b1;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.portal-card .figure-value {
    font-size: 18px;
    font-weight: 800;
    color: #2b2f36;
}
.portal-card .card-cta {
    margin-top: 14px;
    height: 36px;
    background: var(--emerald-700);
    border-radius: 10px;
}

/* =========================================================
   Chat container — sits on top of the blurred portal
   ========================================================= */

.chat-container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 460px;
    height: 86vh;
    max-height: 760px;
    margin: 7vh auto 0;
    background: #FFFFFF;
    border-radius: 22px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow:
        0 24px 80px rgba(15, 17, 22, 0.18),
        0 4px 18px rgba(15, 17, 22, 0.08),
        0 0 0 1px rgba(15, 17, 22, 0.06);
}

.chat-header {
    background: var(--ink);
    color: #fff;
    padding: 18px 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}
.logo-img {
    height: 28px;
    width: auto;
    display: block;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}
.status-dot {
    width: 8px;
    height: 8px;
    background: var(--emerald-500);
    border-radius: 50%;
    animation: pulse 2s infinite;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
}
.status-text {
    font-size: 12px;
    color: rgba(255,255,255,0.8);
    font-weight: 500;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.7; transform: scale(0.95); }
}

/* Progress bar */
.progress-bar {
    position: relative;
    height: 4px;
    background: rgba(15,17,22,0.06);
}
.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--emerald-500), var(--emerald-700));
    transition: width 0.45s ease-out;
}
.progress-text {
    position: absolute;
    right: 12px;
    top: 8px;
    font-size: 11px;
    color: var(--muted);
    font-weight: 500;
}

/* Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px 18px 8px;
    background: #FAFAF7;
    scroll-behavior: smooth;
}

.message {
    display: flex;
    margin-bottom: 12px;
    animation: messageSlideIn 0.3s ease-out;
}
.message.user { justify-content: flex-end; }
.message.bot  { justify-content: flex-start; }

.message-bubble {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14.5px;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.message.user .message-bubble {
    background: var(--user-bubble);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.message.bot .message-bubble {
    background: var(--bot-bubble);
    color: var(--bot-text);
    border-bottom-left-radius: 4px;
}

/* When a bubble contains the final summary card, give it more room
   so the "Request access to the portal →" button stays on one line. */
.message.bot .message-bubble:has(.lead-summary-card) {
    max-width: 96%;
    background: transparent;
    padding: 0;
}

@keyframes messageSlideIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Typing indicator */
.typing-indicator {
    display: inline-block;
    padding: 12px 16px !important;
}
.typing-indicator span {
    display: inline-block;
    width: 7px;
    height: 7px;
    background: #8A8F99;
    border-radius: 50%;
    margin: 0 1px;
    animation: typingDot 1.4s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDot {
    0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
    30%           { opacity: 1;   transform: translateY(-4px); }
}

/* Input area */
.chat-input-area {
    background: #fff;
    padding: 12px 14px 14px;
    border-top: 1px solid var(--line-soft);
}

.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.quick-reply-btn {
    padding: 8px 14px;
    background: #fff;
    color: var(--emerald-700);
    border: 1.5px solid var(--emerald-700);
    border-radius: 999px;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    font-family: inherit;
}
.quick-reply-btn:hover {
    background: var(--emerald-700);
    color: #fff;
}
.quick-reply-btn.skip {
    border-color: var(--muted-soft);
    color: var(--muted);
}
.quick-reply-btn.skip:hover {
    background: var(--muted-soft);
    color: #fff;
}

.input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

#user-input {
    flex: 1;
    height: 42px;
    padding: 0 16px;
    border: 1.5px solid var(--line);
    border-radius: 999px;
    font-size: 14px;
    background: #fff;
    color: var(--ink);
    transition: border-color 0.2s ease;
    font-family: inherit;
    outline: none;
}
#user-input:focus { border-color: var(--emerald-700); }

.send-btn {
    width: 42px;
    height: 42px;
    background: var(--emerald-700);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, background 0.2s ease;
}
.send-btn:hover { background: var(--primary-dark); transform: scale(1.06); }

/* Lead summary card (shown at the end, with the Request access CTA) */
.lead-summary-card {
    background: #fff;
    padding: 16px 18px;
    border-radius: 14px;
    border: 1px solid var(--line-soft);
}
.summary-heading {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 10px;
}
.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 13.5px;
    color: var(--ink-soft);
    border-bottom: 1px dashed var(--line-soft);
}
.summary-row:last-of-type { border-bottom: none; }
.summary-label {
    color: var(--muted);
    font-weight: 500;
}
.summary-pill {
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
}
.summary-pill.hot  { background: var(--emerald-700); }
.summary-pill.warm { background: #F59E0B; }
.summary-pill.cold { background: #9CA3AF; }

.request-access-btn {
    display: block;
    width: 100%;
    margin-top: 14px;
    padding: 14px 12px;
    background: var(--emerald-700);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
    /* Keep button label on one line even on narrow viewports */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.request-access-btn:hover:not(:disabled) { background: var(--primary-dark); }
.request-access-btn:disabled { opacity: 0.7; cursor: default; }
.request-access-btn.submitted { background: var(--emerald-500); }

.request-access-help {
    margin-top: 8px;
    font-size: 12px;
    color: var(--muted);
    text-align: center;
}

/* Calendar (kept light — used if 'Book a chat' picked) */
.calendar-container {
    background: #fff;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid var(--line-soft);
}
.time-slots {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}
.time-slot {
    padding: 10px;
    background: #fff;
    border: 1.5px solid var(--emerald-700);
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    color: var(--emerald-700);
    font-weight: 500;
    font-size: 13px;
    transition: background 0.18s ease, color 0.18s ease;
}
.time-slot:hover, .time-slot.selected {
    background: var(--emerald-700);
    color: #fff;
}

/* Floating lead-score badge (debug aid, bottom-right) */
.lead-score {
    position: fixed;
    bottom: 16px;
    right: 16px;
    background: rgba(15,17,22,0.92);
    color: #fff;
    padding: 10px 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 1000;
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
    backdrop-filter: blur(10px);
}
.lead-score .label { opacity: 0.65; }
.lead-score .score {
    padding: 2px 8px;
    border-radius: 999px;
    background: #6B7280;
}
.lead-score .score.hot  { background: var(--emerald-500); }
.lead-score .score.warm { background: #F59E0B; }
.lead-score .score.cold { background: #6B7280; }

/* ==== Mobile ==== */
@media (max-width: 600px) {
    body { overflow: auto; }
    .chat-container {
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
    }
    .portal-bg { display: none; } /* hide blurred bg on mobile, full chat */
    .lead-score { bottom: 8px; right: 8px; font-size: 11px; padding: 6px 10px; }
}
