/* KI-Chat-Widget */
.ai-chat { position: fixed; right: 24px; bottom: 100px; z-index: 1000; }  /* über dem WhatsApp-Button */

.ai-chat-toggle {
    width: 60px; height: 60px; border-radius: 50%;
    background: var(--primary, #0066cc); color: #fff;
    border: none; cursor: pointer; font-size: 1.6rem;
    box-shadow: 0 6px 20px rgba(0,0,0,.25);
    display: flex; align-items: center; justify-content: center;
    transition: transform .2s;
}
.ai-chat-toggle:hover { transform: scale(1.06); }
.ai-chat-toggle.open { background: var(--secondary, #1a1a1a); }

.ai-chat-panel {
    position: fixed; right: 24px; left: auto; bottom: 172px;
    width: 370px; max-width: calc(100vw - 48px);
    height: min(540px, calc(100vh - 200px));
    background: #fff; border-radius: 16px;
    box-shadow: 0 16px 50px rgba(0,0,0,.3);
    display: flex; flex-direction: column; overflow: hidden;
    border: 1px solid #e9ecef;
}
.ai-chat-panel[hidden] { display: none; }

.ai-chat-header {
    background: var(--primary, #0066cc); color: #fff;
    padding: 14px 16px; font-weight: 600;
    display: flex; align-items: center; justify-content: space-between;
}
.ai-chat-header .ai-chat-close {
    background: none; border: none; color: #fff;
    font-size: 1.5rem; line-height: 1; cursor: pointer; opacity: .9;
}

.ai-chat-msgs {
    flex: 1; overflow-y: auto; padding: 16px;
    background: #f4f5f7; display: flex; flex-direction: column; gap: 10px;
}
.ai-msg {
    max-width: 85%; padding: 10px 13px; border-radius: 14px;
    font-size: .92rem; line-height: 1.45; word-wrap: break-word; white-space: normal;
}
.ai-bot { background: #fff; border: 1px solid #e9ecef; align-self: flex-start; border-bottom-left-radius: 4px; }
.ai-user { background: var(--primary, #0066cc); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }

.ai-typing span {
    display: inline-block; width: 7px; height: 7px; margin: 0 2px;
    background: #adb5bd; border-radius: 50%; animation: aiblink 1.2s infinite both;
}
.ai-typing span:nth-child(2) { animation-delay: .2s; }
.ai-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes aiblink { 0%,80%,100% { opacity: .3; } 40% { opacity: 1; } }

.ai-chat-form { display: flex; align-items: center; gap: 6px; padding: 10px; border-top: 1px solid #e9ecef; }
.ai-chat-hp { display: none !important; }
.ai-chat-input {
    flex: 1; border: 1px solid #ced4da; border-radius: 999px;
    padding: 10px 14px; font-size: .92rem; font-family: inherit; outline: none;
}
.ai-chat-input:focus { border-color: var(--primary, #0066cc); }
.ai-chat-attach, .ai-chat-send {
    width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; border: none; font-size: 1.1rem;
}
.ai-chat-attach { background: #e9ecef; color: #495057; }
.ai-chat-send { background: var(--primary, #0066cc); color: #fff; }

.ai-chat-hint { font-size: .72rem; color: #adb5bd; text-align: center; padding: 0 10px 8px; }

@media (max-width: 768px) {
    .ai-chat { right: 15px; bottom: 150px; }          /* über WhatsApp-Button + Mobile-Nav */
    .ai-chat-panel { left: 8px; right: 8px; top: 70px; bottom: 150px; width: auto; height: auto; max-height: none; }
}
