/* ==============================================================
   BVD CHATBOT – modernes Layout
   ============================================================== */

#wek-chatbot-toggle,
#wek-chatbot-box,
#wek-chatbot-box * {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    box-sizing: border-box;
}

/* --------------------------------------------------------------
   TOGGLE (freistehende Beraterin + Sprechblase)
-------------------------------------------------------------- */

#wek-chatbot-toggle {
    position: fixed;
    bottom: 16px;
    left: 20px;
    cursor: pointer;
    z-index: 999999;
}

#wek-chatbot-avatar-wrap {
    position: relative;
    display: inline-block;
}

#wek-chatbot-avatar {
    width: 120px !important;
    max-width: 120px !important;
    height: auto !important;
    display: block;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.22));
    transform-origin: bottom center;
    animation: wekBob 4.5s ease-in-out infinite;
    transition: transform 0.2s ease;
}

#wek-chatbot-toggle:hover #wek-chatbot-avatar {
    transform: scale(1.05);
}

/* Online-Punkt an der Beraterin */
#wek-chatbot-status {
    position: absolute;
    right: 16px;
    bottom: 16px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #2ecc71;
    border: 3px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

/* Sprechblase – die Beraterin spricht den Besucher an */
#wek-chatbot-bubble {
    position: absolute;
    left: 104px;
    bottom: 92px;
    width: 220px;

    background: #ffffff;
    color: #222;
    font-size: 14px;
    line-height: 1.45;
    font-weight: 500;
    padding: 13px 15px;

    border-radius: 18px;
    border-bottom-left-radius: 5px;
    box-shadow: 0 10px 28px rgba(0,0,0,0.18);

    transform-origin: bottom left;
    animation: wekBubbleIn 0.5s cubic-bezier(0.22,1,0.36,1) 0.7s both,
               wekBubbleFloat 4s ease-in-out 1.2s infinite;
}

/* Sprechblasen-Spitze zur Beraterin */
#wek-chatbot-bubble::after {
    content: "";
    position: absolute;
    left: 18px;
    bottom: -9px;
    width: 0;
    height: 0;
    border-top: 12px solid #ffffff;
    border-right: 12px solid transparent;
}

/* kleiner Hinweis-Punkt oben an der Blase */
#wek-chatbot-bubble::before {
    content: "🎟️";
    position: absolute;
    top: -12px;
    right: -6px;
    font-size: 18px;
    transform: rotate(12deg);
}

/* Beim Öffnen des Chats: Sprechblase ausblenden */
#wek-chatbot-toggle.wek-chat-open #wek-chatbot-bubble {
    opacity: 0;
    transform: translateY(8px) scale(0.9);
    pointer-events: none;
    animation: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

/* --------------------------------------------------------------
   CHATBOX
-------------------------------------------------------------- */

#wek-chatbot-box {
    position: fixed;
    bottom: 150px;
    left: 20px;
    width: 360px;
    height: 70vh;
    max-height: 640px;

    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 18px 50px rgba(0,0,0,0.28);

    display: none;
    flex-direction: column;

    overflow: visible !important; /* Kalender darf rausstehen */
    z-index: 999999 !important;
}

#wek-chatbot-box.wek-open {
    display: flex;
    animation: wekBoxIn 0.28s cubic-bezier(0.22,1,0.36,1) both;
}

/* --------------------------------------------------------------
   HEADER
-------------------------------------------------------------- */

#wek-chatbot-header {
    display: flex !important;
    align-items: center;
    gap: 11px;
    padding: 12px 14px;
    background: linear-gradient(135deg, #ff2e88 0%, #d6005e 100%) !important;
    color: #fff !important;
    border-top-left-radius: 18px;
    border-top-right-radius: 18px;
    flex: 0 0 auto;
}

/* Hohe Spezifität + !important, damit kein Theme die Avatar-Größe überschreibt */
#wek-chatbot-box .wek-head-ava {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    max-width: 40px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    object-position: center top !important;
    background: rgba(255,255,255,0.22);
    flex: 0 0 auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
}

.wek-head-meta { line-height: 1.25; }

#wek-chatbot-header .wek-head-name {
    font-weight: 700;
    font-size: 14px;
    color: #fff !important;
    margin: 0 !important;
}

#wek-chatbot-header .wek-head-status {
    font-size: 11px;
    opacity: 0.95;
    color: #fff !important;
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 0 !important;
}

.wek-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #8effbf;
    animation: wekPulse 2s infinite;
}

#wek-chatbot-close {
    margin-left: auto;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.9;
    padding: 0 4px;
}
#wek-chatbot-close:hover { opacity: 1; }

/* --------------------------------------------------------------
   KALENDER
-------------------------------------------------------------- */

#wek-datepicker-container {
    padding: 10px;
    background: #fafafa;
    border-bottom: 1px solid #eee;
}

#wek-datepicker {
    width: 100%;
    padding: 9px;
    border-radius: 10px;
    border: none;
    background: #ff0099;
    font-size: 14px;
    color: #fff;
    cursor: pointer;
}

#wek-datepicker::placeholder { color: #fff; opacity: .95; }

.flatpickr-calendar { z-index: 9999999 !important; }

/* --------------------------------------------------------------
   NACHRICHTEN
-------------------------------------------------------------- */

#wek-chatbot-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 14px;
    background: #f7f7fa;
    scroll-behavior: smooth;
}

.wek-user-msg {
    background: linear-gradient(135deg, #ff2e88, #ff006e);
    color: #fff;
    padding: 10px 14px;
    border-radius: 16px;
    border-bottom-right-radius: 5px;
    margin-bottom: 10px;
    max-width: 80%;
    margin-left: auto;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(255,0,110,0.20);
}

.wek-bot-msg {
    background: #ffffff;
    color: #222;
    padding: 10px 14px;
    border-radius: 16px;
    border-bottom-left-radius: 5px;
    margin-bottom: 10px;
    max-width: 85%;
    font-size: 14px;
    line-height: 1.45;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.wek-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 12px;
}

/* Eventim-Fallback-Button (bewusst andersfarbig als BVD-Pink) */
.wek-eventim-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #001f5f;
    color: #fff !important;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    padding: 9px 16px;
    border-radius: 999px;
    margin: 0 0 12px;
    box-shadow: 0 3px 10px rgba(0,31,95,0.30);
    transition: background .15s ease, transform .15s ease;
}
.wek-eventim-btn:hover {
    background: #00163f;
    color: #fff !important;
    transform: translateY(-1px);
}

/* --------------------------------------------------------------
   QUICK-REPLIES
-------------------------------------------------------------- */

#wek-quickreplies {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;   /* Buttons zentriert */
    gap: 6px;
    padding: 10px;
    background: #fff;
    border-top: 1px solid #eee;
}

.wek-qr-btn {
    background: #fff0f6;
    color: #c1005e;
    border: 1px solid #ffd0e4;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s ease;
}

.wek-qr-btn:hover {
    background: #ff006e;
    color: #fff;
    border-color: #ff006e;
}

/* --------------------------------------------------------------
   EINGABEFELD
-------------------------------------------------------------- */

#wek-chatbot-inputbar {
    display: flex;
    padding: 10px;
    background: #fff;
    border-top: 1px solid #eee;
    border-bottom-left-radius: 18px;
    border-bottom-right-radius: 18px;
}

#wek-chatbot-input {
    flex: 1;
    padding: 11px 14px;
    border-radius: 999px;
    border: 1px solid #e3e3e8;
    font-size: 14px;
    outline: none;
    transition: border-color .15s ease;
}
#wek-chatbot-input:focus { border-color: #ff006e; }

#wek-chatbot-send {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #ff2e88, #ff006e);
    color: #fff;
    margin-left: 8px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 17px;
    transition: transform .15s ease, box-shadow .15s ease;
    box-shadow: 0 4px 12px rgba(255,0,110,0.35);
}
#wek-chatbot-send:hover { transform: scale(1.06); }

/* --------------------------------------------------------------
   TYPING
-------------------------------------------------------------- */

.wek-typing {
    font-size: 14px;
    color: #888;
    margin: 6px 0 12px;
    opacity: 0;
    animation: fadeInOut 1.2s infinite;
}

@keyframes fadeInOut {
    0% { opacity: 0; } 50% { opacity: 1; } 100% { opacity: 0; }
}

/* --------------------------------------------------------------
   EVENT-KARTE
-------------------------------------------------------------- */

.event-card {
    background: #ffffff;
    border: 1px solid #f0f0f3;
    border-radius: 12px;
    padding: 9px 11px;
    margin-bottom: 8px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.07);
    opacity: 0;
    transform: translateY(12px);
    animation: wekFadeIn .45s cubic-bezier(0.22,1,0.36,1) forwards;
}

.event-card-title {
    font-size: 14px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 6px;
    line-height: 1.25;
}

.event-card-content { display: flex; gap: 10px; }

#wek-chatbot-box .event-card-left img {
    width: 60px !important;
    height: 60px !important;
    max-width: 60px !important;
    object-fit: cover !important;
    border-radius: 8px !important;
    background: #f3f3f3;
    margin: 0 !important;
}

.event-card-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.event-card-badges { display: flex; flex-wrap: wrap; gap: 5px; }

.event-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 999px;
    line-height: 1.6;
}
.event-badge-type { background: #ffe3f0; color: #c1005e; }
.event-badge-cat  { background: #eef0ff; color: #3a44b0; }

.event-card-date  { font-size: 12px; font-weight: 600; color: #444; }
.event-card-price { font-size: 13px; font-weight: 800; color: #ff006e; }

/* Preis + Button in einer Zeile, Button rechtsbündig */
.event-card-bottom {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}
.event-card-bottom .event-card-price { margin: 0; }
.event-card-bottom .event-card-btn {
    margin-top: 0;
    margin-left: auto;   /* schiebt den Button nach rechts */
}

.event-card-btn {
    display: inline-block;
    background: linear-gradient(135deg, #ff2e88, #ff006e);
    color: #fff;
    padding: 4px 11px;
    border-radius: 999px;
    text-decoration: none;
    font-size: 11.5px;
    font-weight: 700;
    width: fit-content;
    margin-top: 3px;
    transition: transform .15s ease;
}
.event-card-btn:hover { transform: translateY(-1px); color: #fff; }

/* --------------------------------------------------------------
   ANIMATIONEN
-------------------------------------------------------------- */

@keyframes wekFadeIn {
    0%   { opacity: 0; transform: translateY(14px); }
    100% { opacity: 1; transform: translateY(0); }
}

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

@keyframes wekBubbleIn {
    0%   { opacity: 0; transform: translateY(10px) scale(0.9); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

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

@keyframes wekBoxIn {
    0%   { opacity: 0; transform: translateY(16px) scale(0.98); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes wekPulse {
    0%   { box-shadow: 0 0 0 0 rgba(142,255,191,0.7); }
    70%  { box-shadow: 0 0 0 8px rgba(142,255,191,0); }
    100% { box-shadow: 0 0 0 0 rgba(142,255,191,0); }
}

/* --------------------------------------------------------------
   MOBIL
-------------------------------------------------------------- */

@media (max-width: 600px) {

    /* Beraterin-Button kleiner, näher in die Ecke */
    #wek-chatbot-toggle { bottom: 12px; left: 12px; }
    #wek-chatbot-avatar { width: 78px !important; max-width: 78px !important; }
    #wek-chatbot-status { right: 9px; bottom: 11px; width: 13px; height: 13px; }

    /* Sprechblase auf kleinen Screens ausblenden (zu wenig Platz) */
    #wek-chatbot-bubble { display: none; }

    /* Chat als bildschirmfüllendes Bottom-Sheet von unten */
    #wek-chatbot-box {
        width: 100% !important;
        max-width: 100% !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        top: auto !important;
        height: 88vh !important;
        height: 88dvh !important;
        max-height: 100% !important;
        border-radius: 18px 18px 0 0;
    }

    #wek-chatbot-header {
        border-top-left-radius: 18px;
        border-top-right-radius: 18px;
    }

    /* Eingabeleiste bündig unten + Schutz vor iPhone-Hausleiste */
    #wek-chatbot-inputbar {
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
    }

    /* Etwas größere Tippziele */
    #wek-chatbot-input { padding: 12px 15px; }

    /* Wenn der Chat offen ist: den Avatar-Button ausblenden (mehr Platz) */
    #wek-chatbot-toggle.wek-chat-open { display: none !important; }
}
