#sb-glass-chat{position:fixed;right:18px;bottom:18px;z-index:999999;font-family:Inter,system-ui,sans-serif}
#sb-glass-open{
  width:58px;height:58px;border-radius:50%;
  background:#ffb700;border:none;cursor:pointer;
  box-shadow:0 12px 30px rgba(0,0,0,.28);
  display:flex;align-items:center;justify-content:center;
  color:#fff;
  font-size:24px;
  animation:sb-gc-pulse 2.5s infinite;
  position:relative;
}

@keyframes sb-gc-pulse{0%{box-shadow:0 0 0 0 rgba(255,183,0,.6)}70%{box-shadow:0 0 0 18px rgba(255,183,0,0)}100%{box-shadow:0 0 0 0 rgba(255,183,0,0)}}

/* Cand sunt mesaje noi iar fereastra e inchisa: iconita devine rosie (fara cerculet cu cifra) */
#sb-glass-open.sb-gc-alert{
  background:#d40000;
  color:#fff;
  animation:sb-gc-pulse-red 2.2s infinite;
}

@keyframes sb-gc-pulse-red{0%{box-shadow:0 0 0 0 rgba(212,0,0,.45)}70%{box-shadow:0 0 0 18px rgba(212,0,0,0)}100%{box-shadow:0 0 0 0 rgba(212,0,0,0)}}
#sb-glass-window{
  /* always in DOM (no display toggle) so we can animate */
  display:block;
  width:320px;
  background:rgba(255,255,255,.75);
  backdrop-filter:blur(14px);
  border-radius:22px;
  box-shadow:0 30px 60px rgba(0,0,0,.35);
  position:absolute;
  right:0;
  bottom:74px;
  overflow:hidden;

  /* closed state */
  opacity:0;
  transform:translateY(14px) scale(.985);
  filter:blur(8px);
  pointer-events:none;
  visibility:hidden;
  transition:opacity .2s ease, transform .2s ease, filter .2s ease;
}

/* open state */
#sb-glass-chat.sb-open #sb-glass-window{
  opacity:1;
  transform:translateY(0) scale(1);
  filter:blur(0);
  pointer-events:auto;
  visibility:visible;
}

@media (prefers-reduced-motion: reduce){
  #sb-glass-window{transition:none;filter:none;transform:none}
}

#sb-glass-head{
  background:#ffb700;
  padding:12px 12px;
  display:flex;
  align-items:center;
  gap:10px;
}

/* desktop: allow dragging the window by grabbing the header */
@media (pointer:fine){
  #sb-glass-head{cursor:grab}
  #sb-glass-chat.sb-gc-dragging #sb-glass-head{cursor:grabbing}
  #sb-glass-chat.sb-gc-drag-off #sb-glass-head{cursor:default}
}

/* when user moved the chat window: make it fixed (independent of the bubble) */
#sb-glass-chat.sb-win-custom #sb-glass-window{
  position:fixed;
  right:auto;
  bottom:auto;
}

#sb-glass-avatar{
  width:42px;
  height:42px;
  border-radius:50%;
  background:var(--sb-gc-avatar-bg, #111);
  color:#ffb700;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:800;
  font-size:18px;
  overflow:hidden;
  flex:0 0 auto;
  box-shadow:0 10px 22px rgba(0,0,0,.22);
}

#sb-glass-avatar img{
  width:100%;
  height:100%;
  display:block;
  object-fit:cover;
  object-position: 50% calc(var(--sb-gc-avatar-pos-y, 50) * 1%);
  transform:scale(var(--sb-gc-avatar-zoom, 1));
  transform-origin:center;
}

.sb-glass-head-meta{line-height:1.05;min-width:0}
.sb-glass-operator{font-size:15px;font-weight:800;color:#fff}

.sb-glass-status{font-size:12px;display:inline-flex;align-items:center;gap:6px;color:rgba(255,255,255,.9)}
.sb-glass-dot{width:7px;height:7px;border-radius:99px;background:rgba(255,255,255,.55)}
.sb-glass-status.sb-online .sb-glass-dot{background:#18a957}
.sb-glass-status.sb-offline .sb-glass-dot{background:rgba(255,255,255,.70)}

#sb-glass-close{
  margin-left:0;
  width:32px;
  height:32px;
  border-radius:10px;
  background:rgba(255,255,255,.18);
  border:none;
  font-size:20px;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  color:rgba(255,255,255,.92);
  transition:background .18s ease, transform .18s ease, opacity .18s ease;
  opacity:.9;
}
#sb-glass-close:hover{background:rgba(255,255,255,.28);transform:translateY(-1px)}
#sb-glass-close:active{transform:translateY(0)}

#sb-glass-gear{
  margin-left:auto;
  width:32px;
  height:32px;
  border-radius:10px;
  background:rgba(255,255,255,.18);
  border:none;
  font-size:16px;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  color:rgba(255,255,255,.92);
  transition:background .18s ease, transform .18s ease, opacity .18s ease;
  opacity:.9;
}
#sb-glass-gear:hover{background:rgba(255,255,255,.28);transform:translateY(-1px)}
#sb-glass-gear:active{transform:translateY(0)}

/* settings dropdown */
.sb-gc-menu{
  position:absolute;
  top:58px;
  right:12px;
  z-index:30;
  min-width:190px;
  padding:8px;
  border-radius:14px;
  background:rgba(255,255,255,.38);
  backdrop-filter:blur(14px);
  -webkit-backdrop-filter:blur(14px);
  border:1px solid rgba(255,255,255,.46);
  box-shadow:0 18px 40px rgba(0,0,0,.24);
}

.sb-gc-menu-item{
  width:100%;
  text-align:left;
  padding:10px 10px;
  border-radius:12px;
  border:none;
  background:rgba(255,255,255,.24);
  color:#111;
  cursor:pointer;
  font-weight:800;
  font-size:13px;
  transition:transform .16s ease, background .16s ease;
}
.sb-gc-menu-item + .sb-gc-menu-item{margin-top:6px}
.sb-gc-menu-item:hover{background:rgba(255,255,255,.34);transform:translateY(-1px)}
.sb-gc-menu-item:active{transform:translateY(0)}

/* prevent text selection while dragging */
body.sb-gc-noselect, body.sb-gc-noselect *{user-select:none !important}
#sb-glass-body{
  padding:14px;
  height:240px;
  overflow-y:auto;
  display:flex;
  flex-direction:column;
  gap:10px;
  position:relative;
  background:
    linear-gradient(180deg, rgba(255,255,255,.62) 0%, rgba(245,245,245,.42) 100%);
}

/* subtle noise (premium) */
#sb-glass-body:before{
  content:"";
  position:absolute;
  inset:0;
  pointer-events:none;
  opacity:.08;
  background-image:url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='120'%20height='120'%3E%3Cfilter%20id='n'%3E%3CfeTurbulence%20type='fractalNoise'%20baseFrequency='.85'%20numOctaves='3'%20stitchTiles='stitch'/%3E%3C/filter%3E%3Crect%20width='120'%20height='120'%20filter='url(%23n)'%20opacity='.55'/%3E%3C/svg%3E");
  background-size:120px 120px;
}

/* keep content above noise */
#sb-glass-body > *{position:relative; z-index:1;}

/* day separators */
.sb-daysep-row{
  align-self:stretch;
  display:flex;
  justify-content:center;
  margin:6px 0;
  position:relative;
  z-index:2;
}
.sb-daysep{
  font-size:11px;
  line-height:1;
  padding:5px 10px;
  border-radius:999px;
  color:rgba(0,0,0,.62);
  background:rgba(0,0,0,.06);
  border:1px solid rgba(0,0,0,.06);
  user-select:none;
  pointer-events:none;
}

/* elegant thin scrollbar (macOS-like) */
#sb-glass-body{scrollbar-width:thin;scrollbar-color:rgba(0,0,0,.35) transparent}
#sb-glass-body::-webkit-scrollbar{width:8px}
#sb-glass-body::-webkit-scrollbar-track{background:transparent}
#sb-glass-body::-webkit-scrollbar-thumb{background:rgba(0,0,0,.18);border-radius:999px;border:2px solid transparent;background-clip:padding-box}
#sb-glass-body:hover::-webkit-scrollbar-thumb{background:rgba(0,0,0,.28);border:2px solid transparent;background-clip:padding-box}

/* "Mesaj nou" chip (premium glass) */
.sb-gc-newchip{
  position:absolute;
  right:14px;
  left:auto;
  bottom:60px;
  z-index:5;
  border:none;
  border-radius:999px;
  padding:10px 12px 10px 10px;
  font-size:12px;
  font-weight:900;
  letter-spacing:.1px;
  background:rgba(255,255,255,.34);
  backdrop-filter:blur(12px);
  -webkit-backdrop-filter:blur(12px);
  border:1px solid rgba(255,255,255,.46);
  color:#111;
  cursor:pointer;
  box-shadow:0 16px 34px rgba(0,0,0,.22);
  transition:transform .18s ease, opacity .18s ease;
  opacity:.98;
  display:none;
  align-items:center;
  gap:8px;
}

.sb-gc-newchip::before{
  content:"↓";
  width:22px;
  height:22px;
  border-radius:999px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  background:rgba(255,183,0,.95);
  color:#fff;
  font-weight:900;
  box-shadow:0 10px 18px rgba(0,0,0,.16);
  flex:0 0 22px;
  line-height:1;
}

.sb-gc-newchip:hover{transform:translateY(-1px)}
.sb-gc-newchip:active{transform:translateY(0)}

.sb-gc-typing{padding:0 14px 10px 14px;font-size:12px;color:rgba(0,0,0,.7)}
.sb-gc-typing:after{content:"";display:inline-block;width:14px}

/* ==================== MESSAGES ==================== */
.sb-msg{
  max-width:78%;
  display:flex;
  flex-direction:column;
  gap:5px;
  font-size:14px;
  line-height:1.4;
  white-space:pre-wrap;
  word-wrap:break-word;
  position:relative;
  z-index:1;
  animation: sbChatPop .18s ease-out;
}

.sb-msg.sb-bot{align-self:flex-start;align-items:flex-start}
.sb-msg.sb-user{align-self:flex-end;align-items:flex-end}

/* Highlight discret pentru mesajele noi (cand utilizatorul e sus, fara auto-scroll) */
.sb-msg.sb-bot.sb-gc-newmsg .sb-bubble{
  animation: sbGcNewGlow .8s ease-out;
}

@keyframes sbGcNewGlow{
  0%{
    box-shadow:0 6px 14px rgba(0,0,0,.10);
    border-color:rgba(0,0,0,.06);
  }
  35%{
    box-shadow:
      0 6px 14px rgba(0,0,0,.10),
      0 0 0 3px rgba(255,183,0,.22);
    border-color:rgba(255,183,0,.18);
  }
  100%{
    box-shadow:0 6px 14px rgba(0,0,0,.10);
    border-color:rgba(0,0,0,.06);
  }
}

.sb-bubble{
  padding:8px 12px;
  border-radius:14px;
  background:rgba(0,0,0,.08);
  color:#111;
  box-shadow:0 6px 14px rgba(0,0,0,.10);
  border:1px solid rgba(0,0,0,.06);
}

.sb-msg.sb-bot .sb-bubble{
  border-radius:14px 14px 4px 14px;
}

.sb-msg.sb-user .sb-bubble{
  border-radius:14px 14px 14px 4px;
  background:#111;
  color:#fff;
  box-shadow:0 14px 26px rgba(0,0,0,.18);
}

/* Timestamp (mic, discret) */
.sb-time{
  font-size:10px;
  line-height:1;
  padding:0 6px;
  color:rgba(0,0,0,.32);
  user-select:none;
}

/* Image messages */
.sb-msg.sb-img .sb-bubble{padding:6px;border-radius:14px;overflow:hidden;background:rgba(0,0,0,.06)}
.sb-msg.sb-img .sb-bubble img{max-width:220px;max-height:220px;display:block;border-radius:12px}
.sb-msg.sb-img .sb-bubble a{display:block}


/* ==================== INPUT BAR ==================== */
#sb-glass-input{
  display:flex;
  align-items:center;
  gap:8px;
  padding:10px 10px calc(10px + env(safe-area-inset-bottom, 0px));
  border-top:1px solid rgba(0,0,0,.10);
  position:relative;
  background:rgba(255,255,255,.55);
  backdrop-filter:blur(12px);
}

#sb-glass-input input#sb-glass-text{
  flex:1;
  height:40px;
  border-radius:16px;
  padding:10px 12px;
  border:1px solid rgba(0,0,0,.12);
  background:rgba(255,255,255,.78);
  box-shadow:0 8px 18px rgba(0,0,0,.08);
  transition:box-shadow .18s ease, border-color .18s ease, transform .18s ease;
}

#sb-glass-text::placeholder{color:rgba(0,0,0,.45)}

#sb-glass-text:focus{
  outline:none;
  border-color:rgba(0,0,0,.32);
  box-shadow:0 0 0 2px rgba(255,183,0,.22), 0 8px 18px rgba(0,0,0,.08);
}

#sb-gc-hp{position:absolute;left:-9999px;opacity:0;height:0;width:0}

#sb-glass-send{
  border:none;
  border-radius:14px;
  width:40px;
  height:40px;
  background:#111;
  color:#fff;
  cursor:pointer;
  box-shadow:0 12px 24px rgba(0,0,0,.22);
  transition:transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}

#sb-glass-send:hover{transform:translateY(-1px)}
#sb-glass-send:active{transform:translateY(0) scale(.98)}
#sb-glass-send:disabled{opacity:.55;cursor:not-allowed}

@keyframes sbChatPop{
  from{ transform:scale(.96); opacity:.6; }
  to{ transform:scale(1); opacity:1; }
}

/* Send arrow center */
#sb-glass-send{
  display:flex;
  align-items:center;
  justify-content:center;
  line-height:1;
}

/* (focus style set above) */



/* === iOS Safari fix: prevent auto-zoom on input focus === */
@supports (-webkit-touch-callout: none) {
  #sb-glass-text{
    font-size:16px !important;
  }
  #sb-glass-window{
    max-height:80vh;
  }
  #sb-glass-input input{
    -webkit-appearance:none;
  }
}





/* ensure messages don't cover day chips */
.sb-msg{position:relative; z-index:1;}

/* Premium texture overlays: subtle dot grid + vignette */
#sb-glass-msgs{
  position:relative;
  overflow:hidden;
}
#sb-glass-msgs::before{
  content:"";
  position:absolute;
  inset:0;
  pointer-events:none;
  background-image:
    radial-gradient(rgba(0,0,0,.06) 1px, transparent 1px);
  background-size:18px 18px;
  opacity:.22; /* ~2% effective ink */
  mix-blend-mode:overlay;
}
#sb-glass-msgs::after{
  content:"";
  position:absolute;
  inset:0;
  pointer-events:none;
  background:radial-gradient(ellipse at center,
    rgba(0,0,0,0) 58%,
    rgba(0,0,0,.18) 100%);
  opacity:.30; /* subtle vignette */
}
#sb-glass-msgs > *{
  position:relative;
  z-index:1;
}

/* Hide timestamps when disabled in admin */
.sb-ts-off .sb-time{display:none !important;}

/* Typing indicator (3 dots) — DOTS ONLY (no bar / no bubble background) */
#sb-gc-typing{
  /* IMPORTANT: don't force display with !important.
     JS toggles display (none/flex). */
  display:flex;
  justify-content:flex-start;

  /* dots-only: no background strip */
  background:transparent !important;
  background-color:transparent !important;
  border:none !important;
  box-shadow:none !important;

  /* keep it tiny and not full-width */
  align-self:flex-start;
  width:fit-content;
  max-width:100%;
  /* align a bit with admin bubble text indent */
  margin-left:8px;

  /* breathing room above/below (no background anyway) */
  padding:7px 0 9px 0;
  margin-top:0;
  margin-right:0;
  margin-bottom:0;

  color:rgba(0,0,0,.55);
  font-size:13px;
  line-height:1;
}

/* If theme/plugin styles the typing area like a bubble, nuke it */
#sb-gc-typing.sb-msg,
#sb-gc-typing .sb-bubble,
#sb-gc-typing-admin.sbgc-msg,
#sb-gc-typing-admin .sbgc-bubble{
  background:none !important;
  background-color:transparent !important;
  border:none !important;
  box-shadow:none !important;
}

.sb-gc-dots{
  display:inline-flex;
  gap:5px;
  align-items:center;
}

.sb-gc-dots i{
  width:6px;
  height:6px;
  border-radius:50%;
  background:currentColor;
  display:inline-block;
  opacity:.35;
  transform:translateY(0);
  animation:sb-gc-dot 1.6s infinite ease-in-out;
}

.sb-gc-dots i:nth-child(2){ animation-delay:.20s; }
.sb-gc-dots i:nth-child(3){ animation-delay:.40s; }

@keyframes sb-gc-dot{
  0%, 80%, 100% { opacity:.30; transform:translateY(0); }
  40% { opacity:.85; transform:translateY(-3px); }
}

/* =========================================================
   BIGXON / THEME OVERRIDE FIX
   - lock perfect shapes (avoid theme button styles)
   - restore pulse animation if theme disables it
   ========================================================= */
#sb-glass-chat, #sb-glass-chat *{box-sizing:border-box;}

/* Floating open button */
#sb-glass-open{
  width:58px !important;
  height:58px !important;
  padding:0 !important;
  border-radius:999px !important;
  line-height:1 !important;
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  font-size:24px !important;
  animation:sb-gc-pulse 2.5s infinite !important;
}

/* Close button */
#sb-glass-close{
  width:32px !important;
  height:32px !important;
  padding:0 !important;
  border-radius:10px !important;
  line-height:1 !important;
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  font-size:20px !important;
  animation:none !important; /* never pulse */
}

/* Send button */
#sb-glass-send{
  width:40px !important;
  height:40px !important;
  padding:0 !important;
  border-radius:14px !important;
  line-height:1 !important;
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  font-size:18px !important;
}

/* Prevent theme from stretching emoji/icon */
#sb-glass-open::before,
#sb-glass-send::before,
#sb-glass-close::before{content:none !important;}
