/* ===== DUMMY PAGE ===== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, sans-serif;
    background: #f5f5f5;
    color: #333;
}

header {
    background: #1a1a2e;
    color: white;
    padding: 20px 30px;
}

    header p {
        margin-top: 6px;
        font-size: 14px;
        opacity: 0.8;
    }

main {
    padding: 40px 30px;
}

/* ===== CHAT WIDGET ===== */
#ta-chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* Toggle Button */
#ta-chat-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #1a1a2e;
    color: white;
    border: none;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: background 0.2s;
}

    #ta-chat-toggle:hover {
        background: #0077b6;
    }

    #ta-chat-toggle.ta-hidden {
        display: none;
    }

/* Chat Window */
#ta-chat-window {
    width: 360px;
    height: 520px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
    overflow: hidden;
    transition: opacity 0.2s, transform 0.2s;
}

    #ta-chat-window.ta-hidden {
        display: none;
    }

/* Header */
#ta-chat-header {
    background: #1a1a2e;
    color: white;
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    font-size: 15px;
    flex-shrink: 0;
}

#ta-chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
}

    #ta-chat-close:hover {
        opacity: 1;
    }

#ta-chat-clear {
    background: none;
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

    #ta-chat-clear:hover {
        opacity: 1;
    }

/* Messages Area */
#ta-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f9f9f9;
}

/* Message Bubbles */
.ta-msg {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}

    .ta-msg.bot {
        background: #e8f4fd;
        color: #1a1a2e;
        align-self: flex-start;
        border-bottom-left-radius: 4px;
    }

    .ta-msg.user {
        background: #1a1a2e;
        color: white;
        align-self: flex-end;
        border-bottom-right-radius: 4px;
    }

    .ta-msg.bot p {
        margin-bottom: 6px;
    }

        .ta-msg.bot p:last-child {
            margin-bottom: 0;
        }

    /* Streaming cursor animation */
    .ta-msg.bot.streaming::after {
        content: '▋';
        display: inline-block;
        animation: blink 0.7s infinite;
        margin-left: 2px;
    }

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* Links inside bot messages */
.ta-msg.bot a {
    color: #0077b6;
    text-decoration: underline;
    word-break: break-all;
}

/* Input Area */
#ta-chat-input-area {
    display: flex;
    padding: 10px 12px;
    border-top: 1px solid #e0e0e0;
    gap: 8px;
    background: #ffffff;
    flex-shrink: 0;
}

#ta-chat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 9px 14px;
    font-size: 14px;
    outline: none;
    font-family: Arial, sans-serif;
}

    #ta-chat-input:focus {
        border-color: #0077b6;
    }

#ta-chat-send {
    background: #0077b6;
    color: white;
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    font-size: 16px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s;
}

    #ta-chat-send:hover {
        background: #005f99;
    }

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
    #ta-chat-widget {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        align-items: stretch;
    }

    #ta-chat-window {
        width: 100%;
        height: 100dvh;
        border-radius: 0;
        margin-bottom: 0;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
    }

    #ta-chat-toggle {
        position: fixed;
        bottom: 16px;
        right: 16px;
    }
}

/* ===== TOKEN LIMIT POPUP ===== */
#ta-too-long-popup {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 16px;
}

#ta-too-long-content {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin: 16px;
    text-align: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

    #ta-too-long-content p {
        font-size: 14px;
        line-height: 1.5;
        color: #1a1a2e;
        margin-bottom: 16px;
    }

    #ta-too-long-content a {
        color: #0077b6;
        text-decoration: underline;
    }

#ta-too-long-close {
    background: #0077b6;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 24px;
    font-size: 14px;
    cursor: pointer;
}

    #ta-too-long-close:hover {
        background: #005f99;
    }
