/* ==========================================================================
   Club Bot
   ========================================================================== */

/* --- Container & Icon --- */
.vb-widget-container {
    position: relative;
    width: 100%;
    min-height: 90px;
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

#vb-chat-icon {
    cursor: pointer;
    text-align: center;
    position: relative;
    z-index: 100;
}

#vb-chat-icon img,
.vb-default-icon {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s;
}

.vb-default-icon {
    background: #0073aa;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 35px;
}

#vb-chat-icon:hover img {
    transform: scale(1.05);
}

.vb-icon-label {
    display: block;
    margin-top: 5px;
    background: #444;
    color: #fff;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: bold;
}

/* --- Chat-Fenster --- */
#vb-chat-window {
    position: fixed;
    bottom: 20px;
    width: 350px;
    height: 500px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    z-index: 99999;
    overflow: hidden;
}

.vb-pos-left  { left: 20px;  right: auto; }
.vb-pos-right { right: 20px; left: auto; }

#vb-chat-window.vb-expanded {
    width: 600px;
    height: 700px;
    max-width: 90vw;
    max-height: 90vh;
    z-index: 999999 !important;
}

/* Divi: Überlagerung nur für die linke Position verhindern.
   Niedriger als Lightboxen (meist 10000+), aber über dem Seitentext. */
.et_pb_column:has(#vb-chat-window.vb-pos-left),
.et_pb_widget_area:has(#vb-chat-window.vb-pos-left),
.et_pb_widget:has(#vb-chat-window.vb-pos-left),
aside:has(#vb-chat-window.vb-pos-left),
.et_pb_section:has(#vb-chat-window.vb-pos-left) {
    z-index: 990 !important;
    isolation: auto !important; /* keine Isolation, damit Lightbox-Layouts nicht gestört werden */
}

.vb-hidden { display: none !important; }

.vb-chat-header {
    background: #23282d;
    color: #fff;
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
}

.vb-controls button {
    background: none;
    border: none;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    margin-left: 8px;
}

#vb-chat-messages {
    flex: 1;
    padding: 15px;
    background: #f1f1f1;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.5;
}

/* --- Smartphones --- */
@media screen and (max-width: 480px) {

    /* Kleines Chat-Fenster auf dem Handy */
    #vb-chat-window {
        width: 92vw !important;
        left: 4vw !important;     /* zentriert: 4 % + 92 % + 4 % */
        right: 4vw !important;
        height: 75vh !important;
        bottom: 10px !important;
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.4) !important;
    }

    /* Vergrößertes Fenster auf dem Handy */
    #vb-chat-window.vb-expanded {
        width: 100vw !important;
        height: 80vh !important;
        max-width: 100vw !important;
        max-height: 100vh !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        border-radius: 0 !important;
    }

    /* Mehr Platz für Text in den Sprechblasen */
    .vb-message {
        max-width: 90% !important;
    }
}

/* --- Nachrichten --- */
.vb-message {
    margin-bottom: 15px;
    padding: 10px 14px;
    border-radius: 18px;
    max-width: 85%;
    word-wrap: break-word;
}

.vb-bot {
    background: #fff;
    border-bottom-left-radius: 2px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.vb-user {
    background: #0073aa;
    color: #fff;
    border-bottom-right-radius: 2px;
    margin-left: auto;
}

/* --- Markdown-Ausgabe (marked.js): kompakte Formatierung --- */
.markdown-body p {
    margin: 0 0 2px 0 !important;
}

.markdown-body strong {
    color: #0073aa;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
    font-size: 1.1em;
    margin: 6px 0 2px 0 !important;
    font-weight: bold;
}

.markdown-body ul,
.markdown-body ol {
    margin: 0 !important;
    padding-left: 0 !important;
    list-style-type: disc !important;
}

.markdown-body li {
    margin-bottom: 0 !important;
}

/* Links: normal fast schwarz ohne Unterstreichung, beim Drüberfahren grau mit Unterstreichung */
.markdown-body a {
    color: #1d2327 !important;
    text-decoration: none !important;
    transition: color 0.2s ease;
}

.markdown-body a:hover {
    color: #3c434a !important;
    text-decoration: underline !important;
}

/* Kein Abstand nach dem letzten Element, damit die Sprechblase unten bündig abschließt */
.markdown-body *:last-child {
    margin-bottom: 0 !important;
}

/* --- Eingabe --- */
.vb-chat-input {
    padding: 10px;
    background: #fff;
    border-top: 1px solid #ddd;
    display: flex;
    position: relative !important;
    z-index: 9998 !important; /* Container liegt ganz vorne */
}

#vb-user-input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;

    /* Erzwingt, dass das Feld anklickbar ist und Text erlaubt */
    pointer-events: auto !important;
    user-select: text !important;
    -webkit-user-select: text !important; /* iPhone/Safari */

    /* Schützt das Feld gegen unsichtbare Überlagerungen */
    position: relative !important;
    z-index: 9999999 !important;
}

#vb-send-btn {
    margin-left: 8px;
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 4px;
    width: 40px;
    cursor: pointer;
}

/* --- Lade-Animation --- */
.vb-loading {
    padding: 5px 15px;
    background: #f1f1f1;
    color: #888;
    font-size: 20px;
    font-weight: bold;
}

.vb-dots span { animation: vb-blink 1.4s infinite both; }
.vb-dots span:nth-child(2) { animation-delay: .2s; }
.vb-dots span:nth-child(3) { animation-delay: .4s; }

@keyframes vb-blink {
    0%   { opacity: .2; }
    20%  { opacity: 1; }
    100% { opacity: .2; }
}

/* --- Standardbild (freigestellte Figur): nicht rund beschneiden, Schatten folgt der Kontur --- */
#vb-chat-icon img.vb-icon-art {
    width: 96px;
    height: 96px;
    object-fit: contain;
    border-radius: 0;
    box-shadow: none;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.28));
}
