/* ============================================
   MB DESIGN — Chatbot Widget Styles
   ============================================ */

/* Toggle Button */
.chatbot-toggle {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed 0%, #06b6d4 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.4), 0 0 40px rgba(6, 182, 212, 0.15);
    z-index: 9998;
    transition: all 0.3s ease;
    animation: togglePulse 3s ease-in-out infinite;
}

.chatbot-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 30px rgba(124, 58, 237, 0.5), 0 0 50px rgba(6, 182, 212, 0.25);
}

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

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

.chatbot-toggle .chatbot-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #f59e0b;
    font-size: 0.65rem;
    font-weight: 700;
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0);
    transition: all 0.3s ease;
}

.chatbot-toggle .chatbot-badge.visible {
    opacity: 1;
    transform: scale(1);
}

@keyframes togglePulse {

    0%,
    100% {
        box-shadow: 0 4px 20px rgba(124, 58, 237, 0.4), 0 0 40px rgba(6, 182, 212, 0.15);
    }

    50% {
        box-shadow: 0 4px 25px rgba(124, 58, 237, 0.5), 0 0 50px rgba(6, 182, 212, 0.25);
    }
}

/* Chat Window */
.chatbot-window {
    position: fixed;
    bottom: 6rem;
    right: 1.5rem;
    width: 380px;
    height: 560px;
    max-height: calc(100vh - 8rem);
    border-radius: 1.25rem;
    background: rgba(20, 24, 41, 0.65);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(124, 58, 237, 0.1);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.chatbot-window.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Header */
.chatbot-header {
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.2) 0%, rgba(6, 182, 212, 0.15) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chatbot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #06b6d4);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chatbot-avatar img {
    width: 26px;
    height: auto;
    filter: brightness(1.5);
}

.chatbot-header-info {
    flex: 1;
    min-width: 0;
}

.chatbot-header-name {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
    color: #e2e8f0;
}

.chatbot-header-status {
    font-size: 0.72rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.chatbot-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    animation: statusBlink 2s ease-in-out infinite;
}

.chatbot-status-dot.offline {
    background: #f59e0b;
    animation: none;
}

@keyframes statusBlink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

.chatbot-close {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
    display: flex;
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

.chatbot-close svg {
    width: 18px;
    height: 18px;
}

/* Messages Area */
.chatbot-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    scroll-behavior: smooth;
}

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

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

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

/* Message Bubbles */
.chatbot-msg {
    max-width: 85%;
    padding: 0.7rem 1rem;
    border-radius: 1rem;
    font-size: 0.85rem;
    color: #e2e8f0;
    line-height: 1.5;
    animation: msgIn 0.3s ease;
    word-wrap: break-word;
}

.chatbot-msg--bot {
    align-self: flex-start;
    background: #1e2440;
    border-bottom-left-radius: 0.25rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.chatbot-msg--user {
    align-self: flex-end;
    background: linear-gradient(135deg, #7c3aed, #5b21b6);
    border-bottom-right-radius: 0.25rem;
}

.chatbot-msg--system {
    align-self: center;
    background: transparent;
    color: #64748b;
    font-size: 0.75rem;
    text-align: center;
    padding: 0.25rem 0;
}

.chatbot-msg-time {
    font-size: 0.65rem;
    color: #64748b;
    margin-top: 0.25rem;
}

.chatbot-msg--user .chatbot-msg-time {
    text-align: right;
    color: rgba(255, 255, 255, 0.5);
}

@keyframes msgIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

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

/* Typing Indicator */
.chatbot-typing {
    align-self: flex-start;
    display: none;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1rem;
    background: #1e2440;
    border-radius: 1rem;
    border-bottom-left-radius: 0.25rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.chatbot-typing.visible {
    display: flex;
}

.chatbot-typing-dots {
    display: flex;
    gap: 3px;
}

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

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

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

@keyframes typingBounce {

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

    30% {
        transform: translateY(-5px);
    }
}

/* Quick Replies */
.chatbot-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0 1rem 0.75rem;
}

.chatbot-quick-btn {
    padding: 0.4rem 0.8rem;
    border-radius: 2rem;
    border: 1px solid rgba(124, 58, 237, 0.3);
    background: rgba(124, 58, 237, 0.08);
    color: #c4b5fd;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
}

.chatbot-quick-btn:hover {
    background: rgba(124, 58, 237, 0.2);
    border-color: rgba(124, 58, 237, 0.5);
    color: #e2e8f0;
    transform: translateY(-1px);
}

/* Lead Form */
.chatbot-lead-form {
    display: none;
    padding: 0.75rem 1rem;
    background: rgba(124, 58, 237, 0.06);
    border-top: 1px solid rgba(124, 58, 237, 0.15);
}

.chatbot-lead-form.visible {
    display: block;
}

.chatbot-lead-form input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: #1a1f35;
    color: #e2e8f0;
    font-size: 0.8rem;
    margin-bottom: 0.4rem;
    font-family: 'Inter', sans-serif;
}

.chatbot-lead-form input::placeholder {
    color: #64748b;
}

.chatbot-lead-form button {
    width: 100%;
    padding: 0.5rem;
    border-radius: 0.5rem;
    border: none;
    background: linear-gradient(135deg, #7c3aed, #06b6d4);
    color: #fff;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: opacity 0.2s;
}

.chatbot-lead-form button:hover {
    opacity: 0.9;
}

/* Input Area */
.chatbot-input-area {
    padding: 0.75rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    gap: 0.5rem;
    align-items: center;
    background: rgba(20, 24, 41, 0.8);
}

.chatbot-input {
    flex: 1;
    padding: 0.6rem 0.9rem;
    border-radius: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: #1a1f35;
    color: #e2e8f0;
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: border-color 0.2s;
    resize: none;
    max-height: 80px;
    min-height: 38px;
    line-height: 1.4;
}

.chatbot-input::placeholder {
    color: #64748b;
}

.chatbot-input:focus {
    border-color: rgba(124, 58, 237, 0.4);
}

.chatbot-send {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #7c3aed, #06b6d4);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chatbot-send:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 12px rgba(124, 58, 237, 0.4);
}

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

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

/* Powered By */
.chatbot-powered {
    text-align: center;
    padding: 0.35rem;
    font-size: 0.6rem;
    color: #475569;
    border-top: 1px solid rgba(255, 255, 255, 0.03);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
    .chatbot-window {
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .chatbot-toggle {
        bottom: 1rem;
        right: 1rem;
        width: 54px;
        height: 54px;
    }

    .chatbot-toggle svg {
        width: 24px;
        height: 24px;
    }
}