:root { --blb-brand: #015FA7; }

.blb-bubble {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--blb-brand);
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 999998;
    transition: transform 0.15s ease, opacity 0.15s ease;
}
.blb-bubble:hover { transform: scale(1.06); }
.blb-bubble.blb-hidden { opacity: 0; pointer-events: none; transform: scale(0.8); }

.blb-window {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 360px;
    max-width: calc(100vw - 32px);
    height: 520px;
    max-height: calc(100vh - 48px);
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 999999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.blb-window.blb-open { opacity: 1; pointer-events: auto; }

.blb-header {
    background: var(--blb-brand);
    color: #fff;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.blb-header-titles { flex: 1; min-width: 0; text-align: center; }
.blb-title { font-weight: 600; font-size: 18px; }
.blb-subtitle { font-size: 13px; opacity: 0.85; margin-top: 3px; }
.blb-header-spacer { flex-shrink: 0; width: 30px; }
.blb-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
}

.blb-chat-view {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.blb-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #f7f9fb;
}

.blb-row { display: flex; align-items: flex-end; gap: 6px; }
.blb-row-user { justify-content: flex-end; }
.blb-row-assistant { justify-content: flex-start; }

.blb-msg {
    max-width: 78%;
    padding: 9px 12px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.blb-msg-user { background: var(--blb-brand); color: #fff; border-bottom-right-radius: 4px; }
.blb-msg-assistant { background: #fff; color: #222; border: 1px solid #e3e7eb; border-bottom-left-radius: 4px; }

@keyframes blb-voice-pulse { 0%, 100% { opacity: 0.25; } 50% { opacity: 0.8; } }

.blb-typing span {
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 3px;
    border-radius: 50%;
    background: #9aa5b1;
    animation: blb-blink 1.2s infinite ease-in-out;
}
.blb-typing span:nth-child(2) { animation-delay: 0.2s; }
.blb-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blb-blink { 0%, 80%, 100% { opacity: 0.3; } 40% { opacity: 1; } }

.blb-inputbar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px;
    border-top: 1px solid #e3e7eb;
    background: #fff;
}
.blb-inputrow {
    display: flex;
    align-items: center;
    gap: 6px;
}
.blb-input {
    flex: 1;
    border: 1px solid #d7dce1;
    border-radius: 20px;
    padding: 9px 14px;
    font-size: 14px;
    outline: none;
}
.blb-input:focus { border-color: var(--blb-brand); }

.blb-send {
    background: var(--blb-brand);
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

/* ---------- Voice call view ---------- */
.blb-voice-view {
    flex: 1;
    min-height: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 0;
    background: #f7f9fb;
}
.blb-voice-header-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-top: 20px;
}
.blb-voice-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--blb-brand);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
}
.blb-voice-label {
    font-size: 20px;
    font-weight: 600;
    color: var(--blb-brand);
    margin-bottom: 22px;
}
.blb-voice-status-card {
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
    background: #fff;
    border: 1px solid #e3e7eb;
    border-bottom: none;
    border-radius: 14px 14px 0 0;
    padding: 16px 16px;
    position: relative;
    flex-shrink: 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}
.blb-voice-call-active { cursor: default; }
.blb-voice-status-row {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.blb-voice-status-text {
    font-size: 14px;
    color: #444;
    font-weight: 500;
}
.blb-voice-call-active .blb-voice-status-text::after {
    content: '';
    display: inline-block;
    width: 5px; height: 5px;
    margin-left: 6px;
    border-radius: 50%;
    background: #2ecc71;
    animation: blb-voice-pulse 1s infinite ease-in-out;
}
.blb-voice-hearing .blb-voice-status-text::after {
    animation: blb-voice-pulse 0.4s infinite ease-in-out;
}
.blb-voice-hearing {
    border-color: #2ecc71 !important;
    box-shadow: 0 -2px 10px rgba(46,204,113,0.15) !important;
}
.blb-voice-timer {
    position: absolute;
    right: 0;
    font-size: 13px;
    color: #888;
    font-variant-numeric: tabular-nums;
}
.blb-voice-closewindow-btn {
    display: block;
    width: 100%;
    margin-top: 16px;
    background: #e53935;
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 11px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

/* ---------- Bottom nav ---------- */
.blb-bottom-nav {
    display: flex;
    background: var(--blb-brand);
    padding: 8px 0 10px;
}
.blb-nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.55);
    font-size: 11px;
    cursor: pointer;
}
.blb-nav-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255,255,255,0.12);
    display: flex;
    align-items: center;
    justify-content: center;
}
.blb-nav-active { color: #fff; }
.blb-nav-active .blb-nav-icon { background: #fff; color: var(--blb-brand); }

@media (max-width: 420px) {
    .blb-window { right: 16px; left: 16px; width: auto; bottom: 16px; }
    .blb-bubble { right: 16px; bottom: 16px; }
}

.blb-attention-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 280px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.22);
    overflow: hidden;
    z-index: 999997;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    cursor: pointer;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.96);
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.blb-attention-popup.blb-popup-visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}
.blb-popup-bar {
    height: 6px;
    background: var(--blb-brand);
}
.blb-popup-body {
    padding: 18px 20px 20px;
    text-align: center;
}
.blb-popup-heading {
    color: var(--blb-brand);
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 6px;
}
.blb-popup-heading + .blb-popup-heading {
    margin-top: 12px;
}
.blb-popup-text {
    color: #222;
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 4px;
}
.blb-popup-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--blb-brand);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 14px auto 0;
}
@media (max-width: 420px) {
    .blb-attention-popup { width: calc(100vw - 40px); max-width: 320px; }
}
