
/* =========================================
   TOWARDS STREAMS - CHATBOT
   Dark Premium Theme
========================================= */

.ts-chatbot {
    --ts-bg: #111018;
    --ts-panel: #171520;
    --ts-panel-light: #201d2b;
    --ts-border: rgba(255,255,255,.09);
    --ts-text: #f5f3f8;
    --ts-muted: #aaa5b5;
    --ts-pink: #ed4bb5;
    --ts-purple: #9460f6;
    --ts-orange: #ffb44d;

    font-family: inherit;
    position: relative;
    z-index: 99999;
}

/* Launcher */

.ts-chat-launcher {
    position: fixed;
    right: 28px;
    bottom: 28px;
    width: 62px;
    height: 62px;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    background: linear-gradient(135deg, var(--ts-purple), var(--ts-pink));
    box-shadow: 0 8px 35px rgba(148,96,246,.35);
    transition: .3s ease;
    z-index: 99999;
}

.ts-chat-launcher:hover {
    transform: translateY(-4px) scale(1.04);
    box-shadow: 0 12px 40px rgba(237,75,181,.4);
}

.ts-launcher-icon svg {
    width: 27px;
    height: 27px;
    fill: none;
    stroke: white;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.ts-launcher-close {
    display: none;
    font-size: 32px;
    line-height: 1;
}

.ts-chatbot.is-open .ts-launcher-icon {
    display: none;
}

.ts-chatbot.is-open .ts-launcher-close {
    display: block;
}

.ts-chat-notification {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 12px;
    height: 12px;
    background: #ffb44d;
    border: 2px solid #111018;
    border-radius: 50%;
}

/* Chat Window */

.ts-chat-window {
    position: fixed;
    right: 28px;
    bottom: 105px;
    width: 390px;
    max-width: calc(100vw - 32px);
    height: 590px;
    max-height: calc(100dvh - 130px);
    background: var(--ts-bg);
    border: 1px solid var(--ts-border);
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 80px rgba(0,0,0,.55);
    opacity: 0;
    visibility: hidden;
    transform: translateY(18px) scale(.97);
    transform-origin: bottom right;
    transition: .25s ease;
}

.ts-chatbot.is-open .ts-chat-window {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Header */

.ts-chat-header {
    min-height: 76px;
    padding: 14px 17px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background:
        radial-gradient(circle at 10% 0%, rgba(148,96,246,.2), transparent 55%),
        #171520;
    border-bottom: 1px solid var(--ts-border);
}

.ts-chat-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ts-chat-avatar {
    width: 43px;
    height: 43px;
    display: grid;
    place-items: center;
    position: relative;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--ts-purple), var(--ts-pink));
    color: white;
    font-size: 13px;
    font-weight: 800;
}

.ts-chat-avatar i {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 11px;
    height: 11px;
    border: 2px solid #171520;
    border-radius: 50%;
    background: #48d597;
}

.ts-chat-brand-info h3 {
    margin: 0 0 5px;
    color: var(--ts-text);
    font-size: 14px;
    font-weight: 700;
}

.ts-chat-brand-info p {
    margin: 0;
    color: var(--ts-muted);
    font-size: 11px;
}

.ts-status-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 4px;
    border-radius: 50%;
    background: #48d597;
}

.ts-chat-header-actions {
    display: flex;
    gap: 6px;
}

.ts-chat-header-actions button {
    width: 31px;
    height: 31px;
    border: 1px solid var(--ts-border);
    border-radius: 9px;
    color: var(--ts-muted);
    background: rgba(255,255,255,.04);
    font-size: 20px;
    cursor: pointer;
}

.ts-chat-header-actions button:hover {
    color: white;
    background: rgba(255,255,255,.1);
}

/* Content */

.ts-chat-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 18px;
    scrollbar-width: thin;
    scrollbar-color: #484052 transparent;
}

.ts-chat-content::-webkit-scrollbar {
    width: 5px;
}

.ts-chat-content::-webkit-scrollbar-thumb {
    background: #484052;
    border-radius: 10px;
}

/* Welcome */

.ts-chat-welcome {
    position: relative;
    padding: 20px 16px;
    margin-bottom: 20px;
    overflow: hidden;
    border: 1px solid var(--ts-border);
    border-radius: 15px;
    background: linear-gradient(135deg, #211b32, #191622 75%);
}

.ts-welcome-glow {
    position: absolute;
    top: -65px;
    right: -45px;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: rgba(148,96,246,.18);
    filter: blur(40px);
}

.ts-welcome-label {
    position: relative;
    color: var(--ts-muted);
    font-size: 9px;
    letter-spacing: 1.2px;
    font-weight: 700;
}

.ts-welcome-label span {
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 5px;
    border-radius: 50%;
    background: var(--ts-pink);
}

.ts-chat-welcome h2 {
    position: relative;
    margin: 14px 0 9px;
    color: white;
    font-size: 22px;
    line-height: 1.3;
    font-weight: 750;
}

.ts-chat-welcome h2 span {
    display: block;
    background: linear-gradient(90deg, var(--ts-pink), var(--ts-purple), var(--ts-orange));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.ts-chat-welcome p {
    position: relative;
    margin: 0;
    color: var(--ts-muted);
    font-size: 12px;
    line-height: 1.7;
}

/* Messages */

.ts-chat-messages {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.ts-message {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 92%;
}

.ts-message-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.ts-message-avatar {
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--ts-purple), var(--ts-pink));
    color: white;
    font-size: 9px;
    font-weight: 800;
}

.ts-message-body {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.ts-message-bubble {
    padding: 11px 13px;
    color: #eae7f0;
    background: #211e2b;
    border: 1px solid var(--ts-border);
    border-radius: 13px 13px 13px 4px;
    font-size: 12px;
    line-height: 1.7;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.ts-message-user .ts-message-bubble {
    color: white;
    border: 0;
    border-radius: 13px 13px 4px 13px;
    background: linear-gradient(135deg, #7550c5, #a443a0);
}

.ts-message-time {
    color: #777181;
    font-size: 9px;
}

.ts-message-user .ts-message-time {
    text-align: right;
}

/* Suggestions */

.ts-chat-suggestions {
    margin-top: 23px;
}

.ts-chat-suggestions > p {
    margin: 0 0 10px;
    color: #888292;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.2px;
}

.ts-suggestion-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ts-suggestion-list button {
    padding: 9px 11px;
    border: 1px solid rgba(148,96,246,.3);
    border-radius: 9px;
    background: rgba(148,96,246,.07);
    color: #d5c6fa;
    font-size: 10px;
    cursor: pointer;
    transition: .2s;
}

.ts-suggestion-list button:hover {
    border-color: var(--ts-pink);
    background: rgba(237,75,181,.12);
    color: white;
}

.ts-suggestion-list button span {
    margin-left: 5px;
}

/* Typing */

.ts-typing {
    padding: 9px 18px;
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--ts-muted);
}

.ts-typing[hidden] {
    display: none;
}

.ts-typing span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--ts-pink);
    animation: tsTyping 1s infinite ease-in-out;
}

.ts-typing span:nth-child(2) {
    animation-delay: .15s;
}

.ts-typing span:nth-child(3) {
    animation-delay: .3s;
}

.ts-typing small {
    margin-left: 6px;
    font-size: 10px;
}

@keyframes tsTyping {
    0%, 60%, 100% { transform: translateY(0); opacity: .5; }
    30% { transform: translateY(-4px); opacity: 1; }
}

/* Footer */

.ts-chat-footer {
    padding: 12px 15px 10px;
    background: #171520;
    border-top: 1px solid var(--ts-border);
}

.ts-chat-mode {
    display: flex;
    gap: 7px;
    margin-bottom: 10px;
}

.ts-chat-mode button {
    padding: 6px 10px;
    border: 1px solid var(--ts-border);
    border-radius: 20px;
    background: transparent;
    color: var(--ts-muted);
    font-size: 10px;
    cursor: pointer;
}

.ts-chat-mode button.active {
    border-color: rgba(237,75,181,.4);
    background: rgba(237,75,181,.1);
    color: #f18bcc;
}

.ts-chat-form {
    display: flex;
    align-items: flex-end;
    gap: 9px;
    padding: 9px;
    border: 1px solid var(--ts-border);
    border-radius: 13px;
    background: #100e17;
}

.ts-chat-form:focus-within {
    border-color: rgba(148,96,246,.7);
}

.ts-chat-form textarea {
    flex: 1;
    min-width: 0;
    max-height: 90px;
    resize: none;
    border: 0;
    outline: 0;
    background: transparent;
    color: white;
    font-family: inherit;
    font-size: 12px;
    line-height: 1.5;
}

.ts-chat-form textarea::placeholder {
    color: #777181;
}

.ts-chat-form button {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--ts-purple), var(--ts-pink));
    cursor: pointer;
    transition: .2s;
}

.ts-chat-form button:hover {
    transform: scale(1.06);
}

.ts-chat-form button:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.ts-chat-form button svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: white;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.ts-chat-footer-note {
    margin-top: 10px;
    text-align: center;
    color: #777181;
    font-size: 9px;
}

.ts-chat-footer-note strong {
    color: #c3b6df;
    font-weight: 600;
}

/* Mobile */

@media (max-width: 480px) {
    .ts-chat-launcher {
        right: 17px;
        bottom: 18px;
        width: 57px;
        height: 57px;
    }

    .ts-chat-window {
        right: 8px;
        bottom: 85px;
        width: calc(100vw - 16px);
        height: min(650px, calc(100dvh - 105px));
        max-height: calc(100dvh - 105px);
        border-radius: 17px;
    }

    .ts-chat-content {
        padding: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ts-chatbot *,
    .ts-chatbot *::before,
    .ts-chatbot *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}
