.chatbot {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 400px;
    height: 600px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, visibility 0.3s ease, opacity 0.3s ease;
    z-index: 9999;
}

.chatbot.active {
    transform: translateY(0);
    visibility: visible;
    opacity: 1;
}

.chatbot:not(.active) {
    transform: translateY(150%);  /* Erhöht auf 150% um sicherzustellen, dass es komplett außerhalb des Sichtfelds ist */
    visibility: hidden;  /* Versteckt es komplett wenn nicht aktiv */
    opacity: 0;  /* Macht es unsichtbar */
}

.chatbot-header {
    padding: 20px;
    background: #4f46e5;
    color: white;
    border-radius: 12px 12px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chatbot-header__title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chatbot-header__status {
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    position: relative;
}

.chatbot-header__status::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: inherit;
    border-radius: inherit;
    opacity: 0.5;
    animation: pulse 2s infinite;
}

.chatbot-header__controls {
    display: flex;
    gap: 10px;
}

.chatbot-header__button {
    background: none;
    border: none;
    color: white;
    padding: 5px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.chatbot-header__button:hover {
    opacity: 1;
}

.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chatbot-message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
}

.chatbot-message--user {
    align-self: flex-end;
    background: #4f46e5;
    color: white;
    border-radius: 12px 12px 0 12px;
}

.chatbot-message--bot {
    align-self: flex-start;
    background: #f3f4f6;
    color: #1f2937;
    border-radius: 12px 12px 12px 0;
}

.chatbot-message--system {
    align-self: center;
    background: #f3f4f6;
    color: #6b7280;
    font-size: 13px;
    padding: 8px 12px;
    border-radius: 100px;
}

.chatbot-input {
    padding: 20px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 10px;
}

.chatbot-input__field {
    flex: 1;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
    resize: none;
    max-height: 120px;
    min-height: 24px;
}

.chatbot-input__field:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}

.chatbot-input__button {
    background: #4f46e5;
    color: white;
    border: none;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.chatbot-input__button:hover {
    background: #4338ca;
}

.chatbot-input__button:disabled {
    background: #e5e7eb;
    cursor: not-allowed;
}

.chatbot-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: #4f46e5;
    border: none;
    border-radius: 30px;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.chatbot-toggle:hover {
    transform: scale(1.05);
}

.chatbot-toggle.hidden {
    transform: scale(0);
}

.chatbot-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: #f3f4f6;
    border-radius: 12px 12px 12px 0;
    align-self: flex-start;
}

.chatbot-typing span {
    width: 6px;
    height: 6px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typing 1s infinite;
}

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

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }
    70% {
        transform: scale(2);
        opacity: 0;
    }
    100% {
        transform: scale(2.5);
        opacity: 0;
    }
}

@keyframes typing {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

@media (max-width: 640px) {
    .chatbot {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
    
    .chatbot-header {
        border-radius: 0;
    }
    
    .chatbot-toggle {
        width: 50px;
        height: 50px;
    }
}