/* ===== BRIVOX WIDGET — Scoped, isolated styles ===== */
.bvx-w * { box-sizing: border-box; margin: 0; padding: 0; }
.bvx-w { font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif; }

/* Floating Bubble */
.bvx-bubble {
  position: fixed; bottom: 24px; right: 24px;
  width: 60px; height: 60px; border-radius: 50%;
  background: #0a0a0a;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 999998;
  box-shadow: 0 8px 32px rgba(0,0,0,.25), 0 0 0 0 rgba(201,162,39,.4);
  transition: transform .3s cubic-bezier(.16,1,.3,1), box-shadow .3s;
  animation: bvxPulse 2.5s ease-in-out infinite;
}
.bvx-bubble:hover { transform: scale(1.08); box-shadow: 0 12px 40px rgba(0,0,0,.35); }
.bvx-bubble img { width: 32px; height: 32px; filter: brightness(0) invert(1); }
.bvx-bubble.bvx-hidden { transform: scale(0); opacity: 0; pointer-events: none; }
.bvx-online-dot {
  position: absolute; top: 4px; right: 4px;
  width: 12px; height: 12px; border-radius: 50%;
  background: #00c853; border: 2px solid #0a0a0a;
  box-shadow: 0 0 8px rgba(0,200,83,.6);
}
.bvx-online-dot::after {
  content: ''; position: absolute; inset: -3px; border-radius: 50%;
  background: #00c853; opacity: .4; animation: bvxDotPulse 1.6s ease infinite;
}
@keyframes bvxPulse {
  0%, 100% { box-shadow: 0 8px 32px rgba(0,0,0,.25), 0 0 0 0 rgba(201,162,39,.5); }
  50% { box-shadow: 0 8px 32px rgba(0,0,0,.25), 0 0 0 14px rgba(201,162,39,0); }
}
@keyframes bvxDotPulse { 0%,100% { transform: scale(1); opacity:.4; } 50% { transform: scale(1.6); opacity:0; } }

/* Teaser bubble */
.bvx-teaser {
  position: fixed; bottom: 96px; right: 24px;
  background: #fff; color: #0a0a0a;
  padding: 10px 14px; border-radius: 14px 14px 4px 14px;
  font-size: 13px; font-weight: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,.15);
  z-index: 999997; max-width: 220px;
  opacity: 0; transform: translateY(8px); pointer-events: none;
  transition: opacity .4s, transform .4s;
  animation: bvxTeaserIn .6s ease 2s forwards;
}
.bvx-teaser.bvx-show { opacity: 1; transform: translateY(0); pointer-events: auto; cursor: pointer; }
@keyframes bvxTeaserIn { to { opacity: 1; transform: translateY(0); pointer-events: auto; } }
.bvx-teaser-close {
  position: absolute; top: -6px; left: -6px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #0a0a0a; color: #fff; border: none;
  font-size: 12px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* Panel */
.bvx-panel {
  position: fixed; bottom: 96px; right: 24px;
  width: 380px; height: 600px; max-height: calc(100vh - 120px);
  background: #0a0a0a; border-radius: 20px; overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.05);
  z-index: 999999;
  display: flex; flex-direction: column;
  transform: scale(.92) translateY(20px); opacity: 0; pointer-events: none;
  transition: transform .35s cubic-bezier(.16,1,.3,1), opacity .35s;
  transform-origin: bottom right;
}
.bvx-panel.bvx-open { transform: scale(1) translateY(0); opacity: 1; pointer-events: auto; }

/* Mobile fullscreen */
@media (max-width: 640px) {
  .bvx-panel {
    bottom: 0; right: 0; left: 0; top: 0;
    width: 100vw; height: 100vh; height: 100dvh;
    max-height: 100vh; max-height: 100dvh;
    border-radius: 0;
    transform: translateY(100%); transform-origin: bottom;
  }
  .bvx-panel.bvx-open { transform: translateY(0); }
  .bvx-bubble { bottom: 18px; right: 18px; width: 56px; height: 56px; }
  .bvx-bubble img { width: 28px; height: 28px; }
  .bvx-teaser { bottom: 84px; right: 18px; }
}

/* Panel Header */
.bvx-header {
  padding: 16px 18px;
  background: linear-gradient(135deg, #141414, #0a0a0a);
  border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.bvx-header-info { display: flex; align-items: center; gap: 12px; }
.bvx-header-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,.08);
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.bvx-header-avatar img {
  width: 22px; height: 22px;
  filter: brightness(0) invert(1);
}
.bvx-header-avatar .bvx-online-dot {
  width: 11px; height: 11px; top: -2px; right: -2px; border-color: #0a0a0a;
}
.bvx-header-text h3 { font-size: 14px; color: #fff; font-weight: 600; line-height: 1.2; }
.bvx-header-text p { font-size: 11px; color: rgba(255,255,255,.5); margin-top: 2px; }
.bvx-close {
  width: 32px; height: 32px; border-radius: 8px;
  background: rgba(255,255,255,.05); border: none;
  color: rgba(255,255,255,.6); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s, color .2s;
  -webkit-tap-highlight-color: transparent;
}
.bvx-close:hover, .bvx-close:active { background: rgba(255,255,255,.12); color: #fff; }

/* Body */
.bvx-body {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 20px 18px;
  scroll-behavior: smooth;
}
.bvx-body::-webkit-scrollbar { width: 4px; }
.bvx-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }

/* ===== WELCOME SCREEN ===== */
.bvx-welcome { display: flex; flex-direction: column; gap: 22px; animation: bvxFadeUp .5s ease; }
.bvx-welcome-top { text-align: center; padding: 8px 0 4px; }
.bvx-avatars { display: flex; justify-content: center; margin-bottom: 14px; position: relative; height: 56px; }
.bvx-avatars img {
  width: 48px; height: 48px; border-radius: 50%;
  border: 3px solid #0a0a0a; object-fit: cover;
  margin-left: -14px; transition: transform .3s;
  box-shadow: 0 4px 12px rgba(0,0,0,.3);
  animation: bvxAvatarIn .5s cubic-bezier(.34,1.56,.64,1) backwards;
}
.bvx-avatars img:nth-child(1) { margin-left: 0; animation-delay: .1s; z-index: 4; }
.bvx-avatars img:nth-child(2) { animation-delay: .2s; z-index: 3; }
.bvx-avatars img:nth-child(3) { animation-delay: .3s; z-index: 2; }
.bvx-avatars img:nth-child(4) { animation-delay: .4s; z-index: 1; }
.bvx-avatars img:hover { transform: translateY(-4px); z-index: 5; }
@keyframes bvxAvatarIn { from { opacity:0; transform: scale(.6); } to { opacity:1; transform: scale(1); } }

.bvx-online-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 100px;
  background: rgba(0,200,83,.12); border: 1px solid rgba(0,200,83,.25);
  font-size: 11px; font-weight: 600; color: #00c853;
  margin-bottom: 12px;
}
.bvx-online-badge::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: #00c853; box-shadow: 0 0 8px #00c853;
  animation: bvxDotPulse 1.6s ease infinite;
}
.bvx-welcome h2 {
  font-size: 18px; color: #fff; font-weight: 600;
  line-height: 1.4; margin-bottom: 8px;
}
.bvx-welcome p {
  font-size: 13px; color: rgba(255,255,255,.55);
  line-height: 1.6; padding: 0 8px;
}

.bvx-actions { display: flex; flex-direction: column; gap: 10px; padding: 0 4px; }
.bvx-btn-primary {
  width: 100%; padding: 14px 18px;
  background: #25d366; color: #fff;
  border: none; border-radius: 14px;
  font-size: 14px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; text-decoration: none;
  transition: transform .2s, box-shadow .2s;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 8px 24px rgba(37,211,102,.25);
}
.bvx-btn-primary:hover, .bvx-btn-primary:active {
  transform: translateY(-1px);
  box-shadow: 0 12px 32px rgba(37,211,102,.35);
}
.bvx-btn-secondary {
  width: 100%; padding: 11px 16px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  color: rgba(255,255,255,.85); font-size: 13px; font-weight: 500;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer;
  transition: background .2s, border-color .2s;
  -webkit-tap-highlight-color: transparent;
}
.bvx-btn-secondary:hover, .bvx-btn-secondary:active {
  background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.15);
}
.bvx-btn-secondary img { width: 18px; height: 18px; filter: brightness(0) invert(1); opacity: .9; }
.bvx-btn-primary svg, .bvx-btn-secondary svg { width: 16px; height: 16px; }

.bvx-divider {
  display: flex; align-items: center; gap: 10px;
  font-size: 10px; color: rgba(255,255,255,.3);
  text-transform: uppercase; letter-spacing: 1px;
  padding: 4px 4px;
}
.bvx-divider::before, .bvx-divider::after {
  content: ''; flex: 1; height: 1px; background: rgba(255,255,255,.06);
}

/* ===== CHAT SCREEN ===== */
.bvx-chat-screen { display: none; flex-direction: column; height: 100%; min-height: 0; flex: 1; overflow: hidden; }
.bvx-chat-screen.bvx-active { display: flex; }
.bvx-messages { flex: 1 1 0; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 20px 18px; display: flex; flex-direction: column; gap: 14px; }
.bvx-messages::-webkit-scrollbar { width: 4px; }
.bvx-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }

.bvx-msg { display: flex; gap: 10px; max-width: 88%; animation: bvxMsgIn .35s cubic-bezier(.16,1,.3,1); }
.bvx-msg.bvx-user { align-self: flex-end; flex-direction: row-reverse; }
.bvx-msg-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(255,255,255,.06);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; position: relative; margin-top: 2px;
}
.bvx-msg-avatar img { width: 16px; height: 16px; filter: brightness(0) invert(1); }
.bvx-msg-avatar.bvx-thinking::before {
  content: ''; position: absolute; inset: -3px; border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0%, transparent 65%, #c9a227 100%);
  animation: bvxRotate 1s linear infinite;
  -webkit-mask: radial-gradient(circle, transparent 60%, #000 62%);
  mask: radial-gradient(circle, transparent 60%, #000 62%);
}
@keyframes bvxRotate { to { transform: rotate(360deg); } }

.bvx-msg-content {
  font-size: 13.5px; line-height: 1.55;
  word-wrap: break-word; overflow-wrap: break-word;
}
.bvx-msg.bvx-user .bvx-msg-content {
  background: #fff; color: #0a0a0a;
  padding: 9px 13px; border-radius: 14px 14px 4px 14px;
  max-width: 100%;
}
.bvx-msg.bvx-bot .bvx-msg-content {
  color: rgba(255,255,255,.92);
  padding: 4px 0;
}
.bvx-msg.bvx-bot .bvx-msg-content a {
  color: #c9a227; text-decoration: underline; word-break: break-all;
}
.bvx-msg.bvx-bot .bvx-msg-content code {
  background: rgba(255,255,255,.08); padding: 1px 6px;
  border-radius: 4px; font-size: 12px;
}
.bvx-msg.bvx-bot .bvx-msg-content pre {
  background: rgba(255,255,255,.05); padding: 10px 12px;
  border-radius: 8px; overflow-x: auto; margin: 6px 0;
  font-size: 12px;
}
.bvx-msg.bvx-bot .bvx-msg-content strong { color: #fff; font-weight: 600; }
.bvx-msg.bvx-bot .bvx-msg-content br + br { display: block; content: ''; margin-top: 4px; }

.bvx-cursor {
  display: inline-block; width: 2px; height: 13px;
  background: #c9a227; vertical-align: middle;
  animation: bvxBlink 1s steps(1) infinite;
  margin-left: 1px;
}
@keyframes bvxBlink { 50% { opacity: 0; } }

.bvx-thinking-dots { display: inline-flex; gap: 4px; padding: 6px 0; }
.bvx-thinking-dots span {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255,255,255,.4);
  animation: bvxDotJump 1.4s ease infinite;
}
.bvx-thinking-dots span:nth-child(2) { animation-delay: .2s; }
.bvx-thinking-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes bvxDotJump { 0%,60%,100% { transform: translateY(0); opacity:.4; } 30% { transform: translateY(-4px); opacity:1; } }
@keyframes bvxMsgIn { from { opacity:0; transform: translateY(8px); } to { opacity:1; transform: translateY(0); } }
@keyframes bvxFadeUp { from { opacity:0; transform: translateY(12px); } to { opacity:1; transform: translateY(0); } }

/* Input */
.bvx-input-wrap {
  padding: 12px 14px 14px;
  border-top: 1px solid rgba(255,255,255,.06);
  background: #0a0a0a;
  flex-shrink: 0;
  padding-bottom: max(14px, env(safe-area-inset-bottom));
}
.bvx-input-box {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px; padding: 4px 4px 4px 14px;
  transition: border-color .2s;
}
.bvx-input-box:focus-within { border-color: rgba(201,162,39,.4); }
.bvx-input {
  flex: 1; border: none; background: transparent; outline: none;
  color: #fff; font-size: 14px; font-family: inherit;
  padding: 10px 0; min-width: 0;
}
.bvx-input::placeholder { color: rgba(255,255,255,.3); }
.bvx-send {
  width: 36px; height: 36px; border-radius: 10px;
  background: #c9a227; color: #0a0a0a; border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
  transition: background .2s, transform .2s;
  -webkit-tap-highlight-color: transparent;
}
.bvx-send:hover:not(:disabled) { background: #d4ad2e; transform: scale(1.05); }
.bvx-send:disabled { background: rgba(255,255,255,.1); color: rgba(255,255,255,.3); cursor: not-allowed; }
.bvx-send svg { width: 16px; height: 16px; }
.bvx-foot {
  font-size: 10px; color: rgba(255,255,255,.3);
  text-align: center; margin-top: 8px;
}
.bvx-foot b { color: rgba(255,255,255,.5); font-weight: 600; }