/* FlagOff.my AI assistant widget */
.fo-chatbot {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 120;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: #0f172a;
}
.fo-chatbot * { box-sizing: border-box; }
.fo-chatbot-present .hp-backtop { right: 148px; }

.fo-chat-launch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: auto;
  min-width: 56px;
  height: 50px;
  padding: 0 16px 0 13px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 999px;
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(15, 23, 42, .28);
  transition: transform .18s ease, box-shadow .18s ease;
}
.fo-chat-launch-icon {
  width: 22px;
  height: 22px;
  display: block;
  flex: 0 0 22px;
}
.fo-chat-launch-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .01em;
  white-space: nowrap;
}
.fo-chat-launch:hover { transform: translateY(-2px); box-shadow: 0 16px 34px rgba(15, 23, 42, .34); }
.fo-chat-launch:focus-visible { outline: 3px solid rgba(249, 115, 22, .55); outline-offset: 3px; }
.fo-chat-launch .fo-chat-launch-dot {
  position: absolute;
  width: 10px;
  height: 10px;
  margin: -30px 0 0 30px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid #fff;
}

.fo-chat-panel {
  position: absolute;
  right: 0;
  bottom: 80px;
  display: flex;
  flex-direction: column;
  width: 360px;
  max-width: calc(100vw - 24px);
  height: 520px;
  max-height: calc(100vh - 110px);
  overflow: hidden;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .22);
}
.fo-chat-panel[hidden] { display: none !important; }

.fo-chat-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: #fff;
}
.fo-chat-head-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: rgba(249, 115, 22, .18);
  color: #fdba74;
}
.fo-chat-head-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}
.fo-chat-head-text { min-width: 0; flex: 1; }
.fo-chat-head-text strong { display: block; font-size: 12.5px; line-height: 1.2; }
.fo-chat-head-text span { display: block; color: #94a3b8; font-size: 9.5px; margin-top: 2px; }
.fo-chat-close {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 8px;
  background: transparent;
  color: #cbd5e1;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.fo-chat-close:hover { background: rgba(255, 255, 255, .08); color: #fff; }

.fo-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.fo-chat-msg {
  max-width: 88%;
  padding: 8px 10px;
  border-radius: 11px;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.fo-chat-msg--bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid #e2e8f0;
  color: #334155;
  border-bottom-left-radius: 4px;
}
.fo-chat-msg--user {
  align-self: flex-end;
  background: #ea580c;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.fo-chat-msg--error {
  align-self: flex-start;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}
.fo-chat-typing {
  align-self: flex-start;
  display: inline-flex;
  gap: 3px;
  padding: 9px 11px;
  border-radius: 11px;
  border-bottom-left-radius: 4px;
  background: #fff;
  border: 1px solid #e2e8f0;
}
.fo-chat-typing i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #94a3b8;
  animation: foChatDot 1s infinite ease-in-out;
}
.fo-chat-typing i:nth-child(2) { animation-delay: .15s; }
.fo-chat-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes foChatDot { 0%, 80%, 100% { opacity: .35; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }

.fo-chat-notice {
  padding: 6px 12px;
  background: #fff7ed;
  border-top: 1px solid #fed7aa;
  color: #9a3412;
  font-size: 9px;
  line-height: 1.35;
}
.fo-chat-form {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  padding: 9px 10px;
  background: #fff;
  border-top: 1px solid #e2e8f0;
}
.fo-chat-input {
  flex: 1;
  min-height: 38px;
  max-height: 92px;
  resize: none;
  padding: 9px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  background: #fff;
  color: #0f172a;
  font: inherit;
  font-size: 12px;
  line-height: 1.35;
}
.fo-chat-input:focus { outline: 2px solid rgba(249, 115, 22, .35); outline-offset: 1px; border-color: #f97316; }
.fo-chat-send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 9px;
  background: #ea580c;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
}
.fo-chat-send:disabled { opacity: .45; cursor: not-allowed; }
.fo-chat-send:hover:not(:disabled) { background: #c2410c; }

@media (max-width: 560px) {
  .fo-chatbot { right: 10px; bottom: 10px; }
  .fo-chat-panel {
    right: 0;
    bottom: 64px;
    width: calc(100vw - 20px);
    height: 72vh;
    max-height: 560px;
  }
  .fo-chat-launch { height: 46px; padding: 0 14px 0 12px; }
  .fo-chat-launch-icon { width: 20px; height: 20px; flex-basis: 20px; }
  .fo-chat-launch-label { font-size: 11px; }
  .fo-chat-msg { font-size: 12px; }
  .fo-chatbot-present .hp-backtop { right: 132px; }
}

@media print {
  .fo-chatbot { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  .fo-chat-launch, .fo-chat-panel, .fo-chat-typing i { animation: none !important; transition: none !important; }
}
