/* ============================================================================
   Chatbot Widget
   ============================================================================ */

.chatbot-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--color-primary, #0d6e3b);
    color: #fff;
    border: none;
    box-shadow: 0 6px 20px rgba(13,110,59,.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    z-index: 1000;
    transition: transform .15s;
}
.chatbot-toggle:hover { transform: scale(1.05); }
.chatbot-toggle:focus { outline: 3px solid #fff; outline-offset: 2px; }

.chatbot-panel {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 360px;
    max-height: 540px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0,0,0,.25);
    display: none;
    flex-direction: column;
    z-index: 999;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.chatbot-panel.open { display: flex; }

.chatbot-header {
    background: var(--color-primary, #0d6e3b);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.chatbot-header h3 { margin: 0; font-size: 1rem; }
.chatbot-header .subtitle { font-size: .75rem; opacity: .85; }
.chatbot-header .close-btn {
    background: none; border: none; color: #fff; font-size: 22px; cursor: pointer;
}

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    background: #f4f7f5;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.chatbot-message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: .9rem;
    line-height: 1.4;
    white-space: pre-wrap;
}
.chatbot-message.user {
    align-self: flex-end;
    background: var(--color-primary, #0d6e3b);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.chatbot-message.assistant {
    align-self: flex-start;
    background: #fff;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
}
.chatbot-message.system {
    align-self: center;
    background: #fef3c7;
    color: #92400e;
    font-size: .8rem;
    font-style: italic;
}

.chatbot-input {
    border-top: 1px solid #e5e7eb;
    padding: 10px;
    background: #fff;
    display: flex;
    gap: 8px;
}
.chatbot-input input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: .9rem;
}
.chatbot-input input:focus { outline: 2px solid var(--color-primary, #0d6e3b); outline-offset: 1px; }
.chatbot-input button {
    background: var(--color-primary, #0d6e3b);
    color: #fff;
    border: none;
    padding: 0 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}
.chatbot-input button:disabled { opacity: .5; cursor: not-allowed; }

.chatbot-typing {
    align-self: flex-start;
    background: #fff;
    border: 1px solid #e5e7eb;
    padding: 10px 14px;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
}
.chatbot-typing .dot {
    display: inline-block;
    width: 6px; height: 6px;
    background: #9ca3af;
    border-radius: 50%;
    margin: 0 2px;
    animation: bounce 1.2s infinite;
}
.chatbot-typing .dot:nth-child(2) { animation-delay: .2s; }
.chatbot-typing .dot:nth-child(3) { animation-delay: .4s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-6px); opacity: 1; } }

@media (max-width: 480px) {
    .chatbot-panel { right: 0; left: 0; bottom: 0; width: 100%; max-height: 80vh; border-radius: 16px 16px 0 0; }
    .chatbot-toggle { bottom: 16px; right: 16px; }
}
