/* -------------------------------------- */
/* Floating toggle button                  */
/* -------------------------------------- */
.chatbot-toggler {
    position: fixed;
    bottom: 20px;
    right: 20px;
    height: 50px;
    width: 50px;
    background: #19a540fc;
    color: #fff;
    border: none;
    outline: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: 0.2s ease;
}

.chatbot-toggler span {
    position: absolute;
    font-size: 25px;
    transition: 0.3s;
    color: #fff;
}

.chatbot-toggler .chatbot-icon {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    transition: opacity 0.3s;
}

body.show-chatbot .chatbot-toggler .chatbot-icon {
    opacity: 0;
}

.chatbot-toggler span:last-child {
    opacity: 0;
}

body.show-chatbot .chatbot-toggler span:last-child {
    opacity: 1;
    transform: rotate(90deg);
}

/* -------------------------------------- */
/* Teaser Bubble (iframe-safe, higher)   */
/* -------------------------------------- */
.chat-teaser {
    position: fixed;
    bottom: 80px;
    right: 30px;                
    background: #19a540fc;
    color: #fff;
    padding: 12px 14px;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    max-width: 260px;
    font-size: 15px;
    cursor: pointer;
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    transform: translateY(-20px); 
}

.chat-teaser.show {
    opacity: 1;
    transform: translateY(-10px); /* visible animation */
    pointer-events: auto;
}

/* Arrow points toward button */
.chat-teaser::after {
    content: "";
    position: absolute;
    bottom: -6px;  /* moved relative to new position */
    right: 50px;   /* adjust to visually point to toggle button */
    width: 12px;
    height: 12px;
    background: #19a540fc;
    transform: rotate(45deg);
    box-shadow: 2px 2px 6px rgba(0,0,0,0.15);
}

.teaser-close {
    position: absolute;
    top: 4px;
    right: 6px;
    border: none;
    background: transparent;
    font-size: 22px;
    cursor: pointer;
    color: rgba(255,255,255,0.8);
}

.teaser-close:hover {
    color: #ffffff;
}

.teaser-content {
    padding-right: 14px;
}

body.show-chatbot .chat-teaser {
    display: none;
}


/* -------------------------------------- */
/* Chatbot Container                       */
/* -------------------------------------- */
.chatbot {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 450px;
    max-width: 90vw;
    height: 550px;
    max-height: 80vh;
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: none;
    transform: scale(0.5);
    opacity: 0;
    pointer-events: none;
    transition: 0.2s ease;
    z-index: 9999;
    display: flex;
    flex-direction: column;
}

body.show-chatbot .chatbot {
    transform: scale(1);
    opacity: 1;
    pointer-events: auto;
}

/* -------------------------------------- */
/* Header                                  */
/* -------------------------------------- */
.chatbot header {
    background: #19a540fc;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chatbot header h2 {
    color: #fff;
    font-size: 1.2rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chatbot-header-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    display: inline-block;
    vertical-align: middle;
}

/* -------------------------------------- */
/* Chat messages                           */
/* -------------------------------------- */
.chatbox {
    height: calc(100% - 125px); /* header + input approx */
    padding: 15px;
    overflow-y: auto;
}

.chat {
    display: flex;
    margin-bottom: 15px;
}

.chat.outgoing {
    justify-content: flex-end;
}

.chat.outgoing p {
    background: #19a540fc;
    color: #fff;
}

.chat.incoming p {
    background: #f1f1f1;
    color: #000;
}

.chat p {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.95rem;
    word-wrap: break-word;
    white-space: pre-wrap;
}

/* -------------------------------------- */
/* Input area                              */
/* -------------------------------------- */
.chat-input {
    border-top: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 15px;
}

.chat-input .input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.chat-input textarea {
    flex: 1;
    resize: none;
    padding: 12px 15px;
    border-radius: 14px;
    border: 1px solid #ccc;
    font-size: 15px;
    background: #fafafa;
    min-height: 55px;
    max-height: 120px;
}

/* -------------------------------------- */
/* Send button                             */
/* -------------------------------------- */
.chat-input button {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    border: none;
    background: #19a540fc;
    color: white;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
}

.chat-input button .material-symbols-rounded {
    font-size: 22px;
    line-height: 1;
}

/* -------------------------------------- */
/* Mobile / small screens                  */
/* -------------------------------------- */
@media (max-width: 768px) {
    .chatbot {
        bottom: 75px; /* leave space for toggle button */
        right: 15px;
        width: 350px;
        max-width: 95vw;
        height: auto;
        max-height: 80vh;
        border-radius: 12px;
        z-index: 10000; /* below toggle */
    }

    .chatbox {
        height: calc(80vh - 80px); /* header + input */
        overflow-y: auto;
    }

    .chat-input textarea {
        font-size: 14px;
        height: 50px;
    }

    .chat-teaser {
        right: 10px;
        bottom: 60px;
        max-width: 260px;
    }

    /* Toggle button always on top */
    .chatbot-toggler {
        bottom: 15px;
        right: 15px;
        width: 50px;
        height: 50px;
        z-index: 10001; /* above chat */
    }
}
