/* ==========================================================================
   UK CARE LEARNING PLATFORM - FLOATING CHAT & WHATSAPP WIDGETS
   ========================================================================== */

/* Floating Buttons Container */
.floating-support-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1045;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  pointer-events: none; /* children enable pointer events */
}

.floating-support-btn {
  pointer-events: auto;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF !important;
  font-size: 1.6rem;
  box-shadow: 0 8px 24px rgba(7, 27, 73, 0.22);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  border: none;
  position: relative;
  cursor: pointer;
}

.floating-support-btn:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 12px 28px rgba(7, 27, 73, 0.32);
}

/* WhatsApp Brand Button */
.btn-whatsapp-floating {
  background-color: #25D366;
  box-shadow: 0 8px 20px rgba(37, 211, 102, 0.35);
}

.btn-whatsapp-floating:hover {
  background-color: #20BD5A;
  box-shadow: 0 12px 24px rgba(37, 211, 102, 0.45);
}

/* Live Chat Brand Button */
.btn-livechat-floating {
  background: linear-gradient(135deg, #2454C6 0%, #071B49 100%);
  box-shadow: 0 8px 20px rgba(36, 84, 198, 0.35);
}

.btn-livechat-floating:hover {
  background: linear-gradient(135deg, #1D4ED8 0%, #102C70 100%);
}

.btn-livechat-floating .unread-indicator {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  background-color: #FFC928;
  border: 2px solid #FFFFFF;
  border-radius: 50%;
}

/* Floating Tooltip Label */
.floating-support-btn::before {
  content: attr(data-tooltip);
  position: absolute;
  right: 64px;
  top: 50%;
  transform: translateY(-50%) translateX(10px);
  background: rgba(7, 27, 73, 0.95);
  color: #FFFFFF;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  font-family: 'Inter', sans-serif;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.floating-support-btn:hover::before {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(0);
}

/* ==========================================================================
   LIVE CHAT PANEL
   ========================================================================== */
.live-chat-panel {
  pointer-events: auto;
  position: fixed;
  bottom: 90px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 120px);
  background: #FFFFFF;
  border-radius: 20px;
  box-shadow: 0 20px 48px -8px rgba(7, 27, 73, 0.3);
  border: 1px solid #E2E8F0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1046;
  opacity: 0;
  transform: translateY(20px) scale(0.96);
  pointer-events: none;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.live-chat-panel.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  visibility: visible;
}

/* Chat Header */
.chat-panel-header {
  background: linear-gradient(135deg, #071B49 0%, #102C70 100%);
  color: #FFFFFF;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #FFC928;
}

.chat-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-header-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFC928;
  font-size: 1.1rem;
}

.chat-header-text h6 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: #FFFFFF;
}

.chat-status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  color: #86EFAC;
}

.chat-status-indicator::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #22C55E;
}

.chat-close-btn {
  background: transparent;
  border: none;
  color: #FFFFFF;
  font-size: 1.25rem;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

.chat-close-btn:hover {
  opacity: 1;
}

/* Chat Body / Messages History */
.chat-panel-body {
  flex-grow: 1;
  padding: 16px;
  background-color: #F8FAFC;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-message {
  display: flex;
  flex-direction: column;
  max-width: 82%;
  font-size: 0.88rem;
  line-height: 1.45;
}

.chat-message.support {
  align-self: flex-start;
}

.chat-message.user {
  align-self: flex-end;
}

.chat-message-bubble {
  padding: 10px 14px;
  border-radius: 14px;
}

.chat-message.support .chat-message-bubble {
  background: #FFFFFF;
  color: #15223B;
  border: 1px solid #E2E8F0;
  border-bottom-left-radius: 2px;
}

.chat-message.user .chat-message-bubble {
  background: #2454C6;
  color: #FFFFFF;
  border-bottom-right-radius: 2px;
}

.chat-message-time {
  font-size: 0.7rem;
  color: #94A3B8;
  margin-top: 3px;
  padding: 0 4px;
}

/* Quick Question Pills */
.chat-quick-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.chat-quick-chip {
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 500;
  color: #2454C6;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chat-quick-chip:hover {
  background: #EEF2FD;
  border-color: #2454C6;
}

/* Chat Footer / Input */
.chat-panel-footer {
  padding: 12px;
  background: #FFFFFF;
  border-top: 1px solid #E2E8F0;
}

.chat-input-form {
  display: flex;
  gap: 8px;
}

.chat-input-box {
  flex-grow: 1;
  border: 1.5px solid #E2E8F0;
  border-radius: 24px;
  padding: 8px 14px;
  font-size: 0.88rem;
  outline: none;
  font-family: 'Inter', sans-serif;
}

.chat-input-box:focus {
  border-color: #2454C6;
}

.chat-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #2454C6;
  color: #FFFFFF;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.chat-send-btn:hover {
  background: #1D4ED8;
  transform: scale(1.05);
}

/* Mobile Adjustments */
@media (max-width: 576px) {
  .floating-support-container {
    bottom: 18px;
    right: 16px;
  }
  .floating-support-btn {
    width: 48px;
    height: 48px;
    font-size: 1.4rem;
  }
  .floating-support-btn::before {
    display: none; /* Hide hover tooltip on touch devices */
  }
  .live-chat-panel {
    bottom: 80px;
    right: 16px;
    width: calc(100vw - 32px);
    height: 460px;
  }
}
