/* Floating icon publik kiri + livechat kanan — mengikuti token tema aktif. */
:root{
  /* Bottom nav publik setinggi 70px; tombol tengahnya menonjol ±27px.
     Semua tombol mengambang (termasuk bubble widget livechat) memakai jarak
     ini supaya tidak menutupi menu bawah. */
  --cx-nav-clearance:calc(104px + env(safe-area-inset-bottom, 0px));
}

.cx-float{
  position:fixed;
  z-index:75;
  left:max(14px, calc((100vw - 1280px) / 2 + 14px));
  right:auto;
  bottom:var(--cx-nav-clearance);
  display:flex;
  flex-direction:column;
  gap:10px;
  pointer-events:none;
}

.cx-float-btn{
  position:relative;
  display:grid;
  place-items:center;
  width:54px;
  height:54px;
  border-radius:50%;
  border:1px solid var(--line-strong, rgba(255,255,255,.2));
  background:var(--surface-solid, #161616);
  box-shadow:0 10px 26px rgba(0,0,0,.45), var(--glow, 0 0 20px rgba(255,255,255,.18));
  pointer-events:auto;
  transition:transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.cx-float-btn img{
  width:34px;
  height:34px;
  object-fit:contain;
  border-radius:50%;
  display:block;
}

/* Slot aktif tanpa gambar: ikon bawaan tetap tampil. */
.cx-float-btn--glyph{
  border-color:rgba(var(--brand-rgb),.42);
}

.cx-float-glyph{
  display:grid;
  place-items:center;
  width:34px;
  height:34px;
  border-radius:50%;
  color:var(--brand-2, #fff);
  background:linear-gradient(145deg, rgba(var(--brand-rgb),.24), rgba(var(--brand-rgb),.06));
}

.cx-float-glyph svg{
  width:22px;
  height:22px;
  display:block;
}

/* Glyph cadangan untuk slot bergambar: kelas .cx-float-glyph memakai
   display:grid, jadi atribut [hidden] perlu aturan eksplisit agar benar-benar
   tersembunyi sampai gambarnya gagal dimuat. */
.cx-float-glyph[hidden]{
  display:none;
}

.cx-float-btn img[hidden]{
  display:none;
}

/* ---------------------------------------------------------------------------
   Launcher: kondisi awal hanya satu tombol (WhatsApp / ikon pertama). Saat
   dibuka, ikon lain muncul bertingkat di atasnya dan tombol berubah jadi
   silang. Semua ukuran diatur ulang di ui/components.css.
   --------------------------------------------------------------------------- */
.cx-float--launcher{
  align-items:flex-start;
  gap:10px;
}

.cx-float-list{
  display:flex;
  flex-direction:column;
  gap:10px;
  opacity:0;
  visibility:hidden;
  transform:translateY(8px);
  pointer-events:none;
  transition:opacity .2s ease,transform .2s ease,visibility .2s ease;
}

.cx-float-list .cx-float-btn{
  transform:translateY(14px) scale(.78);
  transition:transform .24s cubic-bezier(.34,1.4,.64,1),opacity .18s ease,
             box-shadow .18s ease,border-color .18s ease;
}

.cx-float.is-open .cx-float-list{
  opacity:1;
  visibility:visible;
  transform:none;
  pointer-events:auto;
}

.cx-float.is-open .cx-float-list .cx-float-btn{
  transform:none;
}

/* Muncul berurutan dari bawah ke atas. */
.cx-float.is-open .cx-float-list .cx-float-btn:nth-child(2){transition-delay:.05s}
.cx-float.is-open .cx-float-list .cx-float-btn:nth-child(3){transition-delay:.1s}
.cx-float.is-open .cx-float-list .cx-float-btn:hover,
.cx-float.is-open .cx-float-list .cx-float-btn:focus-visible{transform:translateY(-3px)}

.cx-float-toggle{
  position:relative;
  display:grid;
  place-items:center;
  flex:0 0 auto;
  width:56px;
  height:56px;
  padding:0;
  border-radius:50%;
  border:1px solid rgba(var(--brand-rgb),.45);
  background:var(--surface-solid, #161616);
  color:var(--brand-2, #fff);
  pointer-events:auto;
  cursor:pointer;
  transition:transform .18s ease,box-shadow .18s ease,border-color .18s ease;
}

.cx-float-toggle:hover,
.cx-float-toggle:focus-visible{
  transform:translateY(-2px);
  border-color:var(--brand-2, #fff);
}

.cx-float-toggle:active{
  transform:scale(.94);
}

.cx-float-toggle:focus-visible{
  outline:2px solid var(--brand-2, #fff);
  outline-offset:3px;
}

/* Cincin perhatian hanya saat tertutup, supaya member tahu tombol bisa dibuka. */
.cx-float:not(.is-open) .cx-float-toggle::before{
  content:"";
  position:absolute;
  inset:-6px;
  border-radius:50%;
  border:1px solid rgba(var(--brand-rgb),.5);
  animation:cx-livechat-pulse 2.8s ease-out infinite;
  pointer-events:none;
}

.cx-float--branded:not(.is-open) .cx-float-toggle::before{
  border-color:rgba(37,211,102,.65);
}

.cx-toggle-glyph{
  display:grid;
  place-items:center;
  width:100%;
  height:100%;
}

.cx-toggle-glyph--close{
  display:none;
}

.cx-float.is-open .cx-toggle-glyph--open{
  display:none;
}

.cx-float.is-open .cx-toggle-glyph--close{
  display:grid;
}

.cx-brand-svg{
  display:block;
  width:34px;
  height:34px;
}

.cx-float-btn--rtp .cx-brand-svg{
  width:26px;
  height:26px;
  color:var(--brand-2, #fff);
}


.cx-float-btn:hover,
.cx-float-btn:focus-visible{
  transform:translateY(-2px);
  border-color:var(--brand-2, #fff);
  box-shadow:0 14px 30px rgba(0,0,0,.5), var(--glow-strong, 0 0 28px rgba(255,255,255,.28));
}

/* Tombol livechat kanan bawah: sejajar vertikal dengan ikon kiri. */
.cx-livechat{
  position:fixed;
  z-index:75;
  right:max(14px, calc((100vw - 1280px) / 2 + 14px));
  left:auto;
  bottom:var(--cx-nav-clearance);
  display:grid;
  place-items:center;
  width:54px;
  height:54px;
  border-radius:50%;
  border:1px solid rgba(var(--brand-rgb),.42);
  background:var(--surface-solid, #161616);
  color:var(--brand-2, #fff);
  box-shadow:0 10px 26px rgba(0,0,0,.45), 0 0 22px rgba(var(--brand-rgb),.3);
  transition:transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.cx-livechat::before{
  content:"";
  position:absolute;
  inset:-5px;
  border-radius:50%;
  border:1px solid rgba(var(--brand-rgb),.5);
  animation:cx-livechat-pulse 2.6s ease-out infinite;
  pointer-events:none;
}

.cx-livechat::after{
  content:"";
  position:absolute;
  top:4px;
  right:4px;
  width:9px;
  height:9px;
  border-radius:50%;
  border:2px solid var(--surface-solid, #161616);
  background:var(--ok, #4ade80);
  box-shadow:0 0 9px rgba(74,222,128,.85);
}

.cx-livechat:hover,
.cx-livechat:focus-visible{
  transform:translateY(-2px);
  border-color:var(--brand-2, #fff);
  box-shadow:0 14px 30px rgba(0,0,0,.5), var(--glow-strong, 0 0 28px rgba(255,255,255,.28));
}

.cx-livechat:focus-visible{
  outline:2px solid var(--brand-2, #fff);
  outline-offset:3px;
}

.cx-livechat-icon{
  position:relative;
  z-index:1;
  display:grid;
  place-items:center;
  width:100%;
  height:100%;
}

.cx-livechat svg{
  width:26px;
  height:26px;
  display:block;
}

@keyframes cx-livechat-pulse{
  0%{transform:scale(.88);opacity:.7}
  70%,100%{transform:scale(1.2);opacity:0}
}

.cx-float-label{
  position:absolute;
  left:calc(100% + 10px);
  right:auto;
  top:50%;
  transform:translateY(-50%) translateX(-4px);
  padding:6px 10px;
  border-radius:8px;
  border:1px solid var(--line-mid, rgba(255,255,255,.18));
  background:var(--surface-solid, #161616);
  color:var(--text, #f6f3ff);
  font-family:var(--font-body, system-ui, sans-serif);
  font-size:10px;
  font-weight:700;
  white-space:nowrap;
  opacity:0;
  visibility:hidden;
  pointer-events:none;
  transition:opacity .16s ease, transform .16s ease, visibility .16s ease;
  box-shadow:0 8px 20px rgba(0,0,0,.4);
}

.cx-float-btn:hover .cx-float-label,
.cx-float-btn:focus-visible .cx-float-label{
  opacity:1;
  visibility:visible;
  transform:translateY(-50%) translateX(0);
}

/* Label livechat muncul ke kiri agar tetap di dalam layar. */
.cx-livechat-label{
  left:auto;
  right:calc(100% + 10px);
  transform:translateY(-50%) translateX(4px);
}

.cx-livechat:hover .cx-livechat-label,
.cx-livechat:focus-visible .cx-livechat-label{
  opacity:1;
  visibility:visible;
  transform:translateY(-50%) translateX(0);
}

/* ---------------------------------------------------------------------------
   Widget livechat pihak ketiga.
   Tawk.to (dan beberapa widget lain) menempelkan bubble-nya langsung ke body
   dengan posisi fixed di kanan bawah, sehingga menutupi bottom nav. Offset
   utama diatur lewat Tawk_API.customStyle di components/livechat-widget.php;
   aturan di bawah adalah cadangan bila markup widget berubah atau customStyle
   ditimpa kode embed dari panel.
   --------------------------------------------------------------------------- */
#tawk-bubble-container,
#tawkchat-minified-container,
#tawkchat-container{
  bottom:var(--cx-nav-clearance) !important;
}

@media (max-width:600px){
  .cx-float{
    left:12px;
    bottom:var(--cx-nav-clearance);
    gap:7px;
  }
  .cx-float-btn{
    width:44px;
    height:44px;
  }
  .cx-float-btn img{
    width:26px;
    height:26px;
  }
  .cx-float-glyph{
    width:26px;
    height:26px;
  }
  .cx-float-glyph svg{
    width:17px;
    height:17px;
  }
  .cx-float-toggle{
    width:46px;
    height:46px;
  }
  .cx-brand-svg{
    width:28px;
    height:28px;
  }
  .cx-float-btn--rtp .cx-brand-svg{
    width:21px;
    height:21px;
  }
  .cx-livechat{
    right:12px;
    bottom:var(--cx-nav-clearance);
    width:44px;
    height:44px;
  }
  .cx-livechat svg{
    width:20px;
    height:20px;
  }
  .cx-livechat::after{
    top:3px;
    right:3px;
    width:8px;
    height:8px;
  }
}

@media (prefers-reduced-motion:reduce){
  .cx-float-btn,
  .cx-float-label,
  .cx-float-list,
  .cx-float-toggle,
  .cx-livechat,
  .cx-livechat-label{
    transition:none;
  }
  .cx-livechat::before,
  .cx-float:not(.is-open) .cx-float-toggle::before{
    animation:none;
    opacity:0;
  }
}