/* Bakuvi Solutions (bakuvisolutions.az) | Çat Widget — Tawk.to əvəzi
   Mövcud sayt CSS dəyişənlərini (--primary, --bg-card, --text-main və s.)
   istifadə edir, ona görə açıq/qaranlıq rejimlə avtomatik uyğunlaşır. */

#bs-chat-launcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9998;
    box-shadow: 0 10px 28px rgba(30,144,255,0.35);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#bs-chat-launcher:hover { transform: scale(1.08); }
#bs-chat-launcher svg { width: 26px; height: 26px; }
#bs-chat-launcher .bs-unread-dot {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: #dc2626;
    border-radius: 50%;
    border: 2px solid var(--white);
    display: none;
}
#bs-chat-launcher.has-unread .bs-unread-dot { display: block; }

#bs-chat-panel {
    position: fixed;
    bottom: 94px;
    right: 24px;
    width: 360px;
    max-width: calc(100vw - 32px);
    height: 480px;
    max-height: calc(100vh - 160px);
    background: var(--bg-card);
    border-radius: 20px;
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    box-shadow: var(--shadow), 0 30px 70px rgba(0,0,0,0.18);
    font-family: 'Inter', sans-serif;
    border: 1px solid rgba(0,0,0,0.06);
}
[data-theme="dark"] #bs-chat-panel { border-color: rgba(255,255,255,0.08); }
#bs-chat-panel.open { display: flex; animation: bsChatIn 0.3s cubic-bezier(0.16,1,0.3,1); }

@keyframes bsChatIn {
    from { opacity: 0; transform: translateY(16px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.bs-chat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: var(--primary);
    flex-shrink: 0;
}
.bs-chat-header svg { width: 26px; height: 26px; color: #fff; flex-shrink: 0; }
.bs-chat-header .bs-title { color: #fff; font-weight: 700; font-size: 13px; }
.bs-chat-header .bs-status { color: rgba(255,255,255,0.85); font-size: 10px; display: flex; align-items: center; gap: 5px; }
.bs-chat-header .bs-status .bs-dot { width: 6px; height: 6px; border-radius: 50%; background: #4ade80; }
.bs-chat-header .bs-close { margin-left: auto; cursor: pointer; color: #fff; background: none; border: none; font-size: 20px; opacity: 0.85; padding: 4px; }
.bs-chat-header .bs-close:hover { opacity: 1; }

.bs-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--bg-body);
}
.bs-chat-messages::-webkit-scrollbar { width: 4px; }
.bs-chat-messages::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 10px; }

.bs-msg { max-width: 82%; font-size: 13px; line-height: 1.5; padding: 10px 14px; border-radius: 14px; word-wrap: break-word; }
.bs-msg.bot { align-self: flex-start; background: var(--bg-card); color: var(--text-main); border-bottom-left-radius: 4px; box-shadow: var(--shadow); }
.bs-msg.visitor { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.bs-msg.system { align-self: center; color: var(--text-muted); font-size: 11px; text-align: center; }

.bs-typing { align-self: flex-start; display: flex; gap: 4px; padding: 10px 14px; }
.bs-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); animation: bsBlink 1.2s infinite ease-in-out; }
.bs-typing span:nth-child(2) { animation-delay: 0.2s; }
.bs-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bsBlink { 0%, 80%, 100% { opacity: 0.3; } 40% { opacity: 1; } }

.bs-lead-form {
    align-self: flex-start;
    background: var(--bg-card);
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 14px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 90%;
    box-shadow: var(--shadow);
}
[data-theme="dark"] .bs-lead-form { border-color: rgba(255,255,255,0.1); }
.bs-lead-form input {
    background: var(--bg-body);
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 10px;
    padding: 9px 12px;
    color: var(--text-main);
    font-size: 12px;
    outline: none;
}
[data-theme="dark"] .bs-lead-form input { border-color: rgba(255,255,255,0.12); }
.bs-lead-form input:focus { border-color: var(--primary); }
.bs-lead-form button {
    background: var(--primary); color: #fff; border: none; border-radius: 10px;
    padding: 9px; font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; cursor: pointer;
}

.bs-chat-input-row {
    display: flex;
    gap: 8px;
    padding: 12px;
    background: var(--bg-card);
    flex-shrink: 0;
}
.bs-chat-input-row input {
    flex: 1;
    background: var(--bg-body);
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 100px;
    padding: 11px 16px;
    color: var(--text-main);
    font-size: 13px;
    outline: none;
}
[data-theme="dark"] .bs-chat-input-row input { border-color: rgba(255,255,255,0.12); }
.bs-chat-input-row input:focus { border-color: var(--primary); }
.bs-chat-input-row button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}
.bs-chat-input-row button svg { width: 16px; height: 16px; }

@media (max-width: 480px) {
    #bs-chat-panel { right: 12px; left: 12px; width: auto; bottom: 90px; }
    #bs-chat-launcher { right: 16px; bottom: 20px; }
}
