/* ============================================================
   Kundali Chatbot widget
   ============================================================ */
.cb-fab {
    position: fixed; right: 18px; bottom: 18px; z-index: 900;
    width: 58px; height: 58px; border-radius: 50%; border: none; cursor: pointer;
    font-size: 26px; color: #fff;
    background: linear-gradient(135deg, #7b3fe4, #ff6b9d);
    box-shadow: 0 8px 22px rgba(120, 30, 150, .35);
    transition: transform .18s ease, box-shadow .18s ease;
}
.cb-fab:hover { transform: translateY(-2px) scale(1.05); }
.cb-fab.open { transform: rotate(8deg) scale(1.05); }

.cb-panel {
    position: fixed; right: 18px; bottom: 86px; z-index: 901;
    width: min(380px, calc(100vw - 24px)); height: min(560px, calc(100vh - 120px));
    display: flex; flex-direction: column; overflow: hidden;
    background: #fff; border: 1px solid rgba(138, 109, 46, .2); border-radius: 18px;
    box-shadow: 0 18px 50px rgba(36, 27, 51, .28);
    animation: cbPop .22s ease;
}
/* display:flex above beats the plain [hidden] attribute, so force-hide it here,
   otherwise the ✕ close button (panel.hidden = true) has no visible effect */
.cb-panel[hidden] { display: none !important; }
@keyframes cbPop { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
/* Each block of a rich (card) answer fades+slides in as revealBlocks un-hides it */
@keyframes cbBlockIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.cb-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 14px; color: #fff;
    background: linear-gradient(135deg, #7b3fe4, #a86bff);
}
.cb-title { font-weight: 700; font-size: 1rem; }
.cb-x { background: rgba(255,255,255,.2); border: none; color: #fff; width: 28px; height: 28px; border-radius: 8px; cursor: pointer; font-size: 14px; }

.cb-msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: #faf7ff; }
.cb-msg { max-width: 86%; padding: 10px 13px; border-radius: 14px; font-size: .92rem; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.cb-bot { align-self: flex-start; background: #fff; border: 1px solid rgba(138,109,46,.15); color: var(--ink, #241b33); border-bottom-left-radius: 4px; }
.cb-user { align-self: flex-end; background: linear-gradient(135deg, #7b3fe4, #a86bff); color: #fff; border-bottom-right-radius: 4px; }
.cb-thinking { opacity: .7; font-style: italic; animation: cbBlink 1.2s infinite; }
@keyframes cbBlink { 0%,100%{opacity:.5} 50%{opacity:.9} }

.cb-input { display: flex; gap: 8px; padding: 10px; border-top: 1px solid rgba(138,109,46,.12); background: #fff; }
.cb-input textarea {
    flex: 1; resize: none; border: 1px solid rgba(138,109,46,.25); border-radius: 12px;
    padding: 9px 12px; font-family: inherit; font-size: .92rem; line-height: 1.4; max-height: 110px; outline: none;
}
.cb-input textarea:focus { border-color: var(--indigo, #6d4aff); }
.cb-send { border: none; border-radius: 12px; padding: 0 16px; font-weight: 700; cursor: pointer; color: #fff;
    background: linear-gradient(135deg, #4be0b0, #2bb98a); font-size: .9rem; }
.cb-send:disabled { opacity: .5; cursor: not-allowed; }
.cb-note { text-align: center; font-size: .7rem; color: var(--ink-soft, #7a7290); padding: 4px 8px 8px; background: #fff; }

@media print { .cb-fab, .cb-panel { display: none !important; } }

/* Rich (falkathan-card) answers rendered inside the chat */
.cb-msg.cb-rich {
    align-self: stretch; max-width: 100%;
    background: transparent; border: none; padding: 0; border-radius: 0;
}
.cb-rich .section-title { font-size: 1.05rem !important; margin: 4px 0 8px !important; }
.cb-rich .mdir-section, .cb-rich .b7-report { margin: 0 !important; }
.cb-rich .b7-block, .cb-rich .mdir-item, .cb-rich .bhava-card { font-size: .86rem; }
.cb-rich .mdir-grid { grid-template-columns: 1fr !important; }

/* Typewriter cursor while a plain-text answer types out */
.cb-msg.cb-typing::after {
    content: '▋'; margin-left: 1px; color: var(--indigo, #6d4aff);
    animation: cbCaret 0.7s steps(1) infinite;
}
@keyframes cbCaret { 0%,100%{opacity:1} 50%{opacity:0} }

/* ---- starter chips ---- */
.cb-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 6px; }
.cb-chip { font-size: 12.5px; line-height: 1.2; padding: 7px 11px; border-radius: 999px;
    border: 1px solid rgba(124,58,237,.35); background: rgba(124,58,237,.08);
    color: #6d28d9; cursor: pointer; transition: background .15s, transform .1s; }
.cb-chip:hover { background: rgba(124,58,237,.16); transform: translateY(-1px); }

/* ---- sources line ---- */
.cb-src { margin-top: 8px; padding-top: 6px; border-top: 1px dashed rgba(0,0,0,.12);
    font-size: 11.5px; color: #8a8398; }

/* ---- markdown inside bot answers ---- */
.cb-rich p { margin: 0 0 7px; line-height: 1.55; }
.cb-rich p:last-child { margin-bottom: 0; }
.cb-rich ul { margin: 4px 0 7px; padding-left: 18px; }
.cb-rich li { margin: 2px 0; line-height: 1.5; }
.cb-rich b { font-weight: 700; }
.cb-stream::after { content: '▋'; color: #7c3aed; animation: cbBlink 1s steps(2) infinite; margin-left: 1px; }
@keyframes cbBlink { 0%,50%{opacity:1} 50.01%,100%{opacity:0} }

/* ---- copy button on a bot answer ---- */
.cb-msg.cb-bot { position: relative; }
.cb-copy { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; line-height: 20px;
    padding: 0; border: 1px solid rgba(0,0,0,.12); border-radius: 6px; background: rgba(255,255,255,.7);
    color: #6d28d9; font-size: 12px; cursor: pointer; opacity: 0; transition: opacity .15s; }
.cb-msg.cb-bot:hover .cb-copy { opacity: 1; }
.cb-copy:hover { background: rgba(124,58,237,.12); }
