/* Chat live customer ↔ Super Admin — full screen, responsif. */
body.gtc-chat-open { overflow: hidden; }
body.gtc-chat-open .gtc-chat-fab { display: none; }

/* Entry point di pojok kanan bawah; bukan popup chat. */
.gtc-chat-fab {
  position: fixed;
  overflow: visible;
  right: 16px;
  bottom: calc(18px + var(--safe-bottom));
  z-index: 150;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 48px;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--primary);
  border-radius: 999px;
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: 0 7px 20px rgba(0, 0, 0, .16);
  cursor: pointer;
  font: 600 11px/1 var(--ui);
}
.gtc-chat-fab:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.gtc-chat-fab:focus-visible { outline: 2px solid var(--text-strong); outline-offset: 2px; }
.gtc-chat-fab svg { width: 20px; height: 20px; flex: 0 0 20px; }
.gtc-chat-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  margin: 0;
  padding: 0 4px;
  border: 2px solid var(--surface);
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  box-shadow: 0 2px 7px rgba(0, 0, 0, .22);
  font: 600 9px/1 var(--mono);
}
.gtc-chat-badge[hidden] { display: none; }
.gtc-chat-badge.is-pulse { animation: gtc-chat-pulse 1.6s ease-out 3; }
@keyframes gtc-chat-pulse {
  0% { box-shadow: 0 0 0 0 rgba(217, 76, 92, .55); }
  70% { box-shadow: 0 0 0 7px rgba(217, 76, 92, 0); }
  100% { box-shadow: 0 0 0 0 rgba(217, 76, 92, 0); }
}

/* Full-screen chat view. */
.gtc-chat-panel {
  position: fixed;
  inset: 0;
  z-index: 180;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
}
.gtc-chat-panel[hidden] { display: none; }
.gtc-chat-head {
  flex: 0 0 auto;
  padding-top: var(--safe-top);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.gtc-chat-head-inner {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  max-width: 780px;
  min-height: 58px;
  margin: 0 auto;
  padding: 8px 14px;
}
.gtc-chat-back {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.gtc-chat-back:hover { border-color: var(--border); background: var(--surface-2); }
.gtc-chat-back:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.gtc-chat-back svg { width: 20px; height: 20px; }
.gtc-chat-logo { width: 32px; height: 32px; flex: 0 0 32px; object-fit: contain; }
.gtc-chat-head-main { display: grid; min-width: 0; flex: 1; }
.gtc-chat-head-main strong {
  overflow: hidden;
  color: var(--text-strong);
  font: 500 13px/1.3 var(--ui);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gtc-chat-head-main span {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  color: var(--muted);
  font: 9px/1.4 var(--mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gtc-chat-live-dot { display: inline-block; width: 5px; height: 5px; flex: 0 0 5px; border-radius: 50%; background: var(--success); }
.gtc-chat-head-badge {
  flex: 0 0 auto;
  padding: 3px 6px;
  border: 1px solid color-mix(in srgb, var(--success) 30%, var(--border));
  border-radius: 3px;
  color: var(--success);
  font: 8px/1.2 var(--mono);
  letter-spacing: .06em;
}
.gtc-chat-messages {
  flex: 1 1 auto;
  width: 100%;
  max-width: 780px;
  min-height: 0;
  margin: 0 auto;
  overflow-y: auto;
  padding: 15px 14px 22px;
  background: var(--bg);
}
.gtc-chat-empty { padding: 28px 10px; color: var(--muted); font-size: 11px; text-align: center; }
.gtc-chat-msg { display: flex; margin-bottom: 9px; }
.gtc-chat-msg.is-user { justify-content: flex-end; }
.gtc-chat-bubble {
  max-width: min(82%, 560px);
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
  font-size: 11px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.gtc-chat-msg.is-user .gtc-chat-bubble {
  border-color: color-mix(in srgb, var(--primary) 55%, var(--border));
  background: color-mix(in srgb, var(--primary) 20%, var(--surface));
}
.gtc-chat-meta { margin-top: 3px; color: var(--muted); font-family: var(--mono); font-size: 8px; }
.gtc-chat-ticks { margin-left: 4px; color: var(--muted); font-family: var(--mono); font-size: 10px; letter-spacing: -1px; }
.gtc-chat-ticks.is-read { color: #2f9cf4; }
.gtc-chat-msg.is-user .gtc-chat-meta { text-align: right; }
.gtc-chat-form {
  flex: 0 0 auto;
  width: 100%;
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding-bottom: var(--safe-bottom);
}
.gtc-chat-compose-inner {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  padding: 9px 14px;
}
.gtc-chat-form input {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  outline: 0;
  background: var(--surface-2);
  color: var(--text);
  font: 11px/1.4 var(--ui);
}
.gtc-chat-form input:focus { border-color: var(--primary); }
.gtc-chat-form button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  padding: 0;
  border: 1px solid var(--primary);
  border-radius: 4px;
  background: var(--primary);
  color: var(--on-primary);
  cursor: pointer;
}
.gtc-chat-form button:disabled { opacity: .5; cursor: wait; }
.gtc-chat-form .gtc-chat-attach {
  border-color: var(--border);
  background: var(--surface-2);
  color: var(--text);
}
.gtc-chat-form .gtc-chat-attach:hover { border-color: var(--primary); color: var(--primary); }
.gtc-chat-form svg { width: 18px; height: 18px; }
.gtc-chat-image {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 280px;
  margin: 1px 0 5px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--surface-2);
  object-fit: contain;
  cursor: zoom-in;
}
.gtc-chat-image.is-error { width: 120px; height: 70px; cursor: default; }
.gtc-chat-error { flex: 0 0 auto; max-width: 780px; min-height: 0; margin: 0 auto; padding: 0 14px; color: var(--danger); font: 9px/1.4 var(--mono); }
.gtc-chat-error:not(:empty) { padding-bottom: 8px; }

@media (max-width: 899px) {
  .gtc-chat-fab { right: 13px; bottom: calc(78px + var(--safe-bottom)); width: 46px; height: 46px; min-width: 46px; padding: 0; }
  .gtc-chat-fab-label { display: none; }
  .gtc-chat-head-inner { padding: 7px 10px; gap: 7px; }
  .gtc-chat-logo { width: 29px; height: 29px; flex-basis: 29px; }
  .gtc-chat-messages { padding: 12px 10px 18px; }
  .gtc-chat-compose-inner { padding: 8px 10px; }
  .gtc-chat-head-badge { display: none; }
}
@media (max-width: 380px) {
  .gtc-chat-head-main strong { font-size: 12px; }
  .gtc-chat-head-main span { font-size: 8px; }
  .gtc-chat-bubble { max-width: 88%; }
}
@media (min-width: 900px) {
  .gtc-chat-messages { padding-left: 24px; padding-right: 24px; }
  .gtc-chat-compose-inner { padding-left: 24px; padding-right: 24px; }
  .gtc-chat-error { padding-left: 24px; padding-right: 24px; }
}

.gtc-chat-notice {
  position: fixed;
  top: calc(52px + var(--safe-top));
  left: 50%;
  z-index: 175;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: min(410px, calc(100vw - 20px));
  padding: 12px 34px 13px 13px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: 0 14px 38px rgba(0, 0, 0, .2), 0 2px 7px rgba(0, 0, 0, .08);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -8px) scale(.985);
  transition: opacity .2s cubic-bezier(.2,.8,.2,1), transform .2s cubic-bezier(.2,.8,.2,1);
}
.gtc-chat-notice::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--primary);
}
.gtc-chat-notice.is-visible { opacity: 1; pointer-events: auto; transform: translate(-50%, 0) scale(1); }
.gtc-chat-notice[hidden] { display: none; }
.gtc-chat-notice-icon { position: relative; display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--border); border-radius: 50%; background: var(--surface-2); }
.gtc-chat-notice-icon img { width: 24px; height: 24px; object-fit: contain; }
.gtc-chat-notice-icon span { position: absolute; right: -1px; bottom: -1px; width: 9px; height: 9px; border: 2px solid var(--surface); border-radius: 50%; background: var(--success); }
.gtc-chat-notice-main { min-width: 0; }
.gtc-chat-notice-topline { display: flex; align-items: center; justify-content: space-between; gap: 7px; }
.gtc-chat-notice-topline > span { color: var(--primary-hover); font-family: var(--mono); font-size: 7px; font-weight: 600; letter-spacing: .08em; }
.gtc-chat-notice-topline b { display: inline-grid; place-items: center; min-width: 15px; height: 15px; padding: 0 4px; border-radius: 999px; background: color-mix(in srgb, var(--primary) 16%, var(--surface)); color: var(--primary-hover); font-family: var(--mono); font-size: 8px; font-weight: 600; }
.gtc-chat-notice-main > strong { display: block; margin-top: 2px; color: var(--text-strong); font: 600 11px/1.3 var(--ui); }
.gtc-chat-notice-main p { display: -webkit-box; overflow: hidden; margin: 3px 0 0; color: var(--text); font-size: 10px; line-height: 1.4; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.gtc-chat-notice-meta { margin-top: 4px; color: var(--muted); font-family: var(--mono); font-size: 8px; }
.gtc-chat-notice-actions { display: flex; align-items: center; gap: 4px; }
.gtc-chat-notice-actions button { height: 30px; padding: 0 10px; border: 1px solid var(--primary); border-radius: 3px; background: var(--primary); color: var(--on-primary); cursor: pointer; font: 600 9px/1 var(--ui); white-space: nowrap; }
.gtc-chat-notice-actions button:hover { border-color: var(--primary-hover); background: var(--primary-hover); }
.gtc-chat-notice-close { position: absolute; top: 5px; right: 5px; display: grid; place-items: center; width: 23px; height: 23px; padding: 0; border: 0; border-radius: 3px; background: transparent; color: var(--muted); cursor: pointer; font-size: 17px; line-height: 1; }
.gtc-chat-notice-close:hover { background: var(--surface-2); color: var(--text); }
.gtc-chat-notice-progress { position: absolute; right: 0; bottom: 0; left: 0; height: 2px; background: var(--surface-2); }
.gtc-chat-notice-progress i { display: block; width: 100%; height: 100%; background: var(--primary); transform-origin: left; }
.gtc-chat-notice.is-visible .gtc-chat-notice-progress i { animation: gtc-chat-notice-countdown 8s linear forwards; }
@keyframes gtc-chat-notice-countdown { from { transform: scaleX(1); } to { transform: scaleX(0); } }
body.gtc-chat-open .gtc-chat-notice { display: none; }
@media (max-width: 420px) {
  .gtc-chat-notice { grid-template-columns: 33px minmax(0, 1fr) auto; gap: 8px; padding: 10px 31px 11px 11px; }
  .gtc-chat-notice-icon { width: 33px; height: 33px; }
  .gtc-chat-notice-icon img { width: 22px; height: 22px; }
  .gtc-chat-notice-actions button { height: 28px; padding: 0 8px; font-size: 8px; }
  .gtc-chat-notice-main p { font-size: 9px; }
}
