/* ============================================================
   CHATBOT FAB & MODAL
   ============================================================ */

.chatbot-fab-wrapper {
  position: absolute;
  bottom: 80px;
  /* Above bottom nav */
  right: 16px;
  z-index: 90;
}

.chatbot-fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  transition:
    transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
    background 0.3s ease;
}

.chatbot-fab:active {
  transform: scale(0.9);
}

.chatbot-fab.status-aman {
  background: var(--emerald);
  box-shadow: 0 4px 20px var(--emerald-glow);
}

.chatbot-fab.status-waspada {
  background: var(--amber);
  box-shadow: 0 4px 20px var(--amber-glow);
}

.chatbot-fab.status-bahaya {
  background: var(--red);
  box-shadow: 0 4px 20px var(--red-glow);
}

.fab-pulse-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  animation: siaga-fab-pulse 2s infinite ease-out;
  pointer-events: none;
  border: 2px solid currentColor;
}

.chatbot-fab.status-aman .fab-pulse-ring {
  border-color: var(--emerald);
}

.chatbot-fab.status-waspada .fab-pulse-ring {
  border-color: var(--amber);
}

.chatbot-fab.status-bahaya .fab-pulse-ring {
  border-color: var(--red);
}

@keyframes siaga-fab-pulse {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.8;
  }

  100% {
    transform: translate(-50%, -50%) scale(1.6);
    opacity: 0;
  }
}

.chatbot-fab svg {
  width: 26px;
  height: 26px;
  position: relative;
  z-index: 2;
}

/* Modal Overlay */
.chat-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 30, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.chat-modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

/* Chat Bottom Sheet */
.chat-modal {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 430px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: 32px 32px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  height: 80vh;
  /* max height */
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
  pointer-events: none;
}

.chat-modal.active {
  transform: translateY(0);
  pointer-events: all;
}

.chat-modal-drag-handle {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 12px 0 4px;
}

.chat-modal-drag-handle span {
  width: 36px;
  height: 5px;
  background: var(--border-2);
  border-radius: 3px;
  opacity: 0.7;
}

.chat-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 24px 16px;
  border-bottom: 1px solid var(--border);
}

.bot-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--emerald-light);
  color: var(--emerald);
  display: flex;
  align-items: center;
  justify-content: center;
}

.bot-avatar svg {
  width: 24px;
  height: 24px;
}

.chat-close-btn {
  background: var(--off);
  border: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-3);
  cursor: pointer;
  transition: background 0.2s;
}

.chat-close-btn:active {
  background: var(--border);
}

.chat-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: none;
}

.chat-modal-body::-webkit-scrollbar {
  display: none;
}

.chat-msg {
  max-width: 80%;
  padding: 14px 18px;
  font-size: 13.5px;
  line-height: 1.5;
  border-radius: 20px;
  animation: fadeUp 0.3s ease;
  word-wrap: break-word;
}

.chat-msg-bot {
  background: var(--off);
  color: var(--ink);
  border: 1px solid var(--border);
  align-self: flex-start;
  border-bottom-left-radius: 6px;
}

.chat-msg-user {
  background: linear-gradient(135deg, var(--sky) 0%, #3b82f6 100%);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 6px;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.chat-modal-input-area {
  padding: 16px 24px calc(16px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, 0.9);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: center;
}

.chat-input {
  flex: 1;
  background: var(--off-2);
  border: 1px solid var(--border);
  padding: 14px 20px;
  border-radius: 24px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s;
}

.chat-input:focus {
  border-color: var(--sky);
}

.chat-input::placeholder {
  color: var(--ink-4);
  font-weight: 500;
}

.chat-send-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--sky);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(56, 189, 248, 0.4);
}

.chat-send-btn:active {
  transform: scale(0.9);
}

.chat-send-btn svg {
  width: 20px;
  height: 20px;
  position: relative;
  right: 1px;
  top: -1px;
}

/* ============================================================
   SIAGABOT — AI Briefing Assistant Styles
   Sistem warna: --emerald #10B981 / --amber #F59E0B / --red #E63946
   ============================================================ */
/* Chat Bottom Sheet */
.chat-modal {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 430px;
  margin: 0 auto;
  background: #ffffff;
  /* Sesuai gambar, background lebih solid/putih */
  border-radius: 32px 32px 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  height: 80vh;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
  pointer-events: none;
}

.chat-modal.active {
  transform: translateY(0);
  pointer-events: all;
}

.chat-modal-drag-handle {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 12px 0 4px;
}

.chat-modal-drag-handle span {
  width: 36px;
  height: 5px;
  background: var(--border-2);
  border-radius: 3px;
  opacity: 0.7;
}

.chat-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 24px 16px;
  border-bottom: 1px solid var(--off-2);
  /* Garis batas lebih halus */
}

/* --- PERUBAHAN WARNA AVATAR BOT --- */
.bot-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #ff8fa3;
  /* Warna pink/coral lembut sesuai gambar */
  color: #ffffff;
  /* Ikon warna putih */
  display: flex;
  align-items: center;
  justify-content: center;
}

.bot-avatar svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.chat-close-btn {
  background: var(--off);
  border: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-3);
  cursor: pointer;
  transition: background 0.2s;
}

.chat-close-btn:active {
  background: var(--border);
}

.chat-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: none;
  background: #fcfcfc;
  /* Warna background area chat sedikit abu sangat muda */
}

.chat-modal-body::-webkit-scrollbar {
  display: none;
}

/* --- PERUBAHAN BUBBLE CHAT --- */
.chat-msg {
  max-width: 80%;
  padding: 14px 18px;
  font-size: 13.5px;
  line-height: 1.5;
  animation: fadeUp 0.3s ease;
  word-wrap: break-word;
}

.chat-msg-bot {
  background: #ffffff;
  color: var(--ink);
  border: 1px solid var(--border);
  align-self: flex-start;
  /* Lengkungan lancip di KIRI ATAS sesuai gambar */
  border-radius: 4px 16px 16px 16px;
}

.chat-msg-user {
  /* Gradient merah/coral sesuai gambar */
  background: linear-gradient(135deg, #fb7185 0%, #ef4444 100%);
  color: #ffffff;
  align-self: flex-end;
  /* Lengkungan lancip di KANAN ATAS sesuai gambar */
  border-radius: 16px 4px 16px 16px;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

/* --- PERUBAHAN INPUT AREA --- */
.chat-modal-input-area {
  padding: 16px 24px calc(16px + env(safe-area-inset-bottom, 0px));
  background: #ffffff;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: center;
}

.chat-input {
  flex: 1;
  background: var(--off-2);
  /* Abu-abu kebiruan muda */
  border: 1px solid transparent;
  /* Hilangkan border default */
  padding: 14px 20px;
  border-radius: 24px;
  /* Bentuk pill bulat sempurna */
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

.chat-input:focus {
  background: #ffffff;
  border-color: var(--red);
  /* Outline merah saat diketik */
}

.chat-input::placeholder {
  color: var(--ink-4);
  font-weight: 500;
}

/* --- PERUBAHAN TOMBOL SEND --- */
.chat-send-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #ef4444;
  /* Merah solid */
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
  /* Shadow merah */
}

.chat-send-btn:active {
  transform: scale(0.9);
}

.chat-send-btn svg {
  width: 20px;
  height: 20px;
  position: relative;
  right: 1px;
  top: -1px;
}

/* ════════════════════════════════════
   MASKOT WRAPPER + ANIMASI
════════════════════════════════════ */
.bot-wrapper {
  flex-shrink: 0;
  width: 88px;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
}

@keyframes siaga-float-aman {

  0%,
  100% {
    transform: translateY(0px) rotate(-1deg);
  }

  50% {
    transform: translateY(-6px) rotate(1deg);
  }
}

@keyframes siaga-float-waspada {

  0%,
  100% {
    transform: translateY(0px) rotate(0deg);
  }

  30% {
    transform: translateY(-4px) rotate(-2deg);
  }

  60% {
    transform: translateY(-2px) rotate(2deg);
  }
}

@keyframes siaga-shake-bahaya {

  0%,
  100% {
    transform: translateX(0);
  }

  20% {
    transform: translateX(-4px) rotate(-3deg);
  }

  40% {
    transform: translateX(4px) rotate(3deg);
  }

  60% {
    transform: translateX(-3px) rotate(-2deg);
  }

  80% {
    transform: translateX(3px) rotate(1deg);
  }
}

@keyframes siaga-pulse-ring {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.6;
  }

  70% {
    transform: translate(-50%, -50%) scale(1.6);
    opacity: 0;
  }

  100% {
    transform: translate(-50%, -50%) scale(1.6);
    opacity: 0;
  }
}

.status-aman .bot-wrapper svg {
  animation: siaga-float-aman 3.5s ease-in-out infinite;
}

.status-waspada .bot-wrapper svg {
  animation: siaga-float-waspada 2.5s ease-in-out infinite;
}

.status-bahaya .bot-wrapper svg {
  animation: siaga-shake-bahaya 0.7s ease-in-out infinite;
}

/* Pulse ring — hanya muncul saat bahaya */
.bot-pulse-ring {
  position: absolute;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid #e63946;
  opacity: 0;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.status-bahaya .bot-pulse-ring {
  animation: siaga-pulse-ring 1.2s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.bot-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ════════════════════════════════════
   CHAT BUBBLE
════════════════════════════════════ */
.chat-bubble {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bubble-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.bot-name {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.status-aman .bot-name {
  color: #10b981;
}

.status-waspada .bot-name {
  color: #f59e0b;
}

.status-bahaya .bot-name {
  color: #e63946;
}

.status-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  transition: all 0.3s ease;
}

.status-aman .status-badge {
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.status-waspada .status-badge {
  background: rgba(245, 158, 11, 0.18);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.status-bahaya .status-badge {
  background: rgba(230, 57, 70, 0.18);
  color: #fca5a5;
  border: 1px solid rgba(230, 57, 70, 0.35);
}

.bubble-box {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px 16px 16px 16px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  transition: border-color 0.3s ease;
}

.status-aman .bubble-box {
  border-color: rgba(16, 185, 129, 0.2);
}

.status-waspada .bubble-box {
  border-color: rgba(245, 158, 11, 0.22);
}

.status-bahaya .bubble-box {
  border-color: rgba(230, 57, 70, 0.25);
}

.bubble-text {
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.65;
  color: rgba(33, 31, 31, 0.82);
  transition:
    opacity 0.15s ease,
    transform 0.15s ease;
}

.bubble-text.is-fading {
  opacity: 0;
  transform: translateY(4px);
}

.bubble-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2px;
}

.bubble-time {
  font-size: 10px;
  color: rgba(33, 31, 31, 0.82);
  font-weight: 500;
}

.bubble-hint {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.22);
  font-weight: 600;
  letter-spacing: 0.3px;
}

/* Typing dots */
@keyframes siaga-dot-bounce {

  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }

  40% {
    transform: translateY(-5px);
    opacity: 1;
  }
}

.siaga-typing {
  display: flex;
  gap: 4px;
  align-items: center;
  height: 20px;
}

.siaga-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  display: inline-block;
  animation: siaga-dot-bounce 1.2s infinite ease-in-out;
}

.siaga-typing span:nth-child(2) {
  animation-delay: 0.2s;
}

.siaga-typing span:nth-child(3) {
  animation-delay: 0.4s;
}

.hcard:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.hcard.now {
  background: var(--red);
  border-color: var(--red);
  box-shadow: 0 4px 16px var(--red-glow);
  transform: scale(1.04) translateY(-2px);
}

.hcard .ht {
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-4);
}

.hcard.now .ht {
  color: rgba(255, 255, 255, 0.85);
}

.hcard .hi {
  font-size: 22px;
  margin: 5px 0;
}

.hcard .hv {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
}

.hcard.now .hv {
  color: #fff;
}

/* 7-day forecast */
.forecast-item {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  gap: 10px;
  transition: background 0.15s;
}

.forecast-item:last-child {
  border-bottom: none;
}

.forecast-item:hover {
  background: var(--off);
}

.fi-day {
  font-size: 13px;
  font-weight: 700;
  width: 60px;
  color: var(--ink-2);
}

.fi-icon {
  font-size: 22px;
  width: 28px;
  text-align: center;
}

.fi-bar-wrap {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--off-2);
  overflow: hidden;
}

.fi-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--sky), #3b82f6);
  transition: width 0.8s ease;
}

.fi-pct {
  font-size: 11px;
  font-weight: 700;
  color: #3b82f6;
  width: 32px;
  text-align: right;
}

.fi-t {
  display: flex;
  gap: 5px;
  width: 50px;
  justify-content: flex-end;
}

.fi-hi {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
}

.fi-lo {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-4);
}