.chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: var(--font-primary, 'Figtree', sans-serif);
}

.chat-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: var(--primary, #1565C0);
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    transition: transform 0.2s, background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-toggle:hover {
    background: var(--primary-dark, #0D47A1);
    transform: scale(1.05);
}

.chat-window {
    position: fixed;
    bottom: 90px;
    right: 24px;
    width: 380px;
    max-height: 520px;
    background: var(--surface, #fff);
    border-radius: var(--radius, 10px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    background: var(--primary, #1565C0);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.95rem;
}

.chat-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    opacity: 0.8;
    padding: 0;
}

.chat-close:hover { opacity: 1; }

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 360px;
    min-height: 200px;
    background: var(--bg, #F4F7FA);
}

.chat-bubble {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.45;
    word-wrap: break-word;
}

.chat-bubble.user {
    align-self: flex-end;
    background: var(--primary, #1565C0);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-bubble.assistant {
    align-self: flex-start;
    background: var(--surface, #fff);
    color: var(--text, #1E293B);
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
}

.chat-bubble.loading {
    align-self: flex-start;
    background: var(--surface, #fff);
    border: 1px solid #e2e8f0;
    color: var(--text-muted, #64748B);
    font-style: italic;
}

.chat-input-area {
    display: flex;
    padding: 12px;
    gap: 8px;
    border-top: 1px solid #e2e8f0;
    background: var(--surface, #fff);
}

.chat-input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

.chat-input:focus {
    border-color: var(--primary, #1565C0);
}

.chat-send {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: none;
    background: var(--primary, #1565C0);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: background 0.2s;
}

.chat-send:hover { background: var(--primary-dark, #0D47A1); }
.chat-send:disabled { opacity: 0.5; cursor: not-allowed; }

@media (max-width: 480px) {
    .chat-window {
        width: calc(100vw - 32px);
        right: 16px;
        bottom: 80px;
        max-height: 70vh;
    }
    .chat-widget { bottom: 16px; right: 16px; }
}
