/* 08_chat.css — Chat overlay (FAB + panel). Mirrors styles.py:inject_chat_styles()
   using design tokens from 00_tokens.css. */

/* ---- FAB ---- */
.chat-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 50%;
    background: var(--brand-green);
    color: #ffffff;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    padding: 0;
}

.chat-fab svg {
    width: 24px;
    height: 24px;
    stroke: #ffffff;
    fill: none;
}

.chat-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.chat-fab:active {
    transform: scale(0.95);
}

/* The chat is a sign-up incentive: anonymous visitors must never see the
   FAB/panel. The component tree stays in the DOM (callbacks keep their
   wiring); this class hides it visually. */
.chat-container--hidden {
    display: none;
}

/* ---- Panel ---- */
.chat-panel {
    position: fixed;
    bottom: 90px;
    right: 24px;
    z-index: 9998;
    width: 380px;
    max-height: 600px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.chat-panel--closed {
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
}

.chat-panel--open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* ---- Panel header ---- */
.chat-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-header-icon svg {
    width: 20px;
    height: 20px;
    stroke: var(--brand-green);
    fill: none;
}

.chat-header-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.chat-close-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-close-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
}

.chat-close-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ---- Messages ---- */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    min-height: 200px;
    max-height: 400px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-msg {
    padding: 10px 14px;
    font-size: 14px;
    line-height: 1.5;
    max-width: 85%;
    word-wrap: break-word;
}

.chat-msg p {
    margin: 0;
}

.chat-msg--user {
    align-self: flex-end;
    background: var(--brand-green);
    color: #ffffff;
    border-radius: 16px 16px 4px 16px;
}

.chat-msg--assistant {
    align-self: flex-start;
    background: var(--bg-hover);
    color: var(--text-primary);
    border-radius: 16px 16px 16px 4px;
}

/* ---- Typing indicator (animated dots while the LLM answers) ---- */
.chat-typing {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 14px 16px;
}

.chat-typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: chat-typing-bounce 1.2s infinite ease-in-out;
}

.chat-typing-dot:nth-child(2) {
    animation-delay: 0.15s;
}

.chat-typing-dot:nth-child(3) {
    animation-delay: 0.3s;
}

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

/* ---- Input row ---- */
.chat-input-row {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}

.chat-input {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid var(--border-medium);
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    background: var(--bg-page);
    color: var(--text-primary);
    box-sizing: border-box;
}

.chat-input:focus {
    border-color: var(--brand-green);
}
