/* Core */
#ol-chatbot {
  position: fixed !important;
  bottom: 0;
  right: 16px;
  left: auto;
  width: 360px;
  max-width: 100%;
  margin: 0;
  height: 80vh;
  background: #ffffff;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  z-index: 999999 !important;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(0, 0, 0, 0.08);
  transition: transform 0.25s ease, opacity 0.25s ease;
}

/* Minimise behaviour (chat box should not "disappear" permanently) */
#ol-chatbot.ol-minimised {
  transform: translateY(16px);
  opacity: 0;
  pointer-events: none;
}

/* Header */
#ol-chatbot-header {
  background: #074EBB;
  color: #ffffff;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

#ol-chatbot-header h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
  color: #ffffff; /* ensure solid white */
}

#ol-chatbot-minimise {
  background: transparent;
  border: none;
  color: #ffffff; /* solid white icon */
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
  margin: 0;
  border-radius: 999px;
}

#ol-chatbot-minimise:hover {
  background: rgba(255,255,255,0.16);
}

/* Messages */
#ol-chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f8f9fa;
  display: flex;
  flex-direction: column;
}

.ol-chat-event {
  align-self: center;
  margin: 4px 0 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(7, 78, 187, 0.08);
  color: #4c6278;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.15px;
}

.ol-message .ol-name {
  font-size: 11px;
  letter-spacing: 0.2px;
  color: #0a2540;
  margin-bottom: 2px;
  font-weight: 600;
}

.ol-message .ol-message-content {
  color: #1e1e1e !important;
}

.ol-message .ol-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: transparent;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ol-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ol-avatar-initial {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background-color: #074EBB;
  color: #ffffff;
  font-weight: 700;
  font-size: 12px;
}

/* Agent avatars */
.ol-avatar-agent {
  background-color: transparent;
}

/* Visitor avatar: use provided SVG directly, no extra overlay */
.ol-user-message .ol-avatar {
  background-image: none !important;
  border-radius: 50%;
  background-color: transparent;
  border: none;
  position: relative;
}

.ol-user-message .ol-avatar::before,
.ol-user-message .ol-avatar::after {
  content: none;
}

.ol-message {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 18px;
  max-width: 86%;
  line-height: 1.45;
  word-wrap: break-word;
  font-size: 14.5px;
}

.ol-bot-message {
  background: #e6f0ff;
  color: #0a2540;
  align-self: flex-start;
  border-bottom-left-radius: 6px;
}

.ol-user-message {
  background: #dfe9ff;
  color: #1e1e1e;
  align-self: flex-end;
  border-bottom-right-radius: 6px;
  margin-left: auto;
  align-items: center;
  flex-direction: row-reverse;
}

.ol-user-message .ol-message-content {
  color: #1e1e1e !important;
}

/* Input */
#ol-chatbot-input {
  display: flex;
  padding: 12px 16px;
  border-top: 1px solid #e0e0e0;
  background: white;
}

#ol-chatbot-input input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #ddd;
  border-radius: 24px;
  outline: none;
  font-size: 14.5px;
  transition: border-color 0.2s;
  color: #1e1e1e !important;
}

#ol-chatbot-input input:focus {
  border-color: #074EBB;
}

#ol-chatbot-input button {
  margin-left: 12px;
  background: #074EBB;
  color: white;
  border: none;
  border-radius: 24px;
  padding: 12px 18px;
  cursor: pointer;
  font-weight: 700;
  transition: background 0.2s;
}

#ol-chatbot-input button:hover {
  background: #063e96;
}

/* Launcher bubble */
#ol-chatbot-launcher {
  position: fixed !important;
  bottom: 22px;
  right: 22px;
  left: auto;
  z-index: 999999 !important;
  background: linear-gradient(135deg, #0f62ff, #074EBB) !important;
  color: #fff !important;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 999px;
  padding: 10px 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(0,0,0,0.18);
  max-width: 260px;
  white-space: nowrap;
}

#ol-chatbot-launcher svg {
  width: 16px;
  height: 16px;
  fill: #ffffff !important;
}

#ol-chatbot-launcher .ol-launcher-text {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.05px;
}

.ol-launcher-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #1CA3AF;
  box-shadow: 0 0 0 4px rgba(28,163,175,0.18);
}

.ol-launcher-text {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.1px;
}

/* Nudge popup */
.ol-nudge {
  position: fixed !important;
  bottom: 76px;
  right: 22px;
  z-index: 999999 !important;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 14px;
  padding: 10px 12px;
  width: 260px;
  box-shadow: 0 12px 34px rgba(0,0,0,0.16);
  cursor: pointer;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.ol-nudge-inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ol-nudge-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

.ol-nudge-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ol-nudge-copy {
  flex: 1;
}

.ol-nudge-close {
  all: unset;                 /* reset any inherited styles */
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  background-color: #f9fafb;  /* softer light grey */
  border: none;               /* no stroke */
  color: #9ca3af;             /* lighter grey X */
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-sizing: border-box;
}

.ol-nudge-title {
  font-weight: 800;
  font-size: 14px;
  color: #0a2540;
  margin-bottom: 2px;
}

.ol-nudge-sub {
  font-size: 12.5px;
  color: #41566e;
}

/* Typing dots (aligned under bot, calmer animation) */
.ol-typing {
  padding: 0 16px 14px 16px;
  display: flex;
  justify-content: flex-start;
}

.ol-typing-bubble {
  background: #e6f0ff;
  border-radius: 999px;
  padding: 10px 14px;
  display: inline-flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(7,78,187,0.10);
}

.dot {
  width: 5px;
  height: 5px;
  background: #0f62ff;
  border-radius: 50%;
  opacity: 0.75;
  animation: bounce 2.4s infinite ease-in-out;
}

.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Intro overlay (form inside chat) */
.ol-chatbot-intro-overlay {
  position: absolute;
  inset: 0;
  background: rgba(7, 78, 187, 0.82);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 56px 0 12px;
  z-index: 5;
  box-sizing: border-box;
  pointer-events: none;
  overflow: hidden;
}

.ol-intro-card {
  background: #ffffff;
  width: 100%;
  max-width: 380px;
  border-radius: 16px;
  padding: 14px 16px 18px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
  max-height: 72vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
  pointer-events: auto;
}

.ol-intro-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
  color: #0a2540;
}

.ol-intro-sub {
  font-size: 13px;
  color: #41566e;
  margin-bottom: 10px;
}

.ol-intro-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.ol-intro-grid label span {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
  color: #0a2540;
}

.ol-intro-grid input,
.ol-intro-grid select {
  width: 100%;
  box-sizing: border-box;
  border-radius: 10px;
  border: 1px solid #d0d7e2;
  padding: 8px 10px;
  font-size: 13px;
}

.ol-intro-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.ol-intro-actions button {
  flex: 1;
}

.ol-intro-note {
  font-size: 11px;
  color: #516476;
}

.ol-intro-title {
  font-weight: 900;
  font-size: 16px;
  color: #0a2540;
  margin-bottom: 6px;
  letter-spacing: -0.2px;
}

.ol-intro-sub {
  font-size: 13px;
  color: #425a70;
  margin-bottom: 12px;
  line-height: 1.35;
}

.ol-intro-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ol-intro-grid label span {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #0a2540;
  margin-bottom: 6px;
}

.ol-intro-grid input,
.ol-intro-grid select {
  width: 100%;
  border: 1px solid #d7deea;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13.5px;
  outline: none;
  color: #1e1e1e;
}

.ol-intro-grid input:focus,
.ol-intro-grid select:focus {
  border-color: #074EBB;
}

.ol-intro-consent {
  display: flex;
  flex-direction: column;  /* stack checkbox + text on all screens */
  align-items: flex-start;
  gap: 4px;
  font-size: 12.5px;
  color: #22384f;
  padding-top: 4px;
  width: 100%;
  box-sizing: border-box;
  text-align: left !important;
}

.ol-intro-consent input {
  margin-top: 0;
  flex-shrink: 0;
  accent-color: #1CA3AF;
}

.ol-intro-consent-text {
  flex: 1;
  text-align: left !important;
  display: block;
  line-height: 1.35;
  margin: 0;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.ol-intro-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.ol-intro-start {
  flex: 1;
  background: linear-gradient(135deg, #0f62ff, #074EBB);
  border: none;
  color: #fff;
  border-radius: 999px;
  padding: 11px 14px;
  font-weight: 800;
  cursor: pointer;
  font-size: 13px;
  box-shadow: 0 6px 18px rgba(7, 78, 187, 0.35);
}

.ol-intro-start:hover { background: linear-gradient(135deg, #0d54db, #063e96); }

.ol-intro-skip {
  background: transparent;
  border: 1px solid #c7d2e5;
  color: #0a2540;
  border-radius: 999px;
  padding: 11px 14px;
  font-weight: 700;
  cursor: pointer;
  font-size: 13px;
}

.ol-intro-skip:hover { background: #eef3fb; }

.ol-intro-note {
  margin-top: 10px;
  font-size: 11.5px;
  color: #546b84;
  line-height: 1.3;
}

/* Utilities */
.hidden { display: none !important; }

/* Scrollbar */
#ol-chatbot-messages::-webkit-scrollbar { width: 6px; }
#ol-chatbot-messages::-webkit-scrollbar-track { background: #f1f1f1; }
#ol-chatbot-messages::-webkit-scrollbar-thumb { background: #074EBB; border-radius: 3px; }

/* Mobile tweaks */
@media (max-width: 520px) {
  #ol-chatbot {
    right: 0;
    left: 0;
    width: 80%;
    max-width: 380px;
    margin: 0 auto;
  }
  #ol-chatbot-launcher { right: 16px; bottom: 16px; }
  .ol-nudge { right: 16px; bottom: 80px; width: 230px; }

  .ol-chatbot-intro-overlay {
    padding: 52px 0 8px;
    align-items: flex-start;
    overflow-y: auto;
  }

  .ol-intro-card {
    max-width: 100%;
    height: auto;
    margin: 8px 10px 16px;
    border-radius: 14px;
  }

  /* Stack consent checkbox + text so they never overflow horizontally */
  .ol-intro-consent {
    flex-direction: column;
    align-items: flex-start;
  }

  .ol-intro-consent input {
    margin-top: 0;
  }
}
