/* =========================================================
   CHATBOT WIDGET
========================================================= */

#chatbot-toggle {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-blue, #004494);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,68,148,0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    transition: transform 0.2s, box-shadow 0.2s;
}
#chatbot-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(0,68,148,0.45);
}
#chatbot-toggle svg {
    width: 26px;
    height: 26px;
    fill: #fff;
    transition: opacity 0.2s;
}
#chatbot-toggle .icon-close { display: none; }

#chatbot-toggle.open .icon-chat  { display: none; }
#chatbot-toggle.open .icon-close { display: block; }

/* Notification dot */
#chatbot-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 10px;
    height: 10px;
    background: #e53e3e;
    border-radius: 50%;
    border: 2px solid #fff;
    display: none;
}
#chatbot-badge.visible { display: block; }

/* Panel */
#chatbot-panel {
    position: fixed;
    bottom: 96px;
    right: 28px;
    width: 340px;
    max-height: 500px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;
    z-index: 10000;
    overflow: hidden;
    opacity: 0;
    transform: translateY(16px) scale(0.97);
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
}
#chatbot-panel.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Header */
#chatbot-header {
    background: var(--primary-blue, #004494);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
#chatbot-header .bot-avatar {
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}
#chatbot-header .bot-info strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
}
#chatbot-header .bot-info span {
    font-size: 11px;
    opacity: 0.8;
}

/* Messages */
#chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}
#chatbot-messages::-webkit-scrollbar { width: 4px; }
#chatbot-messages::-webkit-scrollbar-thumb {
    background: #d0d0d0;
    border-radius: 4px;
}

.cb-msg {
    max-width: 85%;
    padding: 9px 13px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.5;
    word-break: break-word;
}
.cb-msg.bot {
    background: #f0f4fb;
    color: #222;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}
.cb-msg.user {
    background: var(--primary-blue, #004494);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* Typing indicator */
.cb-msg.typing {
    background: #f0f4fb;
    align-self: flex-start;
    padding: 12px 16px;
}
.cb-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}
.cb-dots span {
    width: 7px;
    height: 7px;
    background: #004494;
    border-radius: 50%;
    animation: cb-bounce 1.2s infinite;
    opacity: 0.5;
}
.cb-dots span:nth-child(2) { animation-delay: 0.2s; }
.cb-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes cb-bounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
    40%            { transform: translateY(-5px); opacity: 1; }
}

/* Input */
#chatbot-input-area {
    padding: 10px 12px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    background: #fff;
}
#chatbot-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 13.5px;
    outline: none;
    font-family: inherit;
    resize: none;
    transition: border-color 0.2s;
}
#chatbot-input:focus { border-color: var(--primary-blue, #004494); }

#chatbot-send {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-blue, #004494);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
}
#chatbot-send:hover  { background: #003070; }
#chatbot-send:disabled { background: #aaa; cursor: default; }
#chatbot-send svg {
    width: 16px;
    height: 16px;
    fill: #fff;
}

/* Mobil */
@media (max-width: 480px) {
    #chatbot-panel {
        right: 0;
        bottom: 0;
        width: 100%;
        max-height: 70vh;
        border-radius: 14px 14px 0 0;
    }
    #chatbot-toggle {
        bottom: 16px;
        right: 16px;
    }
}
