/* Celestify — CelestInfo AI Chatbot Widget */

/* ── Toggle Button ── */
#ci-chatbot-toggle {
  position: fixed;
  bottom: 128px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6C63FF, #5a52e0);
  border: none;
  cursor: pointer;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(108, 99, 255, 0.4);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
#ci-chatbot-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(108, 99, 255, 0.55);
}
#ci-chatbot-toggle svg { width: 28px; height: 28px; fill: #fff; }
#ci-chatbot-toggle .ci-close-icon { display: none; }
#ci-chatbot-toggle.active .ci-chat-icon { display: none; }
#ci-chatbot-toggle.active .ci-close-icon { display: block; }

/* ── Notification Badge ── */
#ci-chatbot-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  background: #ff4757;
  border-radius: 50%;
  border: 2px solid #fff;
  display: none;
}
#ci-chatbot-badge.show { display: block; }

/* ── Auto-popup Tooltip ── */
#ci-chatbot-popup {
  position: fixed;
  bottom: 192px;
  right: 20px;
  background: #fff;
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  z-index: 9997;
  max-width: 260px;
  font-family: 'Manrope', sans-serif;
  font-size: 13.5px;
  color: #333;
  line-height: 1.5;
  display: none;
  animation: ci-fade-in 0.4s ease;
  cursor: pointer;
}
#ci-chatbot-popup.show { display: block; }
#ci-chatbot-popup::after {
  content: '';
  position: absolute;
  bottom: -8px;
  right: 24px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid #fff;
}
#ci-chatbot-popup .ci-popup-close {
  position: absolute;
  top: 4px;
  right: 8px;
  background: none;
  border: none;
  font-size: 16px;
  color: #999;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
#ci-chatbot-popup .ci-popup-close:hover { color: #333; }
#ci-chatbot-popup .ci-popup-name {
  font-weight: 700;
  color: #6C63FF;
  margin-bottom: 4px;
  font-size: 12px;
}

@keyframes ci-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Chat Panel ── */
#ci-chatbot-panel {
  position: fixed;
  bottom: 196px;
  right: 20px;
  width: 370px;
  max-height: 520px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  z-index: 9999;
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Manrope', sans-serif;
  animation: ci-slide-up 0.3s ease;
}
#ci-chatbot-panel.open { display: flex; }

@keyframes ci-slide-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Header ── */
.ci-chat-header {
  background: linear-gradient(135deg, #1a1a2e, #2d2b55);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.ci-chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6C63FF, #5a52e0);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: -0.5px;
}
.ci-chat-header-text h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}
.ci-chat-header-text p {
  margin: 2px 0 0;
  font-size: 12px;
  color: rgba(255,255,255,0.7);
}

/* ── Online dot ── */
.ci-chat-online {
  width: 8px;
  height: 8px;
  background: #2ecc71;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
  animation: ci-pulse 2s infinite;
}
@keyframes ci-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Messages Area ── */
.ci-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 280px;
  max-height: 340px;
  background: #f8f9fc;
}

/* ── Message Bubbles ── */
.ci-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  word-wrap: break-word;
}
.ci-msg-bot {
  background: #fff;
  color: #333;
  align-self: flex-start;
  border: 1px solid #e8e8f0;
  border-bottom-left-radius: 4px;
}
.ci-msg-user {
  background: linear-gradient(135deg, #6C63FF, #5a52e0);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.ci-msg-bot a {
  color: #6C63FF;
  text-decoration: none;
  font-weight: 600;
}
.ci-msg-bot a:hover { text-decoration: underline; }

/* ── Quick Replies ── */
.ci-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.ci-quick-btn {
  background: #f0eeff;
  color: #6C63FF;
  border: 1px solid #ddd8ff;
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  font-family: 'Manrope', sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
}
.ci-quick-btn:hover {
  background: #6C63FF;
  color: #fff;
  border-color: #6C63FF;
}

/* ── Typing Indicator ── */
.ci-typing {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid #e8e8f0;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  max-width: 60px;
}
.ci-typing span {
  width: 7px;
  height: 7px;
  background: #b0b0c0;
  border-radius: 50%;
  animation: ci-bounce 1.4s infinite ease-in-out;
}
.ci-typing span:nth-child(1) { animation-delay: 0s; }
.ci-typing span:nth-child(2) { animation-delay: 0.2s; }
.ci-typing span:nth-child(3) { animation-delay: 0.4s; }

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

/* ── Input Area ── */
.ci-chat-input {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  border-top: 1px solid #eee;
  gap: 8px;
  flex-shrink: 0;
  background: #fff;
}
.ci-chat-input input {
  flex: 1;
  border: 1px solid #e0e0e8;
  border-radius: 24px;
  padding: 9px 16px;
  font-size: 13.5px;
  font-family: 'Manrope', sans-serif;
  outline: none;
  transition: border-color 0.2s;
}
.ci-chat-input input:focus { border-color: #6C63FF; }
.ci-chat-input input::placeholder { color: #aaa; }
.ci-chat-input button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #6C63FF;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}
.ci-chat-input button:hover { background: #5a52e0; }
.ci-chat-input button svg { width: 18px; height: 18px; fill: #fff; }

/* ── Powered By ── */
.ci-chat-powered {
  text-align: center;
  font-size: 10px;
  color: #bbb;
  padding: 4px 0 8px;
  background: #fff;
}

/* ══════════════════════════════════════════════
   TABLET (max-width: 768px)
   ══════════════════════════════════════════════ */
@media (max-width: 768px) {
  #ci-chatbot-toggle {
    bottom: 112px;
    right: 14px;
    width: 50px;
    height: 50px;
  }
  #ci-chatbot-toggle svg { width: 24px; height: 24px; }

  #ci-chatbot-popup {
    bottom: 170px;
    right: 14px;
    max-width: 220px;
    font-size: 13px;
    padding: 10px 14px;
  }

  #ci-chatbot-panel {
    width: 340px;
    right: 14px;
    bottom: 174px;
    max-height: 480px;
  }
  .ci-chat-messages { min-height: 240px; max-height: 300px; }
}

/* ══════════════════════════════════════════════
   MOBILE (max-width: 480px)
   ══════════════════════════════════════════════ */
@media (max-width: 480px) {
  #ci-chatbot-toggle {
    right: 10px;
    bottom: 100px;
    width: 46px;
    height: 46px;
  }
  #ci-chatbot-toggle svg { width: 22px; height: 22px; }

  #ci-chatbot-badge {
    width: 14px;
    height: 14px;
    top: -1px;
    right: -1px;
  }

  #ci-chatbot-popup {
    bottom: 154px;
    right: 10px;
    max-width: 200px;
    font-size: 12.5px;
    padding: 10px 12px;
  }
  #ci-chatbot-popup::after {
    right: 18px;
  }

  #ci-chatbot-panel {
    width: calc(100vw - 20px);
    right: 10px;
    left: 10px;
    bottom: 154px;
    max-height: 65vh;
    border-radius: 14px;
  }
  .ci-chat-header { padding: 12px 14px; gap: 10px; }
  .ci-chat-avatar { width: 34px; height: 34px; font-size: 12px; }
  .ci-chat-header-text h4 { font-size: 14px; }
  .ci-chat-header-text p { font-size: 11px; }

  .ci-chat-messages {
    min-height: 180px;
    max-height: 45vh;
    padding: 12px;
    gap: 10px;
  }
  .ci-msg { font-size: 13px; padding: 8px 12px; }
  .ci-quick-btn { font-size: 11px; padding: 4px 10px; }

  .ci-chat-input { padding: 10px 12px; gap: 6px; }
  .ci-chat-input input { padding: 8px 14px; font-size: 13px; }
  .ci-chat-input button { width: 34px; height: 34px; }
  .ci-chat-input button svg { width: 16px; height: 16px; }

  .ci-chat-powered { font-size: 9px; padding: 3px 0 6px; }
}
