/* Chat-overlay: knop + paneel, zie includes/web.php (Footer) en scripts/chat.js */
#chat-widget {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1050;
    font-family: "Open Sans", "Roboto", sans-serif;
}

#chat-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: #333333;
    color: #fff;
    font-size: 22px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .25);
    cursor: pointer;
    transition: transform .15s ease;
}
#chat-toggle:hover { transform: scale(1.06); }
#chat-widget.open #chat-toggle { display: none; }

#chat-panel {
    display: none;
    flex-direction: column;
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 360px;
    max-width: calc(100vw - 40px);
    /* height:520px is het comfortabele formaat op desktop; min() zorgt dat het paneel
       op een klein of liggend scherm nooit hoger is dan wat er effectief beschikbaar is.
       dvh (i.p.v. vh) houdt ook rekening met de adresbalk van mobiele browsers. */
    height: 520px;
    height: min(520px, calc(100vh - 40px));
    height: min(520px, calc(100dvh - 40px));
    max-height: calc(100vh - 40px);
    max-height: calc(100dvh - 40px);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, .3);
    overflow: hidden;
}
#chat-widget.open #chat-panel { display: flex; }

#chat-panel-header, #chat-panel-footer {
    background: #333333;
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}
#chat-panel-header h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 4px;
    color: #fff;
}
#chat-panel-subtitle {
    font-size: 12px;
    line-height: 1.4;
    margin: 0;
    color: rgba(255, 255, 255, .9);
}
#chat-panel-subtitle-vw, #chat-panel-subtitle-vw a {
    font-size: 10px;
    line-height: 1.4;
    margin: 0;
    color: rgba(255, 255, 255, .9);
}
#chat-panel-undertitle {
    font-size: 12px;
    line-height: 1.4;
    margin: 0;
    color: rgba(255, 255, 255, .9);
}
#chat-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
}

#chat-thread {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px;
    background: #f5f6f8;
}

.chat-msg {
    max-width: 85%;
    margin-bottom: 10px;
    padding: 8px 12px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
    clear: both;
}
a.chat-msg-link {
    text-decoration: underline;
}
a.chat-msg-link:hover {color:black}
.chat-msg-user {
    background: #e9ebef;
    color: #333;
    float: right;
    border-bottom-right-radius: 3px;
}
.chat-msg-bot {
    background: #ffc80a;
    color: #000;
    float: left;
    border-bottom-left-radius: 3px;
}
.chat-msg-bot.chat-msg-pending { color: #888; font-style: italic; }

.chat-msg-sources {
    max-width: 85%;
    float: left;
    clear: left;
    margin: -4px 0 12px;
    font-size: 12px;
}
.chat-msg-sources a { display: block; }

#chat-form {
    display: flex;
    border-top: 1px solid #e0e0e0;
    padding: 10px;
    background: #fff;
}
#chat-question {
    flex: 1;
    border: 1px solid #ccc;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 14px;
    outline: none;
}
#chat-question:focus { border-color: #333333; }
#chat-send {
    width: 38px;
    height: 38px;
    margin-left: 8px;
    border: none;
    border-radius: 50%;
    background: #333333;
    color: #fff;
    cursor: pointer;
}
#chat-send:disabled { opacity: .6; cursor: default; }

@media (max-width: 480px) {
    #chat-panel {
        right: 0; bottom: 0; width: 100vw;
        height: 100vh;
        height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        border-radius: 0;
    }
    #chat-widget { right: 12px; bottom: 12px; }
}
