/* =========================================================
   Chatbot Widget — CEMIL
   ========================================================= */

#chatbotToggle {
    position: fixed;
    bottom: 54px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: #b71c1c;
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28);
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
}

#chatbotToggle:hover {
    background-color: #c62828;
    transform: scale(1.08);
}

#chatbotPanel {
    position: fixed;
    bottom: 120px;
    right: 24px;
    width: 360px;
    height: 520px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    z-index: 1049;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transform: translateY(16px);
    transition: opacity 0.22s ease, transform 0.22s ease;
    overflow: hidden;
}

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

/* Header */
.chatbot-header {
    background: #b71c1c;
    color: #fff;
    padding: 11px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.chatbot-header-icon {
    font-size: 1.15rem;
}

.chatbot-header-title {
    flex: 1;
    font-weight: 600;
    font-size: 0.92rem;
}

.chatbot-header-subtitle {
    font-size: 0.72rem;
    opacity: 0.8;
    margin-top: 1px;
}

.chatbot-clear-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.75);
    cursor: pointer;
    padding: 3px 7px;
    border-radius: 5px;
    font-size: 0.78rem;
    transition: color 0.15s, background 0.15s;
    white-space: nowrap;
}

.chatbot-clear-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
}

/* Messages */
#chatbotMessages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #f7f7f7;
}

#chatbotMessages::-webkit-scrollbar {
    width: 4px;
}

#chatbotMessages::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 4px;
}

.chatbot-msg {
    max-width: 86%;
    padding: 8px 12px;
    border-radius: 14px;
    font-size: 0.87rem;
    line-height: 1.55;
    word-break: break-word;
}

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

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

.chatbot-msg-assistant ul {
    margin: 4px 0 4px 18px;
    padding: 0;
}

.chatbot-msg-assistant li {
    margin-bottom: 2px;
}

.chatbot-msg-assistant code {
    background: #f0f0f0;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.82em;
    font-family: monospace;
}

.chatbot-msg-assistant h6 {
    font-size: 0.88rem;
    font-weight: 600;
    margin: 6px 0 3px;
}

.chatbot-msg-assistant strong {
    font-weight: 600;
}

/* Thinking dots */
.chatbot-thinking {
    display: flex;
    gap: 5px;
    padding: 10px 14px;
    align-items: center;
}

.chatbot-thinking span {
    width: 8px;
    height: 8px;
    background: #b71c1c;
    border-radius: 50%;
    animation: chatbot-bounce 1.2s infinite ease-in-out;
    opacity: 0.7;
}

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

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

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

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Input area */
.chatbot-input-area {
    display: flex;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid #ebebeb;
    background: #fff;
    flex-shrink: 0;
}

#chatbotInput {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 7px 11px;
    font-size: 0.875rem;
    outline: none;
    resize: none;
    transition: border-color 0.15s;
    font-family: inherit;
}

#chatbotInput:focus {
    border-color: #b71c1c;
}

#chatbotInput:disabled {
    background: #f5f5f5;
}

#chatbotSend {
    background: #b71c1c;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 7px 14px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.15s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

#chatbotSend:hover:not(:disabled) {
    background: #c62828;
}

#chatbotSend:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Mobile */
@media (max-width: 480px) {
    #chatbotPanel {
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    #chatbotToggle {
        bottom: 16px;
        right: 16px;
    }
}
