/* Mentari chat — custom FAB + bottom-sheet, port dari putu-chat.css (AskPutu).
   Desain sama persis, hanya pewarnaan disesuaikan ke tema GuestApp
   (--teal mengikuti PrimaryColor hotel, default #1FA39D). */
.mentari-fab-wrap {
  position: fixed;
  z-index: 999;
  width: 62px;
  height: 62px;
  right: max(16px, calc(50% - 240px + 16px));
  bottom: 100px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  will-change: transform;
  transition: opacity .2s;
}
.mentari-fab-wrap.mentari-snapping { transition: transform .28s cubic-bezier(.32, .72, 0, 1); }
.mentari-pulse {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: rgba(31, 163, 157, .12);
  animation: mentari-pulse 1.4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes mentari-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.06); opacity: .75; }
}
.mentari-fab {
  position: relative;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 2.5px solid var(--teal, #1FA39D);
  background: #fff;
  padding: 0;
  cursor: grab;
  overflow: visible;
  box-shadow: 0 4px 12px rgba(31, 163, 157, .35);
  display: flex;
  align-items: center;
  justify-content: center;
}
.mentari-fab:active { cursor: grabbing; }
.mentari-fab img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  pointer-events: none;
}
.mentari-fab-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--teal, #1FA39D);
  background: #fff;
  border-radius: 50%;
}
.mentari-fab-fallback svg { width: 26px; height: 26px; }
.mentari-fab img:not([style*="none"]) + .mentari-fab-fallback { display: none; }
.mentari-online {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #4CAF50;
  border: 1.5px solid #fff;
  pointer-events: none;
}

/* ---- bottom sheet ---- */
.mentari-root {
  position: fixed;
  inset: 0;
  z-index: 9999;
}
.mentari-root[hidden] { display: none; }
.mentari-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .4);
}
.mentari-sheet {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 0;
  bottom: 0;
  width: 100%;
  max-width: 480px;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  background: #fff;
  border-radius: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: mentari-up .28s cubic-bezier(.32, .72, 0, 1);
}
@keyframes mentari-up { from { transform: translate(-50%, 24px); opacity: .6; } to { transform: translate(-50%, 0); opacity: 1; } }
.mentari-handle {
  display: none;
}
.mentari-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(14px + env(safe-area-inset-top)) 20px 14px;
  border-bottom: 1px solid #E2E8F0;
  flex-shrink: 0;
}
.mentari-title-row { display: flex; align-items: center; gap: 6px; }
.mentari-title-row strong {
  font-family: 'Fraunces', serif;
  font-size: 18px;
  color: var(--teal, #1FA39D);
  letter-spacing: .2px;
}
.mentari-ai-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .4px;
  background: #E0F2F1;
  color: #0F766E;
  border-radius: 999px;
  padding: 2px 7px;
}
.mentari-subtitle { font-size: 12px; color: #64748B; display: block; margin-top: 2px; }
.mentari-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #F8FAFC;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1E293B;
}
.mentari-close svg { width: 18px; height: 18px; }

.mentari-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  -webkit-overflow-scrolling: touch;
}
.mentari-row { display: flex; margin-bottom: 12px; max-width: 82%; }
.mentari-row.ai { align-self: flex-start; align-items: flex-end; gap: 8px; }
.mentari-row.user { align-self: flex-end; justify-content: flex-end; }
.mentari-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--teal, #1FA39D);
  object-fit: cover;
  flex-shrink: 0;
  background: #fff;
}
.mentari-col { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.mentari-row.user .mentari-col { align-items: flex-end; }
.mentari-bubble {
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.mentari-row.ai .mentari-bubble {
  background: #fff;
  color: #1E293B;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
  border: 1px solid #F1F5F9;
}
.mentari-row.user .mentari-bubble {
  background: var(--teal, #1FA39D);
  color: #fff;
  border-radius: 16px;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 4px rgba(20, 124, 119, .2);
}
.mentari-time { font-size: 11px; color: #CBD5E1; margin: 0 2px; }

/* ---- rich text di bubble AI (markdown: bold, italic, list, link, kode) ---- */
.mentari-bubble .mentari-p { margin: 0 0 6px; }
.mentari-bubble .mentari-p:last-child { margin-bottom: 0; }
.mentari-bubble strong { font-weight: 700; }
.mentari-bubble em { font-style: italic; }
.mentari-bubble del { text-decoration: line-through; opacity: .7; }
.mentari-bubble code.mentari-code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12.5px;
  background: rgba(30, 41, 59, .09);
  padding: 1px 6px;
  border-radius: 6px;
}
.mentari-bubble pre.mentari-pre {
  margin: 8px 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #1E293B;
  color: #F8FAFC;
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.5;
  white-space: pre;
}
.mentari-bubble pre.mentari-pre code {
  background: transparent;
  padding: 0;
  color: inherit;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}
.mentari-bubble ul.mentari-list, .mentari-bubble ol.mentari-list { margin: 6px 0 8px; padding-left: 20px; }
.mentari-bubble ul.mentari-list:last-child, .mentari-bubble ol.mentari-list:last-child,
.mentari-bubble pre.mentari-pre:last-child, .mentari-bubble .mentari-h:last-child { margin-bottom: 0; }
.mentari-bubble li { margin: 3px 0; }
.mentari-bubble li::marker { color: var(--teal, #1FA39D); font-weight: 700; }
.mentari-bubble .mentari-h { font-weight: 700; font-size: 14.5px; margin: 8px 0 4px; }
.mentari-bubble .mentari-h:first-child { margin-top: 0; }
.mentari-row.ai .mentari-bubble a { color: #147C77; font-weight: 600; }
.mentari-row.user .mentari-bubble a { color: #fff; }
.mentari-typing {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #fff;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
  border: 1px solid #F1F5F9;
}
.mentari-typing i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal, #1FA39D);
  animation: mentari-blink 1s ease-in-out infinite;
}
.mentari-typing i:nth-child(2) { animation-delay: .2s; }
.mentari-typing i:nth-child(3) { animation-delay: .4s; }
@keyframes mentari-blink { 0%, 100% { opacity: .25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-4px); } }

.mentari-dock {
  border-top: 1px solid #E2E8F0;
  background: #fff;
  padding-bottom: env(safe-area-inset-bottom);
  flex-shrink: 0;
}
.mentari-input-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
}
.mentari-input-row textarea {
  flex: 1;
  min-height: 44px;
  max-height: 100px;
  resize: none;
  background: #F8FAFC;
  border: 1.2px solid transparent;
  border-radius: 22px;
  padding: 12px 18px;
  font-size: 14px;
  line-height: 1.45;
  color: #1E293B;
  font-family: 'Inter', sans-serif;
}
.mentari-input-row textarea:focus { outline: none; border-color: var(--teal, #1FA39D); background: #fff; }
.mentari-send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  flex-shrink: 0;
  background: var(--teal, #1FA39D);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 6px rgba(20, 124, 119, .3);
}
.mentari-send:disabled { opacity: .45; box-shadow: none; }
.mentari-send svg { width: 18px; height: 18px; }

body.mentari-open { overflow: hidden; }
body.mentari-open .bottom-nav { opacity: 0; pointer-events: none; transform: translateY(100%); }
@media (prefers-reduced-motion: reduce) {
  .mentari-pulse, .mentari-typing i, .mentari-sheet { animation: none; }
}
