/* Chatbot Widget Styles */
.chatbot-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--color-primary, #2563eb);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.chatbot-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.chatbot-toggle svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
}

.chatbot-toggle .chatbot-close-icon {
    display: none;
}

.chatbot-toggle.active .chatbot-open-icon {
    display: none;
}

.chatbot-toggle.active .chatbot-close-icon {
    display: block;
}

/* Chat Panel */
.chatbot-panel {
    position: fixed;
    bottom: 92px;
    right: 24px;
    width: 360px;
    max-width: calc(100vw - 48px);
    height: 480px;
    max-height: calc(100vh - 140px);
    background: var(--color-bg, #ffffff);
    border: 1px solid var(--color-border, #e2e8f0);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    z-index: 9998;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.chatbot-panel.open {
    display: flex;
}

/* Header */
.chatbot-header {
    padding: 16px;
    background: var(--color-primary, #2563eb);
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chatbot-header-dot {
    width: 10px;
    height: 10px;
    background: #4ade80;
    border-radius: 50%;
    flex-shrink: 0;
}

.chatbot-header-text h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
}

.chatbot-header-text p {
    margin: 2px 0 0;
    font-size: 12px;
    opacity: 0.85;
    color: #fff;
}

/* Messages Area */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chatbot-message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.chatbot-message.bot {
    align-self: flex-start;
    background: var(--color-surface, #f1f5f9);
    color: var(--color-text, #1e293b);
    border-bottom-left-radius: 4px;
}

.chatbot-message.user {
    align-self: flex-end;
    background: var(--color-primary, #2563eb);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chatbot-message.error {
    align-self: flex-start;
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    font-size: 13px;
}

/* Typing indicator */
.chatbot-typing {
    align-self: flex-start;
    padding: 10px 14px;
    background: var(--color-surface, #f1f5f9);
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    display: none;
}

.chatbot-typing.visible {
    display: flex;
    gap: 4px;
    align-items: center;
}

.chatbot-typing span {
    width: 6px;
    height: 6px;
    background: var(--color-text-muted, #94a3b8);
    border-radius: 50%;
    animation: chatbot-bounce 1.4s infinite ease-in-out;
}

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

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

@keyframes chatbot-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Input Area */
.chatbot-input-area {
    padding: 12px 16px;
    border-top: 1px solid var(--color-border, #e2e8f0);
    display: flex;
    gap: 8px;
    align-items: center;
}

.chatbot-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--color-border, #e2e8f0);
    border-radius: 8px;
    font-size: 14px;
    background: var(--color-bg, #fff);
    color: var(--color-text, #1e293b);
    outline: none;
    resize: none;
    font-family: inherit;
    max-height: 80px;
    overflow-y: auto;
}

.chatbot-input:focus {
    border-color: var(--color-primary, #2563eb);
}

.chatbot-input::placeholder {
    color: var(--color-text-muted, #94a3b8);
}

.chatbot-send {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--color-primary, #2563eb);
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.2s;
}

.chatbot-send:hover {
    opacity: 0.85;
}

.chatbot-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chatbot-send svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* Mobile responsive */
@media (max-width: 480px) {
    .chatbot-panel {
        bottom: 0;
        right: 0;
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .chatbot-toggle {
        bottom: 16px;
        right: 16px;
    }
}
