.bubble a {
  color: #007bff;
  text-decoration: underline;
}


/* ------------------------
   Luna Chat Widget CSS
------------------------ */

#luna-widget {
  position: fixed;
  top: 60%;       /* place slightly below middle (50%) */
  right: 20px;
  transform: translateY(-50%); /* optional, centers relative to top */
  font-family: Arial, sans-serif;
  z-index: 9999;
}

/* ------------------------
   Avatar styling
------------------------ */
#luna-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  cursor: pointer;
  animation: wave 1.5s infinite alternate, glowPulse 1.5s infinite alternate;
  transform-origin: bottom center;
  transition: transform 0.3s;
}



/* Glow pulse animation */
@keyframes glowPulse {
  0% { box-shadow: 0 0 4px 1px rgba(0, 123, 255, 0.3); }
  100% { box-shadow: 0 0 12px 4px rgba(0, 123, 255, 0.7); }
}

/* ------------------------
   Luna Toggle (X) Button over avatar
------------------------ */
#luna-toggle-icon {
  position: fixed;          /* same as avatar */
  bottom: px;             /* same bottom as avatar */
  right: 20px;              /* same right as avatar */
  width: 50px;              /* same size as avatar */
  height: 50px;
  background-color: #007bff; /* blue circle */
  color: #fff;               /* white X */
  border-radius: 50%;
  display: none;             /* hidden by default */
  justify-content: center;
  align-items: center;
  cursor: pointer;
  font-weight: bold;
  font-size: 24px;
  text-align: center;
  line-height: 50px;         /* center the X */
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  z-index: 10001;
  transition: transform 0.2s ease;
}

#luna-toggle-icon:hover {
  transform: scale(1.1);
}


/* ------------------------
   Luna Popup
------------------------ */
/* ------------------------
   Luna Popup (Compact, tight)
------------------------ */
#luna-popup {
  position: fixed;
  bottom: 240px;          /* just above avatar */
  right: 20px;           /* align with avatar */
  background: #fff;
  border-radius: 12px;
  padding: 4px 10px;     /* reduced padding */
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  display: none;
  font-size: 12px;
  width: auto;           /* fit content */
  max-width: 180px;      /* optional max width */
  text-align: center;
  line-height: 1.2;      /* tighter line height */
  z-index: 10000;
  animation: popupFade 0.4s ease-in-out;
}

/* Close button outside top-right */
#popup-close {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: red;
  color: white;
  border: none;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
}

/* Popup text styles */
#luna-popup p {
  margin: 0;
  padding: 0;
}

#luna-popup p strong {
  color: #007bff;   /* blue */
  font-weight: bold;
}

#luna-popup p em {
  color: #888;       /* grey */
  font-style: italic;
}

/* Popup fade animation */
@keyframes popupFade {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ------------------------
   Chatbox styling
------------------------ */
#luna-chatbox {
  display: none;
  flex-direction: column;
  position: fixed;
  bottom: 240px; /* place above avatar */
  right: 20px;
  width: 300px;
  height: 400px;
  max-height: 400px;
  border: 1px solid #ccc;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  overflow: hidden;
  z-index: 9999;
}

/* Header inside chatbox */
#luna-header {
  display: flex;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid #eee;
  background: #f9f9f9;
}

.luna-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin-right: 10px;
}

#luna-header div {
  flex: 1;
}

#luna-header small {
  font-style: italic;
  color: #666;
  display: block;
}

#status {
  display: flex;
  align-items: center;
  font-size: 12px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 5px;
}

.status-dot.online {
  background: #0f0;
}

.status-dot.typing {
  background: #0af;
  animation: blink 1s infinite;
}

@keyframes blink {
  0%, 50%, 100% { opacity: 1; }
  25%, 75% { opacity: 0; }
}

/* Messages */
#luna-messages {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
}

.message {
  display: flex;
  align-items: flex-end;
  margin-bottom: 10px;
}

.user-message { justify-content: flex-end; }
.luna-message { justify-content: flex-start; }

.user-message span, .luna-message span {
  padding: 8px 12px;
  border-radius: 15px;
  max-width: 70%;
  display: inline-block;
  position: relative;
}

/* Bubble colors */
.user-message span { background: #007bff; color: #fff; }
.luna-message span { background: #eee; color: #333; }

/* Bubble pointers */
.user-message span::after {
  content: "";
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  border-width: 8px 0 8px 8px;
  border-style: solid;
  border-color: transparent transparent transparent #007bff;
}

.luna-message span::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
  border-width: 8px 8px 8px 0;
  border-style: solid;
  border-color: transparent #eee transparent transparent;
}

/* Timestamp */
.timestamp {
  display: block;
  font-size: 10px;
  color: #888;
  margin-top: 2px;
}

/* Typing dots animation */
.typing-dots {
  display: flex;
  justify-content: flex-start;
  gap: 3px;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  background: #ccc;
  border-radius: 50%;
  animation: blinkDots 1.4s infinite both;
}

.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes blinkDots {
  0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
  40% { transform: scale(1); opacity: 1; }
}

/* Input wrapper */
#luna-input-wrapper {
  display: flex;
  border-top: 1px solid #eee;
}

#luna-input {
  flex: 1;
  padding: 10px;
  border: none;
  outline: none;
}

#luna-send {
  padding: 0 15px;
  cursor: pointer;
  background: #007bff;
  color: #fff;
  border: none;
}

/* ------------------------
   Responsive Mobile View
------------------------ */
@media screen and (max-width: 768px) {
  #luna-widget { width: 100%; bottom: 0; right: 0; }
  #luna-chatbox {
    width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
  #luna-messages { max-height: calc(100vh - 120px); }
  #luna-input-wrapper { padding: 5px; }
  #luna-input { padding: 10px; }
  #luna-send { padding: 0 10px; }
}
@media screen and (max-width: 768px) {
  /* Optional: adjust size for mobile */
  #luna-widget {
    width: 60px;        /* floating avatar size */
    bottom: 240px;
    right: 20px;
  }

  #luna-chatbox {
    width: 90%;         /* chatbox width */
    max-width: 400px;
    height: 70vh;
    bottom: 240px;
    right: 20px;
  }

  #luna-messages {
    max-height: calc(70vh - 120px);
  }
}
