/* ========================================
   TRIPULSE CHATBOT WIDGET
   ======================================== */

/* ---------- TOGGLE BUTTON ---------- */
.cb-toggle {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #ff7a18, #ff2d87);
  color: #fff;
  font-size: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 28px rgba(255, 45, 135, 0.4);
  transition: transform 0.3s, box-shadow 0.3s;
}

.cb-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 36px rgba(255, 45, 135, 0.55);
}

.cb-toggle .cb-close-icon { display: none; }
.cb-toggle.active .cb-chat-icon { display: none; }
.cb-toggle.active .cb-close-icon { display: block; }

/* ---------- CHAT WINDOW ---------- */
.cb-window {
  position: fixed;
  bottom: 100px;
  right: 28px;
  z-index: 9998;
  width: 380px;
  max-height: 560px;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 20px 60px rgba(11, 31, 58, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
}

.cb-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ---------- HEADER ---------- */
.cb-header {
  background: linear-gradient(135deg, #0b1f3a, #1a3a6e);
  color: #fff;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.cb-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff7a18, #ff2d87);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.cb-header-info h4 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
}

.cb-header-info p {
  margin: 0;
  font-size: 0.75rem;
  opacity: 0.7;
}

/* ---------- MESSAGES AREA ---------- */
.cb-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f6f8ff;
  min-height: 280px;
  max-height: 360px;
}

.cb-messages::-webkit-scrollbar { width: 5px; }
.cb-messages::-webkit-scrollbar-thumb { background: #c5cde0; border-radius: 10px; }

/* ---------- MESSAGE BUBBLES ---------- */
.cb-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.88rem;
  line-height: 1.5;
  animation: cbFadeIn 0.3s ease;
  word-wrap: break-word;
}

@keyframes cbFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.cb-msg--bot {
  align-self: flex-start;
  background: #fff;
  color: #1a1a2e;
  border: 1px solid #e8ecf4;
  border-bottom-left-radius: 4px;
}

.cb-msg--user {
  align-self: flex-end;
  background: linear-gradient(135deg, #2f5bea, #6c5ce7);
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* ---------- QUICK REPLIES ---------- */
.cb-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 12px;
  background: #f6f8ff;
}

.cb-quick-btn {
  padding: 7px 14px;
  border-radius: 20px;
  border: 1.5px solid #2f5bea;
  background: #fff;
  color: #2f5bea;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.cb-quick-btn:hover {
  background: #2f5bea;
  color: #fff;
}

/* ---------- TYPING INDICATOR ---------- */
.cb-typing {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 10px 14px;
  align-self: flex-start;
  background: #fff;
  border: 1px solid #e8ecf4;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
}

.cb-typing span {
  width: 7px;
  height: 7px;
  background: #a0aec0;
  border-radius: 50%;
  animation: cbBounce 1.4s infinite ease-in-out;
}

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

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

/* ---------- INPUT AREA ---------- */
.cb-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid #e8ecf4;
  background: #fff;
  flex-shrink: 0;
}

.cb-input {
  flex: 1;
  border: 1.5px solid #e0e4ee;
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}

.cb-input:focus {
  border-color: #2f5bea;
}

.cb-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #ff7a18, #ff2d87);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.cb-send-btn:hover {
  transform: scale(1.08);
}

/* ---------- SUMMARY BOX ---------- */
.cb-summary {
  background: #f0f4ff;
  border: 1px solid #d0d8f0;
  border-radius: 12px;
  padding: 12px;
  font-size: 0.82rem;
  line-height: 1.55;
  color: #1a1a2e;
}

.cb-summary strong {
  display: block;
  margin-bottom: 6px;
  font-size: 0.88rem;
  color: #0b1f3a;
}

.cb-summary ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.cb-summary li {
  padding: 2px 0;
}

.cb-summary li::before {
  content: "• ";
  color: #ff7a18;
  font-weight: bold;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 480px) {
  .cb-window {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }

  .cb-toggle {
    bottom: 16px;
    right: 16px;
    width: 54px;
    height: 54px;
  }

  .cb-messages {
    max-height: calc(100vh - 200px);
  }
}
