/* CHATBOT V2 - PREMIUM GLASS UI */
:root {
    --chat-primary: #4f46e5;
    --chat-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --chat-bg: rgba(255, 255, 255, 0.95);
    --chat-border: rgba(255, 255, 255, 0.2);
    --chat-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
    --chat-radius: 20px;
}

/* 1. FLOATING TOGGLE */
#chatbot-toggle-v2 {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: var(--chat-gradient);
    border-radius: 50%;
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10000;
    border: none;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#chatbot-toggle-v2:hover {
    transform: scale(1.1) translateY(-5px);
    box-shadow: 0 12px 25px rgba(79, 70, 229, 0.5);
}

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

#chatbot-toggle-v2.open svg {
    transform: rotate(90deg);
    opacity: 0;
}

/* 2. CHAT WINDOW */
#chatbot-window-v2 {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    height: 600px;
    max-height: calc(100vh - 120px);
    background: var(--chat-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--chat-radius);
    box-shadow: var(--chat-shadow);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.8);
}

#chatbot-window-v2.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* 3. HEADER */
.chat-header-v2 {
    padding: 20px;
    background: var(--chat-gradient);
    color: white;
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.chat-agent-status {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    background: #10b981;
    border: 2px solid #4f46e5;
    border-radius: 50%;
}

.chat-agent-info h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

.chat-agent-info p {
    margin: 0;
    font-size: 12px;
    opacity: 0.9;
}

.chat-close-v2 {
    background: transparent;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    margin-left: auto;
    opacity: 0.8;
    transition: opacity 0.2s;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.chat-close-v2:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

/* 4. MESSAGES AREA */
.chat-messages-v2 {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #f8fafc;
}

.chat-bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-bubble.bot {
    background: white;
    color: #1e293b;
    border-radius: 4px 16px 16px 16px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.chat-bubble.user {
    align-self: flex-end;
    background: var(--chat-gradient);
    color: white;
    border-radius: 16px 16px 4px 16px;
}

/* Markdown Styles in Bubbles */
.chat-bubble p {
    margin-bottom: 8px;
}

.chat-bubble p:last-child {
    margin-bottom: 0;
}

.chat-bubble strong {
    font-weight: 700;
}

.chat-bubble a {
    color: inherit;
    text-decoration: underline;
}

/* 5. QUICK REPLIES */
.chat-quick-replies {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.quick-reply-btn {
    background: white;
    border: 1px solid #e2e8f0;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    color: #4f46e5;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.quick-reply-btn:hover {
    background: #4f46e5;
    color: white;
    border-color: #4f46e5;
}

/* 6. INPUT AREA */
.chat-input-area-v2 {
    padding: 16px;
    background: white;
    border-top: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-input-v2 {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input-v2:focus {
    border-color: #4f46e5;
}

.chat-send-btn-v2 {
    width: 40px;
    height: 40px;
    background: var(--chat-primary);
    border-radius: 50%;
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.chat-send-btn-v2:hover {
    transform: scale(1.05);
}

.chat-send-btn-v2:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
}

/* 7. TYPING INDICATOR */
.typing-dots {
    display: inline-flex;
    gap: 4px;
    padding: 4px 8px;
    background: #e2e8f0;
    border-radius: 10px;
    margin-bottom: 10px;
    align-self: flex-start;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #64748b;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

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

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

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* MOBILE RESPONSIVE */
@media (max-width: 768px) {
    #chatbot-window-v2 {
        bottom: 0;
        right: 0;
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    #chatbot-toggle-v2.open {
        display: none !important;
    }
}