/* ============================================
   Chat Bubble — FinGov Tool Assistant IA
   ============================================ */

/* Floating Button */
#chatbot-toggle {
    position: fixed;
    bottom: 1.75rem;
    right: 1.75rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0c1e3a, #00d4ff);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 212, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#chatbot-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(0, 212, 255, 0.55);
}

#chatbot-toggle svg {
    width: 24px;
    height: 24px;
    fill: #fff;
    transition: opacity 0.2s ease;
}

/* Chat Window */
#chatbot-window {
    position: fixed;
    bottom: 5.5rem;
    right: 1.75rem;
    width: 420px;
    max-height: 580px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9998;
    opacity: 0;
    transform: translateY(12px) scale(0.97);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

#chatbot-window.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Header */
.chatbot-header {
    background: linear-gradient(135deg, #0c1e3a 0%, #15305c 100%);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.chatbot-avatar {
    width: 34px;
    height: 34px;
    background: rgba(0, 212, 255, 0.15);
    border-radius: 50%;
    border: 1.5px solid rgba(0, 212, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-avatar svg {
    width: 18px;
    height: 18px;
    fill: #00d4ff;
}

.chatbot-title {
    font-weight: 700;
    font-size: 0.875rem;
    color: #fff;
    margin: 0;
}

.chatbot-subtitle {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.5);
    margin: 0;
}

.chatbot-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: rgba(255,255,255,0.6);
    line-height: 1;
    transition: color 0.2s;
}

.chatbot-close:hover {
    color: #fff;
}

/* Messages */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: #f8fafc;
}

.chatbot-messages::-webkit-scrollbar {
    width: 4px;
}
.chatbot-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

/* Message bubbles */
.msg {
    max-width: 82%;
    padding: 0.6rem 0.9rem;
    border-radius: 12px;
    font-size: 0.835rem;
    line-height: 1.55;
    word-break: break-word;
}

.msg-bot {
    background: #fff;
    color: #1F2937;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}

.msg-user {
    background: #0c1e3a;
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.msg-bot ol,
.msg-bot ul {
    margin: 0;
    padding-left: 1.2rem;
}

.msg-bot li {
    margin-bottom: 0.25rem;
    line-height: 1.5;
}

/* Suggestion Chips */
.chatbot-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-self: flex-start;
    max-width: 100%;
}

.chatbot-chip {
    background: #fff;
    border: 1.5px solid #00d4ff;
    color: #0c1e3a;
    border-radius: 20px;
    padding: 0.3rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    white-space: normal;
    word-break: break-word;
    text-align: left;
    max-width: 100%;
}

.chatbot-chip:hover {
    background: #00d4ff;
    color: #0c1e3a;
}

/* Typing indicator */
.msg-typing {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 0.65rem 0.9rem;
}

.msg-typing span {
    width: 7px;
    height: 7px;
    background: #94a3b8;
    border-radius: 50%;
    animation: typing-bounce 1.2s infinite;
}

.msg-typing span:nth-child(2) { animation-delay: 0.2s; }
.msg-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* Footer Input */
.chatbot-footer {
    padding: 0.75rem 1rem;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

#chatbot-input {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 0.835rem;
    outline: none;
    transition: border-color 0.2s;
    resize: none;
    font-family: inherit;
}

#chatbot-input:focus {
    border-color: #00d4ff;
}

#chatbot-send {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: #0c1e3a;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.15s;
}

#chatbot-send:hover {
    background: #00d4ff;
    transform: scale(1.05);
}

#chatbot-send svg {
    width: 16px;
    height: 16px;
    fill: #fff;
}

/* Mobile */
@media (max-width: 480px) {
    #chatbot-window {
        width: calc(100vw - 2rem);
        right: 1rem;
        bottom: 5rem;
    }

    #chatbot-toggle {
        right: 1rem;
        bottom: 1rem;
    }
}
