/* ==========================================================================
   Bhoumik Ventures - AI chat assistant widget
   --------------------------------------------------------------------------
   Every rule is scoped under .bv-chat / #bv-chat so nothing here can reach an
   existing site element. Properties are set explicitly rather than inherited,
   because the site's global rules (white anchors, list-style:none, box-sizing)
   would otherwise bleed in.

   Palette is taken from :root in Front/style.css - navy #00305C and light blue
   #0056A5 - plus the accent cyan #00B8E0 already used across the site.
   Typography reuses the Satoshi faces loaded site-wide by Front/satoshi.css.
   ========================================================================== */

#bv-chat {
    --bv-navy: #00305C;
    --bv-navy-soft: #073f73;
    --bv-blue: #0056A5;
    --bv-cyan: #00B8E0;
    --bv-white: #ffffff;
    --bv-ink: #12263d;
    --bv-muted: #6b7f95;
    --bv-line: #e2e9f0;
    --bv-surface: #f6f9fc;

    --bv-font: 'Satoshi-Regular', 'Red Hat Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    --bv-font-medium: 'Satoshi-Medium', var(--bv-font);
    --bv-font-bold: 'Satoshi-Bold', var(--bv-font);

    position: fixed;
    right: 24px;
    bottom: 24px;
    /* Above fullpage.js sections, the fixed header and the site overlays. */
    z-index: 99999;
    font-family: var(--bv-font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--bv-ink);
    -webkit-font-smoothing: antialiased;
}

#bv-chat *,
#bv-chat *::before,
#bv-chat *::after {
    box-sizing: border-box;
}

/* --------------------------------------------------------------- launcher */

/* The mascot sits on the page on its own - no badge, no circle behind it. The
   button itself is just a transparent hit area; depth comes from a drop-shadow
   on the artwork so the silhouette casts the shadow, not a disc. */
.bv-chat__launcher {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 74px;
    height: 74px;
    margin-left: auto;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    box-shadow: none;
    cursor: pointer;
    transition: transform .25s ease;
    -webkit-appearance: none;
    appearance: none;
}

.bv-chat__launcher:hover {
    transform: translateY(-3px) scale(1.06);
}

.bv-chat__launcher:active {
    transform: translateY(-1px) scale(1.02);
}

.bv-chat__launcher:focus-visible {
    outline: 3px solid var(--bv-cyan);
    outline-offset: 4px;
    border-radius: 22px;
}

/* A gentle idle bob, so the mascot reads as friendly rather than static. */
.bv-chat__launcher-open {
    animation: bv-chat-float 3.6s ease-in-out infinite;
}

.bv-chat__launcher:hover .bv-chat__launcher-open {
    animation-play-state: paused;
}

@keyframes bv-chat-float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-3px); }
}

/* Once the panel is open the button shows a close cross, which does need a
   solid target to sit on. */
#bv-chat.is-open .bv-chat__launcher {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, var(--bv-blue) 0%, var(--bv-cyan) 100%);
    box-shadow: 0 10px 26px rgba(0, 48, 92, .38);
}

.bv-chat__launcher .bv-chat__bot {
    width: 74px;
    height: 74px;
    pointer-events: none;
    /* Shadow follows the character's outline, not a bounding box. */
    filter: drop-shadow(0 8px 14px rgba(0, 20, 40, .45));
}

.bv-chat__launcher .bv-chat__launcher-close {
    width: 26px;
    height: 26px;
    fill: none;
    stroke: var(--bv-white);
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
}

/* --------------------------------------------------------- robot mascot
   Two-tone assistant mark: a white speech bubble wearing a headset, with a
   navy face plate and white eyes and smile. Drawn from the brand tokens so it
   recolours automatically if the palette ever changes. */

.bv-chat__bot-fill {
    fill: var(--bv-white);
}

.bv-chat__bot-line {
    fill: none;
    stroke: var(--bv-white);
    stroke-width: 3.2;
    stroke-linecap: round;
}

/* The screen the eyes sit on. */
.bv-chat__bot-face {
    fill: var(--bv-navy);
}

/* Antenna light and eyes - the brand cyan already used across the site. */
.bv-chat__bot-accent {
    fill: var(--bv-cyan);
}

/* Catchlight in each eye; this is what does most of the work in making the
   character read as friendly rather than robotic. */
.bv-chat__bot-spark {
    fill: var(--bv-white);
}

/* ------------------------------------------------------------------ blink

   Each eye squashes vertically about its own centre. The origin is given in
   viewBox units against `transform-box: view-box`, rather than relying on
   fill-box, so the eyes squash in place instead of sliding across the face on
   browsers that resolve the box differently.

   The cycle is one single blink followed by a double blink, which reads as
   alive; evenly spaced blinks look mechanical. */

.bv-chat__bot-eye {
    transform-box: view-box;
    animation: bv-chat-blink 6s infinite;
    will-change: transform;
}

.bv-chat__bot-eye--left  { transform-origin: 26px 29px; }
.bv-chat__bot-eye--right { transform-origin: 38px 29px; }

@keyframes bv-chat-blink {
    0%, 41%   { transform: scaleY(1); }
    43%       { transform: scaleY(.08); }
    45%, 88%  { transform: scaleY(1); }
    90%       { transform: scaleY(.08); }
    92%       { transform: scaleY(1); }
    94%       { transform: scaleY(.08); }
    96%, 100% { transform: scaleY(1); }
}

.bv-chat__bot-smile {
    fill: none;
    stroke: var(--bv-cyan);
    stroke-width: 2.4;
    stroke-linecap: round;
}

/* Cheeks. */
.bv-chat__bot-blush {
    fill: var(--bv-cyan);
    opacity: .38;
}

.bv-chat__launcher-close { display: none; }

#bv-chat.is-open .bv-chat__launcher-open { display: none; }
#bv-chat.is-open .bv-chat__launcher-close { display: block; }

/* Attention dot on the launcher until the widget is opened once. */
.bv-chat__badge {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    border: 2px solid var(--bv-white);
    border-radius: 50%;
    background: #ff5a5f;
}

#bv-chat.is-open .bv-chat__badge,
#bv-chat.is-seen .bv-chat__badge { display: none; }

/* ------------------------------------------------------------------ panel */

.bv-chat__panel {
    position: absolute;
    right: 0;
    bottom: 78px;
    display: flex;
    flex-direction: column;
    width: 384px;
    max-width: calc(100vw - 32px);
    height: 560px;
    max-height: calc(100vh - 130px);
    overflow: hidden;
    border-radius: 18px;
    background: var(--bv-white);
    box-shadow: 0 24px 64px rgba(0, 26, 51, .28);
    opacity: 0;
    transform: translateY(14px) scale(.98);
    pointer-events: none;
    transition: opacity .22s ease, transform .22s ease;
}

#bv-chat.is-open .bv-chat__panel {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* ----------------------------------------------------------------- header */

.bv-chat__header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 16px 15px;
    background: linear-gradient(135deg, var(--bv-navy) 0%, var(--bv-blue) 100%);
    color: var(--bv-white);
}

.bv-chat__avatar {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    /* No disc here either - the mascot sits straight on the header. */
    background: transparent;
}

.bv-chat__avatar .bv-chat__bot {
    width: 42px;
    height: 42px;
}

/* The header mascot sits on the navy gradient, so the screen is lifted a shade
   to stay legible at this size. */
.bv-chat__avatar .bv-chat__bot-face {
    fill: var(--bv-blue);
}

.bv-chat__heading { flex: 1 1 auto; min-width: 0; }

.bv-chat__title {
    margin: 0;
    font-family: var(--bv-font-bold);
    font-size: 15px;
    line-height: 1.3;
    color: var(--bv-white);
    letter-spacing: .01em;
}

.bv-chat__subtitle {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    line-height: 1.3;
    color: rgba(255, 255, 255, .78);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bv-chat__header-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 2px;
}

.bv-chat__icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--bv-white);
    cursor: pointer;
    transition: background .15s ease;
    -webkit-appearance: none;
    appearance: none;
}

.bv-chat__icon-btn:hover { background: rgba(255, 255, 255, .16); }

.bv-chat__icon-btn svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ------------------------------------------------------------------- body */

.bv-chat__body {
    flex: 1 1 auto;
    padding: 18px 16px 6px;
    overflow-y: auto;
    background: var(--bv-surface);
    overscroll-behavior: contain;
}

.bv-chat__body::-webkit-scrollbar { width: 6px; }
.bv-chat__body::-webkit-scrollbar-track { background: transparent; }
.bv-chat__body::-webkit-scrollbar-thumb {
    border-radius: 4px;
    background: #cbd8e4;
}

/* --------------------------------------------------------------- messages */

.bv-chat__msg {
    display: flex;
    margin-bottom: 12px;
}

.bv-chat__msg--bot { justify-content: flex-start; }
.bv-chat__msg--user { justify-content: flex-end; }

.bv-chat__bubble {
    max-width: 84%;
    padding: 11px 14px;
    font-size: 14.5px;
    line-height: 1.55;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.bv-chat__msg--bot .bv-chat__bubble {
    border: 1px solid var(--bv-line);
    border-radius: 4px 16px 16px 16px;
    background: var(--bv-white);
    color: var(--bv-ink);
}

.bv-chat__msg--user .bv-chat__bubble {
    border-radius: 16px 4px 16px 16px;
    background: linear-gradient(135deg, var(--bv-blue) 0%, var(--bv-navy-soft) 100%);
    color: var(--bv-white);
}

.bv-chat__msg--system .bv-chat__bubble {
    max-width: 100%;
    border: 1px solid #f2d5a8;
    border-radius: 12px;
    background: #fff8ec;
    color: #8a5a11;
    font-size: 13.5px;
}

/* Links the assistant offers to on-site pages. */
.bv-chat__bubble a {
    color: var(--bv-blue);
    font-family: var(--bv-font-medium);
    text-decoration: underline;
    letter-spacing: normal;
}

.bv-chat__msg--user .bv-chat__bubble a { color: var(--bv-white); }

/* ---------------------------------------------------------- quick actions */

.bv-chat__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 2px 0 16px;
    padding: 0;
    list-style: none;
}

.bv-chat__chip {
    padding: 8px 14px;
    border: 1px solid #c7dcef;
    border-radius: 999px;
    background: var(--bv-white);
    color: var(--bv-blue);
    font-family: var(--bv-font-medium);
    font-size: 13.5px;
    line-height: 1.3;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
    -webkit-appearance: none;
    appearance: none;
}

.bv-chat__chip:hover {
    border-color: var(--bv-blue);
    background: var(--bv-blue);
    color: var(--bv-white);
}

/* ------------------------------------------------------ enquiry summary */

.bv-chat__summary {
    margin: 0 0 14px;
    border: 1px solid #c7dcef;
    border-radius: 14px;
    background: var(--bv-white);
    overflow: hidden;
}

.bv-chat__summary-head {
    padding: 10px 14px;
    background: #eef6fc;
    border-bottom: 1px solid #dbe9f5;
    font-family: var(--bv-font-bold);
    font-size: 13px;
    color: var(--bv-navy);
    text-transform: uppercase;
    letter-spacing: .06em;
}

.bv-chat__summary-rows {
    margin: 0;
    padding: 12px 14px;
    list-style: none;
}

.bv-chat__summary-rows li {
    display: flex;
    gap: 10px;
    padding: 4px 0;
    font-size: 14px;
    line-height: 1.45;
}

.bv-chat__summary-label {
    flex: 0 0 38%;
    color: var(--bv-muted);
}

.bv-chat__summary-value {
    flex: 1 1 auto;
    font-family: var(--bv-font-medium);
    color: var(--bv-ink);
    overflow-wrap: anywhere;
}

.bv-chat__summary-actions {
    display: flex;
    gap: 8px;
    padding: 0 14px 14px;
}

.bv-chat__btn {
    flex: 1 1 auto;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-family: var(--bv-font-medium);
    font-size: 14px;
    cursor: pointer;
    transition: filter .15s ease, background .15s ease;
    -webkit-appearance: none;
    appearance: none;
}

.bv-chat__btn--primary {
    background: linear-gradient(135deg, var(--bv-blue) 0%, var(--bv-cyan) 100%);
    color: var(--bv-white);
}

.bv-chat__btn--primary:hover { filter: brightness(1.07); }

.bv-chat__btn--ghost {
    border-color: #c7dcef;
    background: var(--bv-white);
    color: var(--bv-blue);
}

.bv-chat__btn--ghost:hover { background: #eef6fc; }

.bv-chat__btn[disabled] {
    opacity: .55;
    cursor: not-allowed;
}

/* ------------------------------------------------------------- typing dots */

.bv-chat__typing {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 14px 16px;
}

.bv-chat__typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #9fb4c8;
    animation: bv-chat-bounce 1.3s infinite ease-in-out;
}

.bv-chat__typing span:nth-child(2) { animation-delay: .18s; }
.bv-chat__typing span:nth-child(3) { animation-delay: .36s; }

@keyframes bv-chat-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: .45; }
    30%           { transform: translateY(-5px); opacity: 1; }
}

/* ---------------------------------------------------------------- footer */

.bv-chat__footer {
    flex: 0 0 auto;
    padding: 10px 12px 8px;
    border-top: 1px solid var(--bv-line);
    background: var(--bv-white);
}

.bv-chat__form {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin: 0;
}

.bv-chat__input {
    flex: 1 1 auto;
    max-height: 108px;
    min-height: 42px;
    padding: 11px 14px;
    border: 1px solid var(--bv-line);
    border-radius: 12px;
    background: var(--bv-surface);
    color: var(--bv-ink);
    font-family: var(--bv-font);
    font-size: 14.5px;
    line-height: 1.4;
    resize: none;
    outline: none;
    transition: border-color .15s ease, background .15s ease;
}

.bv-chat__input::placeholder { color: #9aabbd; }

.bv-chat__input:focus {
    border-color: var(--bv-cyan);
    background: var(--bv-white);
}

.bv-chat__send {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--bv-blue) 0%, var(--bv-cyan) 100%);
    cursor: pointer;
    transition: filter .15s ease, opacity .15s ease;
    -webkit-appearance: none;
    appearance: none;
}

.bv-chat__send:hover { filter: brightness(1.08); }

.bv-chat__send[disabled] {
    opacity: .5;
    cursor: not-allowed;
}

.bv-chat__send svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: var(--bv-white);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.bv-chat__disclaimer {
    margin: 7px 2px 2px;
    font-size: 11px;
    line-height: 1.4;
    color: var(--bv-muted);
    text-align: center;
}

.bv-chat__disclaimer a {
    color: var(--bv-blue);
    text-decoration: none;
    letter-spacing: normal;
}

/* ------------------------------------------------------------- responsive */

@media (max-width: 600px) {
    #bv-chat {
        right: 16px;
        bottom: 16px;
    }

    .bv-chat__launcher {
        width: 64px;
        height: 64px;
    }

    .bv-chat__launcher .bv-chat__bot {
        width: 64px;
        height: 64px;
    }

    #bv-chat.is-open .bv-chat__launcher {
        width: 48px;
        height: 48px;
    }

    .bv-chat__panel {
        position: fixed;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        /* Dynamic viewport height keeps the composer above mobile browser UI. */
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
    }

    .bv-chat__bubble { max-width: 88%; }

    .bv-chat__summary-label { flex-basis: 40%; }
}

/* On short landscape phones fall back to a full-height sheet too. */
@media (max-height: 560px) and (min-width: 601px) {
    .bv-chat__panel {
        height: calc(100vh - 100px);
    }
}

@media (prefers-reduced-motion: reduce) {
    #bv-chat .bv-chat__panel,
    #bv-chat .bv-chat__launcher,
    #bv-chat .bv-chat__launcher-open,
    #bv-chat .bv-chat__bot-eye,
    #bv-chat .bv-chat__typing span {
        transition: none;
        animation: none;
    }

    /* With the blink switched off the eyes must be left open, not mid-squash. */
    #bv-chat .bv-chat__bot-eye {
        transform: none;
    }
}
