/* GRUNDSTYLING */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Geist Sans', -apple-system, BlinkMacSystemFont, system-ui, sans-serif !important;
}

/* POSITION LINKS/RECHTS */
#chat-widget-container.td-pos-left { left: 20px; right: auto; }
#chat-widget-container.td-pos-right { right: 20px; left: auto; }

#chat-widget-button.td-btn-left { left: 20px; right: auto; }
#chat-widget-button.td-btn-right { right: 20px; left: auto; }

/* CHAT CONTAINER */
#chat-widget-container {
    position: fixed;
    bottom: 20px;
    width: 350px;
    height: 500px;
    background: #ffffff;
    border-radius: 12px;
    display: none;
    flex-direction: column;
    box-shadow: 0 4px 22px rgba(0,0,0,0.15);
    overflow: hidden;
    z-index: 99999;
    transform-origin: bottom left;
}

/* CLOSE ANIMATION */
@keyframes widgetShrink {
    to { transform: scale(0.1); opacity: 0; }
}
.widget-close-anim {
    animation: widgetShrink .15s ease forwards;
}

/* HEADER */
#chat-widget-header {
    background: #8916cb;
    color: #fff;
    padding: 16px;
    font-size: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-left img {
    width: 26px;
    height: 26px;
}

/* HEADER ICONS */
.header-icons {
    display: flex;
    gap: 6px;
}

.header-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: rgba(255,255,255,0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    transition: .2s;
}

.header-icon:hover {
    transform: scale(1.1);
    background: rgba(255,255,255,0.3);
}

.header-icon img {
    width: 20px;
    height: 20px;
    filter: brightness(0) invert(1);
}

/* INFO MODAL */
#info-modal {
    position: absolute;
    top: 58px;
    right: 10px;
    width: 280px;
    padding: 14px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.15);
    display: none;
    font-size: 13px;
    line-height: 1.38;
    z-index: 50000;
}

#info-modal a {
    color: #8916cb;
}

/* CHAT BODY */
#chat-widget-body {
    flex: 1;
    padding: 14px;
    overflow-y: auto;
    font-size: 13px;
}

/* Bubbles */
.bubble-user,
.bubble-bot {
    font-size: 13px;
    line-height: 1.32;
    animation: bubbleFade .22s ease;
}

@keyframes bubbleFade {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.bubble-user {
    background: #f3f3f3;
    color: #222;
    padding: 10px 12px;
    border-radius: 12px;
    border-top-right-radius: 4px;
    max-width: 80%;
    margin-left: auto;
    margin-bottom: 12px;
}

.bubble-bot {
    background: #8916cb;
    color: #fff;
    padding: 10px 12px;
    border-radius: 12px;
    border-top-left-radius: 4px;
    max-width: 80%;
    margin-right: auto;
    margin-bottom: 12px;
}

/* CLEAR ANIMATION */
@keyframes clearFade {
    from { opacity: 1; transform: translateY(0);}
    to { opacity: 0; transform: translateY(8px);}
}

.clear-fade {
    animation: clearFade .28s ease forwards;
}

/* TYPING INDICATOR */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #e8e8e8;
    padding: 10px 12px;
    border-radius: 12px;
    width: fit-content;
    margin-bottom: 12px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #8916cb;
    border-radius: 50%;
    animation: typingBlink 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBlink {
    0% { opacity: 0.2; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(-3px); }
    100% { opacity: 0.2; transform: translateY(0); }
}

/* FOOTER */
#chat-widget-footer {
    padding: 12px;
    border-top: 1px solid #ddd;
    display: flex;
    gap: 8px;
}

#chat-widget-input {
    flex: 1;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid #ddd;
    font-size: 13px;
}

#chat-widget-send {
    background: #8916cb;
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
}

/* CIRCLE BUTTON */
#chat-widget-button {
    position: fixed;
    bottom: 20px;
    background: #8916cb;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: .2s;
}

#chat-widget-button img {
    width: 30px;
    height: 30px;
    filter: brightness(0) invert(1);
}

#chat-widget-button:hover {
    box-shadow: 0 0 16px rgba(137,22,203,.7);
    transform: scale(1.06);
}

#chat-widget-button.clicked {
    box-shadow: 0 0 22px rgba(137,22,203,1);
    transform: scale(1.1);
}
