/* ==========================================================================
   One Health Assistant — UI
   Built from Figma: "iPhone 14 & 15 Pro Max" -3 (default), -5 (FAQ hover/active), -4 (conversation)
   ========================================================================== */
@font-face {
    font-family: "NeueHaasDisplayRoman";
    src: url("./NeueHaasDisplay-Roman.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

:root {
    /* Brand */
    --oh-pink: #E43591;
    --oh-pink-dark: #c9277e;
    --oh-purple: #6A2A78;
    --oh-navy: #12284B;
    --oh-navy-deep: #0C203F;
    --oh-green: #40B86B;
    --oh-blue: #1A4A99;
    --oh-yellow: #FBB520;
    --oh-teal: #126165;

    /* Surfaces & text */
    --oh-white: #ffffff;
    --oh-bg: #F4F0EC;
    --oh-border: #D0D0D0;
    --oh-border-soft: #E3E3E3;
    --oh-text: #12284B;
    --oh-body: #212121;
    --oh-muted: #747474;
    --oh-placeholder: #676565;

    /* Typography */
    --oh-font: "NeueHaasDisplayRoman", "Neue Haas Grotesk Display Pro", "Helvetica Neue", Helvetica, Arial, sans-serif;
    --oh-font-heading: "Nicholas", "NeueHaasDisplayRoman", sans-serif;

    /* Layout */
    --oh-width: 430px;
    --oh-width-expanded: 560px;
    --oh-radius: 20px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--oh-font);
}

button,
input,
textarea,
select {
    font-family: var(--oh-font);
}

.welcome-card .dot {
    font-size: 24px;
    font-weight: 400;
    font-family: "Nicholas";
    font-style: italic;
    letter-spacing: 0.5px;
    line-height: 1;
    display: inline-block;
    margin-bottom: 5px;
}
.welcome-card .dot span {
    color: #E43591;
}

/* ==========================================================================
   Launcher
   ========================================================================== */

/* ==========================================================================
   Launcher  — "Ask Dot" pill with speech-bubble tail (Figma: Group 25, 134×74)
   REPLACES the whole existing "Launcher" section (from #chat-toggle { down to
   and including #chat-toggle.is-open .close-icon {...}), and also remove the
   stray .welcome-card .dot rules if you no longer use them there.
   ========================================================================== */

#chat-toggle {
    position: fixed;
    right: 25px;
    bottom: 40px;                    /* pill is 59px tall + 15px tail below = 25px from the edge */
    width: 134px;                    /* closed: pill */
    height: 59px;
    padding: 0 20px 0 15px;
    border: 0;
    border-radius: 50px;
    background: var(--oh-navy-deep);
    color: var(--oh-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    white-space: nowrap;
    filter: drop-shadow(0 10px 18px rgba(12, 32, 63, .22));   /* drop-shadow so the tail casts one too */
    z-index: 99999;
    transition: width .3s ease, padding .3s ease, transform .3s ease, filter .3s ease;
}

/* Speech-bubble tail */
#chat-toggle::after {
    content: "";
    position: absolute;
    top: 52px;
    right: 24px;
    width: 22px;
    height: 22px;
    background: var(--oh-navy-deep);
    clip-path: polygon(100% 0, 0 27.9%, 100% 100%);
    transition: opacity .2s ease;
}

#chat-toggle:hover {
    transform: translateY(-2px);
    filter: drop-shadow(0 14px 22px rgba(12, 32, 63, .30));
}

#chat-toggle:focus-visible,
.chat-action:focus-visible,
#chat-send:focus-visible,
.faq-question:focus-visible,
.message-cta:focus-visible {
    outline: 3px solid rgba(228, 49, 146, .45);
    outline-offset: 2px;
}

/* Icon + label */
#chat-toggle .chat-icon {
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 1;
    transition: opacity .22s ease, transform .3s ease;
}

#chat-toggle .chat-icon svg {
    flex: 0 0 29px;
    width: 29px;
    height: 29px;
}

#chat-toggle .ask-dot-label {
    font-family: var(--oh-font);
    font-size: 18px;
    line-height: 1;
    color: var(--oh-white);
}

/* Close icon (shown while the chat is open) */
#chat-toggle .close-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    opacity: 0;
    transform: rotate(-90deg) scale(.7);
    transition: opacity .22s ease, transform .3s ease;
}

/* Open state: pill collapses to a 59px circle with an X, tail tucks away */
#chat-toggle.is-open {
    width: 59px;
    padding: 0;
}

#chat-toggle.is-open::after { opacity: 0; }

#chat-toggle.is-open .chat-icon {
    opacity: 0;
    transform: scale(.7);
}

#chat-toggle.is-open .close-icon {
    opacity: 1;
    transform: rotate(0) scale(1);
}

/* ==========================================================================
   Widget shell
   ========================================================================== */

.chat-widget {
    position: fixed;
    right: 25px;
    bottom: 112px;                              /* clears the 72px launcher */
    width: var(--oh-width);
    max-width: calc(100vw - 30px);
    height: 772px;
    max-height: calc(100vh - 137px);
    max-height: calc(100dvh - 137px);
    background: var(--oh-bg);
    border-radius: var(--oh-radius);
    box-shadow: 0 20px 60px rgba(18, 40, 75, .24);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 99998;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(18px) scale(.97);
    transform-origin: bottom right;
    transition: opacity .28s ease, transform .28s ease, visibility .28s ease, width .3s ease, height .3s ease;
}

.chat-widget.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.chat-widget.is-expanded {
    width: var(--oh-width-expanded);
    height: calc(100vh - 137px);
    height: calc(100dvh - 137px);
}

/* ==========================================================================
   Header (hero image + brand + window actions)
   ========================================================================== */

.chat-header {
    position: relative;
    flex: 0 0 120px;
    height: 120px;
    color: var(--oh-white);
}

.chat-hero {
    position: absolute;
    inset: 0;
    /*background: url("hero.jpg") center 35% / cover no-repeat;*/
    background-color: var(--oh-navy);
}

/*.chat-hero::after {                      */
/*    content: "";*/
/*    position: absolute;*/
/*    inset: 0;*/
/*    background: linear-gradient(93.96deg, rgba(255, 255, 255, 0.6) 18.03%, rgba(255, 255, 255, 0) 73.91%);*/
/*}*/

.chat-brand {
    position: absolute;
    top: 30px;
    left: 20px;
    width: 186px;
}

.oh-logo {
    display: block;
    width: 169px;
    height: 27px;
}

.chat-tagline {
    margin: 16px 0 0;
    font-size: 14px;
    line-height: 1.2;
    color: var(--oh-navy);
}

.chat-actions {
    position: absolute;
    top: 25px;
    right: 20px;
    display: flex;
    gap: 10px;
}

.chat-action {
    width: 35px;
    height: 35px;
    padding: 0;
    border: 1px solid #9a9a9a;
    border-radius: 50%;
    background: var(--oh-white);
    color: var(--oh-navy);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color .2s ease, transform .2s ease, color .2s ease, border-color .2s ease;
}

.chat-action svg { width: 12px; height: 12px; }

.chat-action:hover {
    background: var(--oh-navy);
    color: var(--oh-white);
}

#chat-expand .ico-collapse { display: none; }
.chat-widget.is-expanded #chat-expand .ico-expand { display: none; }
.chat-widget.is-expanded #chat-expand .ico-collapse { display: block; }

/* ==========================================================================
   Body — overlaps hero by 30px with rounded top
   ========================================================================== */

.chat-body {
    position: relative;
    flex: 1;
    min-height: 0;
    margin-top: -30px;
    display: flex;
    flex-direction: column;
    background: var(--oh-bg);
    border-radius: var(--oh-radius) var(--oh-radius) 0 0;
}

.chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 24px 20px 20px;
    scroll-behavior: smooth;
    overscroll-behavior: contain;
}

.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(18, 40, 75, .18); border-radius: 6px; }

/* ==========================================================================
   Intro: welcome card, heading, FAQs
   ========================================================================== */

.chat-intro.is-leaving {
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity .22s ease, transform .22s ease;
}

.oh-spark {
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    fill: var(--oh-pink);
}

.welcome-card {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 20px 10px 20px 10px;
    background: var(--oh-white);
    border: 1px solid var(--oh-border);
    border-radius: 10px;
    animation: messageIn .3s ease both;
}

.welcome-card p {
    margin: 0;
    font-size: 14px;
    line-height: 1.2;
    color: var(--oh-navy);
}

.faq-section { margin-top: 18px; }

.faq-title {
    margin: 0;
    font-family: var(--oh-font-heading);
    font-size: 25px;
    font-weight: 400;
    line-height: 1;
    color: var(--oh-navy);
}

.faq-dots {
    display: flex;
    gap: 2px;
    margin: 12px 0 20px;
}

.faq-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.faq-dots span:nth-child(1) { background: var(--oh-green); }
.faq-dots span:nth-child(2) { background: var(--oh-blue); }
.faq-dots span:nth-child(3) { background: var(--oh-purple); }
.faq-dots span:nth-child(4) { background: var(--oh-pink); }
.faq-dots span:nth-child(5) { background: var(--oh-yellow); }
.faq-dots span:nth-child(6) { background: var(--oh-teal); }

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding-bottom: 20px;
}

.faq-question {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 11px;
    width: 100%;
    min-height: 51px;
    padding: 0 15px;
    border: 1px solid var(--oh-border);
    border-radius: 10px;
    background: var(--oh-white);
    color: var(--oh-navy);
    font-family: var(--oh-font);
    font-size: 15px;
    line-height: 1.2;
    text-align: left;
    cursor: pointer;
    animation: messageIn .3s ease both;
    transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}

.faq-question svg {
    flex: 0 0 auto;
    width: 7px;
    height: 11px;
    stroke: var(--oh-pink);
    transition: stroke .2s ease, transform .2s ease;
}

/* Variant -5: hover / active */
.faq-question:hover,
.faq-question:active,
.faq-question:focus-visible {
    background: var(--oh-pink);
    border-color: var(--oh-pink);
    color: var(--oh-white);
}

.faq-question:hover svg,
.faq-question:active svg,
.faq-question:focus-visible svg {
    stroke: var(--oh-white);
    transform: translateX(2px);
}

/* ==========================================================================
   Conversation (variant -4)
   ========================================================================== */

.message {
    display: flex;
    flex-direction: column;
    margin-bottom: 10px;
    animation: messageIn .25s ease both;
}

.message.bot  { align-items: stretch; }
.message.user { align-items: flex-end; }

.message-text {
    font-size: 15px;
    overflow-wrap: anywhere;
    white-space: pre-line;
}

/* User bubble — navy, square bottom-right */
.message.user .message-text {
    max-width: 85%;
    padding: 15px;
    border-radius: 19px 19px 0 19px;
    background: var(--oh-navy);
    color: var(--oh-white);
    line-height: 1.3;
}

/* Bot bubble — white card, square bottom-left, holds answer + CTA pills */
.bot-bubble {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 15px 16px 16px 15px;
    background: var(--oh-white);
    border: 1px solid var(--oh-border);
    border-radius: 19px 19px 19px 0;
}

.message.bot .message-text {
    color: var(--oh-body);
    line-height: 21px;
}

.message-ctas {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.message-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 49px;
    padding: 0 23px;
    border-radius: 500px;
    background-color: var(--oh-pink);
    color: var(--oh-white);
    font-family: var(--oh-font);
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    text-align: center;
    text-decoration: none;
    transition: transform .2s ease, filter .2s ease, box-shadow .2s ease;
}

.message-ctas:only-child .message-cta:only-child { padding: 0 30px; }

.message-cta.cta-2 { background-color: var(--oh-purple); }
.message-cta.cta-3 { background-color: var(--oh-blue); }
.message-cta.cta-4 { background-color: var(--oh-teal); }

.message-cta:hover {
    color: var(--oh-white);
    transform: translateY(-1px);
    filter: brightness(.92);
    box-shadow: 0 6px 16px rgba(18, 40, 75, .18);
}

/* Typing indicator */
.typing .bot-bubble {
    align-self: flex-start;
    flex-direction: row;
    padding: 17px 18px;
}

.thinking-dots { display: flex; gap: 5px; }

.thinking-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--oh-pink);
    animation: thinking 1.1s infinite ease-in-out;
}

.thinking-dots span:nth-child(2) { animation-delay: .15s; }
.thinking-dots span:nth-child(3) { animation-delay: .3s; }

/* ==========================================================================
   Input + footer
   ========================================================================== */

.chat-footer {
    flex: 0 0 auto;
    padding: 10px 20px 25px;
}

.chat-input-area {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 64px;
    padding: 10px 10px 10px 20px;
    background: var(--oh-white);
    border: 1px solid var(--oh-border-soft);
    border-radius: 50px;
    box-shadow: 0 3px 11.8px rgba(0, 0, 0, .08);
    transition: border-color .2s ease, box-shadow .2s ease;
}

.chat-input-area:focus-within {
    border-color: var(--oh-pink);
    box-shadow: 0 3px 11.8px rgba(0, 0, 0, .08), 0 0 0 3px rgba(228, 49, 146, .12);
}

#chat-input {
    flex: 1;
    min-width: 0;
    height: 24px;
    max-height: 96px;
    padding: 0;
    resize: none;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--oh-text);
    font-family: var(--oh-font);
    font-size: 14px;
    line-height: 24px;
}

#chat-input::placeholder { color: var(--oh-placeholder); }

#chat-send {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--oh-pink);
    color: var(--oh-white);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform .2s ease, background-color .2s ease, opacity .2s ease;
}

#chat-send svg { width: 17px; height: 17px; }

#chat-send:hover:not(:disabled) {
    background: var(--oh-pink-dark);
    transform: translateY(-1px);
}

#chat-send:disabled { opacity: .55; cursor: not-allowed; }

.chat-disclaimer {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-top: 15px;
    color: var(--oh-muted);
    font-size: 10px;
    line-height: 1.25;
}

.chat-disclaimer p { margin: 0; max-width: 255px; }

.chat-privacy {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    max-width: 90px;
    color: var(--oh-muted);
    font-weight: 500;
    text-decoration: none;
}

.chat-privacy svg { flex: 0 0 18px; width: 18px; height: 20px; fill: currentColor; }
.chat-privacy .oh-lock { fill: var(--oh-bg); }
a.chat-privacy:hover { color: var(--oh-navy); }


.dot-circles {
    display: flex;
    justify-content: flex-start;
    gap: 2px;
    margin: 10px 0;
}
.dot-circle {
    width: 10px;
    height: 10px;
    flex-shrink: 0;
    border-radius: 50%;
    opacity: 0;
}

.dot-circle.animate {
    animation: slideIn 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.dot-circle.animate:nth-child(1) {
    animation-delay: 0s;
}

.dot-circle.animate:nth-child(2) {
    animation-delay: 0.1s;
}

.dot-circle.animate:nth-child(3) {
    animation-delay: 0.2s;
}

.dot-circle.animate:nth-child(4) {
    animation-delay: 0.3s;
}

.dot-circle.animate:nth-child(5) {
    animation-delay: 0.4s;
}

@keyframes slideIn {
    from {
        transform: translateX(40px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ==========================================================================
   Motion
   ========================================================================== */

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

@keyframes thinking {
    0%, 60%, 100% { opacity: .3; transform: translateY(0); }
    30%           { opacity: 1;  transform: translateY(-3px); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ==========================================================================
   Mobile — fills the screen like the iPhone frames
   ========================================================================== */

@media (max-width: 600px) {
    #chat-toggle { right: 16px; bottom: 16px; width: 64px; height: 64px; }
    #chat-toggle .chat-icon { width: 31px; height: 31px; }

    body.chat-is-open #chat-toggle { opacity: 0; pointer-events: none; }

    .chat-widget,
    .chat-widget.is-expanded {
        top: 8px;
        right: 8px;
        bottom: 8px;
        left: 8px;
        width: auto;
        max-width: none;
        height: auto;
        max-height: none;
    }

    #chat-expand { display: none; }
    .chat-actions { gap: 0; }

    .chat-messages { padding: 20px 16px 16px; }
    .chat-footer { padding: 0 16px 16px; }
    .chat-brand { left: 16px; }
    .chat-actions { right: 16px; }
    .message.user .message-text { max-width: 90%; }
    #chat-input { font-size: 16px; }              /* prevents iOS zoom-on-focus */
}