/* =============================================
   CHATBOT WIDGET — sajidkhan.me
   ============================================= */

/* --- Floating toggle button --- */
#chatbot-toggle {
    position: fixed;
    bottom: 55px;
    /* scroll-top: 15px + 44px height + 20px gap */
    right: 28px;
    z-index: 9999;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    outline: none;
}

#chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 10px 32px rgba(99, 102, 241, 0.55);
}

#chatbot-toggle svg {
    width: 28px;
    height: 28px;
    fill: #fff;
    transition: opacity 0.2s;
}

#chatbot-toggle .icon-close {
    display: none;
}

#chatbot-toggle.open .icon-chat {
    display: none;
}

#chatbot-toggle.open .icon-close {
    display: block;
}

/* Notification dot */
#chatbot-toggle .notif-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 12px;
    height: 12px;
    background: #22c55e;
    border-radius: 50%;
    border: 2px solid #fff;
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.3);
        opacity: 0.7;
    }
}

/* --- Chat window --- */
#chatbot-window {
    position: fixed;
    bottom: 153px;
    /* toggle bottom 79px + toggle height 60px + 14px gap */
    right: 28px;
    z-index: 9998;
    width: 360px;
    max-height: 540px;
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
    transform: scale(0.85) translateY(20px);
    transform-origin: bottom right;
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
        opacity 0.25s ease;
}

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

/* --- Header --- */
#chatbot-header {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

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

.chatbot-info h4 {
    margin: 0;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
}

.chatbot-info span {
    color: rgba(255, 255, 255, 0.75);
    font-size: 12px;
    font-family: 'Poppins', sans-serif;
}

.chatbot-status-dot {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    display: inline-block;
    margin-right: 4px;
    animation: pulse-dot 2s infinite;
}

/* --- Messages area --- */
#chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f8fafc;
    scroll-behavior: smooth;
}

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

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

#chatbot-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

/* Bubbles */
.chat-bubble {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 13.5px;
    line-height: 1.55;
    font-family: 'Poppins', sans-serif;
    word-break: break-word;
    animation: bubble-in 0.25s cubic-bezier(0.34, 1.4, 0.64, 1);
}

@keyframes bubble-in {
    from {
        transform: scale(0.85);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.chat-bubble.bot {
    background: #fff;
    color: #1e293b;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
}

.chat-bubble.user {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #fff;
    border-bottom-right-radius: 4px;
    align-self: flex-end;
}

/* Typing indicator */
.typing-indicator {
    align-self: flex-start;
    background: #fff;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    padding: 12px 18px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
    display: flex;
    gap: 5px;
    align-items: center;
}

.typing-indicator span {
    width: 7px;
    height: 7px;
    background: #cbd5e1;
    border-radius: 50%;
    display: inline-block;
    animation: typing-bounce 1.2s infinite;
}

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

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

@keyframes typing-bounce {

    0%,
    80%,
    100% {
        transform: translateY(0);
        background: #cbd5e1;
    }

    40% {
        transform: translateY(-6px);
        background: #6366f1;
    }
}

/* WhatsApp redirect card */
.wa-card {
    background: #f0fdf4;
    border: 1.5px solid #bbf7d0;
    border-radius: 14px;
    padding: 12px 14px;
    align-self: flex-start;
    max-width: 90%;
    animation: bubble-in 0.25s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.wa-card p {
    margin: 0 0 10px;
    font-size: 13px;
    color: #166534;
    line-height: 1.5;
    font-family: 'Poppins', sans-serif;
}

.wa-card a {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: #25d366;
    color: #fff;
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    font-family: 'Poppins', sans-serif;
    transition: background 0.2s, transform 0.2s;
}

.wa-card a:hover {
    background: #1da851;
    transform: scale(1.03);
}

.wa-card a svg {
    width: 16px;
    height: 16px;
    fill: #fff;
    flex-shrink: 0;
}

/* Quick replies */
#chatbot-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 14px 4px;
    background: #f8fafc;
    flex-shrink: 0;
}

.quick-reply-btn {
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 50px;
    padding: 6px 13px;
    font-size: 12px;
    font-family: 'Poppins', sans-serif;
    color: #4f46e5;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.quick-reply-btn:hover {
    background: #6366f1;
    color: #fff;
    border-color: #6366f1;
    transform: translateY(-1px);
}

/* --- Input area --- */
#chatbot-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid #f1f5f9;
    background: #fff;
    flex-shrink: 0;
}

#chatbot-input {
    flex: 1;
    border: 1.5px solid #e2e8f0;
    border-radius: 50px;
    padding: 9px 16px;
    font-size: 13px;
    font-family: 'Poppins', sans-serif;
    color: #1e293b;
    outline: none;
    background: #f8fafc;
    transition: border-color 0.2s;
}

#chatbot-input:focus {
    border-color: #6366f1;
    background: #fff;
}

#chatbot-input::placeholder {
    color: #94a3b8;
}

#chatbot-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.2s, box-shadow 0.2s;
    outline: none;
}

#chatbot-send:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

#chatbot-send svg {
    width: 18px;
    height: 18px;
    fill: #fff;
}

/* Mobile */
@media (max-width: 480px) {
    #chatbot-window {
        width: calc(100vw - 20px);
        right: 10px;
        left: 10px;
        bottom: 141px;
        /* toggle 79px + toggle height 52px + 10px gap */
        max-height: 65vh;
        border-radius: 16px;
    }

    #chatbot-toggle {
        right: 16px;
        bottom: 79px;
        /* scroll-top 15px + height 44px + 20px gap = 79px */
        width: 52px;
        height: 52px;
    }

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

    #chatbot-messages {
        padding: 12px 10px;
    }

    #chatbot-input-area {
        padding: 10px 10px;
    }

    .quick-reply-btn {
        font-size: 11px;
        padding: 5px 10px;
    }
}