/**
 * 4Unit Chatbot - Öffentliche Styles
 *
 * @author 4Unit Systems Integration GmbH <info@4unit.com>
 */

/* Chatbot Container */
.fourunit-chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    visibility: visible; /* War vorher hidden, wird aber jetzt initial sichtbar gemacht */
}

/* _4unit Chat Stile */
#_4unit-chat-container {
    /* Keine zusätzlichen Stile notwendig, das Paket bringt seine eigenen Stile mit */
    /* Wir stellen sicher, dass der Container für das _4unit-Chat-Modul richtig positioniert ist */
    position: fixed;
    bottom: 0;
    right: 0;
    z-index: 9999;
    /* Das Widget kümmert sich um seine eigene Positionierung */
}

/* Spezifische Anpassungen für den _4unit Chat */
._4unit-chat-widget {
    /* Wir müssen keine zusätzlichen Stile hinzufügen, aber wir können das Erscheinungsbild bei Bedarf überschreiben */
    /* zum Beispiel die Position auf der linken Seite wenn die Option auf "left" gesetzt ist */
}

.fourunit-position-left #_4unit-chat-container {
    left: 0;
    right: auto;
}

/* Chatbot Toggle Button */
.fourunit-chatbot-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: #0056b3; /* Dunkleres Blau als Standard */
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
    position: relative;
}

.fourunit-chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.fourunit-chatbot-toggle:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.fourunit-chatbot-toggle:hover:before {
    opacity: 1;
}

.fourunit-chatbot-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
    position: relative;
}

/* Icon-Animationen */
.fourunit-chatbot-icon .main-icon {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.fourunit-chatbot-icon .close-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.fourunit-chatbot-toggle.is-active .main-icon {
    opacity: 0;
    transform: scale(0);
}

.fourunit-chatbot-toggle.is-active .close-icon {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) rotate(180deg);
}

/* Header-Icon */
.fourunit-chatbot-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
}

.fourunit-chatbot-header .header-icon {
    margin-right: 4px;
}

/* Chatbot Widget */
.fourunit-chatbot-widget {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    height: 520px;
    background-color: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1), 0 2px 10px rgba(0, 0, 0, 0.07);
    display: none;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    transform: translateY(20px);
    opacity: 0;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.fourunit-chatbot-widget.active {
    display: flex;
    transform: translateY(0);
    opacity: 1;
}

/* Chatbot Header */
.fourunit-chatbot-header {
    padding: 16px 20px;
    background-color: #0056b3;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.fourunit-chatbot-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 500;
    letter-spacing: 0.2px;
}

.fourunit-chatbot-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 5px 8px;
    margin: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    width: 28px;
    height: 28px;
}

.fourunit-chatbot-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Chatbot Body */
.fourunit-chatbot-body {
    flex: 1;
    overflow: hidden;
    background-color: #f9f9f9;
    position: relative;
}

#fourunit-chatbot-iframe {
    width: 100%;
    height: 100%;
    border: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: white;
}

/* Chat Loading Indicator */
.fourunit-chatbot-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #ffffff;
    z-index: 1;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.fourunit-chatbot-loading.hidden {
    opacity: 0;
    visibility: hidden;
}

.fourunit-chatbot-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 86, 179, 0.2);
    border-top-color: #0056b3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 4Unit Spezifische Styles */
/* Diese Styles helfen bei der Integration von 4Unit Embedded Chat */
.fourunit-iframe-fix {
    overflow: hidden !important;
    background: white !important;
}

.fourunit-iframe-fix iframe {
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Chat Badge für neue Nachrichten */
.fourunit-chatbot-toggle .chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #e74c3c;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transform: scale(0);
    animation: badge-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    z-index: 2;
}

@keyframes badge-pop {
    0% { transform: scale(0); }
    80% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Neuer Nachricht Animation */
.fourunit-chatbot-toggle.new-message {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(0, 86, 179, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(0, 86, 179, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 86, 179, 0); }
}

/* Positionierung */
.fourunit-chatbot-container.fourunit-position-left {
    left: 20px;
    right: auto;
}

.fourunit-chatbot-container.fourunit-position-left .fourunit-chatbot-widget {
    left: 20px;
    right: auto;
}

/* Für 4Unit optimierte Anzeige */
.fourunit-chatbot-container.fourunit-4unit-enabled .fourunit-chatbot-body {
    background-color: #fff;
}

/* 4Unit spezifische Styles */
.fourunit-chat-widget .fourunit-chatbot-body {
    background-color: white;
}

/* Verbesserte Header-Darstellung */
.fourunit-chatbot-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
}

.fourunit-chatbot-header .header-icon {
    margin-right: 2px;
}

/* Responsive Design */
@media (max-width: 480px) {
    .fourunit-chatbot-widget {
        width: calc(100% - 40px);
        height: 70vh;
        bottom: 90px;
        left: 20px;
        right: 20px;
    }
    
    .fourunit-chatbot-toggle {
        width: 52px;
        height: 52px;
    }
    
    .fourunit-iframe-fix iframe {
        width: 100% !important;
        height: 100% !important;
        max-width: 100% !important;
        max-height: 100% !important;
    }
}

/* Chat Message Styles */
._4unit-chat-widget .chat-message.bot.error {
    background-color: #fff8f8;
    border-color: rgba(255, 73, 73, 0.3);
    color: #e53935;
    font-size: 13px;
    padding: 15px;
    line-height: 1.5;
}

._4unit-chat-widget .chat-message.bot.error a {
    color: #0056b3;
    text-decoration: underline;
}

._4unit-chat-widget .chat-message.bot.loading {
    background-color: #f0f8ff;
    border-color: rgba(0, 123, 255, 0.3);
    color: #0056b3;
    font-size: 14px;
    text-align: center;
    padding: 15px;
    position: relative;
}

._4unit-chat-widget .chat-message.bot.loading:after {
    content: "";
    display: block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid rgba(0, 123, 255, 0.3);
    border-top-color: #0056b3;
    animation: spin 1s linear infinite;
    margin: 10px auto 0;
}

/* Chatbot-Widget Stile */
.chatbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: 'Roboto', sans-serif;
}

/* Stile für Links in Chatbot-Nachrichten */
.chatbot-widget .chat-messages .bot-message a {
    color: #1a73e8;
    text-decoration: underline;
    word-break: break-all;
    transition: color 0.2s;
}

.chatbot-widget .chat-messages .bot-message a:hover {
    color: #0d47a1;
    text-decoration: underline;
}

.chatbot-widget .chat-messages .bot-message a:focus {
    outline: 2px solid #4285f4;
    outline-offset: 2px;
}

/* Verbesserte Darstellung der Chatnachrichten */
.chatbot-widget .chat-messages .message {
    margin-bottom: 12px;
    padding: 10px 14px;
    max-width: 85%;
    border-radius: 18px;
    line-height: 1.5;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.chatbot-widget .chat-messages .user-message {
    background-color: #e3f2fd;
    color: #333;
    border-top-right-radius: 4px;
    align-self: flex-end;
    margin-left: auto;
}

.chatbot-widget .chat-messages .bot-message {
    background-color: #f5f5f5;
    color: #333;
    border-top-left-radius: 4px;
    align-self: flex-start;
}

/* Verbesserte Lesbarkeit */
.chatbot-widget .chat-messages {
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
    scrollbar-color: #c0c0c0 transparent;
}

.chatbot-widget .chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-widget .chat-messages::-webkit-scrollbar-thumb {
    background-color: #c0c0c0;
    border-radius: 3px;
}

.chatbot-widget .chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

/* Angepasste Textformatierung in Nachrichten */
.chatbot-widget .chat-messages .bot-message p,
.chatbot-widget .chat-messages .user-message p {
    margin: 0 0 8px 0;
}

.chatbot-widget .chat-messages .bot-message p:last-child,
.chatbot-widget .chat-messages .user-message p:last-child {
    margin-bottom: 0;
}

.chatbot-widget .chat-messages .bot-message ul,
.chatbot-widget .chat-messages .bot-message ol {
    padding-left: 20px;
    margin: 8px 0;
}

/* Bessere Darstellung von Codeblöcken und vorformatierten Texten */
.chatbot-widget .chat-messages .bot-message code {
    background-color: #f1f1f1;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.chatbot-widget .chat-messages .bot-message pre {
    background-color: #f1f1f1;
    padding: 10px;
    border-radius: 5px;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    margin: 10px 0;
} 