/* =========================================
   ABI – BINCANG ISLAM
   ========================================= */

:root {
  --app-header-h: 64px;
  --bottom-nav-h: 72px;
}

/* SECTION ABI */
.pwa-abi {
  position: relative;
  padding-bottom: calc(var(--bottom-nav-h, 72px) + 90px);
}

.pwa-abi .abi-shell {
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

/* TOPBAR */
.pwa-abi .abi-topbar {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: .15rem;
}

.pwa-abi .abi-back-btn {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 0;
  display: grid;
  place-items: center;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(15,23,42,.10);
  color: #0f172a;
  cursor: pointer;
}

.pwa-abi .abi-back-btn i {
  font-size: .95rem;
}

.pwa-abi .abi-topbar-text {
  display: flex;
  flex-direction: column;
  gap: .1rem;
}

.pwa-abi .abi-title {
  font-size: 1.02rem;
  font-weight: 700;
  margin: 0;
  color: #0f172a;
}

.pwa-abi .abi-status {
  font-size: .68rem;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
}

.pwa-abi .abi-status .dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34,197,94,.22);
}

.pwa-abi .abi-topbar-actions {
  margin-left: auto;
  display: flex;
  gap: .25rem;
}

.pwa-abi .abi-circle-btn {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 0;
  display: grid;
  place-items: center;
  background: #f1f5f9;
  color: #0f172a;
  cursor: pointer;
  font-size: .8rem;
}

/* INTRO CARD */
.pwa-abi .abi-intro-card {
  border-radius: 1.05rem;
  padding: .7rem .75rem;
  background: linear-gradient(135deg, #ecfdf5, #eff6ff);
  border: 1px solid rgba(148,163,184,.35);
  box-shadow: 0 10px 24px rgba(15,23,42,.05);
  display: flex;
  flex-direction: column;
  gap: .55rem;
}

.pwa-abi .abi-intro-main {
  display: flex;
  gap: .7rem;
  align-items: flex-start;
}

.pwa-abi .abi-intro-avatar {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: linear-gradient(135deg, #0B7A75, #14b8a6);
  display: grid;
  place-items: center;
  color: #ecfdf5;
  font-size: .84rem;
  font-weight: 700;
  letter-spacing: .03em;
  flex-shrink: 0;
}

.pwa-abi .abi-intro-text {
  flex: 1;
  min-width: 0;
}

.pwa-abi .abi-intro-title {
  font-size: .88rem;
  font-weight: 700;
  margin-bottom: .15rem;
  color: #022c22;
}

.pwa-abi .abi-intro-text p {
  font-size: .72rem;
  margin-bottom: .25rem;
  color: #0f172a;
  opacity: .9;
}

.pwa-abi .abi-intro-text ul {
  padding-left: 1rem;
  margin: 0;
}

.pwa-abi .abi-intro-text li {
  font-size: .68rem;
  margin-bottom: .12rem;
  color: #03695d;
}

.pwa-abi .abi-end-btn {
  align-self: flex-end;
  border-radius: 999px;
  border: 0;
  padding: .25rem .65rem;
  background: rgba(248,113,113,.1);
  color: #b91c1c;
  font-size: .7rem;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  cursor: pointer;
}

.pwa-abi .abi-end-btn i {
  font-size: .8rem;
}

/* CHAT AREA */
.pwa-abi .abi-chat-scroll {
  margin-top: .1rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
  padding: .1rem .05rem .4rem;
  max-height: calc(100vh - var(--app-header-h,64px) - var(--bottom-nav-h,72px) - 180px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* satu message */
.pwa-abi .abi-msg {
  width: 100%;
}

.pwa-abi .abi-msg-inner {
  display: flex;
  align-items: flex-end;
  gap: .4rem;
}

/* Abi di kiri */
.pwa-abi .abi-msg.is-abi .abi-msg-inner {
  justify-content: flex-start;
}

/* User di kanan */
.pwa-abi .abi-msg.is-user .abi-msg-inner {
  justify-content: flex-end;
}

.pwa-abi .abi-msg-avatar {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #0B7A75;
  color: #e0f2f1;
  font-size: .65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pwa-abi .abi-msg-body {
  max-width: 80%;
}

.pwa-abi .abi-msg-body-user {
  text-align: right;
}

.pwa-abi .abi-msg-name {
  font-size: .64rem;
  color: #94a3b8;
  margin-bottom: .1rem;
}

/* bubble */
.pwa-abi .abi-bubble {
  font-size: .78rem;
  line-height: 1.45;
  padding: .5rem .75rem;
  border-radius: 1rem;
  box-shadow: 0 6px 14px rgba(15,23,42,.06);
}

/* Abi */
.pwa-abi .abi-bubble-abi {
  background: #ffffff;
  color: #0f172a;
  border-bottom-left-radius: .25rem;
}

/* User */
.pwa-abi .abi-bubble-user {
  background: linear-gradient(135deg, #0B7A75, #22c55e);
  color: #f9fafb;
  border-bottom-right-radius: .25rem;
}

/* TYPING */
.pwa-abi .abi-typing-line {
  margin-top: .1rem;
  display: flex;
  align-items: center;
  gap: .4rem;
}

.pwa-abi .abi-msg-avatar-typing {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #0B7A75;
  color: #e0f2f1;
  font-size: .62rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pwa-abi .abi-typing-bubble {
  padding: .35rem .55rem;
  border-radius: 999px;
  background: #e0f2fe;
  display: inline-flex;
  gap: .2rem;
}

.pwa-abi .abi-typing-bubble span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #6366f1;
  animation: abi-dot 1s infinite ease-in-out;
}

.pwa-abi .abi-typing-bubble span:nth-child(2) { animation-delay: .15s; }
.pwa-abi .abi-typing-bubble span:nth-child(3) { animation-delay: .3s; }

@keyframes abi-dot {
  0%, 80%, 100% { transform: translateY(0); opacity: .4; }
  40% { transform: translateY(-3px); opacity: 1; }
}

/* INPUT BAR (FIXED) */
.pwa-abi .abi-input-row {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--bottom-nav-h, 72px) + 8px);
  width: min(100% - 1.5rem, 780px);
  display: flex;
  align-items: flex-end;
  gap: .45rem;
  padding: .3rem .2rem;
  background: transparent;
  z-index: 50;
}

.pwa-abi .abi-input-row::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: linear-gradient(to top, rgba(248,250,252,.96), rgba(248,250,252,.6));
  box-shadow: 0 -4px 20px rgba(15,23,42,.12);
  z-index: -1;
}

.pwa-abi .abi-input {
  flex: 1;
  resize: none;
  font-size: .8rem;
  padding: .55rem .8rem;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  max-height: 90px;
  background: #ffffff;
}

.pwa-abi .abi-send-btn {
  border: 0;
  border-radius: 999px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  background: #0B7A75;
  color: #f9fafb;
  box-shadow: 0 10px 24px rgba(11,122,117,.35);
  flex-shrink: 0;
  cursor: pointer;
}

.pwa-abi .abi-send-btn i {
  font-size: .8rem;
}

.pwa-abi .abi-send-btn:active {
  transform: translateY(1px);
  box-shadow: 0 6px 16px rgba(11,122,117,.28);
}

/* RESPONSIVE */
@media (max-width: 480px) {
  .pwa-abi .abi-intro-card {
    padding: .6rem .65rem;
  }
  .pwa-abi .abi-msg-body {
    max-width: 85%;
  }
}
