/* Tali Chat Bubble — Semilla website */

#tali-bubble-root {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Toggle button */
#tali-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2e7d32, #4caf50);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(46, 125, 50, 0.45);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    outline: none;
}

#tali-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(46, 125, 50, 0.55);
}

#tali-toggle svg {
    width: 26px;
    height: 26px;
    fill: #fff;
    transition: opacity 0.2s, transform 0.2s;
    position: absolute;
}

.tali-icon-chat { opacity: 1; transform: scale(1); }
.tali-icon-close { opacity: 0; transform: scale(0.6); }

#tali-toggle.open .tali-icon-chat { opacity: 0; transform: scale(0.6); }
#tali-toggle.open .tali-icon-close { opacity: 1; transform: scale(1); }

/* Notification dot */
#tali-notif {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #e53935;
    border: 2px solid #fff;
    position: absolute;
    top: 2px;
    right: 2px;
    display: none;
}
#tali-notif.visible { display: block; }

/* Chat panel */
#tali-panel {
    position: absolute;
    bottom: 68px;
    right: 0;
    width: 340px;
    max-height: 520px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(12px) scale(0.97);
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
    overflow: hidden;
}

#tali-panel.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Header */
#tali-header {
    background: linear-gradient(135deg, #2e7d32, #388e3c);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

#tali-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    color: #fff;
    font-weight: 700;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

#tali-header-info {
    flex: 1;
    min-width: 0;
}

#tali-header-name {
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    line-height: 1.2;
}

#tali-header-sub {
    color: rgba(255,255,255,0.8);
    font-size: 11px;
    line-height: 1.2;
}

#tali-lang-select {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.35);
    border-radius: 8px;
    color: #fff;
    font-size: 12px;
    padding: 4px 6px;
    cursor: pointer;
    outline: none;
    flex-shrink: 0;
}

#tali-lang-select option {
    background: #2e7d32;
    color: #fff;
}

/* Messages */
#tali-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px 14px 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scrollbar-width: thin;
    scrollbar-color: #c8e6c9 transparent;
}

#tali-messages::-webkit-scrollbar { width: 4px; }
#tali-messages::-webkit-scrollbar-thumb { background: #c8e6c9; border-radius: 4px; }

.tali-msg {
    max-width: 85%;
    padding: 10px 13px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.5;
    word-break: break-word;
}

.tali-msg.tali {
    background: #f1f8e9;
    color: #1b5e20;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
}

.tali-msg.user {
    background: #2e7d32;
    color: #fff;
    border-bottom-right-radius: 4px;
    align-self: flex-end;
}

/* Typing indicator */
.tali-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 13px;
    background: #f1f8e9;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    width: fit-content;
}

.tali-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4caf50;
    animation: tali-bounce 1.2s infinite;
}
.tali-typing span:nth-child(2) { animation-delay: 0.2s; }
.tali-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes tali-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-5px); }
}

/* Input area */
#tali-input-area {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #e8f5e9;
    flex-shrink: 0;
}

#tali-input {
    flex: 1;
    border: 1px solid #c8e6c9;
    border-radius: 20px;
    padding: 9px 14px;
    font-size: 13.5px;
    resize: none;
    outline: none;
    line-height: 1.4;
    max-height: 100px;
    overflow-y: auto;
    font-family: inherit;
    transition: border-color 0.15s;
}

#tali-input:focus {
    border-color: #4caf50;
}

#tali-send {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #2e7d32;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, transform 0.15s;
    outline: none;
}

#tali-send:hover { background: #388e3c; transform: scale(1.05); }
#tali-send:disabled { background: #a5d6a7; cursor: default; transform: none; }

#tali-send svg {
    width: 18px;
    height: 18px;
    fill: #fff;
}

/* Footer */
#tali-footer {
    text-align: center;
    font-size: 10.5px;
    color: #a5d6a7;
    padding: 6px 12px 8px;
    flex-shrink: 0;
}

/* Mobile */
@media (max-width: 480px) {
    #tali-bubble-root {
        bottom: 16px;
        right: 16px;
    }
    #tali-panel {
        width: calc(100vw - 32px);
        right: -8px;
        max-height: 70vh;
    }
}
