/* Shared call UI — portal + (also mirrored in public CSS) */
.call-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: grid;
  place-items: center;
  padding: max(0.75rem, env(safe-area-inset-top)) 0.75rem max(0.75rem, env(safe-area-inset-bottom));
  background:
    radial-gradient(ellipse 90% 70% at 50% 0%, rgba(36, 90, 200, 0.42), transparent 55%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(16, 110, 80, 0.18), transparent 50%),
    #070d1c;
  isolation: isolate;
}
.call-overlay[hidden] { display: none !important; }

.call-shell {
  position: relative;
  width: min(24rem, 100%);
  height: min(36rem, 92dvh);
  max-height: 96dvh;
  display: flex;
  flex-direction: column;
  padding: 1rem 1.1rem 1.1rem;
  border-radius: 1.75rem;
  overflow: hidden;
  background:
    linear-gradient(165deg, rgba(255,255,255,0.09) 0%, rgba(255,255,255,0.02) 40%, rgba(8,16,36,0.55) 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  color: #eef3ff;
}

/* Brand atas (emas — beda dari nav biru) */
.call-brandbar {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  margin: 0 0 0.55rem;
  padding: 0.45rem 0.7rem 0.5rem;
  border-radius: 0.85rem;
  background: linear-gradient(135deg, rgba(212, 160, 23, 0.22), rgba(255, 236, 179, 0.08));
  border: 1px solid rgba(232, 196, 90, 0.35);
  text-align: center;
}
.call-brandbar__name {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: 0.88rem;
  letter-spacing: -0.02em;
  color: #f5d76e;
  line-height: 1.15;
}
.call-brandbar__tag {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 236, 179, 0.72);
}

/* Saat call: sembunyikan SEMUA chrome situs (nav, footer, fab) */
body.call-active #liquid-nav,
body.call-active .liquid-nav,
body.call-active .chatbot,
body.call-active .chatbot__fab,
body.call-active .site-footer,
body.call-active .site-header,
body.call-active .staff-side,
body.call-active .staff-top,
body.call-active .staff-foot,
body.call-active .staff-shell > aside {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  height: 0 !important;
  overflow: hidden !important;
}
body.call-active {
  overflow: hidden !important;
}
body.call-active .call-overlay {
  z-index: 9999 !important;
}

@media (max-width: 720px) {
  .call-overlay {
    padding: 0;
    place-items: stretch;
    align-items: stretch;
  }
  .call-shell {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    min-height: 100dvh;
    border-radius: 0;
    padding:
      max(0.65rem, env(safe-area-inset-top))
      0.9rem
      max(0.85rem, env(safe-area-inset-bottom));
  }
  .call-brandbar {
    margin-bottom: 0.4rem;
    border-radius: 0.7rem;
    padding: 0.4rem 0.55rem;
  }
  .call-shell__hero {
    flex: 1 1 auto;
    min-height: 0;
    padding: 0.25rem 0;
  }
  .call-shell__pulse {
    width: 5.5rem;
    height: 5.5rem;
    margin-bottom: 0.65rem;
  }
  .call-shell__avatar {
    width: 4.25rem;
    height: 4.25rem;
  }
  .call-shell__peer {
    font-size: 1.15rem;
  }
  .call-disclaimer {
    flex: 0 0 auto;
    font-size: 0.62rem;
    padding: 0.35rem 0.5rem;
    margin-bottom: 0.4rem;
    line-height: 1.35;
  }
  .call-stats {
    flex: 0 0 auto;
    margin-bottom: 0.45rem;
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem;
    padding: 0.45rem;
  }
  .call-transcript {
    max-height: 3.5rem;
    margin-bottom: 0.4rem;
  }
  .call-shell__ctrls {
    flex: 0 0 auto;
    margin-top: 0;
    padding-top: 0.35rem;
    gap: 0.65rem;
    /* pastikan di atas segalanya, tidak ketutup footer situs */
    position: relative;
    z-index: 6;
  }
  .call-btn__ico {
    width: 3.35rem;
    height: 3.35rem;
  }
  .call-btn--hang .call-btn__ico {
    width: 3.85rem;
    height: 3.85rem;
  }
  .call-btn__txt {
    font-size: 0.68rem;
  }
}
.call-shell__glow {
  position: absolute;
  inset: -20% -10% auto;
  height: 55%;
  background: radial-gradient(circle at 50% 30%, rgba(70, 130, 255, 0.32), transparent 65%);
  pointer-events: none;
}
.call-shell__top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.call-shell__brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}
.call-shell__dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #64748b;
  box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.25);
  flex-shrink: 0;
}
.call-overlay.is-ringing .call-shell__dot,
.call-overlay.is-connecting .call-shell__dot {
  background: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.28);
  animation: callDotPulse 1.1s ease-in-out infinite;
}
.call-overlay.is-live .call-shell__dot {
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.3);
  animation: callDotPulse 1.6s ease-in-out infinite;
}
@keyframes callDotPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.85; }
}
.call-shell__label {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(236, 242, 255, 0.72);
}
.call-shell__timer {
  margin: 0;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  color: #fff;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  min-width: 4.25rem;
  text-align: center;
}
.call-overlay.is-live .call-shell__timer {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.35);
  color: #bbf7d0;
}

.call-shell__hero {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.5rem 0 0.75rem;
  min-height: 10rem;
}
.call-shell__pulse {
  position: relative;
  width: 7.25rem;
  height: 7.25rem;
  margin: 0 auto 1rem;
  display: grid;
  place-items: center;
}
.call-shell__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(120, 170, 255, 0.35);
  opacity: 0;
}
.call-overlay.is-ringing .call-shell__ring,
.call-overlay.is-connecting .call-shell__ring {
  animation: callRings 1.6s ease-out infinite;
}
.call-overlay.is-ringing .call-shell__ring--delay,
.call-overlay.is-connecting .call-shell__ring--delay {
  animation-delay: 0.55s;
}
.call-overlay.is-live .call-shell__ring {
  animation: none;
  inset: -6px;
  border-color: rgba(34, 197, 94, 0.45);
  opacity: 0.65;
}
@keyframes callRings {
  0% { transform: scale(0.72); opacity: 0.7; }
  100% { transform: scale(1.28); opacity: 0; }
}
.call-shell__avatar {
  width: 5.5rem;
  height: 5.5rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, #3b77e0, #1a3f9c);
  box-shadow: 0 16px 36px rgba(22, 63, 156, 0.45);
  position: relative;
  z-index: 1;
}
.call-overlay.is-live .call-shell__avatar {
  background: linear-gradient(145deg, #34d399, #15803d);
}
.call-shell__peer {
  margin: 0;
  font-weight: 800;
  font-size: clamp(1.15rem, 4vw, 1.4rem);
  color: #fff;
  letter-spacing: -0.02em;
  max-width: 18rem;
  word-break: break-word;
}
.call-shell__status {
  margin: 0.4rem 0 0;
  font-size: 0.9rem;
  color: rgba(220, 230, 255, 0.68);
  min-height: 1.35em;
  max-width: 18rem;
}
.call-overlay.is-live .call-shell__status {
  color: #86efac;
  font-weight: 600;
}
.call-shell__dots {
  display: none;
  justify-content: center;
  gap: 6px;
  margin: 0.7rem 0 0;
}
.call-overlay.is-connecting .call-shell__dots,
.call-overlay.is-ringing .call-shell__dots { display: flex; }
.call-shell__dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #8eb4ff;
  opacity: 0.35;
  animation: callDotBlink 1s infinite ease-in-out;
}
.call-shell__dots i:nth-child(2) { animation-delay: 0.15s; }
.call-shell__dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes callDotBlink {
  0%, 100% { opacity: 0.25; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-3px); }
}

.call-stats {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  margin: 0 0 0.75rem;
  padding: 0.6rem;
  border-radius: 1rem;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.call-stats[hidden] { display: none !important; }
.call-stats__item {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  padding: 0.4rem 0.5rem;
  border-radius: 0.65rem;
  background: rgba(255, 255, 255, 0.04);
  min-width: 0;
}
.call-stats__item--wide {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}
.call-stats__k {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(200, 214, 255, 0.55);
}
.call-stats__v {
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  font-size: 0.95rem;
  color: #f1f5ff;
}
.call-stats__v--sm { font-size: 0.78rem; font-weight: 650; }
#call-ping[data-quality="good"],
#call-quality[data-quality="good"] { color: #4ade80; }
#call-ping[data-quality="ok"],
#call-quality[data-quality="ok"] { color: #fbbf24; }
#call-ping[data-quality="bad"],
#call-quality[data-quality="bad"] { color: #f87171; }

.call-rec-badge {
  position: relative;
  z-index: 1;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin: 0 0 0.65rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(248, 113, 113, 0.4);
  color: #fecaca;
}
.call-overlay.is-live .call-rec-badge { display: inline-flex; }
.call-rec-badge__dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #ef4444;
  animation: callDotPulse 1s ease-in-out infinite;
}

.call-transcript {
  position: relative;
  z-index: 1;
  max-height: 5.5rem;
  overflow-y: auto;
  margin: 0 0 0.75rem;
  padding: 0.55rem 0.7rem;
  border-radius: 0.85rem;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.78rem;
  line-height: 1.45;
  color: rgba(226, 232, 255, 0.88);
  text-align: left;
}
.call-transcript[hidden] { display: none !important; }
.call-transcript__live {
  color: rgba(200, 214, 255, 0.55);
  font-style: italic;
}

.call-shell__ctrls {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 0.85rem;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 0.35rem;
}
.call-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  min-width: 4.5rem;
  padding: 0.2rem;
  border: 0;
  border-radius: 1.1rem;
  background: transparent;
  font: inherit;
  font-weight: 600;
  font-size: 0.72rem;
  cursor: pointer;
  color: rgba(236, 242, 255, 0.9);
  transition: transform 0.15s, opacity 0.15s;
}
.call-btn__ico {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}
.call-btn:hover { transform: translateY(-2px); }
.call-btn:hover .call-btn__ico { background: rgba(255, 255, 255, 0.18); }
.call-btn.is-off .call-btn__ico {
  background: rgba(248, 113, 113, 0.28);
  border-color: rgba(248, 113, 113, 0.5);
  color: #fecaca;
}
.call-btn.is-off .call-btn__txt { color: #fca5a5; }
.call-btn--speaker .call-btn__ico {
  background: rgba(59, 130, 246, 0.28);
  border-color: rgba(96, 165, 250, 0.4);
}
.call-btn--hang .call-btn__ico {
  width: 3.85rem;
  height: 3.85rem;
  background: linear-gradient(145deg, #f43f5e, #be123c);
  border-color: transparent;
  box-shadow: 0 12px 28px rgba(225, 29, 72, 0.45);
}
.call-btn--hang .call-btn__txt { color: #fda4af; font-weight: 700; }

.call-shell__play {
  position: relative;
  z-index: 1;
  margin-top: 0.85rem;
  width: 100%;
  border: 0;
  border-radius: 999px;
  padding: 0.8rem 1rem;
  font: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  color: #0b1224;
  background: linear-gradient(135deg, #93c5fd, #60a5fa);
}
.call-shell__play[hidden] { display: none !important; }

.call-disclaimer {
  position: relative;
  z-index: 1;
  margin: 0 0 0.65rem;
  padding: 0.55rem 0.7rem;
  border-radius: 0.75rem;
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.28);
  color: #fde68a;
  font-size: 0.72rem;
  line-height: 1.4;
  text-align: left;
}

/* Jangan matikan audio element — HP sering gagal play */
#call-remote-audio {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 1px;
  height: 1px;
  opacity: 0.01;
  z-index: -1;
  pointer-events: none;
}
