/* ============================================================
   ABP GLOBAL AI CHATBOT WIDGET STYLESHEET
   Design System: Glassmorphism, Modern Teal Palette & Premium UX
   ============================================================ */

:root {
  --abp-chat-primary: #17a2a2;
  --abp-chat-primary-dark: #1e5c6e;
  --abp-chat-primary-light: #48c9c9;
  --abp-chat-accent: #20b2b2;
  --abp-chat-bg-dark: #0f172a;
  --abp-chat-card-shadow: 0 12px 36px rgba(0, 0, 0, 0.16), 0 4px 12px rgba(23, 162, 162, 0.15);
  --abp-chat-radius: 20px;
  --abp-chat-transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  --abp-chat-font: 'Inter', system-ui, -apple-system, sans-serif;
  --abp-chat-user-msg: linear-gradient(135deg, #17a2a2 0%, #1e5c6e 100%);
  --abp-chat-text-dark: #1e293b;
  --abp-chat-text-muted: #64748b;
}

/* Chat Widget Container */
#abp-chat-widget-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999999;
  font-family: var(--abp-chat-font);
}

/* Floating Launcher Button */
.abp-chat-launcher {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #17a2a2 0%, #1e5c6e 100%);
  color: #ffffff;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(23, 162, 162, 0.4), 0 2px 8px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  position: relative;
  transition: var(--abp-chat-transition);
  outline: none;
}

.abp-chat-launcher:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 12px 28px rgba(23, 162, 162, 0.5), 0 4px 12px rgba(0, 0, 0, 0.2);
}

.abp-chat-launcher:active {
  transform: scale(0.96);
}

/* Pulse Ring Animation */
.abp-chat-launcher::before {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 50%;
  border: 2px solid var(--abp-chat-primary);
  opacity: 0.8;
  animation: abp-chat-pulse 2s infinite ease-in-out;
}

@keyframes abp-chat-pulse {
  0% {
    transform: scale(1);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.2);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 0;
  }
}

/* Unread Badge */
.abp-chat-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  height: 20px;
  min-width: 20px;
  padding: 0 5px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Tooltip Greeting Popup */
.abp-chat-tooltip {
  position: absolute;
  right: 76px;
  top: 50%;
  transform: translateY(-50%);
  background: #ffffff;
  color: var(--abp-chat-text-dark);
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  border-left: 4px solid var(--abp-chat-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.abp-chat-tooltip-close {
  cursor: pointer;
  color: var(--abp-chat-text-muted);
  font-size: 12px;
  margin-left: 4px;
}

.abp-chat-tooltip-close:hover {
  color: #ef4444;
}

/* Chat Window Box */
.abp-chat-window {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 400px;
  max-width: calc(100vw - 32px);
  height: 600px;
  max-height: calc(100vh - 120px);
  background: #ffffff;
  border-radius: var(--abp-chat-radius);
  box-shadow: var(--abp-chat-card-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transform-origin: bottom right;
  transition: var(--abp-chat-transition);
  border: 1px solid rgba(23, 162, 162, 0.18);
}

.abp-chat-window.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Chat Header */
.abp-chat-header {
  background: linear-gradient(135deg, #17a2a2 0%, #1e5c6e 100%);
  color: #ffffff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  position: relative;
  z-index: 2;
}

.abp-chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.abp-chat-avatar-wrap {
  position: relative;
  width: 42px;
  height: 42px;
}

.abp-chat-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--abp-chat-primary-dark);
  font-size: 20px;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.abp-chat-status-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  background: #10b981;
  border: 2px solid #ffffff;
  border-radius: 50%;
}

.abp-chat-header-text h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: -0.2px;
}

.abp-chat-header-text p {
  margin: 2px 0 0 0;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Header Action Icons */
.abp-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.abp-chat-action-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: background 0.2s ease;
}

.abp-chat-action-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Chat Body / Messages Scroll Area */
.abp-chat-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.abp-chat-body::-webkit-scrollbar {
  width: 5px;
}

.abp-chat-body::-webkit-scrollbar-thumb {
  background: rgba(23, 162, 162, 0.2);
  border-radius: 10px;
}

/* Message Bubble */
.abp-chat-message {
  display: flex;
  flex-direction: column;
  max-width: 82%;
  animation: abp-message-fade 0.3s ease-out forwards;
}

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

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

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

.abp-chat-msg-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.5;
  position: relative;
  word-wrap: break-word;
}

.abp-chat-message.user .abp-chat-msg-bubble {
  background: var(--abp-chat-user-msg);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(23, 162, 162, 0.25);
}

.abp-chat-message.bot .abp-chat-msg-bubble {
  background: #ffffff;
  color: var(--abp-chat-text-dark);
  border-bottom-left-radius: 4px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.abp-chat-msg-bubble ul, .abp-chat-msg-bubble ol {
  margin: 6px 0 6px 18px;
  padding: 0;
}

.abp-chat-msg-bubble p {
  margin: 0 0 6px 0;
}
.abp-chat-msg-bubble p:last-child {
  margin: 0;
}

.abp-chat-msg-time {
  font-size: 10px;
  color: var(--abp-chat-text-muted);
  margin-top: 4px;
  align-self: flex-end;
}

.abp-chat-message.user .abp-chat-msg-time {
  color: rgba(255, 255, 255, 0.85);
  margin-right: 4px;
}

/* Quick Starter Pills */
.abp-chat-starter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.abp-chat-pill {
  background: #ffffff;
  border: 1px solid var(--abp-chat-primary);
  color: var(--abp-chat-primary-dark);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}

.abp-chat-pill:hover {
  background: var(--abp-chat-primary);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(23, 162, 162, 0.25);
}

/* Typing Indicator Animation */
.abp-chat-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
  background: #ffffff;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  width: fit-content;
  border: 1px solid #e2e8f0;
}

.abp-chat-typing-dot {
  width: 7px;
  height: 7px;
  background: var(--abp-chat-primary);
  border-radius: 50%;
  animation: abp-typing-bounce 1.4s infinite ease-in-out both;
}

.abp-chat-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.abp-chat-typing-dot:nth-child(2) { animation-delay: -0.16s; }

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

/* Chat Footer / Input Area */
.abp-chat-footer {
  padding: 12px 16px;
  background: #ffffff;
  border-top: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  gap: 8px;
}

.abp-chat-input-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.abp-chat-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 24px;
  border: 1px solid #cbd5e1;
  font-size: 13.5px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s ease;
  background: #f8fafc;
}

.abp-chat-input:focus {
  border-color: var(--abp-chat-primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(23, 162, 162, 0.15);
}

.abp-chat-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #17a2a2 0%, #1e5c6e 100%);
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: var(--abp-chat-transition);
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(23, 162, 162, 0.3);
}

.abp-chat-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 14px rgba(23, 162, 162, 0.4);
}

.abp-chat-send-btn:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
  box-shadow: none;
}

/* Modal Settings Overlay */
.abp-chat-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}

.abp-chat-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.abp-chat-modal {
  background: #ffffff;
  width: 90%;
  padding: 20px;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.abp-chat-modal h4 {
  margin: 0 0 8px 0;
  color: var(--abp-chat-text-dark);
  font-size: 15px;
}

.abp-chat-modal p {
  font-size: 12px;
  color: var(--abp-chat-text-muted);
  margin-bottom: 12px;
}

.abp-chat-modal input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 12px;
  margin-bottom: 14px;
  box-sizing: border-box;
}

.abp-chat-modal-btns {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.abp-chat-modal-btn {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  cursor: pointer;
}

.abp-chat-btn-cancel {
  background: #f1f5f9;
  color: #475569;
}

.abp-chat-btn-save {
  background: var(--abp-chat-primary);
  color: #ffffff;
}

/* Responsiveness for Mobile Screens */
@media (max-width: 480px) {
  #abp-chat-widget-container {
    bottom: 16px;
    right: 16px;
  }
  .abp-chat-window {
    width: calc(100vw - 32px);
    height: calc(100vh - 100px);
    bottom: 74px;
    right: 0;
  }
}
