/* Chatbot Styles */
.chatbot-trigger {
    position: fixed;
    bottom: 30px;
    right: 90px; /* Offset from WA button */
    width: 45px;
    height: 45px;
    background: var(--teal);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-teal);
    z-index: 1001;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.chatbot-trigger:hover { transform: scale(1.1); }
.chatbot-trigger svg { width: 22px; height: 22px; color: var(--navy-bg); }

.chatbot-window {
    position: fixed;
    bottom: 90px;
    right: 30px;
    width: 380px;
    height: 500px;
    background: rgba(3, 16, 33, 0.85); /* Semi-transparent */
    backdrop-filter: blur(12px); /* Glassmorphism effect */
    border: 1px solid var(--navy-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px rgba(0,0,0,0.5), 0 0 20px rgba(0,212,180,0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1002;
    transform: translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}
.chatbot-window.active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
}

.chatbot-header {
    background: linear-gradient(135deg, var(--navy-card), var(--navy-bg));
    padding: 1.5rem;
    border-bottom: 1px solid var(--navy-border);
    display: flex;
    align-items: center;
    gap: 1rem;
}
.chatbot-avatar {
    width: 40px; height: 40px; background: var(--teal-glow); border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; color: var(--teal); border: 1px solid rgba(0,212,180,0.3);
}

.chatbot-content { flex: 1; padding: 1.5rem; overflow-y: auto; display: flex; flex-direction: column; gap: 1rem; }
.chat-msg { 
    max-width: 85%; 
    padding: 0.75rem 1rem; 
    border-radius: var(--radius-md); 
    font-size: 0.85rem; 
    line-height: 1.5; 
    white-space: pre-wrap; /* Crucial for point-wise rendering */
}
.chat-msg.bot { background: var(--navy-card); color: var(--text-light); align-self: flex-start; border-bottom-left-radius: 2px; }
.chat-msg.user { background: var(--teal); color: var(--navy-bg); align-self: flex-end; border-bottom-right-radius: 2px; font-weight: 600; }

.chat-chip {
    background: rgba(0,212,180,0.1);
    border: 1px solid rgba(0,212,180,0.3);
    color: var(--teal);
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    cursor: pointer;
    transition: 0.2s;
    font-weight: 600;
}
.chat-chip:hover {
    background: rgba(0,212,180,0.25);
    border-color: var(--teal);
}

.chatbot-input-wrap { padding: 1rem; border-top: 1px solid var(--navy-border); display: flex; gap: 0.5rem; }
.chatbot-input { 
    flex: 1; background: #051428; border: 1px solid var(--navy-border); 
    border-radius: var(--radius-pill); padding: 0.6rem 1.2rem; color: var(--white); font-size: 0.85rem; 
}
.chatbot-input:focus { outline: none; border-color: var(--teal); }

.search-results { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.5rem; }
.search-result-item { 
    padding: 0.75rem; background: rgba(0,212,180,0.05); border: 1px solid rgba(0,212,180,0.2); 
    border-radius: var(--radius-md); color: var(--white); font-size: 0.8rem; cursor: pointer; transition: 0.2s;
    display: flex; justify-content: space-between; align-items: center;
}
.search-result-item:hover { background: rgba(0,212,180,0.15); border-color: var(--teal); }
.result-formula { font-size: 0.7rem; color: var(--teal); opacity: 0.8; font-weight: 700; }

@media (max-width: 480px) {
    .chatbot-window { width: calc(100vw - 40px); right: 20px; height: 70vh; }
    .chatbot-trigger { right: 70px; }
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 2px 0;
}
.typing-indicator span {
    width: 6px;
    height: 6px;
    background: var(--teal);
    border-radius: 50%;
    opacity: 0.4;
    animation: typing 1s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 100% { transform: translateY(0); opacity: 0.4; }
    50% { transform: translateY(-4px); opacity: 1; }
}
