/* =========================================================
   DHANMONDI32.COM - AI CHATBOT CSS (Final Refined)
   Small button, TOP-RIGHT fixed
========================================================= */
:root {
    --chatbot-primary:       #8b1e2d;
    --chatbot-primary-dark:  #681421;
    --chatbot-primary-light: #f8e9ec;
    --chatbot-gold:          #d6b56d;
    --chatbot-white:         #ffffff;
    --chatbot-bg:            #f7f8fa;
    --chatbot-text:          #20242b;
    --chatbot-muted:         #737b87;
    --chatbot-border:        #e5e7eb;
    --chatbot-shadow:        0 12px 40px rgba(0, 0, 0, 0.18);
    --chatbot-radius:        18px;
}

#chatbot-widget,
#chatbot-widget * { box-sizing: border-box; }

#chatbot-widget {
    font-family: "Noto Sans Bengali", "Hind Siliguri", "Segoe UI", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--chatbot-text);
}

#chatbot-widget button,
#chatbot-widget input,
#chatbot-widget textarea { font: inherit; }

#chatbot-widget button { -webkit-tap-highlight-color: transparent; }

#chatbot-widget button:focus-visible,
#chatbot-widget input:focus-visible,
#chatbot-widget textarea:focus-visible {
    outline: 3px solid rgba(139, 30, 45, 0.25);
    outline-offset: 2px;
}

/* ==========================================================
   FLOATING BUTTON — Custom Robot Icon
========================================================== */
#chatbot-toggle {
    position: fixed;
    top: 33px;
    right: 30px;
    z-index: 10000;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px; 
    height: 36px;
    padding: 0;
    background: transparent !important; /* ব্যাকগ্রাউন্ড SVG থেকে আসছে */
    border: none !important;
    border-radius: 50%;
    cursor: pointer;
    user-select: none;
    transition: transform 0.22s ease, filter 0.22s ease;
    filter: drop-shadow(0 4px 10px rgba(255, 0, 24, 0.4));
}

#chatbot-toggle:hover {
    transform: translateY(-3px) scale(1.05);
    filter: drop-shadow(0 6px 14px rgba(255, 0, 24, 0.6));
}

#chatbot-toggle:active {
    transform: scale(0.94);
}

#chatbot-toggle .chatbot-toggle-icon {
    display: block;
    width: 100%;
    height: 100%;
}

#chatbot-toggle .chatbot-toggle-label {
    display: none !important;
}

@media (max-width: 480px) {
    #chatbot-toggle {
        top: 12px;
        right: 12px;
        width: 42px; 
        height: 42px;
    }
}

/* notification dot (optional) */
#chatbot-toggle .chatbot-notification {
    position: absolute;
    top: 3px; right: 3px;
    width: 11px; height: 11px;
    border: 2px solid var(--chatbot-white);
    border-radius: 50%;
    background: #22c55e;
}

/* ==========================================================
   CHAT PANEL — বাটনের নিচে, ডান পাশে
========================================================== */
#chatbot-panel {
    position: fixed;
    top: 82px;
    right: 18px;
    z-index: 9999;

    display: none;
    flex-direction: column;

    width: 380px;
    max-width: calc(100vw - 24px);
    height: 540px;
    max-height: calc(100dvh - 100px);
    min-height: 320px;

    overflow: hidden;
    background: var(--chatbot-white);
    border: 1px solid rgba(0, 0, 0, 0.07);
    border-radius: var(--chatbot-radius);
    box-shadow: var(--chatbot-shadow);

    opacity: 0;
    transform: translateY(-8px) scale(0.98);
    transform-origin: top right;
    transition: opacity 0.22s ease, transform 0.22s ease;
}

#chatbot-panel.is-open {
    display: flex;
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* ---------- Header ---------- */
#chatbot-panel .chatbot-header {
    position: relative;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 72px;
    padding: 13px 16px;
    background: linear-gradient(120deg,
        var(--chatbot-primary-dark),
        var(--chatbot-primary));
    color: var(--chatbot-white);
}

#chatbot-panel .chatbot-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 42px; height: 42px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    font-size: 21px;
}

#chatbot-panel .chatbot-header-info { flex: 1; min-width: 0; }

#chatbot-panel .chatbot-title {
    margin: 0; padding: 0;
    color: var(--chatbot-white);
    font-size: 16px; font-weight: 700; line-height: 1.5;
}

#chatbot-panel .chatbot-status {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 3px;
    color: rgba(255, 255, 255, 0.88);
    font-size: 12px;
}

#chatbot-panel .chatbot-status-dot {
    width: 7px; height: 7px; flex-shrink: 0;
    border-radius: 50%;
    background: #4ade80;
}

#chatbot-panel .chatbot-header-actions {
    display: flex; align-items: center; gap: 5px;
}

#chatbot-panel .chatbot-header-btn {
    display: inline-flex;
    align-items: center; justify-content: center;
    width: 34px; height: 34px; padding: 0;
    border: 0; border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: var(--chatbot-white);
    font-size: 20px; line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease;
}
#chatbot-panel .chatbot-header-btn:hover {
    background: rgba(255, 255, 255, 0.24);
}

/* ---------- Messages ---------- */
#chatbot-panel .chatbot-messages {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 14px;
    min-height: 0;
    padding: 18px 14px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    background:
        radial-gradient(circle at top right,
            rgba(139, 30, 45, 0.035), transparent 45%),
        var(--chatbot-bg);
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: #c8cbd1 transparent;
}
#chatbot-panel .chatbot-messages::-webkit-scrollbar { width: 5px; }
#chatbot-panel .chatbot-messages::-webkit-scrollbar-track { background: transparent; }
#chatbot-panel .chatbot-messages::-webkit-scrollbar-thumb {
    border-radius: 10px; background: #c8cbd1;
}

/* ---------- Message rows ---------- */
#chatbot-panel .chatbot-message {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    width: 100%; min-width: 0;
}
#chatbot-panel .chatbot-message.bot  { justify-content: flex-start; }
#chatbot-panel .chatbot-message.user { justify-content: flex-end; }

#chatbot-panel .chatbot-message-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 27px; height: 27px;
    border-radius: 50%;
    background: var(--chatbot-primary-light);
    color: var(--chatbot-primary);
    font-size: 14px;
}

#chatbot-panel .chatbot-bubble {
    max-width: 84%;
    min-width: 0;
    padding: 11px 13px;
    overflow-wrap: anywhere;
    word-break: normal;
    white-space: pre-wrap;
    font-size: 13.5px;
    line-height: 1.7;
}

#chatbot-panel .chatbot-message.bot .chatbot-bubble {
    border: 1px solid var(--chatbot-border);
    border-radius: 15px 15px 15px 4px;
    background: var(--chatbot-white);
    color: var(--chatbot-text);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.025);
}

#chatbot-panel .chatbot-message.user .chatbot-bubble {
    border: 1px solid var(--chatbot-primary);
    border-radius: 15px 15px 4px 15px;
    background: var(--chatbot-primary);
    color: var(--chatbot-white);
}

#chatbot-panel .chatbot-bubble a {
    color: var(--chatbot-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
    overflow-wrap: anywhere;
}
#chatbot-panel .chatbot-message.user .chatbot-bubble a { color: var(--chatbot-white); }

#chatbot-panel .chatbot-time {
    display: block;
    margin-top: 5px;
    color: var(--chatbot-muted);
    font-size: 10px; line-height: 1.4;
}
#chatbot-panel .chatbot-message.user .chatbot-time {
    color: rgba(255, 255, 255, 0.75);
    text-align: right;
}

/* ---------- Quick replies ---------- */
#chatbot-panel .chatbot-quick-replies {
    display: flex; flex-wrap: wrap; gap: 7px;
    margin: 0 0 0 35px;
}
#chatbot-panel .chatbot-quick-reply {
    max-width: 100%;
    padding: 7px 11px;
    border: 1px solid rgba(139, 30, 45, 0.3);
    border-radius: 20px;
    background: var(--chatbot-white);
    color: var(--chatbot-primary);
    font-size: 12px; font-weight: 600;
    text-align: left;
    overflow-wrap: anywhere;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}
#chatbot-panel .chatbot-quick-reply:hover {
    border-color: var(--chatbot-primary);
    background: var(--chatbot-primary);
    color: var(--chatbot-white);
}

/* ---------- Typing ---------- */
#chatbot-panel .chatbot-typing { display: none; align-items: center; gap: 8px; }
#chatbot-panel .chatbot-typing.is-visible { display: flex; }

#chatbot-panel .chatbot-typing-bubble {
    display: flex; align-items: center; gap: 4px;
    padding: 12px 14px;
    border: 1px solid var(--chatbot-border);
    border-radius: 14px 14px 14px 4px;
    background: var(--chatbot-white);
}
#chatbot-panel .chatbot-typing-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #969ba4;
    animation: chatbot-typing 1.2s infinite ease-in-out;
}
#chatbot-panel .chatbot-typing-dot:nth-child(2) { animation-delay: 0.15s; }
#chatbot-panel .chatbot-typing-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes chatbot-typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
    30%           { transform: translateY(-5px); opacity: 1; }
}

/* ---------- Input ---------- */
#chatbot-panel .chatbot-input-area {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    gap: 8px;
    padding: 12px 13px 10px;
    border-top: 1px solid var(--chatbot-border);
    background: var(--chatbot-white);
}
#chatbot-panel .chatbot-input-row {
    display: flex; align-items: flex-end; gap: 8px; width: 100%;
}
#chatbot-panel .chatbot-input {
    display: block; flex: 1;
    width: 100%; min-width: 0;
    min-height: 43px; max-height: 110px;
    padding: 11px 13px;
    resize: none;
    border: 1px solid #d9dde3;
    border-radius: 13px;
    background: #fbfbfc;
    color: var(--chatbot-text);
    font-size: 13px; line-height: 1.5;
    transition: border-color 0.2s ease, background 0.2s ease;
}
#chatbot-panel .chatbot-input::placeholder { color: #959ba5; opacity: 1; }
#chatbot-panel .chatbot-input:focus {
    border-color: var(--chatbot-primary);
    background: var(--chatbot-white);
    outline: none;
}

#chatbot-panel .chatbot-send-btn {
    display: inline-flex;
    align-items: center; justify-content: center;
    flex-shrink: 0;
    width: 44px; height: 44px; padding: 0;
    border: 0; border-radius: 13px;
    background: var(--chatbot-primary);
    color: var(--chatbot-white);
    font-size: 19px; line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}
#chatbot-panel .chatbot-send-btn:hover { background: var(--chatbot-primary-dark); }
#chatbot-panel .chatbot-send-btn:active { transform: scale(0.94); }
#chatbot-panel .chatbot-send-btn:disabled {
    background: #b9a0a4; cursor: not-allowed; opacity: 0.75;
}

#chatbot-panel .chatbot-footer {
    padding: 0 5px 2px;
    color: var(--chatbot-muted);
    font-size: 10px; line-height: 1.5; text-align: center;
}

/* ---------- Error ---------- */
#chatbot-panel .chatbot-error {
    padding: 9px 11px;
    border: 1px solid #fecaca;
    border-radius: 10px;
    background: #fef2f2;
    color: #991b1b;
    font-size: 12px; line-height: 1.6;
}

/* ---------- Hidden ---------- */
#chatbot-widget [hidden] { display: none !important; }
#chatbot-widget .chatbot-hidden { display: none !important; }

/* ==========================================================
   LEAD FORM STYLES (Updated - No Social Buttons)
========================================================== */
.chatbot-lead-form {
    background: #ffffff;
    border: 1px solid var(--chatbot-border);
    border-radius: 12px;
    padding: 15px;
    margin: 10px 0 10px 35px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    box-sizing: border-box;
}

.lead-title {
    font-size: 13px;
    color: #555;
    margin: 0 0 12px 0;
    font-weight: 600;
}

.chatbot-lead-form input,
.chatbot-lead-form textarea {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 10px;
    border: 1px solid #d9dde3;
    border-radius: 8px;
    font-size: 13px;
    box-sizing: border-box;
    outline: none;
    font-family: inherit;
    background: #fbfbfc;
    transition: border-color 0.2s;
}

.chatbot-lead-form input:focus,
.chatbot-lead-form textarea:focus {
    border-color: var(--chatbot-primary);
    background: #ffffff;
}

.chatbot-lead-form textarea {
    resize: vertical;
    min-height: 70px;
}

.chatbot-lead-form button {
    width: 100%;
    padding: 10px;
    background: var(--chatbot-primary);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.chatbot-lead-form button:hover {
    background: var(--chatbot-primary-dark);
}

.chatbot-lead-form button:disabled {
    background: #b9a0a4;
    cursor: not-allowed;
}

/* ==========================================================
   RESPONSIVE
========================================================== */
@media (max-width: 768px) {
    #chatbot-toggle { top: 14px; right: 14px; }
    #chatbot-panel {
        top: 76px; right: 14px;
        width: 360px;
        max-height: calc(100dvh - 90px);
    }
}

@media (max-width: 480px) {
    #chatbot-toggle {
        top: 12px; right: 12px;
        width: 48px; height: 48px;
    }
    #chatbot-toggle .chatbot-toggle-icon { font-size: 22px; }

    #chatbot-panel {
        top: 70px;
        right: 10px; left: 10px;
        width: auto;
        max-width: none;
        height: 520px;
        max-height: calc(100dvh - 82px);
        border-radius: 16px;
    }
    #chatbot-panel .chatbot-header { min-height: 66px; padding: 11px 12px; }
    #chatbot-panel .chatbot-avatar { width: 38px; height: 38px; font-size: 20px; }
    #chatbot-panel .chatbot-title  { font-size: 15px; }
    #chatbot-panel .chatbot-messages { gap: 12px; padding: 14px 11px; }
    #chatbot-panel .chatbot-bubble { max-width: 88%; padding: 10px 11px; font-size: 13px; }
    #chatbot-panel .chatbot-input-area { padding: 10px 10px 8px; }
    #chatbot-panel .chatbot-input { font-size: 16px; }
    #chatbot-panel .chatbot-send-btn { width: 42px; height: 42px; }
    
    .chatbot-lead-form { margin-left: 0; }
}

@media (max-width: 360px) {
    #chatbot-toggle { width: 44px; height: 44px; top: 10px; right: 10px; }
    #chatbot-toggle .chatbot-toggle-icon { font-size: 20px; }
    #chatbot-panel {
        top: 62px;
        right: 8px; left: 8px;
        max-height: calc(100dvh - 74px);
    }
    #chatbot-panel .chatbot-header-btn { width: 30px; height: 30px; }
    #chatbot-panel .chatbot-message-avatar { width: 23px; height: 23px; }
    #chatbot-panel .chatbot-bubble { max-width: 90%; font-size: 12.5px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    #chatbot-widget *,
    #chatbot-widget *::before,
    #chatbot-widget *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}