/* =============================================
   Conebyte Live Chat Widget
   ============================================= */

/* Floating Chat Button */
.chat-widget-btn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #ff5e14;
  color: #fff;
  border: 3px solid #fff;
  border-radius: 50px;
  padding: 14px 24px;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  /* Strong shadow so button pops on ANY background - light or dark */
  box-shadow:
    0 4px 6px rgba(0, 0, 0, 0.5),
    0 8px 24px rgba(0, 0, 0, 0.35),
    0 2px 8px rgba(255, 94, 20, 0.5);
  transition: all 0.3s ease;
  /* Pulsing ring to draw attention */
  animation: chatPulse 2.5s infinite;
}

@keyframes chatPulse {
  0%, 100% { box-shadow: 0 4px 6px rgba(0,0,0,0.5), 0 8px 24px rgba(0,0,0,0.35), 0 0 0 0 rgba(255, 94, 20, 0.5); }
  50%       { box-shadow: 0 4px 6px rgba(0,0,0,0.5), 0 8px 24px rgba(0,0,0,0.35), 0 0 0 10px rgba(255, 94, 20, 0); }
}

.chat-widget-btn:hover,
.chat-widget-btn:focus,
.chat-widget-btn:active {
  background: #ff5e14 !important;
  color: #fff !important;
  outline: none;
  transform: translateY(-2px);
  box-shadow: 0 6px 8px rgba(0, 0, 0, 0.5), 0 12px 32px rgba(0, 0, 0, 0.4), 0 4px 14px rgba(255, 94, 20, 0.6);
  animation: none;
}

.chat-widget-btn i {
  font-size: 18px;
}

/* Always keep the pill shape — hide open icon and show close icon when active */
.chat-widget-btn .chat-close-icon {
  display: none;
}

.chat-widget-btn.active .chat-open-icon {
  display: none;
}

.chat-widget-btn.active .chat-btn-label {
  display: inline; /* keep the label visible */
}

.chat-widget-btn.active .chat-close-icon {
  display: inline;
}

/* Keep the full pill shape when active — no collapsing to circle */
.chat-widget-btn.active {
  background: #e04d00;
  animation: none;
}

/* Chat Window */
.chat-widget-window {
  position: fixed;
  bottom: 100px;
  right: 30px;
  z-index: 9998;
  width: 380px;
  max-height: 520px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.2);
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: chatSlideUp 0.3s ease;
  font-family: 'Poppins', sans-serif;
}

.chat-widget-window.open {
  display: flex;
}

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

/* Expanded / Fullscreen State */
.chat-widget-window.expanded {
  width: 100vw;
  height: 100vh;
  max-height: 100vh;
  bottom: 0;
  right: 0;
  border-radius: 0;
  animation: none;
}

.chat-widget-window.expanded .chat-widget-body {
  max-height: none;
}

/* Hide floating button when chat is expanded fullscreen */
.chat-widget-btn.expanded-hidden {
  display: none !important;
}

/* Chat Header */
.chat-widget-header {
  background: #1b2839;
  color: #fff;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-widget-header-icon {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.chat-widget-header-text {
  flex: 1;
}

.chat-widget-header-text h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
}

.chat-widget-header-text p {
  margin: 0;
  font-size: 12px;
  opacity: 0.8;
  color: #ccc;
}

/* Header Action Buttons */
.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.chat-header-actions button {
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: background 0.2s;
}

.chat-header-actions button:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Chat Body */
.chat-widget-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #f7f8fa;
}

/* Chat Messages */
.chat-message {
  margin-bottom: 16px;
  max-width: 85%;
}

.chat-message.bot {
  margin-right: auto;
}

.chat-message.user {
  margin-left: auto;
  display: flex;
  justify-content: flex-end;
}

.chat-message-bubble {
  background: #fff;
  border: 1px solid #e8eaed;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.6;
  color: #333;
  display: inline-block;
}

.chat-message.user .chat-message-bubble {
  background: #1b2839;
  color: #fff;
  border-color: #1b2839;
  border-radius: 12px 12px 2px 12px;
}

.chat-message.bot .chat-message-bubble {
  border-radius: 12px 12px 12px 2px;
}

/* Typing Indicator */
.chat-typing-indicator {
  margin-bottom: 16px;
  margin-right: auto;
}

.chat-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fff;
  border: 1px solid #e8eaed;
  border-radius: 12px 12px 12px 2px;
  padding: 12px 18px;
}

.chat-typing-dots span {
  width: 7px;
  height: 7px;
  background: #999;
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out;
}

.chat-typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.chat-typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingBounce {
  0%, 60%, 100% {
    transform: translateY(0);
    background: #bbb;
  }
  30% {
    transform: translateY(-6px);
    background: #666;
  }
}

.chat-message-time {
  font-size: 11px;
  color: #999;
  margin-top: 4px;
  text-align: center;
}

/* Quick Action Buttons */
.chat-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 0 0;
}

.chat-quick-btn {
  background: #f57c00;
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Poppins', sans-serif;
  white-space: nowrap;
}

.chat-quick-btn:hover {
  background: #e06800;
  transform: translateY(-1px);
}

/* Chat Input */
.chat-widget-footer {
  border-top: 1px solid #e8eaed;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
}

.chat-widget-footer input {
  flex: 1;
  min-width: 0;
  border: 1px solid #e0e0e0;
  border-radius: 25px;
  padding: 10px 16px;
  font-size: 13px;
  font-family: 'Poppins', sans-serif;
  outline: none;
  transition: border-color 0.2s;
}

.chat-widget-footer input:focus {
  border-color: #f57c00;
}

.chat-footer-btns {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.chat-widget-footer button {
  width: 36px;
  height: 36px;
  background: #1b2839;
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
  font-size: 14px;
}

.chat-widget-footer button:hover {
  background: #f57c00;
}

/* Microphone / Audio Button */
.chat-widget-footer .chat-mic-btn {
  width: 36px;
  height: 36px;
  background: #1b2839;
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: background 0.2s, box-shadow 0.2s;
  flex-shrink: 0;
}

.chat-widget-footer .chat-mic-btn:hover {
  background: #f57c00;
}

.chat-widget-footer .chat-mic-btn.listening {
  background: #e53935;
  animation: micPulse 1.2s infinite ease-in-out;
}

@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(229, 57, 53, 0.5); }
  50% { box-shadow: 0 0 0 10px rgba(229, 57, 53, 0); }
}

/* Help Sub-Topics in Chat */
.chat-help-topics {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.chat-help-topics a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #f0f1f3;
  border-radius: 8px;
  color: #1b2839;
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
}

.chat-help-topics a:hover {
  background: #f57c00;
  color: #fff;
}

.chat-help-topics a i {
  font-size: 14px;
  width: 20px;
  text-align: center;
  color: #f57c00;
}

.chat-help-topics a:hover i {
  color: #fff;
}

/* Notification Badge */
.chat-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #f57c00;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}

/* Link styles inside chat */
.chat-message-bubble a {
  color: #f57c00;
  text-decoration: none;
  font-weight: 500;
}

.chat-message-bubble a:hover {
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 480px) {
  .chat-widget-window {
    width: calc(100vw - 20px);
    right: 10px;
    bottom: 80px;
    max-height: 70vh;
  }

  .chat-widget-window.expanded {
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    bottom: 0;
    right: 0;
    border-radius: 0;
  }

  .chat-widget-btn {
    bottom: 15px;
    right: 15px;
    padding: 12px 18px;
    font-size: 13px;
  }

  .chat-widget-btn.active {
    padding: 12px 14px;
  }

  .chat-header-actions button {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }
}
