/* TSL Assistant Chat Styling */

.chat-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
}

/* Floating Action Button */
.chat-fab {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: var(--transition);
    border: none;
    outline: none;
}

.chat-fab:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 8px 30px rgba(0, 85, 164, 0.4);
}

.chat-fab.active {
    transform: scale(0.9);
    background: white;
    color: var(--primary);
}

/* Chat Window */
.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 600px;
    max-height: calc(100vh - 120px);
    background: rgba(13, 17, 23, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--surface-border);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: var(--transition);
    pointer-events: none;
}

.chat-window.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Header */
.chat-header {
    padding: 1.2rem 1.5rem;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.chat-header .bot-avatar {
    width: 35px;
    height: 35px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-header .bot-info h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

.chat-header .bot-info span {
    font-size: 0.75rem;
    opacity: 0.8;
}

/* Messages Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
}

.chat-messages::-webkit-scrollbar {
    width: 5px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background-color: var(--primary);
    border-radius: 10px;
}

.msg {
    max-width: 85%;
    padding: 0.8rem 1.2rem;
    border-radius: 18px;
    font-size: 0.9rem;
    line-height: 1.5;
    animation: msg-in 0.3s ease forwards;
}

.msg-bot {
    align-self: flex-start;
    background: var(--surface);
    color: var(--text);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--surface-border);
}

.msg-user {
    align-self: flex-end;
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
}

/* Typing Indicator */
.typing {
    display: flex;
    gap: 0.3rem;
    padding: 0.5rem;
}

.typing span {
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typing-blink 1.4s infinite both;
}

.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }

/* Input Area */
.chat-input-area {
    padding: 1rem 1.5rem 1.5rem 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid var(--surface-border);
}

.chat-input-form {
    display: flex;
    gap: 0.8rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.5rem;
    border-radius: 50px;
    border: 1px solid var(--surface-border);
    transition: var(--transition);
}

.chat-input-form:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
}

.chat-input-form input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: white;
    padding: 0.5rem 0.5rem 0.5rem 1rem;
    font-size: 0.9rem;
}

.chat-input-form button {
    background: var(--primary);
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.chat-input-form button:hover {
    background: var(--accent);
    color: var(--primary-dark);
}

@keyframes msg-in {
    from { opacity: 0; transform: translateY(10px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes typing-blink {
    0%, 80%, 100% { opacity: 0; }
    40% { opacity: 1; }
}

@media (max-width: 480px) {
    .chat-window {
        width: calc(100vw - 40px);
        height: 60vh;
        bottom: 70px;
    }
}
