/* ======================================================
   BBS LIVE CHAT — PUBLIC WIDGET
====================================================== */

.bbs-live-chat-widget{
  position:fixed;
  bottom:22px;
  z-index:999999;
  font-family:inherit;
  color:var(--bbs-text-main, #111827);
}

.bbs-live-chat-widget--right{right:22px;}
.bbs-live-chat-widget--left{left:22px;}

.bbs-live-chat-widget__launcher{
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
  width:54px;
  height:54px;
  padding:0 !important;
  border:0 !important;
  border-radius:50% !important;
  background:var(--bbs-primary) !important;
  color:var(--bbs-text-inverse, #fff) !important;
  box-shadow:0 12px 30px rgba(0,0,0,.22) !important;
  outline:none !important;
  cursor:pointer;
  transition:transform .18s ease, background .18s ease, box-shadow .18s ease;
}

.bbs-live-chat-widget__launcher::before{
  content:"";
  position:absolute;
  inset:0;
  z-index:-1;
  border-radius:50%;
  background:var(--bbs-primary);
  opacity:.28;
  transform:scale(1);
  animation:bbsLiveChatLauncherRipple 2.2s ease-out infinite;
  pointer-events:none;
}

@keyframes bbsLiveChatLauncherRipple{
  0%{
    opacity:.36;
    transform:scale(1);
  }

  70%{
    opacity:.08;
    transform:scale(1.30);
  }

  100%{
    opacity:0;
    transform:scale(1.30);
  }
}

.bbs-live-chat-widget__launcher:hover,
.bbs-live-chat-widget__launcher:focus,
.bbs-live-chat-widget__launcher:focus-visible,
.bbs-live-chat-widget__launcher:active,
.bbs-live-chat-widget.is-open .bbs-live-chat-widget__launcher{
  border:0 !important;
  background:var(--bbs-primary-hover) !important;
  color:var(--bbs-text-inverse, #fff) !important;
  box-shadow:0 16px 34px rgba(0,0,0,.26) !important;
}

.bbs-live-chat-widget__launcher:hover{
  transform:translateY(-2px);
}

.bbs-live-chat-widget.is-open .bbs-live-chat-widget__launcher{
  transform:none;
}

.bbs-live-chat-widget__launcher svg{
  width:28px;
  height:28px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.8;
  stroke-linecap:round;
  stroke-linejoin:round;
}

.bbs-live-chat-widget__launcher svg circle{
  fill:currentColor;
  stroke:none;
}

.bbs-live-chat-widget__launcher-dot{
  position:absolute;
  top:2px;
  right:3px;
  width:13px;
  height:13px;
  border:3px solid var(--bbs-surface, #fff);
  border-radius:50%;
  background:#16a34a;
}

.bbs-live-chat-widget[data-status="offline"] .bbs-live-chat-widget__launcher-dot{
  background:#9ca3af;
}

.bbs-live-chat-widget__panel{
  position:absolute;
  bottom:76px;
  display:flex;
  flex-direction:column;
  width:min(390px, calc(100vw - 32px));
  height:min(590px, calc(100vh - 120px));
  overflow:hidden;
  border:1px solid var(--bbs-surface-border, #e5e7eb);
  border-radius:25px;
  background:var(--bbs-surface, #fff);
  box-shadow:0 22px 60px rgba(15,23,42,.22);
  opacity:0;
  visibility:hidden;
  pointer-events:none;
  transform:translateY(14px) scale(.98);
  transform-origin:bottom;
  transition:opacity .18s ease, transform .18s ease, visibility .18s ease;
}

.bbs-live-chat-widget--right .bbs-live-chat-widget__panel{right:0;}
.bbs-live-chat-widget--left .bbs-live-chat-widget__panel{left:0;}

.bbs-live-chat-widget.is-open .bbs-live-chat-widget__panel{
  opacity:1;
  visibility:visible;
  pointer-events:auto;
  transform:translateY(0) scale(1);
}

.bbs-live-chat-widget__header{
  display:flex;
  align-items:center;
  gap:11px;
  flex:0 0 auto;
  min-height:78px;
  padding:14px 15px 14px 17px;
  border-bottom:1px solid var(--bbs-surface-border, #e5e7eb);
  background:var(--bbs-surface, #fff);
}

.bbs-live-chat-widget__brand-icon{
  display:flex;
  align-items:center;
  justify-content:center;
  flex:0 0 42px;
  width:42px;
  height:42px;
  border-radius:14px;
  background:color-mix(in srgb, var(--bbs-primary) 10%, var(--bbs-surface));
  color:var(--bbs-primary);
}

.bbs-live-chat-widget__brand-icon svg{
  width:22px;
  height:22px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.8;
  stroke-linecap:round;
  stroke-linejoin:round;
}

.bbs-live-chat-widget__heading{
  min-width:0;
  flex:1 1 auto;
}

.bbs-live-chat-widget__title{
  display:block;
  overflow:hidden;
  color:var(--bbs-text-main);
  font-size:15px;
  font-weight:800;
  line-height:1.25;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.bbs-live-chat-widget__status{
  display:flex;
  align-items:center;
  gap:6px;
  margin-top:4px;
  color:var(--bbs-text-muted);
  font-size:11px;
  font-weight:600;
}

.bbs-live-chat-widget__status-dot{
  width:8px;
  height:8px;
  border-radius:50%;
  background:#16a34a;
}

.bbs-live-chat-widget[data-status="offline"] .bbs-live-chat-widget__status-dot{
  background:#9ca3af;
}

.bbs-live-chat-widget__minimize{
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
  flex:0 0 38px;
  width:38px;
  height:38px;
  padding:0;
  border:0;
  border-radius:50%;
  background:var(--bbs-surface-soft, #f9f9f9);
  color:var(--bbs-text-main);
  cursor:pointer;
}

.bbs-live-chat-widget__minimize:hover{
  background:color-mix(in srgb, var(--bbs-primary) 9%, var(--bbs-surface));
}

.bbs-live-chat-widget__minimize span{
  width:15px;
  height:2px;
  border-radius:99px;
  background:currentColor;
}

.bbs-live-chat-widget__body{
  flex:1 1 auto;
  min-height:0;
  overflow-y:auto;
  padding:22px 18px;
  background:var(--bbs-surface-soft, #f9f9f9);
  scrollbar-color:var(--bbs-scrollbar, #dee2e6) transparent;
  scrollbar-width:thin;
}

.bbs-live-chat-widget__welcome{
  display:flex;
  justify-content:flex-start;
  margin-bottom:18px;
}

.bbs-live-chat-widget__message{
  max-width:84%;
  padding:13px 15px;
  border:1px solid var(--bbs-surface-border, #e5e7eb);
  border-radius:8px 17px 17px 17px;
  background:var(--bbs-surface, #fff);
  color:var(--bbs-text-main);
  font-size:14px;
  line-height:1.5;
  box-shadow:0 4px 14px rgba(15,23,42,.05);
}

.bbs-live-chat-widget__message--authenticated{
  display:grid;
  gap:3px;
}

.bbs-live-chat-widget__message--authenticated strong{
  color:var(--bbs-text-main);
  font-size:14px;
  font-weight:800;
  line-height:1.35;
}

.bbs-live-chat-widget__message--authenticated span{
  color:var(--bbs-text-muted);
  font-size:12px;
  line-height:1.45;
}

.bbs-live-chat-widget__form{
  display:grid;
  gap:11px;
}

.bbs-live-chat-widget__field{
  display:grid;
  gap:5px;
}

.bbs-live-chat-widget__field label{
  color:var(--bbs-text-label, #374151);
  font-size:11px;
  font-weight:700;
}

.bbs-live-chat-widget__field label span{
  margin-left:3px;
  color:var(--bbs-text-muted);
  font-size:10px;
  font-weight:500;
}

.bbs-live-chat-widget__field input,
.bbs-live-chat-widget__field textarea{
  width:100%;
  box-sizing:border-box;
  border:1px solid var(--bbs-surface-border, #e5e7eb);
  border-radius:11px;
  background:var(--bbs-surface, #fff);
  color:var(--bbs-text-main);
  font:inherit;
  font-size:13px;
  outline:none;
  box-shadow:none;
}

.bbs-live-chat-widget__field input{
  height:42px;
  padding:0 12px;
}

.bbs-live-chat-widget__field textarea{
  min-height:82px;
  padding:10px 12px;
  resize:vertical;
}

.bbs-live-chat-widget__field input:focus,
.bbs-live-chat-widget__field textarea:focus{
  border-color:var(--bbs-primary);
  box-shadow:0 0 0 3px color-mix(in srgb, var(--bbs-primary) 13%, transparent);
}

.bbs-live-chat-widget__error{
  min-height:0;
  color:var(--bbs-error, #ef4444);
  font-size:11px;
  font-weight:600;
  line-height:1.4;
}

.bbs-live-chat-widget__error:empty{
  display:none;
}

.bbs-live-chat-widget__submit{
  display:flex;
  align-items:center;
  justify-content:center;
  width:100%;
  min-height:44px;
  padding:10px 16px;
  border:0;
  border-radius:12px;
  background:var(--bbs-primary);
  color:var(--bbs-text-inverse, #fff);
  font-size:13px;
  font-weight:800;
  cursor:pointer;
  transition:background .18s ease, transform .18s ease;
}

.bbs-live-chat-widget__submit:hover{
  background:var(--bbs-primary-hover);
}

.bbs-live-chat-widget__submit:disabled{
  opacity:.65;
  cursor:wait;
}

.bbs-live-chat-widget__result{
  padding:36px 18px;
  text-align:center;
}

.bbs-live-chat-widget__result-icon{
  display:flex;
  align-items:center;
  justify-content:center;
  width:48px;
  height:48px;
  margin:0 auto 14px;
  border-radius:50%;
  background:color-mix(in srgb, var(--bbs-primary) 12%, var(--bbs-surface));
  color:var(--bbs-primary);
  font-size:22px;
  font-weight:900;
}

.bbs-live-chat-widget__result-title{
  display:block;
  margin-bottom:7px;
  color:var(--bbs-text-main);
  font-size:17px;
  font-weight:800;
}

.bbs-live-chat-widget__result-message{
  margin:0;
  color:var(--bbs-text-muted);
  font-size:13px;
  line-height:1.55;
}

.bbs-live-chat-widget__result-reference{
  display:block;
  margin-top:12px;
  color:var(--bbs-text-main);
  font-size:11px;
  font-weight:700;
}

.bbs-live-chat-widget__footer{
  display:flex;
  align-items:center;
  justify-content:center;
  flex:0 0 40px;
  min-height:40px;
  padding:5px 12px;
  border-top:1px solid var(--bbs-surface-border, #e5e7eb);
  background:var(--bbs-surface, #fff);
  text-align:center;
}

.bbs-live-chat-widget__powered-by{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  margin:0 auto;
  color:var(--bbs-text-muted);
  font-size:9px;
  line-height:1;
  text-decoration:none !important;
}

.bbs-live-chat-widget__powered-by:hover,
.bbs-live-chat-widget__powered-by:focus{
  color:var(--bbs-text-muted);
  text-decoration:none !important;
}

.bbs-live-chat-widget__powered-by img{
  display:block;
  width:auto;
  max-width:118px;
  height:auto;
  max-height:23px;
  object-fit:contain;
}

.bbs-live-chat-widget.is-open .bbs-live-chat-widget__launcher::before{
  animation:none;
  opacity:0;
}

@media (max-width:575px){

  .bbs-live-chat-widget{
    right:12px !important;
    left:auto !important;
    bottom:12px;
  }
  
  body:has(#bbsBookModal.show) .bbs-live-chat-widget{
    bottom:446px !important;
  }


  .bbs-live-chat-widget__panel{
    position:fixed;
    top:8px;
    right:8px !important;
    bottom:8px;
    left:8px !important;
    width:auto;
    height:auto;
    max-width:none;
    border-radius:22px;
  }

  .bbs-live-chat-widget.is-open .bbs-live-chat-widget__launcher{
    visibility:hidden;
    opacity:0;
    pointer-events:none;
  }

  .bbs-live-chat-widget__header{
    min-height:72px;
  }

  .bbs-live-chat-widget__body{
    padding:20px 15px;
  }
  
  .bbs-live-chat-widget__launcher{
      width:45px;
      height:45px;
    }
    
    .bbs-live-chat-widget__launcher svg{
      width:20px;
      height:20px;
    }
    
    .bbs-live-chat-widget__launcher-dot{
      top:1px;
      right:1px;
      width:10px;
      height:10px;
      border-width:2px;
    }
  
}

/* ======================================================
   LIVE CHAT — ACTIVE CONVERSATION
====================================================== */

.bbs-live-chat-widget__conversation{
  display:flex;
  flex:1 1 auto;
  flex-direction:column;
  min-height:0;
  overflow:hidden;
}

.bbs-live-chat-widget__conversation[hidden]{
  display:none;
}

.bbs-live-chat-widget__connected{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  flex:0 0 auto;
  margin:0 0 10px;
  color:var(--bbs-text-muted);
  font-size:10px;
}

.bbs-live-chat-widget__connected strong{
  color:var(--bbs-text-main);
  font-weight:800;
}

.bbs-live-chat-widget__connected-dot{
  width:7px;
  height:7px;
  border-radius:50%;
  background:#16a34a;
}

.bbs-live-chat-widget__messages{
  display:flex;
  flex:1 1 auto;
  flex-direction:column;
  gap:10px;
  min-height:0;
  overflow-y:auto;
  padding:4px 2px 12px;
}

.bbs-live-chat-widget__chat-row{
  display:flex;
  width:100%;
}

.bbs-live-chat-widget__chat-row.is-agent{
  justify-content:flex-start;
}

.bbs-live-chat-widget__chat-row.is-visitor{
  justify-content:flex-end;
}

.bbs-live-chat-widget__chat-bubble{
  max-width:82%;
  padding:11px 13px;
  border-radius:16px;
  font-size:13px;
  line-height:1.45;
  overflow-wrap:anywhere;
}

.bbs-live-chat-widget__chat-row.is-agent .bbs-live-chat-widget__chat-bubble{
  border:1px solid var(--bbs-surface-border);
  border-bottom-left-radius:6px;
  background:var(--bbs-surface);
  color:var(--bbs-text-main);
}

.bbs-live-chat-widget__chat-row.is-visitor .bbs-live-chat-widget__chat-bubble{
  border-bottom-right-radius:6px;
  background:var(--bbs-primary);
  color:var(--bbs-text-inverse, #fff);
}

.bbs-live-chat-widget__chat-bubble strong{
  display:block;
  margin-bottom:4px;
  font-size:10px;
  font-weight:800;
}

.bbs-live-chat-widget__chat-bubble > span{
  display:block;
  margin-top:5px;
  font-size:9px;
  opacity:.65;
  text-align:right;
}

.bbs-live-chat-widget__composer{
  display:grid;
  grid-template-columns:minmax(0,1fr) 42px;
  gap:8px;
  flex:0 0 auto;
  padding-top:10px;
  border-top:1px solid var(--bbs-surface-border);
  background:var(--bbs-panel-bg, #fff);
}

.bbs-live-chat-widget__composer textarea{
  width:100%;
  min-height:42px;
  max-height:100px;
  box-sizing:border-box;
  padding:10px 12px;
  border:1px solid var(--bbs-surface-border);
  border-radius:12px;
  background:var(--bbs-surface);
  color:var(--bbs-text-main);
  font:inherit;
  font-size:13px;
  resize:none;
  outline:none;
}

.bbs-live-chat-widget__composer textarea:focus{
  border-color:var(--bbs-primary);
}

.bbs-live-chat-widget__composer button{
  display:flex;
  align-items:center;
  justify-content:center;
  width:42px;
  height:42px;
  padding:0;
  border:0;
  border-radius:12px;
  background:var(--bbs-primary);
  color:var(--bbs-text-inverse, #fff);
  cursor:pointer;
  font-size:17px;
}

.bbs-live-chat-widget__composer button:hover{
  background:var(--bbs-primary-hover);
}

.bbs-live-chat-widget__composer button:disabled{
  opacity:.55;
  cursor:wait;
}

.bbs-live-chat-widget__new-conversation{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:42px;
  margin-top:14px;
  padding:9px 16px;
  border:1px solid var(--bbs-primary) !important;
  border-radius:12px !important;
  background:var(--bbs-primary) !important;
  color:var(--bbs-text-inverse, #fff) !important;
  font-size:12px;
  font-weight:700;
  line-height:1.2;
  text-decoration:none !important;
  box-shadow:none !important;
  cursor:pointer;
}

.bbs-live-chat-widget__new-conversation:hover,
.bbs-live-chat-widget__new-conversation:focus{
  border-color:var(--bbs-primary-hover) !important;
  background:var(--bbs-primary-hover) !important;
  color:var(--bbs-text-inverse, #fff) !important;
  outline:none;
}

.bbs-live-chat-widget__new-conversation[hidden]{
  display:none !important;
}

.bbs-live-chat-widget__ended{
  flex:0 0 auto;
  margin:0 12px 12px;
  padding:14px;
  border:1px solid var(--bbs-surface-border);
  border-radius:14px;
  background:var(--bbs-surface);
  text-align:center;
}

.bbs-live-chat-widget__ended[hidden]{
  display:none !important;
}

.bbs-live-chat-widget__ended-icon{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:32px;
  height:32px;
  margin-bottom:8px;
  border-radius:50%;
  background:var(--bbs-primary-bg-soft);
  color:var(--bbs-primary);
  font-size:17px;
  font-weight:800;
}

.bbs-live-chat-widget__ended strong{
  display:block;
  margin-bottom:5px;
  color:var(--bbs-text-main);
  font-size:13px;
  font-weight:800;
}

.bbs-live-chat-widget__ended p{
  margin:0;
  color:var(--bbs-text-muted);
  font-size:11px;
  line-height:1.5;
}

/* ======================================================
   LIVE CHAT — TYPING INDICATOR
====================================================== */

.bbs-live-chat-widget__typing{
  display:flex;
  align-items:center;
  gap:7px;
  flex:0 0 auto;
  margin:0 12px 8px;
  color:var(--bbs-text-muted);
  font-size:13px;
  line-height:1.3;
}

.bbs-live-chat-widget__typing[hidden]{
  display:none !important;
}

.bbs-live-chat-widget__typing-dots{
  display:inline-flex;
  align-items:center;
  gap:3px;
}

.bbs-live-chat-widget__typing-dots i{
  width:4px;
  height:4px;
  border-radius:50%;
  background:currentColor;
  animation:bbsLiveChatTypingDot 1s ease-in-out infinite;
}

.bbs-live-chat-widget__typing-dots i:nth-child(2){
  animation-delay:.15s;
}

.bbs-live-chat-widget__typing-dots i:nth-child(3){
  animation-delay:.3s;
}

@keyframes bbsLiveChatTypingDot{
  0%,
  60%,
  100%{
    opacity:.35;
    transform:translateY(0);
  }

  30%{
    opacity:1;
    transform:translateY(-2px);
  }
}

/* ======================================================
   LIVE CHAT — WAITING / RINGING
====================================================== */

.bbs-live-chat-widget__waiting-meta{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:9px;
  margin-top:15px;
}

.bbs-live-chat-widget__waiting-meta[hidden]{
  display:none !important;
}

.bbs-live-chat-widget__ringing{
  display:inline-flex;
  align-items:center;
  gap:6px;
  color:var(--bbs-text-muted);
  font-size:12px;
}

.bbs-live-chat-widget__ringing strong{
  color:var(--bbs-text-main);
  font-weight:800;
}

.bbs-live-chat-widget__ringing-dot{
  width:8px;
  height:8px;
  border-radius:50%;
  background:var(--bbs-primary);
  animation:bbsLiveChatRinging 1.15s ease-in-out infinite;
}

.bbs-live-chat-widget__queue-position{
  padding:5px 10px;
  border-radius:999px;
  background:color-mix(in srgb, var(--bbs-primary) 9%, var(--bbs-surface));
  color:var(--bbs-primary);
  font-size:11px;
  font-weight:800;
}

@keyframes bbsLiveChatRinging{
  0%,
  100%{
    opacity:.4;
    transform:scale(.85);
  }

  50%{
    opacity:1;
    transform:scale(1.15);
  }
}

/* ======================================================
   LIVE CHAT — ANCHORED TYPING + COMPOSER
====================================================== */

.bbs-live-chat-widget__typing{
  flex:0 0 auto;
  margin:0;
  padding:6px 12px 5px;
  background:var(--bbs-surface, #fff);
}

.bbs-live-chat-widget__typing[hidden]{
  display:none !important;
}

.bbs-live-chat-widget__composer{
  flex:0 0 auto;
  margin:0;
  padding:8px 12px 6px;
  border-top:1px solid var(--bbs-surface-border);
  background:var(--bbs-surface, #fff);
}

/* Active Live Chat: keep composer visible and scroll messages only */
.bbs-live-chat-widget__body:has(
  .bbs-live-chat-widget__conversation:not([hidden])
){
  display:flex;
  flex-direction:column;
  min-height:0;
  overflow:hidden;
  padding-bottom:6px;
}

/* Hide the welcome bubble during an active Live Chat */
.bbs-live-chat-widget__body:has(
  .bbs-live-chat-widget__conversation:not([hidden])
) .bbs-live-chat-widget__welcome{
  display:none;
}