/* AI Chatbot Container & Launcher Widget */
.vionixai-chatbot-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 99999;
    font-family: 'Inter', sans-serif;
}

/* Chat bubble launcher button */
.vionixai-chatbot-trigger {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #066436 0%, #0d8a4d 100%);
    border: none;
    box-shadow: 0 8px 24px rgba(6, 100, 54, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    outline: none;
    padding: 0;
}

.vionixai-chatbot-trigger:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 12px 28px rgba(6, 100, 54, 0.4);
}

.chatbot-trigger-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.chatbot-trigger-icon {
    font-size: 26px;
    color: #ffffff;
    line-height: 1;
}

.chatbot-notification-dot {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    background-color: #fc0818;
    border: 2px solid #ffffff;
    border-radius: 50%;
    animation: chatbot-pulse 1.8s infinite;
}

@keyframes chatbot-pulse {
    0% {
        transform: scale(0.9);
        box-shadow: 0 0 0 0 rgba(252, 8, 24, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 8px rgba(252, 8, 24, 0);
    }
    100% {
        transform: scale(0.9);
        box-shadow: 0 0 0 0 rgba(252, 8, 24, 0);
    }
}

/* Pop-up Preview Bubble */
.vionixai-chatbot-preview-bubble {
    position: absolute;
    bottom: 75px;
    right: 10px;
    width: 250px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    padding: 14px 16px;
    animation: chatbot-slide-up 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
}

.preview-bubble-close {
    position: absolute;
    top: 6px;
    right: 10px;
    font-size: 16px;
    font-weight: bold;
    color: #94a3b8;
    cursor: pointer;
    transition: color 0.2s;
}

.preview-bubble-close:hover {
    color: #475569;
}

.preview-bubble-content strong {
    display: block;
    font-size: 13px;
    color: #0f172a;
    margin-bottom: 4px;
}

.preview-bubble-content p {
    margin: 0;
    font-size: 12px;
    color: #475569;
    line-height: 1.4;
}

/* Main Chat Drawer Window */
.vionixai-chatbot-drawer {
    position: absolute;
    bottom: 75px;
    right: 0;
    width: 380px;
    height: 520px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: chatbot-slide-up 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes chatbot-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Header */
.chatbot-header {
    background: linear-gradient(135deg, #066436 0%, #0d8a4d 100%);
    padding: 16px 20px;
    color: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.chatbot-header-icon-fallback {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.chatbot-header-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.chatbot-header-status {
    font-size: 10px;
    opacity: 0.9;
    display: block;
    margin-top: 1px;
}

.chatbot-header-close {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 24px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
    padding: 0;
    line-height: 1;
}

.chatbot-header-close:hover {
    opacity: 1;
}

/* Chat logs list */
.chatbot-logs {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Messages */
.chatbot-msg {
    display: flex;
    max-width: 80%;
}

.chatbot-msg--bot {
    align-self: flex-start;
}

.chatbot-msg--user {
    align-self: flex-end;
}

.chatbot-msg-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.5;
}

.chatbot-msg--bot .chatbot-msg-bubble {
    background: #f1f5f9;
    color: #0f172a;
    border-bottom-left-radius: 4px;
}

.chatbot-msg--user .chatbot-msg-bubble {
    background: #0d8a4d;
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

/* Typing indicator loading dots */
.chatbot-typing-dots {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
}

.chatbot-typing-dots span {
    width: 6px;
    height: 6px;
    background: #94a3b8;
    border-radius: 50%;
    animation: typing-bounce 1.4s infinite ease-in-out;
}

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

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

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

/* Dynamic CTA Glowing Ribbon */
.chatbot-cta-banner {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border-top: 1px solid #fde68a;
    border-bottom: 1px solid #fde68a;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    box-shadow: 0 -4px 12px rgba(251, 191, 36, 0.08);
    animation: chatbot-slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.cta-banner-close {
    position: absolute;
    top: 4px;
    right: 8px;
    font-size: 14px;
    font-weight: bold;
    color: #b45309;
    cursor: pointer;
}

.cta-banner-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}

.cta-banner-content p {
    margin: 0;
    font-size: 11px;
    font-weight: 600;
    color: #92400e;
}

.chatbot-cta-button {
    align-self: flex-start;
    background: #d97706;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    text-decoration: none;
    transition: background 0.2s;
    box-shadow: 0 2px 6px rgba(217, 119, 6, 0.2);
}

.chatbot-cta-button:hover {
    background: #b45309;
    color: #ffffff;
}

/* Inputs Footer Area */
.chatbot-input-area {
    padding: 16px;
    background: rgba(255, 255, 255, 0.9);
    border-top: 1px solid #e2e8f0;
}

.chatbot-input-area form {
    display: flex;
    gap: 8px;
    margin: 0;
}

.chatbot-input-area input {
    flex-grow: 1;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 13px;
    outline: none;
    transition: all 0.2s;
    background: #ffffff;
    color: #0f172a;
}

.chatbot-input-area input:focus {
    border-color: #0d8a4d;
    box-shadow: 0 0 0 3px rgba(13, 138, 77, 0.15);
}

.chatbot-input-area button {
    background: #0d8a4d;
    color: #ffffff;
    border: none;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chatbot-input-area button:hover {
    background: #066436;
}

/* Dark mode overrides */
html[data-theme="dark"] .vionixai-chatbot-drawer {
    background: rgba(15, 23, 42, 0.85);
    border-color: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .vionixai-chatbot-preview-bubble {
    background: #1e293b;
    border-color: #334155;
}

html[data-theme="dark"] .preview-bubble-content strong {
    color: #f8fafc;
}

html[data-theme="dark"] .preview-bubble-content p {
    color: #cbd5e1;
}

html[data-theme="dark"] .chatbot-msg--bot .chatbot-msg-bubble {
    background: #1e293b;
    color: #f8fafc;
}

html[data-theme="dark"] .chatbot-input-area {
    background: rgba(15, 23, 42, 0.9);
    border-top-color: #334155;
}

html[data-theme="dark"] .chatbot-input-area input {
    background: #1e293b;
    border-color: #334155;
    color: #f8fafc;
}

html[data-theme="dark"] .chatbot-input-area input:focus {
    border-color: #0d8a4d;
}

/* Scrollbar styling */
.chatbot-logs::-webkit-scrollbar {
    width: 5px;
}

.chatbot-logs::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-logs::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

html[data-theme="dark"] .chatbot-logs::-webkit-scrollbar-thumb {
    background: #475569;
}

@media (max-width: 576px) {
    .vionixai-chatbot-container {
        bottom: 16px !important;
        right: 16px !important;
    }
    
    .vionixai-chatbot-trigger {
        width: 50px !important;
        height: 50px !important;
        box-shadow: 0 6px 20px rgba(6, 100, 54, 0.25) !important;
    }
    
    .chatbot-trigger-icon {
        font-size: 20px !important;
    }
    
    .vionixai-chatbot-preview-bubble {
        bottom: 65px !important;
        right: 0 !important;
        width: calc(100vw - 32px) !important;
        box-sizing: border-box !important;
    }
    
    .vionixai-chatbot-drawer {
        width: calc(100vw - 32px) !important;
        height: calc(100vh - 100px) !important;
        max-height: 480px !important;
        bottom: 60px !important;
        right: 0 !important;
        border-radius: 16px !important;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2) !important;
    }
}
