/* === CHAT KNOP === */
.chat-knop {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 58px;
    height: 58px;
    background: linear-gradient(180deg, var(--brass-400), var(--brass-600));
    color: var(--ink-950);
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    box-shadow: var(--shadow-deep);
    z-index: 1000;
    transition: transform 0.2s, filter 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-knop:hover {
    filter: brightness(1.08);
    transform: scale(1.08);
}

.chat-knop .chat-notif {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    background: var(--wax-500);
    border-radius: 50%;
    border: 2px solid var(--ink-950);
    display: none;
}

.chat-knop.heeft-notif .chat-notif {
    display: block;
}

/* === CHAT VENSTER === */
.chat-venster {
    position: fixed;
    bottom: 100px;
    right: 28px;
    width: 370px;
    max-height: 540px;
    background: var(--ink-900);
    border: 1px solid var(--line-strong);
    border-radius: 18px;
    box-shadow: var(--shadow-deep);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.85) translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s ease, opacity 0.25s ease;
    transform-origin: bottom right;
}

.chat-venster.open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: all;
}

/* Header */
.chat-header {
    background: var(--ink-850);
    border-bottom: 1px solid var(--line);
    color: var(--paper-100);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.chat-avatar {
    width: 38px;
    height: 38px;
    background: var(--ink-950);
    border: 1.5px solid var(--brass-500);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.chat-header-info strong {
    display: block;
    font-size: 15px;
    color: var(--paper-050);
}

.chat-header-info span {
    font-size: 12px;
    color: var(--paper-500);
}

.chat-online {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--sage-500);
    border-radius: 50%;
    margin-right: 5px;
}

.chat-online.offline {
    background: var(--paper-500);
}

.chat-offline-banner {
    padding: 8px 16px;
    font-size: 12px;
    text-align: center;
    background: var(--ink-800);
    color: var(--paper-300);
    border-bottom: 1px solid var(--line);
}

.chat-geschiedenis-knop {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--paper-100);
    font-size: 17px;
    cursor: pointer;
    opacity: 0.7;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    text-decoration: none;
    transition: opacity 0.15s;
}

.chat-geschiedenis-knop:hover {
    opacity: 1;
}

.chat-sluit {
    background: none;
    border: none;
    color: var(--paper-100);
    font-size: 20px;
    cursor: pointer;
    opacity: 0.7;
    line-height: 1;
    padding: 0;
}

.chat-sluit:hover {
    opacity: 1;
}

/* Banner: gesprek overgenomen door medewerker */
.chat-medewerker-banner {
    background: rgba(192,138,78,0.10);
    border-bottom: 1px solid var(--line);
    color: var(--brass-300);
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    padding: 8px 12px;
    display: none;
}
.chat-medewerker-banner.zichtbaar { display: block; }

/* Berichten */
.chat-berichten {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

.chat-bericht {
    display: flex;
    flex-direction: column;
    max-width: 82%;
}

.chat-bericht.gebruiker {
    align-self: flex-end;
    align-items: flex-end;
}

.chat-bericht.bot,
.chat-bericht.medewerker {
    align-self: flex-start;
    align-items: flex-start;
}

.chat-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.55;
}

.chat-bericht.gebruiker .chat-bubble {
    background: linear-gradient(180deg, var(--brass-400), var(--brass-600));
    color: var(--ink-950);
    border-bottom-right-radius: 4px;
}

.chat-bericht.bot .chat-bubble {
    background: var(--ink-800);
    color: var(--paper-100);
    border-bottom-left-radius: 4px;
}

.chat-bericht.medewerker .chat-bubble {
    background: var(--ink-800);
    color: var(--paper-100);
    border: 1px solid var(--brass-500);
    border-bottom-left-radius: 4px;
}

.chat-bericht.medewerker .chat-afzender {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--brass-400);
    margin-bottom: 3px;
    padding: 0 4px;
}

.chat-tijdstip {
    font-size: 11px;
    color: var(--paper-700);
    margin-top: 4px;
    padding: 0 4px;
}

/* Typing indicator */
.chat-typing .chat-bubble {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 12px 16px;
}

.chat-typing .dot {
    width: 8px;
    height: 8px;
    background: var(--paper-700);
    border-radius: 50%;
    animation: typing 1.2s infinite;
}

.chat-typing .dot:nth-child(2) { animation-delay: 0.2s; }
.chat-typing .dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* Snelle vragen */
.chat-suggesties {
    padding: 0 16px 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chat-suggestie {
    background: var(--ink-850);
    border: 1px solid var(--line-strong);
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 12px;
    color: var(--paper-300);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.chat-suggestie:hover {
    background: var(--ink-800);
    border-color: var(--brass-500);
}

/* Input */
.chat-input-wrap {
    padding: 12px 16px;
    border-top: 1px solid var(--line);
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}

.chat-input {
    flex: 1;
    border: 1px solid var(--line-strong);
    border-radius: 22px;
    padding: 10px 16px;
    font-size: 14px;
    font-family: var(--font-body);
    outline: none;
    resize: none;
    height: 42px;
    max-height: 100px;
    overflow-y: auto;
    transition: border-color 0.2s;
    line-height: 1.4;
    box-sizing: border-box;
    background: var(--ink-850);
    color: var(--paper-100);
}

.chat-input:focus {
    border-color: var(--brass-500);
}

.chat-stuur {
    width: 40px;
    height: 40px;
    background: linear-gradient(180deg, var(--brass-400), var(--brass-600));
    color: var(--ink-950);
    border: none;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: filter 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-stuur:hover {
    filter: brightness(1.08);
}

.chat-stuur:disabled {
    background: var(--ink-700);
    color: var(--paper-700);
    cursor: not-allowed;
}

.chat-bijlage-knop {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    background: var(--ink-800);
    color: var(--paper-300);
    border: 1px solid var(--line);
    border-radius: 50%;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: filter 0.15s;
}

.chat-bijlage-knop:hover {
    filter: brightness(1.2);
}

.chat-bijlage-knop:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chat-bijlage {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: inherit;
}

.chat-bijlage img {
    max-width: 160px;
    max-height: 160px;
    border-radius: 8px;
    display: block;
}

.chat-bijlage .chat-bijlage-bestand {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    text-decoration: underline;
}

.chat-escalatie-rij {
    text-align: center;
    padding: 6px 12px 0;
    flex-shrink: 0;
}

.escalatie-knop {
    background: none;
    border: 1px solid var(--line-strong);
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 12px;
    color: var(--paper-500);
    cursor: pointer;
    transition: all 0.2s;
}
.escalatie-knop:hover {
    border-color: var(--brass-500);
    color: var(--brass-300);
}

/* Responsive */
@media (max-width: 420px) {
    .chat-venster {
        width: calc(100vw - 20px);
        right: 10px;
        bottom: 90px;
    }
    .chat-knop {
        right: 16px;
        bottom: 16px;
    }
}
