/* TTC KiBot Chat-Widget */

#ttc-kibot-wrapper {
    position: fixed;
    bottom: 24px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#ttc-kibot-wrapper.ttc-kibot-right {
    right: 24px;
}

#ttc-kibot-wrapper.ttc-kibot-left {
    left: 24px;
}

/* Toggle-Button */
#ttc-kibot-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #1a73e8;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    transition: background 0.2s, transform 0.2s;
    margin-left: auto;
}

.ttc-kibot-left #ttc-kibot-toggle {
    margin-left: 0;
    margin-right: auto;
}

#ttc-kibot-toggle:hover {
    background: #1557b0;
    transform: scale(1.05);
}

#ttc-kibot-toggle svg {
    width: 24px;
    height: 24px;
}

/* Chat-Fenster */
#ttc-kibot-window {
    display: none;
    flex-direction: column;
    width: 360px;
    height: 500px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    margin-bottom: 12px;
    overflow: hidden;
}

#ttc-kibot-window.ttc-kibot-open {
    display: flex;
}

/* Header */
#ttc-kibot-header {
    background: #1a73e8;
    color: #fff;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

#ttc-kibot-bot-name {
    font-size: 16px;
    font-weight: 600;
}

#ttc-kibot-status {
    font-size: 12px;
    opacity: 0.85;
}

/* Nachrichten */
#ttc-kibot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

.ttc-kibot-message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.ttc-kibot-message.bot {
    background: #f1f3f4;
    color: #202124;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.ttc-kibot-message.user {
    background: #1a73e8;
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* Markdown-Formatierung in Bot-Nachrichten */
.ttc-kibot-message.bot ul {
    margin: 6px 0 2px 0;
    padding-left: 18px;
}

.ttc-kibot-message.bot li {
    margin-bottom: 3px;
}

/* Links in Bot-Nachrichten */
.ttc-kibot-message.bot a {
    color: #1a73e8;
    text-decoration: underline;
    word-break: break-all;
}

.ttc-kibot-message.bot a:hover {
    color: #1557b0;
}

/* Tipp-Indikator */
.ttc-kibot-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    background: #f1f3f4;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
}

.ttc-kibot-typing span {
    width: 8px;
    height: 8px;
    background: #9aa0a6;
    border-radius: 50%;
    animation: ttc-kibot-bounce 1.2s infinite;
}

.ttc-kibot-typing span:nth-child(2) { animation-delay: 0.2s; }
.ttc-kibot-typing span:nth-child(3) { animation-delay: 0.4s; }

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

/* Fehlermeldung */
.ttc-kibot-error {
    color: #c5221f;
    background: #fce8e6;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    padding: 10px 14px;
    font-size: 13px;
    align-self: flex-start;
    max-width: 85%;
}

/* Eingabebereich */
#ttc-kibot-input-area {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #e8eaed;
    background: #fff;
}

#ttc-kibot-input {
    flex: 1;
    resize: none;
    border: 1px solid #dadce0;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    max-height: 120px;
    overflow-y: auto;
    transition: border-color 0.2s;
    line-height: 1.4;
}

#ttc-kibot-input:focus {
    border-color: #1a73e8;
}

#ttc-kibot-send {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #1a73e8;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
}

#ttc-kibot-send:hover {
    background: #1557b0;
}

#ttc-kibot-send:disabled {
    background: #dadce0;
    cursor: not-allowed;
}

#ttc-kibot-send svg {
    width: 18px;
    height: 18px;
}

/* Mobilgeräte */
@media (max-width: 480px) {
    #ttc-kibot-wrapper.ttc-kibot-right,
    #ttc-kibot-wrapper.ttc-kibot-left {
        right: 12px;
        left: 12px;
        bottom: 12px;
    }

    #ttc-kibot-window {
        width: 100%;
        height: 420px;
    }
}
