/* ============================================
   AI Chatbot Widget - ZIXE Engineering
   ============================================ */

/* Floating Button */
.chatbot-toggle {
    position: fixed;
    bottom: 30px;
    left: 30px;
    /* Moved to left side */
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: chatbot-pulse 2s infinite;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px rgba(102, 126, 234, 0.7);
}

.chatbot-toggle svg {
    width: 28px;
    height: 28px;
    fill: white;
    transition: transform 0.3s ease;
}

.chatbot-toggle.active svg {
    transform: rotate(90deg);
}

.chatbot-toggle .badge-dot {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    background: #10b981;
    border-radius: 50%;
    border: 2px solid white;
    animation: chatbot-dot-pulse 1.5s infinite;
}

@keyframes chatbot-pulse {

    0%,
    100% {
        box-shadow: 0 4px 20px rgba(102, 126, 234, 0.5);
    }

    50% {
        box-shadow: 0 4px 30px rgba(102, 126, 234, 0.8);
    }
}

@keyframes chatbot-dot-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Chat Window */
.chatbot-window {
    position: fixed;
    bottom: 100px;
    left: 30px;
    /* Moved to left side */
    width: 380px;
    max-height: 520px;
    background: #0f172a;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    z-index: 10001;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

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

/* Header */
.chatbot-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.chatbot-header-info {
    flex: 1;
}

.chatbot-header-info h6 {
    margin: 0;
    color: white;
    font-weight: 700;
    font-size: 14px;
}

.chatbot-header-info small {
    color: rgba(255, 255, 255, 0.7);
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.chatbot-header-info small::before {
    content: '';
    width: 7px;
    height: 7px;
    background: #10b981;
    border-radius: 50%;
    display: inline-block;
}

.chatbot-close {
    background: none;
    border: none;
    color: white;
    opacity: 0.7;
    cursor: pointer;
    padding: 4px;
    font-size: 18px;
    transition: opacity 0.2s;
}

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

/* Messages Area */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 340px;
    min-height: 280px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.chatbot-messages::-webkit-scrollbar {
    width: 4px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

/* Message Bubbles */
.chatbot-msg {
    display: flex;
    gap: 8px;
    max-width: 85%;
    animation: chatbot-msg-in 0.3s ease;
}

@keyframes chatbot-msg-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

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

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

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

.chatbot-msg-avatar {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    margin-top: 2px;
}

.chatbot-msg.bot .chatbot-msg-avatar {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.chatbot-msg.user .chatbot-msg-avatar {
    background: #334155;
}

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

.chatbot-msg.bot .chatbot-msg-bubble {
    background: #1e293b;
    color: #e2e8f0;
    border-bottom-left-radius: 4px;
}

.chatbot-msg.user .chatbot-msg-bubble {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-bottom-right-radius: 4px;
}

.chatbot-msg-time {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.3);
    margin-top: 4px;
    display: block;
}

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

.chatbot-typing span {
    width: 7px;
    height: 7px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    animation: chatbot-typing-dot 1.4s infinite;
}

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

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

@keyframes chatbot-typing-dot {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* Input Area */
.chatbot-input-area {
    padding: 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    gap: 8px;
    align-items: center;
    background: #0f172a;
}

.chatbot-input {
    flex: 1;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 10px 16px;
    color: #e2e8f0;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

.chatbot-input:focus {
    border-color: #667eea;
}

.chatbot-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.chatbot-send {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, opacity 0.2s;
    flex-shrink: 0;
}

.chatbot-send:hover {
    transform: scale(1.1);
}

.chatbot-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.chatbot-send svg {
    width: 16px;
    height: 16px;
    fill: white;
}

/* Quick Actions */
.chatbot-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.chatbot-quick-btn {
    background: rgba(102, 126, 234, 0.15);
    border: 1px solid rgba(102, 126, 234, 0.3);
    color: #93a8f4;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.chatbot-quick-btn:hover {
    background: rgba(102, 126, 234, 0.3);
    color: white;
}

/* Powered by */
.chatbot-powered {
    text-align: center;
    padding: 6px;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.15);
    background: #0f172a;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .chatbot-window {
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        height: 100% !important;
        /* Full height */
        max-height: 100dvh !important;
        border-radius: 0 !important;
        display: flex;
        flex-direction: column;
    }

    .chatbot-toggle {
        bottom: 90px;
        left: 20px;
        /* Keep on left but higher */
        right: auto;
        width: 54px;
        height: 54px;
    }

    .chatbot-messages {
        max-height: calc(100vh - 180px);
    }
}