/* ==========================================================================
   Radhix Technologies - Smart AI Lead Chatbot Styles
   Modern Dark/Indigo Glassmorphic Interactive Widget
   ========================================================================== */

/* --- Launcher Button in Quick Contact --- */
.quick-contact__item--chatbot {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%) !important;
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.45) !important;
    border: none !important;
    cursor: pointer !important;
    position: relative !important;
}

.quick-contact__item--chatbot:hover {
    box-shadow: 0 12px 30px rgba(99, 102, 241, 0.6) !important;
    transform: translateY(-3px) scale(1.08) !important;
}

/* Online Pulse Dot on Launcher */
.chatbot-pulse-dot {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: #10b981;
    border: 2px solid #0f172a;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: chatbotPulse 2s infinite cubic-bezier(0.4, 0, 0.6, 1);
}

@keyframes chatbotPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.8);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* --- Floating Greeting Bubble (Auto popup after 4s) --- */
.chatbot-greeting-bubble {
    position: fixed;
    right: 80px;
    bottom: 200px;
    z-index: 999;
    max-width: 290px;
    background: #0f172a;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(30, 27, 75, 0.94));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(99, 102, 241, 0.35);
    border-radius: 16px;
    padding: 12px 14px;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: bottom right;
    animation: chatbotGreetingIn 0.4s ease forwards;
}

.chatbot-greeting-bubble:hover {
    transform: translateY(-2px);
    border-color: rgba(99, 102, 241, 0.6);
    box-shadow: 0 20px 42px rgba(79, 70, 229, 0.3);
}

.chatbot-greeting-bubble[hidden] {
    display: none !important;
}

@keyframes chatbotGreetingIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.92);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.chatbot-greeting-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4f46e5, #06b6d4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1rem;
    flex-shrink: 0;
}

.chatbot-greeting-content {
    flex: 1;
}

.chatbot-greeting-content strong {
    display: block;
    font-size: 0.85rem;
    color: #f8fafc;
    margin-bottom: 2px;
}

.chatbot-greeting-content span {
    display: block;
    font-size: 0.78rem;
    color: #cbd5e1;
    line-height: 1.35;
}

.chatbot-greeting-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0 2px;
    cursor: pointer;
    transition: color 0.2s;
}

.chatbot-greeting-close:hover {
    color: #f8fafc;
}

/* --- Main Chatbot Modal Window --- */
.chatbot-window {
    position: fixed;
    right: 22px;
    bottom: 85px;
    width: 390px;
    max-width: calc(100vw - 32px);
    height: 580px;
    max-height: calc(100vh - 110px);
    background: #0b1120;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(79, 70, 229, 0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 100000;
    transform-origin: bottom right;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease, visibility 0.25s;
}

.chatbot-window[hidden] {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(20px) scale(0.92);
    display: none !important;
}

.chatbot-window.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
    display: flex !important;
}

/* Header */
.chatbot-header {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 60%, #4338ca 100%);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.chatbot-header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chatbot-header-avatar {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #06b6d4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1.05rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.chatbot-header-avatar .online-indicator {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 10px;
    height: 10px;
    background: #10b981;
    border: 2px solid #1e1b4b;
    border-radius: 50%;
}

.chatbot-header-info h4 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
}

.chatbot-header-info p {
    margin: 0;
    font-size: 0.72rem;
    color: #a5b4fc;
    display: flex;
    align-items: center;
    gap: 4px;
}

.chatbot-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.chatbot-action-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #e2e8f0;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.chatbot-action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

/* Chat Messages Stream */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #0b1120;
    scrollbar-width: thin;
    scrollbar-color: rgba(99, 102, 241, 0.3) transparent;
}

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

.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.3);
    border-radius: 10px;
}

/* Individual Message Row */
.chat-msg {
    display: flex;
    gap: 8px;
    max-width: 90%;
    animation: chatMsgFade 0.25s ease-out;
}

@keyframes chatMsgFade {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

.chat-avatar-mini {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4f46e5, #06b6d4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.75rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.chat-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.86rem;
    line-height: 1.45;
    word-break: break-word;
}

.chat-msg.bot .chat-bubble {
    background: #1e293b;
    color: #f1f5f9;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-top-left-radius: 4px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.chat-msg.user .chat-bubble {
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    color: #ffffff;
    border-top-right-radius: 4px;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}

.chat-time {
    display: block;
    font-size: 0.66rem;
    color: #94a3b8;
    margin-top: 4px;
    text-align: right;
}

.chat-msg.bot .chat-time {
    text-align: left;
}

/* Quick Action Chips */
.chatbot-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.chatbot-chip {
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.32);
    color: #c7d2fe;
    font-size: 0.78rem;
    font-weight: 500;
    padding: 6px 11px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.chatbot-chip:hover {
    background: rgba(99, 102, 241, 0.28);
    border-color: #818cf8;
    color: #ffffff;
    transform: translateY(-1px);
}

/* Interactive In-Chat Form (Lead Capture Card) */
.chatbot-lead-card {
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 14px;
    padding: 12px;
    margin-top: 8px;
}

.chatbot-lead-card h5 {
    margin: 0 0 8px 0;
    font-size: 0.85rem;
    font-weight: 700;
    color: #f8fafc;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chatbot-lead-card .form-group {
    margin-bottom: 8px;
}

.chatbot-lead-card input,
.chatbot-lead-card textarea {
    width: 100%;
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 0.82rem;
    color: #ffffff;
    outline: none;
    transition: border-color 0.2s;
}

.chatbot-lead-card input:focus,
.chatbot-lead-card textarea:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}

.chatbot-lead-submit {
    width: 100%;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 8px;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.chatbot-lead-submit:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

.chatbot-lead-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Typing Indicator Animation */
.chatbot-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    background: #1e293b;
    border-radius: 16px;
    border-top-left-radius: 4px;
    width: fit-content;
    box-shadow: 0 4px 14px rgba(0,0,0,0.2);
}

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

.chatbot-typing span:nth-child(1) { animation-delay: -0.32s; }
.chatbot-typing span:nth-child(2) { animation-delay: -0.16s; }
.chatbot-typing span:nth-child(3) { animation-delay: 0s; }

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

/* Footer / Input Area */
.chatbot-footer {
    padding: 10px 12px;
    background: #0f172a;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.chatbot-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chatbot-input {
    flex: 1;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 24px;
    padding: 9px 14px;
    font-size: 0.85rem;
    color: #f8fafc;
    outline: none;
    transition: all 0.2s;
}

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

.chatbot-input:focus {
    border-color: #6366f1;
    background: #131c2e;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.chatbot-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    border: none;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chatbot-send-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.5);
}

.chatbot-brand-tag {
    font-size: 0.68rem;
    color: #64748b;
    text-align: center;
    margin-top: 6px;
    display: block;
}

.chatbot-brand-tag i {
    color: #f59e0b;
}

/* --- Mobile Responsive Rules --- */
@media (max-width: 576px) {
    .chatbot-window {
        right: 10px !important;
        left: 10px !important;
        bottom: 80px !important;
        width: calc(100vw - 20px) !important;
        max-width: calc(100vw - 20px) !important;
        height: 75vh !important;
        max-height: 540px !important;
        border-radius: 16px !important;
    }

    .chatbot-greeting-bubble {
        right: 15px !important;
        left: 15px !important;
        bottom: 185px !important;
        max-width: calc(100vw - 30px) !important;
    }
}
