/* =========================
   BRIVOX CHAT — GLASS WIDGET (Upgraded)
========================= */

:root{
  --bx-bg: var(--bg, #1e1e1e);
  --bx-text: var(--text, #f3f5f7);
  --bx-muted: var(--muted, #9aa4af);
  --bx-gold: var(--gold, #c9a227);
  --bx-line: var(--line, rgba(255,255,255,.10));
  --bx-soft: var(--soft, rgba(255,255,255,.06));
  --bx-soft2: var(--soft2, rgba(255,255,255,.03));
  --bx-r: 18px;
  --bx-r2: 26px;
  --bx-shadow: 0 18px 60px rgba(0,0,0,.55);

  /* new */
  --bx-ai: rgba(0,0,0,.26);
  --bx-user: rgba(201,162,39,.14);
  --bx-ai-b: rgba(255,255,255,.10);
  --bx-user-b: rgba(201,162,39,.26);
}

/* Floating launcher */
.bxChatLauncher{
  position:fixed;
  right:18px;
  bottom:18px;
  z-index:9998;
  width:58px;height:58px;
  border-radius:18px;
  border:1px solid rgba(255,255,255,.12);
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.03));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--bx-shadow);
  display:grid;
  place-items:center;
  cursor:pointer;
  transition: transform .22s ease, border-color .22s ease;
}
.bxChatLauncher:hover{ transform: translateY(-2px); border-color: rgba(201,162,39,.35); }
.bxChatLauncher svg{ width:22px;height:22px; color: rgba(243,245,247,.95); }

/* Nudge bubble */
.bxChatNudge{
  position:fixed;
  right:18px;
  bottom:86px;
  z-index:9998;
  max-width: 340px;
  padding:12px 12px;
  border-radius: 18px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--bx-shadow);
  color: rgba(243,245,247,.92);
  font-size: 13px;
  line-height:1.45;
  transform: translateY(10px);
  opacity:0;
  pointer-events:none;
  transition: transform .45s cubic-bezier(.2,.8,.2,1), opacity .45s ease;
}
.bxChatNudge.show{ transform: translateY(0); opacity:1; }
.bxChatNudge b{ color: var(--bx-gold); font-weight:650; }

/* Overlay */
.bxChatOverlay{
  position:fixed; inset:0;
  z-index:9999;
  display:none;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.bxChatOverlay.show{ display:block; }

/* Panel */
.bxChatPanel{
  position:absolute;
  right:18px;
  bottom:18px;
  width:min(440px, calc(100% - 36px));
  height:min(740px, calc(100% - 36px));
  border-radius: var(--bx-r2);
  border:1px solid rgba(255,255,255,.12);
  background:
    radial-gradient(1200px 500px at 20% 0%, rgba(201,162,39,.10), transparent 55%),
    linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.03));
  box-shadow: var(--bx-shadow);
  overflow:hidden;
  transform: translateY(14px) scale(.98);
  opacity:0;
  transition: transform .35s cubic-bezier(.2,.8,.2,1), opacity .35s ease;
}
.bxChatOverlay.show .bxChatPanel{
  transform: translateY(0) scale(1);
  opacity:1;
}

/* Mobile: full screen */
@media (max-width: 900px){
  .bxChatPanel{
    right:0; bottom:0;
    width:100%;
    height:100%;
    border-radius: 0;
  }
  .bxChatLauncher{ right:14px; bottom:14px; }
  .bxChatNudge{ right:14px; bottom:82px; max-width: 86vw; }
}

/* Header */
.bxChatHead{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:14px 14px;
  border-bottom:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.22);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.bxAgent{
  display:flex; align-items:center; gap:10px;
  min-width:0;
}

.bxAgent img.bxAvatar{
  width:36px;height:36px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.20);
  object-fit:cover;
}

.bxAgentTxt{ min-width:0; display:flex; flex-direction:column; gap:2px; }

.bxNameRow{
  display:flex; align-items:center; gap:8px;
  min-width:0;
}
.bxBrandIcon{
  width:16px;height:16px;
  border-radius:5px;
  object-fit:contain;
  opacity:.95;
}
.bxAgentTxt b{
  font-size:13px;
  letter-spacing:.06em;
  text-transform:uppercase;
  color: rgba(243,245,247,.95);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.bxAgentTxt span{
  font-size:12px;
  color: rgba(154,164,175,.92);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}

.bxHeadBtns{ display:flex; gap:8px; }
.bxIconBtn{
  width:40px;height:40px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.18);
  display:grid; place-items:center;
  cursor:pointer;
  transition: transform .18s ease, border-color .18s ease;
}
.bxIconBtn:hover{ transform: translateY(-1px); border-color: rgba(201,162,39,.28); }
.bxIconBtn svg{ width:18px;height:18px; color: rgba(243,245,247,.92); }

/* Body */
.bxChatBody{
  display:flex;
  flex-direction:column;
  height: calc(100% - 68px);
}
.bxMsgs{
  flex:1 1 auto;
  overflow:auto;
  padding:16px 14px 10px;
  scroll-behavior:smooth;
}

/* Message rows (with avatars + better rhythm) */
.bxRow{ display:flex; align-items:flex-end; gap:10px; margin:12px 0; }
.bxRow.ai{ justify-content:flex-start; }
.bxRow.user{ justify-content:flex-end; }

.bxMiniAvatar{
  width:26px;height:26px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.20);
  object-fit:cover;
  flex:0 0 auto;
  opacity:.95;
}
.bxRow.user .bxMiniAvatar{ display:none; }

.bxBubble{
  max-width: 84%;
  border-radius: 18px;
  padding:12px 12px;
  border:1px solid var(--bx-ai-b);
  background: var(--bx-ai);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: rgba(243,245,247,.92);
  font-size: 13.5px;
  line-height:1.55;
  box-shadow: 0 10px 26px rgba(0,0,0,.30);
  white-space:pre-wrap;
  position:relative;
}

/* bubble tails */
.bxRow.ai .bxBubble:after{
  content:"";
  position:absolute;
  left:-6px; bottom:10px;
  width:12px;height:12px;
  background: var(--bx-ai);
  border-left:1px solid var(--bx-ai-b);
  border-bottom:1px solid var(--bx-ai-b);
  transform: rotate(45deg);
  border-radius:3px;
  filter: blur(.0px);
}
.bxRow.user .bxBubble:after{
  content:"";
  position:absolute;
  right:-6px; bottom:10px;
  width:12px;height:12px;
  background: var(--bx-user);
  border-right:1px solid var(--bx-user-b);
  border-bottom:1px solid var(--bx-user-b);
  transform: rotate(-45deg);
  border-radius:3px;
}

.bxRow.user .bxBubble{
  background: var(--bx-user);
  border-color: var(--bx-user-b);
  color: rgba(243,245,247,.96);
}

.bxMeta{
  margin-top:8px;
  font-size:11px;
  letter-spacing:.06em;
  text-transform:uppercase;
  color: rgba(154,164,175,.80);
}

/* Composer */
.bxComposer{
  padding:12px 12px 14px;
  border-top:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.22);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.bxActionsTop{
  display:flex;
  justify-content:space-between;
  gap:10px;
  margin-bottom:10px;
}
.bxHumanBtn{
  display:inline-flex; align-items:center; gap:10px;
  border-radius: 16px;
  padding:10px 12px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.18);
  color: rgba(243,245,247,.92);
  cursor:pointer;
  transition: transform .18s ease, border-color .18s ease;
  font-size:12px;
  letter-spacing:.06em;
  text-transform:uppercase;
}
.bxHumanBtn:hover{ transform: translateY(-1px); border-color: rgba(201,162,39,.28); }

.bxLinks{ display:flex; gap:10px; flex-wrap:wrap; }
.bxLink{
  font-size:12px;
  color: rgba(154,164,175,.92);
  border-bottom:1px solid transparent;
}
.bxLink:hover{ color: rgba(243,245,247,.95); border-bottom-color: rgba(201,162,39,.45); }

.bxInputRow{
  display:flex; gap:10px; align-items:flex-end;
}
.bxInput{
  flex:1 1 auto;
  min-height:46px;
  max-height:140px;
  resize:none;
  padding:12px 12px;
  border-radius: 16px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.18);
  color: rgba(243,245,247,.95);
  outline:none;
}
.bxInput::placeholder{ color: rgba(154,164,175,.70); }

.bxSend{
  width:46px;height:46px;
  border-radius: 16px;
  border:1px solid rgba(201,162,39,.28);
  background: rgba(201,162,39,.14);
  display:grid; place-items:center;
  cursor:pointer;
  transition: transform .18s ease;
}
.bxSend:hover{ transform: translateY(-1px); }
.bxSend svg{ width:18px;height:18px; color: rgba(243,245,247,.95); }

.bxTyping{ display:inline-flex; gap:6px; align-items:center; }
.bxDot{
  width:6px;height:6px;border-radius:999px;
  background: rgba(243,245,247,.75);
  opacity:.6;
  animation: bxPulse 1.1s infinite ease-in-out;
}
.bxDot:nth-child(2){ animation-delay:.15s; }
.bxDot:nth-child(3){ animation-delay:.30s; }
@keyframes bxPulse{
  0%,100%{ transform: translateY(0); opacity:.35; }
  50%{ transform: translateY(-3px); opacity:.90; }
}


/* =========================
   BRIVOX Chat Enhancements (Pro + Active)
========================= */

/* online dot */
.bxOnlineDot{
  display:inline-block;
  width:8px;height:8px;
  border-radius:999px;
  background:#22c55e;
  margin-right:8px;
  transform: translateY(-1px);
}

/* small note text */
.bxNote{
  font-size:12px;
  line-height:1.45;
  color: rgba(154,164,175,.92);
}

/* quick replies row */
.bxQuick{
  padding: 10px 12px 0;
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.bxQuick.is-hidden{display:none;}

.bxChip{
  border-radius:999px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.14);
  color: rgba(243,245,247,.95);
  padding:8px 10px;
  font-size:12px;
  cursor:pointer;
  user-select:none;
  transition: border-color .18s ease, transform .18s ease;
}
.bxChip:hover{border-color:rgba(201,162,39,.35); transform: translateY(-1px);}

/* ===== Prevent iOS zoom on focus (IMPORTANT) =====
   iOS zoom happens when input font-size < 16px
*/
.bxChatPanel .bxInput{
  font-size:16px !important;
  line-height:1.3;
}

/* soften focus without layout jump */
.bxChatPanel .bxInput:focus{
  outline:none;
  border-color: rgba(201,162,39,.35);
}

/* optional: keep the overlay stable */
.bxChatOverlay{
  -webkit-text-size-adjust: 100%;
}

.bxChatNudge{
  position:fixed;
  right:16px;
  bottom:92px;
  z-index:999999;
  max-width:320px;

  opacity:0;
  transform: translateY(8px);
  pointer-events:none;

  border-radius:16px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(10px);

  padding:10px 12px;
  color: rgba(243,245,247,.96);
  font-size:13px;
  line-height:1.35;

  box-shadow: 0 18px 60px rgba(0,0,0,.45);
}

.bxChatNudge b{
  letter-spacing:.04em;
}

.bxChatNudge.show{
  opacity:1;
  transform: translateY(0);
  pointer-events:auto;
  cursor:pointer;
}

/* subtle “tap me” pulse */
.bxChatNudge.show{
  animation: bxNudgePulse 1.4s ease-in-out infinite;
}
@keyframes bxNudgePulse{
  0%,100%{ transform: translateY(0); }
  50%{ transform: translateY(-2px); }
}