/* ============================================================
   Gokul Nandhini - AI chatbot widget
   ============================================================ */

.chatbot {
    position: fixed;
    bottom: 96px;          /* stacked above the WhatsApp float button */
    right: 26px;
    z-index: 1001;
    font-family: 'Poppins', Arial, sans-serif;
}

.chatbot-toggle {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #b8862b, #96691c);
    color: #fff;
    font-size: 1.6rem;
    cursor: pointer;
    box-shadow: 0 8px 22px rgba(184, 134, 43, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
    position: relative;
}

.chatbot-toggle:hover {
    transform: scale(1.08);
}

.chatbot-toggle .fa-xmark {
    display: none;
}

.chatbot-open .chatbot-toggle .fa-comment-dots {
    display: none;
}

.chatbot-open .chatbot-toggle .fa-xmark {
    display: block;
}

.chatbot-window {
    position: fixed;
    bottom: 166px;          /* clears the 96px toggle offset + its 58px height + a gap */
    right: 26px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: clamp(300px, calc(100vh - 280px), 580px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(16px) scale(0.98);
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
}

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

/* Header */
.chatbot-header {
    background: linear-gradient(120deg, #2a2621, #1c1a17);
    color: #fff;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #b8862b, #96691c);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.chatbot-header strong {
    display: block;
    font-size: 0.95rem;
    font-family: 'Playfair Display', serif;
}

.chatbot-header span {
    font-size: 0.75rem;
    color: #a39c8d;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chatbot-online {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #25d366;
    display: inline-block;
}

.chatbot-close {
    margin-left: auto;
    background: none;
    border: none;
    color: #a39c8d;
    font-size: 1.1rem;
    cursor: pointer;
}

/* Messages */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    background: #faf6ef;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-msg {
    display: flex;
    max-width: 85%;
}

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

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

.chat-bubble {
    padding: 11px 15px;
    border-radius: 14px;
    font-size: 0.88rem;
    line-height: 1.55;
    word-break: break-word;
}

.chat-msg.bot .chat-bubble {
    background: #fff;
    border: 1px solid #eee6d8;
    border-bottom-left-radius: 4px;
    color: #3a352e;
}

.chat-msg.user .chat-bubble {
    background: linear-gradient(135deg, #b8862b, #96691c);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-quick {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 18px 6px;
    background: #faf6ef;
}

.chat-quick button {
    background: #fff;
    border: 1px solid #ddd6c9;
    color: #7a7268;
    font-family: inherit;
    font-size: 0.78rem;
    padding: 7px 13px;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-quick button:hover {
    border-color: #b8862b;
    color: #96691c;
    background: #fffdf8;
}

/* Typing dots */
.typing {
    display: inline-flex;
    gap: 5px;
    padding: 14px 16px;
}

.typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #b8862b;
    animation: chatBounce 1.2s infinite;
}

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

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

@keyframes chatBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-5px); opacity: 1; }
}

/* Intake form (name/phone/location, collected before the chat unlocks) */
.chatbot-intake {
    padding: 16px 18px 18px;
    background: #fff;
    border-top: 1px solid #eee6d8;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chatbot-intake-lead {
    font-size: 0.82rem;
    color: #6b6355;
    margin: 0 0 2px;
    line-height: 1.45;
}

.chatbot-intake .form-group {
    margin: 0;
}

.chatbot-intake input {
    width: 100%;
    border: 1.5px solid #e7dfd0;
    border-radius: 10px;
    padding: 10px 14px;
    font-family: inherit;
    font-size: 0.88rem;
    outline: none;
    box-sizing: border-box;
}

.chatbot-intake input:focus {
    border-color: #b8862b;
}

.chatbot-intake-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: 999px;
    padding: 11px 16px;
    background: linear-gradient(135deg, #b8862b, #96691c);
    color: #fff;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    margin-top: 2px;
}

.chatbot-intake-submit:disabled {
    opacity: 0.65;
    cursor: default;
}

.chatbot-intake-error {
    color: #c0392b;
    font-size: 0.8rem;
    margin: 0;
}

/* Input */
.chatbot-input {
    display: flex;
    gap: 8px;
    padding: 12px;
    background: #fff;
    border-top: 1px solid #eee6d8;
}

.chatbot-input input {
    flex: 1;
    border: 1.5px solid #e7dfd0;
    border-radius: 999px;
    padding: 10px 16px;
    font-family: inherit;
    font-size: 0.88rem;
    outline: none;
}

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

.chatbot-input button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #b8862b, #96691c);
    color: #fff;
    cursor: pointer;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .chatbot {
        right: 76px;
    }

    .chatbot-window {
        position: fixed;
        right: 16px;
        bottom: 88px;
        left: 16px;
        width: auto;
        max-width: none;
        height: min(70vh, 520px);
        max-height: calc(100dvh - 120px);
    }
}

@media (max-width: 420px) {
    .chatbot {
        right: 70px;
    }

    .chatbot-window {
        right: 10px;
        left: 10px;
        bottom: 82px;
        height: min(72vh, 480px);
        max-height: calc(100dvh - 108px);
        border-radius: 14px;
    }

    .chatbot-toggle {
        width: 52px;
        height: 52px;
        font-size: 1.4rem;
    }
}
