/* Chatbot Panel — Engage2Excel AI Assistant */

/* Floating trigger button */
.chatbot-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #008050;
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.chatbot-btn:hover {
    background: #003d26;
    transform: scale(1.05);
}
.chatbot-btn svg {
    width: 26px;
    height: 26px;
    fill: #fff;
}
.chatbot-btn.open { display: none; }

/* Panel overlay — slides from right */
.chatbot-panel {
    position: fixed;
    top: 0;
    right: -420px;
    width: 400px;
    height: 100vh;
    background: #fff;
    box-shadow: -4px 0 30px rgba(0, 0, 0, 0.1);
    z-index: 998;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
    font-family: 'Inter', sans-serif;
}
.chatbot-panel.open {
    right: 0;
}

/* Panel header */
.chatbot-header {
    background: linear-gradient(135deg, #008050 0%, #003d26 100%);
    color: #fff;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.chatbot-header-title {
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.chatbot-header-title svg {
    width: 18px;
    height: 18px;
    fill: #fff;
}
.chatbot-close {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0.25rem;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}
.chatbot-close:hover {
    opacity: 1;
}

/* Messages area */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Suggestion chips (shown when empty) */
.chatbot-suggestions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem 0;
}
.chatbot-suggestion {
    background: #f0fdf4;
    border: 1px solid #dcfce7;
    border-radius: 12px;
    padding: 0.6rem 0.9rem;
    font-size: 0.8rem;
    color: #166534;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    font-family: 'Inter', sans-serif;
}
.chatbot-suggestion:hover {
    background: #dcfce7;
    border-color: #008050;
}

/* Message bubbles */
.chatbot-msg {
    max-width: 88%;
    padding: 0.65rem 0.9rem;
    border-radius: 14px;
    font-size: 0.82rem;
    line-height: 1.5;
    word-wrap: break-word;
}
.chatbot-msg-user {
    align-self: flex-end;
    background: #dcfce7;
    color: #1a1a1a;
    border-bottom-right-radius: 4px;
}
.chatbot-msg-assistant {
    align-self: flex-start;
    background: #f3f4f6;
    color: #1a1a1a;
    border-bottom-left-radius: 4px;
}

/* Markdown rendering in assistant messages */
.chatbot-msg-assistant strong { font-weight: 600; }
.chatbot-msg-assistant ul, .chatbot-msg-assistant ol {
    margin: 0.3rem 0;
    padding-left: 1.2rem;
}
.chatbot-msg-assistant li { margin-bottom: 0.15rem; }
.chatbot-msg-assistant table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.4rem 0;
    font-size: 0.75rem;
}
.chatbot-msg-assistant th,
.chatbot-msg-assistant td {
    border: 1px solid #e5e7eb;
    padding: 0.25rem 0.4rem;
    text-align: left;
}
.chatbot-msg-assistant th {
    background: #f9fafb;
    font-weight: 600;
}
.chatbot-msg-assistant code {
    background: #e5e7eb;
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    font-size: 0.75rem;
}
.chatbot-msg-assistant p { margin: 0.3rem 0; }
.chatbot-msg-assistant p:first-child { margin-top: 0; }
.chatbot-msg-assistant p:last-child { margin-bottom: 0; }

/* Typing indicator */
.chatbot-typing {
    align-self: flex-start;
    display: flex;
    gap: 4px;
    padding: 0.65rem 0.9rem;
    background: #f3f4f6;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
}
.chatbot-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #9ca3af;
    animation: chatbot-bounce 1.2s infinite;
}
.chatbot-typing span:nth-child(2) { animation-delay: 0.2s; }
.chatbot-typing span:nth-child(3) { animation-delay: 0.4s; }

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

/* Input area */
.chatbot-input-area {
    padding: 0.75rem 1rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
    flex-shrink: 0;
    background: #fff;
}
.chatbot-input {
    flex: 1;
    border: 1.5px solid #d1d5db;
    border-radius: 12px;
    padding: 0.55rem 0.8rem;
    font-size: 0.82rem;
    font-family: 'Inter', sans-serif;
    resize: none;
    min-height: 38px;
    max-height: 100px;
    outline: none;
    transition: border-color 0.2s;
    line-height: 1.4;
}
.chatbot-input:focus {
    border-color: #008050;
    box-shadow: 0 0 0 2px rgba(0, 128, 80, 0.1);
}
.chatbot-input::placeholder {
    color: #9ca3af;
}
.chatbot-send {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: #008050;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}
.chatbot-send:hover {
    background: #003d26;
}
.chatbot-send:disabled {
    background: #d1d5db;
    cursor: not-allowed;
}
.chatbot-send svg {
    width: 18px;
    height: 18px;
    fill: #fff;
}

/* Timestamp */
.chatbot-time {
    font-size: 0.65rem;
    color: #9ca3af;
    text-align: center;
    margin: 0.25rem 0;
}

/* Mobile responsive */
@media (max-width: 600px) {
    .chatbot-panel {
        width: 100vw;
        right: -100vw;
    }
    .chatbot-btn {
        bottom: 16px;
        right: 16px;
        width: 48px;
        height: 48px;
    }
}
