/* ==========================================================================
   Tanu AI Assistant Chatbot Styles
   ========================================================================== */

/* Chatbot Floating Button */
#chatbot-toggle-btn {
    position: fixed;
    bottom: 2rem;
    right: 6rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    cursor: pointer;
    z-index: 9999;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), background-color 0.3s;
    border: none;
    outline: none;
}

#chatbot-toggle-btn:hover {
    transform: scale(1.1);
    background-color: var(--primary-hover);
}

#chatbot-toggle-btn svg {
    width: 28px;
    height: 28px;
    transition: transform 0.3s ease;
}

#chatbot-toggle-btn.active {
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
}

/* Chatbot Window */
#chatbot-window {
    position: fixed;
    bottom: 6rem;
    right: 2rem;
    width: 380px;
    max-height: 600px;
    height: calc(100vh - 120px);
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    z-index: 9998;
    transform: translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
    overflow: hidden;
}

#chatbot-window.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* Header */
.chatbot-header {
    padding: 1rem;
    background: rgba(15, 23, 42, 0.8);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chatbot-avatar {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.chatbot-avatar svg {
    width: 20px;
    height: 20px;
}

.chatbot-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text);
    display: flex;
    flex-direction: column;
}

.chatbot-status {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: #10b981;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

.chatbot-controls {
    display: flex;
    gap: 0.25rem;
}

.chatbot-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.4rem;
    border-radius: var(--radius-md);
    transition: color 0.2s, background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-btn:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.1);
}

/* Messages Area */
.chatbot-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}
.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}
.chatbot-messages::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.chat-msg {
    max-width: 85%;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    font-size: 0.95rem;
    line-height: 1.5;
    word-wrap: break-word;
    animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-msg.bot {
    align-self: flex-start;
    background: var(--surface-alt);
    color: var(--text);
    border-bottom-left-radius: 0.25rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.chat-msg.bot a {
    color: var(--primary-hover);
    text-decoration: underline;
}
.chat-msg.bot ul {
    list-style-type: disc;
    padding-left: 1.5rem;
    margin-top: 0.5rem;
}

.chat-msg.user {
    align-self: flex-end;
    background: var(--primary);
    color: #fff;
    border-bottom-right-radius: 0.25rem;
}

/* Quick Replies */
.chatbot-quick-replies {
    padding: 0 1rem 0.75rem;
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    scrollbar-width: none; /* Firefox */
}

.chatbot-quick-replies::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.quick-reply-btn {
    white-space: nowrap;
    padding: 0.5rem 0.8rem;
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-hover);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-reply-btn:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* Input Area */
.chatbot-input-area {
    padding: 1rem;
    background: rgba(15, 23, 42, 0.8);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.chatbot-input-area input {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text);
    padding: 0.75rem 1rem;
    border-radius: 1.5rem;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.chatbot-input-area input:focus {
    border-color: var(--primary);
}

.chatbot-input-area input::placeholder {
    color: var(--text-muted);
}

.chatbot-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
    border: none;
    flex-shrink: 0;
}

.chatbot-send-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
}

.chatbot-send-btn:disabled {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.3);
    cursor: not-allowed;
    transform: none;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    align-items: center;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background-color: var(--text-muted);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }
.typing-dot:nth-child(3) { animation-delay: 0s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

.typing-cursor {
    animation: blink 1s step-start infinite;
    display: inline-block;
    margin-left: 2px;
    font-weight: bold;
    color: var(--primary);
}

@keyframes blink {
    50% { opacity: 0; }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    #chatbot-window {
        bottom: 0;
        right: 0;
        width: 100%;
        height: 100vh;
        height: 100dvh;
        max-height: 100vh;
        border-radius: 0;
        border: none;
        transform: translateY(100%);
    }

    #chatbot-toggle-btn {
        bottom: 1.5rem;
        right: 4.5rem;
        width: 55px;
        height: 55px;
    }
}
