/* Chatbot Button */
.chatbot-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--color-secondary), var(--color-secondary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4), 0 0 0 rgba(99, 102, 241, 0.4);
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: none;
    outline: none;
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0% { box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4), 0 0 0 0 rgba(99, 102, 241, 0.4); }
    70% { box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4), 0 0 0 15px rgba(99, 102, 241, 0); }
    100% { box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4), 0 0 0 0 rgba(99, 102, 241, 0); }
}

.chatbot-btn:hover {
    transform: scale(1.15) rotate(10deg);
    animation: none;
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.6);
}

.chatbot-btn i {
    transition: transform 0.3s ease;
}

/* Notification Bubble */
#chat-notification-bubble {
    position: absolute;
    bottom: 80px;
    right: 0;
    background: white;
    color: black;
    padding: 12px 16px;
    border-radius: 12px 12px 0 12px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    width: 200px;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-origin: bottom right;
    pointer-events: none;
}

#chat-notification-bubble::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 20px;
    border-width: 8px 8px 0 0;
    border-style: solid;
    border-color: white transparent transparent transparent;
}

@keyframes popIn {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Chatbot Window */
.chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 350px;
    height: 500px;
    max-height: calc(100vh - 120px);
    background: rgba(10, 15, 25, 0.7);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(30px) scale(0.95);
    transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

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

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

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

.chatbot-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: white;
}

.chatbot-title-wrap {
    display: flex;
    flex-direction: column;
}

.chatbot-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 16px;
    color: white;
    margin: 0;
}

.chatbot-status {
    font-size: 12px;
    color: var(--color-primary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.chatbot-status::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--color-primary);
    border-radius: 50%;
    display: inline-block;
}

.chatbot-close {
    background: none;
    border: none;
    color: var(--color-text-dim);
    font-size: 16px;
    cursor: pointer;
    transition: color 0.3s ease;
}

.chatbot-close:hover {
    color: white;
}

/* Messages Area */
.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Markdown Styling inside Bot Messages */
.chat-msg.bot strong {
    color: var(--color-primary);
    font-weight: 700;
}

.chat-msg.bot ul {
    margin: 8px 0;
    padding-left: 20px;
}

.chat-msg.bot li {
    margin-bottom: 4px;
}

/* Disabled Input State */
.chatbot-input:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.chatbot-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Custom Scrollbar */
.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}
.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}
.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

/* Chat Suggestions */
.chatbot-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 20px 10px 20px;
    margin-top: -10px;
}

.suggestion-chip {
    background: rgba(16, 185, 129, 0.05);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: var(--color-primary-light);
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.suggestion-chip:hover {
    background: rgba(16, 185, 129, 0.15);
    border-color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

/* Lead Generation Form inside Chat */
.soft-lead-form-wrap {
    margin-bottom: 10px;
    border-radius: 8px;
    overflow: hidden;
}

.chat-lead-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-lead-form input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 8px;
    padding: 10px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.chat-lead-form input:focus {
    border-color: var(--color-primary);
}

.chat-lead-form button {
    background: var(--color-primary);
    color: black;
    border: none;
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}

.chat-lead-form button:hover {
    background: var(--color-primary-light);
}

.chat-lead-form button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.chat-lead-success {
    padding: 20px;
    text-align: center;
    color: var(--color-primary-light);
    font-weight: bold;
    font-size: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Message Bubbles */
.chat-msg {
    max-width: 85%;
    font-size: 14px;
    line-height: 1.6;
    padding: 14px 18px;
    border-radius: 20px;
    animation: fadeInMsg 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
    transform: translateY(15px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

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

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

.chat-msg.user {
    background: linear-gradient(135deg, var(--color-secondary-light), var(--color-secondary));
    color: white;
    border-bottom-right-radius: 6px;
    align-self: flex-end;
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.3);
}

/* Typing Indicator */
.chat-typing {
    display: none;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    width: max-content;
}

.chat-typing.active {
    display: flex;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--color-text-dim);
    border-radius: 50%;
    animation: typingBounce 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; }

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

/* Input Area */
.chatbot-input-area {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    gap: 10px;
    background: rgba(0, 0, 0, 0.2);
}

.chatbot-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px 16px;
    color: white;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
}

.chatbot-input:focus {
    border-color: var(--color-secondary);
    background: rgba(255, 255, 255, 0.08);
}

.chatbot-send {
    width: 44px;
    height: 44px;
    background: var(--color-secondary);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.chatbot-send:hover {
    background: var(--color-secondary-light);
    transform: translateY(-2px);
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .chatbot-btn {
        bottom: 80px;
        right: 20px;
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .chatbot-window {
        bottom: 140px;
        right: 20px;
        width: calc(100% - 40px);
        height: 450px;
    }
}
