/* Explain: Styles for the floating assistant button, chat panel, message bubbles, and quick-question chips. */
/*
    Explain: Styles for the floating assistant button, chat panel, message bubbles and quick-question chips.
*/

.chat-fab {
    position: fixed;
    z-index: 70;
    inset-inline-end: 12px;
    bottom: calc(var(--mobile-cta-height, 0px) + 12px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 44px;
    height: auto;
    max-width: calc(100vw - 24px);
    padding: 8px 13px;
    border: 1px solid var(--primary-dark);
    border-radius: var(--radius-pill);
    background: var(--primary-dark);
    color: var(--text-on-dark);
    font-family: var(--font-heading);
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1.55;
    white-space: normal;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(4, 44, 27, 0.22);
    transition: background-color 180ms ease, box-shadow 180ms ease;
}
.chat-fab-label { min-width: 0; overflow-wrap: anywhere; }
.chat-fab i { flex-shrink: 0; font-size: 0.82rem; line-height: 1; }
.chat-fab .fa-xmark { display: none; }
.chat-fab.is-open .fa-xmark { display: inline-block; }
.chat-fab.is-open .fa-comment-dots { display: none; }

.chat-panel {
    position: fixed;
    z-index: 75;
    inset-inline: 12px;
    bottom: calc(var(--mobile-cta-height, 0px) + 74px);
    display: none;
    flex-direction: column;
    max-height: min(72dvh, 560px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--surface-color);
    box-shadow: 0 24px 60px rgba(4, 44, 27, 0.24);
    overflow: hidden;
}
.chat-panel.is-open { display: flex; }

.chat-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--primary-dark);
    border-bottom: 1px solid var(--border-dark);
}
.chat-avatar {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: var(--radius-pill);
    background: rgba(106, 215, 154, 0.18);
    color: var(--accent-color);
    font-size: 1rem;
}
.chat-head-text { flex: 1 1 auto; min-width: 0; }
.chat-title { color: var(--text-on-dark); font-size: 0.95rem; line-height: 1.6; }
.chat-status { color: var(--text-muted-on-dark); font-size: 0.74rem; line-height: 1.7; }
.chat-close {
    display: inline-grid;
    place-items: center;
    width: 38px;
    min-height: 38px;
    height: auto;
    flex-shrink: 0;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.26);
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--text-on-dark);
    font-size: 0.9rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: none;
    transition: background-color 160ms ease;
}

.chat-log {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 10px;
    min-height: 132px;
    padding: 14px;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--background-color);
}
.chat-msg { display: flex; flex-direction: column; max-width: 100%; }
.chat-msg p {
    max-width: 100%;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    line-height: 1.9;
    white-space: pre-line;
    overflow-wrap: anywhere;
}
.chat-msg.is-bot { align-items: flex-start; }
.chat-msg.is-bot p {
    background: var(--surface-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-start-start-radius: var(--radius-xs);
}
.chat-msg.is-user { align-items: flex-end; }
.chat-msg.is-user p {
    background: var(--primary-dark);
    color: var(--text-on-dark);
    border: 1px solid var(--primary-dark);
    border-start-end-radius: var(--radius-xs);
}
.chat-dots { display: inline-flex; align-items: center; gap: 5px; padding: 14px 16px; }
.chat-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-soft);
    animation: chat-pulse 1s ease-in-out infinite;
}
.chat-dots span:nth-child(2) { animation-delay: 0.15s; }
.chat-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes chat-pulse {
    0%, 100% { opacity: 0.32; }
    50% { opacity: 1; }
}

.chat-starters {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding: 10px 14px;
    border-top: 1px solid var(--border-color);
    background: var(--surface-color);
}
.chat-starters.is-hidden { display: none; }
.chat-chip {
    min-height: 38px;
    height: auto;
    max-width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-pill);
    background: var(--surface-2);
    color: var(--primary-dark);
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.7;
    white-space: normal;
    text-align: start;
    cursor: pointer;
    box-shadow: none;
    transition: background-color 160ms ease, border-color 160ms ease;
}

.chat-form {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid var(--border-color);
    background: var(--surface-color);
}
.chat-input {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 46px;
    max-height: 108px;
    padding: 11px 13px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text-color);
    font-family: var(--font-body);
    font-size: 0.9rem;
    line-height: 1.8;
    box-shadow: none;
    resize: none;
}
.chat-input::placeholder { color: var(--text-soft); opacity: 1; }
.chat-input:focus {
    outline: 2px solid var(--focus-ring);
    outline-offset: 1px;
    border-color: var(--primary-dark);
    background: var(--surface-color);
}
.chat-send {
    display: inline-grid;
    place-items: center;
    width: 46px;
    min-height: 46px;
    height: auto;
    flex-shrink: 0;
    padding: 0;
    border: 1px solid var(--primary-dark);
    border-radius: var(--radius-sm);
    background: var(--primary-dark);
    color: var(--text-on-dark);
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: none;
    transition: background-color 160ms ease;
}
.chat-send:disabled { cursor: not-allowed; opacity: 0.55; }
.chat-note {
    padding: 0 14px 12px;
    background: var(--surface-color);
    color: var(--text-muted);
    font-size: 0.74rem;
    line-height: 1.8;
    text-align: center;
}
.chat-note a { color: var(--primary-dark); font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }

@media (min-width: 1024px) {
    .chat-fab { inset-inline-end: 24px; bottom: 24px; }
    .chat-panel {
        inset-inline: auto;
        inset-inline-end: 24px;
        bottom: 80px;
        width: 384px;
        max-height: min(70dvh, 600px);
    }
    .chat-log { min-height: 190px; }
}

@media (hover: hover) {
    .chat-fab:hover { background: var(--primary-color); box-shadow: var(--shadow-lift); }
    .chat-close:hover { background: rgba(255, 255, 255, 0.16); }
    .chat-chip:hover { border-color: var(--primary-dark); background: var(--primary-soft); }
    .chat-send:hover:not(:disabled) { background: var(--primary-color); }
}