/* ─── Empla Chatbot Widget ─────────────────────────────────────────── */

#empla-chat-toggle {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 56px;
    height: 56px;
    background: #1D3461;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(29,52,97,0.38);
    z-index: 9990;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

#empla-chat-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(29,52,97,0.48);
}

#empla-chat-toggle .chat-icon-open,
#empla-chat-toggle .chat-icon-close {
    position: absolute;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

#empla-chat-toggle .chat-icon-close {
    opacity: 0;
    transform: rotate(-90deg);
}

#empla-chat-widget.open #empla-chat-toggle .chat-icon-open {
    opacity: 0;
    transform: rotate(90deg);
}

#empla-chat-widget.open #empla-chat-toggle .chat-icon-close {
    opacity: 1;
    transform: rotate(0deg);
}

/* Puls-ring voor aandacht */
#empla-chat-toggle::after {
    content: '';
    position: absolute;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid #fcd307;
    animation: chatPulse 2.2s ease-out infinite;
    opacity: 0;
}

@keyframes chatPulse {
    0%   { transform: scale(1);   opacity: 0.7; }
    100% { transform: scale(1.7); opacity: 0;   }
}

/* Notificatiebadge */
#empla-chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #fcd307;
    color: #1D3461;
    font-size: 10px;
    font-weight: 800;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    opacity: 0;
    transition: opacity 0.2s;
}

#empla-chat-badge.visible {
    opacity: 1;
}

/* Chat panel */
#empla-chat-panel {
    position: fixed;
    bottom: 96px;
    right: 28px;
    width: 360px;
    max-width: calc(100vw - 40px);
    max-height: 560px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;
    z-index: 9989;
    transform: translateY(20px) scale(0.97);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.22s cubic-bezier(0.34,1.56,0.64,1), opacity 0.18s ease;
    overflow: hidden;
}

#empla-chat-widget.open #empla-chat-panel {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}

/* Header */
.empla-chat-header {
    background: #1D3461;
    color: #fff;
    padding: 16px 18px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.empla-chat-avatar {
    width: 38px;
    height: 38px;
    background: #fcd307;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    color: #1D3461;
    flex-shrink: 0;
}

.empla-chat-header-info {
    flex: 1;
    min-width: 0;
}

.empla-chat-header-info strong {
    font-size: 14px;
    display: block;
    font-weight: 700;
}

.empla-chat-header-info span {
    font-size: 11px;
    opacity: 0.75;
}

.empla-chat-header-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    padding: 2px 4px;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.empla-chat-header-close:hover {
    opacity: 1;
}

/* Messages area */
.empla-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}

.empla-chat-messages::-webkit-scrollbar {
    width: 4px;
}

.empla-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.empla-chat-messages::-webkit-scrollbar-thumb {
    background: #d0d5dd;
    border-radius: 4px;
}

/* Berichten */
.chat-msg {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    max-width: 100%;
}

.chat-msg.user {
    flex-direction: row-reverse;
}

.chat-msg-avatar {
    width: 28px;
    height: 28px;
    background: #e8ecf5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #1D3461;
    flex-shrink: 0;
    margin-bottom: 2px;
}

.chat-msg.user .chat-msg-avatar {
    background: #fcd307;
    color: #1D3461;
}

.chat-msg-bubble {
    background: #f0f2f7;
    color: #1a1a1a;
    padding: 10px 13px;
    border-radius: 14px 14px 14px 3px;
    font-size: 13px;
    line-height: 1.5;
    max-width: 240px;
    word-break: break-word;
}

.chat-msg.user .chat-msg-bubble {
    background: #1D3461;
    color: #fff;
    border-radius: 14px 14px 3px 14px;
}

.chat-msg-bubble a {
    color: #1D3461;
    text-decoration: underline;
}

.chat-msg.user .chat-msg-bubble a {
    color: #fcd307;
}

/* Typingindicator */
.chat-typing .chat-msg-bubble {
    padding: 10px 14px;
}

.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
    height: 16px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: #9aa3b5;
    border-radius: 50%;
    animation: typingBounce 1.2s ease-in-out infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30%            { transform: translateY(-6px); }
}

/* Suggesties */
.empla-chat-suggestions {
    padding: 0 14px 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex-shrink: 0;
}

.chat-suggestion-btn {
    background: #f0f2f7;
    color: #1D3461;
    border: 1px solid #d0d5dd;
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.chat-suggestion-btn:hover {
    background: #1D3461;
    color: #fcd307;
    border-color: #1D3461;
}

/* Action button */
.chat-action-btn {
    display: inline-block;
    margin-top: 8px;
    background: #fcd307;
    color: #1D3461;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 20px;
    text-decoration: none !important;
    transition: background 0.15s;
}

.chat-action-btn:hover {
    background: #e6be00;
    color: #1D3461 !important;
}

/* Input area */
.empla-chat-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #eaedf2;
    flex-shrink: 0;
    background: #fff;
}

#empla-chat-input {
    flex: 1;
    border: 1px solid #d0d5dd;
    border-radius: 22px;
    padding: 8px 14px;
    font-size: 13px;
    outline: none;
    resize: none;
    font-family: inherit;
    line-height: 1.4;
    max-height: 80px;
    overflow-y: auto;
    transition: border-color 0.15s;
}

#empla-chat-input:focus {
    border-color: #1D3461;
}

#empla-chat-input::placeholder {
    color: #a0a8b8;
}

#empla-chat-send {
    width: 36px;
    height: 36px;
    background: #1D3461;
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    transition: background 0.15s, transform 0.12s;
}

#empla-chat-send:hover {
    background: #fcd307;
    color: #1D3461;
}

#empla-chat-send:active {
    transform: scale(0.92);
}

/* Welkomstbericht tijdstip */
.chat-msg-time {
    font-size: 10px;
    color: #a0a8b8;
    text-align: center;
    margin: 4px 0;
}

/* Responsive */
@media (max-width: 480px) {
    #empla-chat-panel {
        left: 12px;
        right: 12px;
        width: auto;
        bottom: 88px;
    }

    #empla-chat-toggle {
        bottom: 20px;
        right: 16px;
    }
}
