/* B.E Security Assistant — isolated styles. Everything is scoped under .bec- */
.bec-root {
  --bec-gold: var(--gold, #d4a017);
  --bec-gold-soft: rgba(212, 160, 23, .16);
  --bec-black: #0d0d0d;
  --bec-ink: #151515;
  --bec-panel: #1b1b1b;
  --bec-line: rgba(255, 255, 255, .09);
  --bec-text: #f4f1ea;
  --bec-muted: #b9b4a8;
  --bec-ease: cubic-bezier(.22, .8, .26, 1);
  position: fixed; right: 20px; bottom: 20px; z-index: 2147483000;
  font-family: "Manrope", "Helvetica Neue", Arial, sans-serif;
  font-size: 13px; line-height: 1.5; color: var(--bec-text);
  -webkit-text-size-adjust: 100%;
}
@supports (color: oklch(72% .155 75)) {
  .bec-root { --bec-gold: var(--gold, oklch(72% .155 75)); }
}
.bec-root *, .bec-root *::before, .bec-root *::after { box-sizing: border-box; }
.bec-root button, .bec-root input, .bec-root textarea { font: inherit; color: inherit; }
.bec-root button { cursor: pointer; }
.bec-root :focus-visible { outline: 2px solid var(--bec-gold); outline-offset: 2px; }

/* ---------- Launcher ---------- */
.bec-launcher {
  position: relative; display: grid; place-items: center;
  width: 56px; height: 56px; border-radius: 50%; padding: 0;
  background: radial-gradient(circle at 30% 25%, #262626, #050505 70%);
  border: 1.5px solid var(--bec-gold); color: var(--bec-gold);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .45), 0 0 0 4px rgba(0, 0, 0, .06);
  transition: transform .3s var(--bec-ease), box-shadow .3s var(--bec-ease), background .3s;
}
.bec-launcher::before {
  content: ""; position: absolute; inset: -2px; border-radius: 50%;
  border: 2px solid var(--bec-gold); opacity: 0; pointer-events: none;
  animation: bec-pulse 2.8s ease-out infinite;
}
.bec-launcher:hover { transform: translateY(-3px) scale(1.06); box-shadow: 0 16px 34px rgba(0, 0, 0, .5), 0 0 0 5px var(--bec-gold-soft); }
.bec-launcher:active { transform: scale(.97); }
.bec-launcher svg { width: 25px; height: 25px; transition: transform .35s var(--bec-ease), opacity .25s; }
.bec-launcher .bec-ico-close { position: absolute; opacity: 0; transform: rotate(-60deg) scale(.6); }
.bec-open .bec-launcher .bec-ico-chat { opacity: 0; transform: rotate(60deg) scale(.6); }
.bec-open .bec-launcher .bec-ico-close { opacity: 1; transform: none; }
.bec-open .bec-launcher::before { animation: none; }
.bec-badge {
  position: absolute; top: 2px; right: 2px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--bec-gold); border: 2px solid #050505;
}
.bec-open .bec-badge, .bec-seen .bec-badge { display: none; }
@keyframes bec-pulse {
  0% { transform: scale(1); opacity: .55; }
  70%, 100% { transform: scale(1.55); opacity: 0; }
}

/* ---------- Window ---------- */
.bec-window {
  position: absolute; right: 0; bottom: 70px;
  width: 340px; max-width: calc(100vw - 24px);
  height: 500px; max-height: calc(100vh - 100px); max-height: calc(100dvh - 100px);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--bec-ink); border: 1px solid rgba(212, 160, 23, .35); border-radius: 16px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, .5), 0 4px 14px rgba(0, 0, 0, .3);
  opacity: 0; visibility: hidden; transform: translateY(16px) scale(.97); transform-origin: bottom right;
  transition: opacity .25s var(--bec-ease), transform .3s var(--bec-ease), visibility 0s linear .3s;
}
.bec-open .bec-window { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }

.bec-header {
  display: flex; align-items: center; gap: 10px; padding: 11px 11px 11px 14px; flex: none;
  background: linear-gradient(135deg, #050505, #1a1a1a);
  border-bottom: 1px solid rgba(212, 160, 23, .45);
}
.bec-avatar {
  position: relative; flex: none; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; color: var(--bec-gold);
  background: #000; border: 1.5px solid var(--bec-gold);
}
.bec-avatar svg { width: 18px; height: 18px; }
.bec-status-dot {
  position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%;
  background: #3ddc84; border: 2px solid #0a0a0a;
}
.bec-title { flex: 1; min-width: 0; }
.bec-title strong { display: block; font-size: 14px; font-weight: 800; letter-spacing: .02em; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bec-title span { display: block; font-size: 11.5px; color: var(--bec-muted); }
.bec-hbtn {
  flex: none; display: grid; place-items: center; width: 30px; height: 30px; padding: 0;
  background: transparent; border: 1px solid transparent; border-radius: 8px; color: var(--bec-muted);
  transition: color .2s, background .2s, border-color .2s;
}
.bec-hbtn:hover { color: var(--bec-gold); background: rgba(255, 255, 255, .06); border-color: var(--bec-line); }
.bec-hbtn svg { width: 18px; height: 18px; }

/* ---------- Messages ---------- */
.bec-log {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  padding: 14px 12px 8px; display: flex; flex-direction: column; gap: 10px;
  background: radial-gradient(120% 60% at 50% 0%, #202020 0%, var(--bec-ink) 60%);
  scrollbar-width: thin; scrollbar-color: #3a3a3a transparent;
}
.bec-log::-webkit-scrollbar { width: 6px; }
.bec-log::-webkit-scrollbar-thumb { background: #3a3a3a; border-radius: 6px; }
.bec-row { display: flex; align-items: flex-end; gap: 8px; max-width: 100%; animation: bec-in .32s var(--bec-ease) both; }
.bec-row.bec-user { justify-content: flex-end; }
.bec-mini {
  flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: #000; border: 1px solid var(--bec-gold); color: var(--bec-gold);
}
.bec-mini svg { width: 14px; height: 14px; }
.bec-bubble {
  max-width: 84%; padding: 8px 12px; border-radius: 13px; overflow-wrap: anywhere; word-break: break-word;
}
.bec-bot .bec-bubble {
  background: var(--bec-panel); border: 1px solid var(--bec-line); border-bottom-left-radius: 4px; color: var(--bec-text);
}
.bec-user .bec-bubble {
  background: linear-gradient(135deg, #e2b43a, #b98a12); color: #141007; font-weight: 600;
  border-bottom-right-radius: 4px; white-space: pre-wrap;
}
.bec-bubble p { margin: 0; }
.bec-bubble p + p, .bec-bubble p + ul, .bec-bubble ul + p, .bec-bubble ul + .bec-links { margin-top: 8px; }
.bec-bubble ul { margin: 0; padding: 0; list-style: none; }
.bec-bubble li { position: relative; padding-left: 16px; margin: 3px 0; }
.bec-bubble li::before { content: ""; position: absolute; left: 2px; top: .62em; width: 6px; height: 6px; background: var(--bec-gold); transform: rotate(45deg); }
.bec-bubble li b { color: #fff; font-weight: 700; }
.bec-bubble a { color: var(--bec-gold); text-decoration: underline; text-underline-offset: 2px; }
.bec-bubble a:hover { color: #f0c75a; }
.bec-links { display: flex; flex-wrap: wrap; gap: 6px; }
.bec-link {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px;
  background: var(--bec-gold-soft); border: 1px solid rgba(212, 160, 23, .5); color: #f3d27a !important;
  text-decoration: none !important; font-weight: 700; font-size: 12.5px; cursor: pointer;
}
.bec-link:hover { background: rgba(212, 160, 23, .28); }

/* typing indicator */
.bec-typing .bec-bubble { display: flex; gap: 5px; padding: 13px 15px; }
.bec-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--bec-gold); opacity: .35; animation: bec-dot 1.1s infinite ease-in-out; }
.bec-typing i:nth-child(2) { animation-delay: .16s; }
.bec-typing i:nth-child(3) { animation-delay: .32s; }
@keyframes bec-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .35; } 30% { transform: translateY(-5px); opacity: 1; } }
@keyframes bec-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* chips */
.bec-chips { display: flex; flex-wrap: wrap; gap: 7px; padding-left: 34px; animation: bec-in .35s var(--bec-ease) both; }
.bec-chip {
  padding: 6px 11px; border-radius: 999px; background: transparent; color: #f3d27a;
  border: 1px solid rgba(212, 160, 23, .6); font-size: 12px; font-weight: 600; line-height: 1.2;
  transition: background .2s, color .2s, transform .2s;
}
.bec-chip:hover { background: var(--bec-gold); color: #111; transform: translateY(-1px); }
.bec-chip[disabled] { opacity: .45; pointer-events: none; }

/* ---------- Composer ---------- */
.bec-form {
  flex: none; display: flex; align-items: flex-end; gap: 8px; padding: 8px 10px 10px;
  background: #101010; border-top: 1px solid var(--bec-line);
}
.bec-input {
  flex: 1; min-width: 0; resize: none; max-height: 110px; min-height: 38px; padding: 8px 12px;
  background: #1c1c1c; border: 1px solid #333; border-radius: 11px; font-size: 13px; line-height: 1.4;
  color: var(--bec-text); overflow-y: auto; transition: border-color .2s, box-shadow .2s;
}
.bec-input::placeholder { color: #8d887c; }
.bec-input:focus { outline: none; border-color: var(--bec-gold); box-shadow: 0 0 0 3px var(--bec-gold-soft); }
.bec-send {
  flex: none; width: 38px; height: 38px; display: grid; place-items: center; padding: 0;
  border-radius: 12px; border: 0; background: var(--bec-gold); color: #111;
  transition: transform .2s, opacity .2s, background .2s;
}
.bec-send:hover:not(:disabled) { transform: translateY(-1px); background: #e5b52c; }
.bec-send:disabled { opacity: .35; cursor: not-allowed; }
.bec-send svg { width: 17px; height: 17px; }
.bec-foot { flex: none; text-align: center; font-size: 11px; color: #8d887c; padding: 0 12px 9px; background: #101010; }

.bec-sr { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Mobile ---------- */
@media (max-width: 520px) {
  .bec-root { right: 12px; bottom: 12px; }
  .bec-launcher { width: 52px; height: 52px; }
  .bec-window {
    right: 0; bottom: 64px; width: min(320px, calc(100vw - 24px));
    height: min(460px, calc(100vh - 100px)); height: min(460px, calc(100dvh - 100px)); border-radius: 14px;
  }
  .bec-bubble { max-width: 86%; }
  .bec-input { font-size: 16px; } /* prevents iOS zoom on focus */
}
@media (max-width: 400px) {
  .bec-header { gap: 9px; padding: 12px 8px 12px 12px; }
  .bec-title strong { font-size: 14px; letter-spacing: 0; }
  .bec-avatar { width: 36px; height: 36px; }
  .bec-hbtn { width: 32px; }
}
@media (max-height: 520px) {
  .bec-window { height: calc(100vh - 84px); height: calc(100dvh - 84px); }
}
@media (prefers-reduced-motion: reduce) {
  .bec-root *, .bec-root *::before, .bec-root *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media (max-width: 340px) {
  .bec-title strong { font-size: 13px; }
  .bec-title span { font-size: 11px; }
}
