/* ============================================================
   chatbot.css — Hilfeweb.com Chatbot
   Standalone, RTL-fähig, grün/orange Corporate Design
   ============================================================ */

/* === Schwebender Button === */
#chatbot-toggle {
    position: fixed;
    bottom: 24px;
    left: 24px;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f5a623 0%, #e8951a 100%);
    color: white;
    border: 3px solid white;
    cursor: pointer;
    font-size: 2.2rem;
    box-shadow: 0 6px 25px rgba(245,166,35,0.5);
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s, box-shadow 0.3s;
    animation: chatbot-pulse 1.8s infinite;
}
#chatbot-toggle:hover {
    transform: scale(1.12) rotate(-5deg);
    box-shadow: 0 8px 35px rgba(245,166,35,0.7);
}
@keyframes chatbot-pulse {
    0%, 100% {
        box-shadow: 0 6px 25px rgba(245,166,35,0.5), 0 0 0 0 rgba(245,166,35,0.5);
    }
    50% {
        box-shadow: 0 6px 25px rgba(245,166,35,0.5), 0 0 0 18px rgba(245,166,35,0);
    }
}
#chatbot-toggle.active { animation: none; background: linear-gradient(135deg, #1a7a4c 0%, #2d9560 100%); }

/* === Aufmerksamkeits-Badge ("Neu" / "1") === */
#chatbot-toggle::after {
    content: "؟";
    position: absolute;
    top: -4px;
    right: -4px;
    background: #d93025;
    color: white;
    font-size: 0.85rem;
    font-weight: bold;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    animation: badge-bounce 2s infinite;
}
@keyframes badge-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

/* === Popup-Hinweis nach 3 Sekunden === */
#chatbot-hint {
    position: fixed;
    bottom: 110px;
    left: 24px;
    background: white;
    color: #1a5a38;
    padding: 12px 18px 12px 14px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    font-size: 0.95rem;
    font-weight: 600;
    z-index: 99997;
    max-width: 240px;
    border-right: 4px solid #f5a623;
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 0.4s, transform 0.4s;
    pointer-events: none;
    display: none;
}
#chatbot-hint.show {
    opacity: 1;
    transform: translateX(0);
    display: block;
    animation: hint-pulse 4s forwards;
}
#chatbot-hint::after {
    content: "";
    position: absolute;
    bottom: -8px;
    left: 30px;
    border-width: 8px 8px 0 0;
    border-style: solid;
    border-color: white transparent transparent transparent;
}
@keyframes hint-pulse {
    0% { opacity: 0; transform: translateX(-20px); }
    10%, 85% { opacity: 1; transform: translateX(0); }
    100% { opacity: 0; transform: translateX(-20px); display: none; }
}

/* === Chat-Fenster === */
#chatbot-window {
    position: fixed;
    bottom: 100px;
    left: 24px;
    width: 380px;
    max-width: calc(100vw - 48px);
    max-height: 550px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    z-index: 99999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
    direction: rtl;
}
#chatbot-window.open { display: flex; }

/* === Header === */
#chatbot-header {
    background: linear-gradient(135deg, #1a7a4c 0%, #2d9560 100%);
    color: white;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
#chatbot-header .bot-info { display: flex; align-items: center; gap: 10px; }
#chatbot-header .bot-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
}
#chatbot-header .bot-name { font-weight: bold; font-size: 1rem; }
#chatbot-header .bot-status {
    font-size: 0.72rem; opacity: 0.9;
    display: flex; align-items: center; gap: 4px;
}
#chatbot-header .status-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: #4ade80; display: inline-block;
}
#chatbot-close {
    background: none; border: none; color: white;
    font-size: 1.5rem; cursor: pointer; padding: 0 4px;
    line-height: 1;
}
#chatbot-close:hover { opacity: 0.7; }

/* === Nachrichten === */
#chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8f9fa;
    scroll-behavior: smooth;
}
.bot-msg, .user-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 10px;
    word-wrap: break-word;
}
.bot-msg {
    background: white;
    color: #333;
    border: 1px solid #e8e8e8;
    margin-left: auto;
    border-bottom-left-radius: 4px;
}
.user-msg {
    background: linear-gradient(135deg, #1a7a4c 0%, #2d9560 100%);
    color: white;
    margin-right: auto;
    border-bottom-right-radius: 4px;
}
.bot-msg a {
    color: #1a7a4c;
    font-weight: bold;
    text-decoration: none;
}
.bot-msg a:hover { text-decoration: underline; }
.bot-source {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px dashed #e0e0e0;
    font-size: 0.8rem;
}

/* === Loading-Animation === */
.bot-typing {
    display: flex; gap: 4px; padding: 12px 14px;
    background: white; border: 1px solid #e8e8e8;
    border-radius: 14px; width: fit-content;
    margin-left: auto; margin-bottom: 10px;
}
.bot-typing span {
    width: 8px; height: 8px; border-radius: 50%;
    background: #999;
    animation: typing-bounce 1.4s infinite;
}
.bot-typing span:nth-child(2) { animation-delay: 0.2s; }
.bot-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* === Schnell-Vorschläge === */
#chatbot-suggestions {
    padding: 8px 12px;
    background: white;
    border-top: 1px solid #f0f0f0;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    overflow-x: auto;
}
.suggestion-chip {
    padding: 6px 14px;
    background: #f0f5f2;
    border: 1px solid #cfe3d8;
    border-radius: 20px;
    font-size: 0.78rem;
    color: #1a7a4c;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    font-family: inherit;
}
.suggestion-chip:hover {
    background: #1a7a4c;
    color: white;
    border-color: #1a7a4c;
}

/* === Eingabebereich === */
#chatbot-input-area {
    padding: 12px;
    background: white;
    border-top: 1px solid #f0f0f0;
    display: flex;
    align-items: flex-end;
    gap: 8px;
}
#chatbot-input {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1.05rem;
    font-family: inherit;
    direction: rtl;
    outline: none;
    transition: border-color 0.2s;
    min-height: 72px;
    max-height: 150px;
    resize: vertical;
    line-height: 1.6;
    overflow-y: auto;
}
#chatbot-input:focus { border-color: #1a7a4c; }
#chatbot-send {
    background: linear-gradient(135deg, #1a7a4c 0%, #2d9560 100%);
    color: white;
    border: none;
    padding: 14px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.15rem;
    font-family: inherit;
    transition: transform 0.2s;
    min-height: 52px;
}
#chatbot-send:hover { transform: scale(1.05); }

/* === Datenschutz-Hinweis === */
#chatbot-privacy {
    background: #fff3cd;
    border-top: 1px solid #ffe69c;
    padding: 8px 12px;
    font-size: 0.72rem;
    color: #856404;
    text-align: center;
}

/* === Mobile === */
@media (max-width: 480px) {
    #chatbot-window {
        left: 0; bottom: 0;
        width: 100%; max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    #chatbot-toggle { bottom: 16px; left: 16px; }
    #chatbot-hint { bottom: 100px; left: 16px; max-width: 200px; }
}

/* === Scrollbar-Stil === */
#chatbot-messages::-webkit-scrollbar { width: 5px; }
#chatbot-messages::-webkit-scrollbar-track { background: transparent; }
#chatbot-messages::-webkit-scrollbar-thumb {
    background: #c0c0c0; border-radius: 5px;
}

/* === Sonderfall-Hinweis (v2) ===
 * Wird bei erkannten Einzelfällen (Untermieter, WG, Azubi ...)
 * unter die Standardantwort gehängt. Warn-Orange, dezent. */
.bot-special-note {
    margin-top: 8px;
    padding: 8px 10px;
    background: #fff3cd;
    border: 1px solid #ffe69c;
    border-radius: 8px;
    font-size: 0.8rem;
    color: #856404;
    line-height: 1.5;
}
.bot-special-note a { color: #b8860b; font-weight: bold; }

/* === Disambiguation-Chips (v2) ===
 * Klickbare Auswahl bei mehrdeutigen Fragen ("Meinen Sie X oder Y?"). */
.bot-disambiguation {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 10px;
    margin-left: auto;
    max-width: 85%;
    direction: rtl;
}
.disambig-chip {
    padding: 7px 14px;
    background: #fff;
    border: 2px solid #1a7a4c;
    border-radius: 20px;
    font-size: 0.8rem;
    color: #1a7a4c;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    transition: all 0.2s;
}
.disambig-chip:hover {
    background: #1a7a4c;
    color: white;
}
