/**
 * @file
 * Modern UI & WCAG 2.1 AA Compliant CSS styling for Support Chatbot Widget.
 */

#support-chatbot-root {
  position: fixed !important;
  bottom: 24px !important;
  right: 24px !important;
  z-index: 999999 !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Floating Action Trigger Button */
#support-chatbot-trigger {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #ffffff;
  border: 2px solid #ffffff;
  border-radius: 50px;
  padding: 14px 26px;
  font-size: 1rem;
  font-weight: 700;
  box-shadow: 0 10px 25px -5px rgba(79, 70, 229, 0.5), 0 8px 10px -6px rgba(79, 70, 229, 0.3);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#support-chatbot-trigger:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 16px 30px -5px rgba(79, 70, 229, 0.65), 0 10px 12px -5px rgba(79, 70, 229, 0.4);
}

#support-chatbot-trigger:focus-visible {
  outline: 3px solid #f59e0b !important;
  outline-offset: 4px !important;
}

/* Chat Window Container */
#support-chatbot-window {
  width: 380px;
  height: 550px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 100px);
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.3), 0 10px 20px -10px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: absolute;
  bottom: 70px;
  right: 0;
  border: 1px solid #d1d5db;
  animation: supportChatPopIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transform-origin: bottom right;
}

@keyframes supportChatPopIn {
  0% {
    opacity: 0;
    transform: scale(0.85) translateY(20px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Header Styling */
#support-chatbot-header {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #ffffff;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}

#support-chatbot-header span {
  letter-spacing: -0.01em;
}

#support-chatbot-close {
  background: rgba(255, 255, 255, 0.2) !important;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff !important;
  font-size: 1.3rem !important;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

#support-chatbot-close:hover {
  background: rgba(255, 255, 255, 0.35) !important;
  transform: rotate(90deg);
}

#support-chatbot-close:focus-visible {
  outline: 3px solid #f59e0b !important;
  outline-offset: 2px !important;
}

/* Welcome Banner */
#support-chatbot-banner {
  background: #f0fdf4;
  color: #14532d;
  padding: 12px 18px;
  font-size: 0.85rem;
  border-bottom: 1px solid #bbf7d0;
  line-height: 1.45;
  font-weight: 600;
}

/* Scrollable Chat Body */
#support-chatbot-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  background: #f9fafb;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#support-chatbot-body::-webkit-scrollbar {
  width: 6px;
}

#support-chatbot-body::-webkit-scrollbar-thumb {
  background: #9ca3af;
  border-radius: 10px;
}

/* Chat Message Bubbles with WCAG AA Contrast */
.chat-bubble {
  max-width: 82%;
  padding: 11px 16px;
  border-radius: 16px;
  font-size: 0.92rem;
  line-height: 1.45;
  word-wrap: break-word;
  animation: bubbleFadeUp 0.25s ease-out forwards;
}

@keyframes bubbleFadeUp {
  0% {
    opacity: 0;
    transform: translateY(6px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-bubble.user-msg {
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  color: #ffffff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.chat-bubble.bot-msg {
  background: #ffffff;
  color: #111827;
  align-self: flex-start;
  border: 1px solid #d1d5db;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.chat-bubble.agent-msg {
  background: linear-gradient(135deg, #047857 0%, #059669 100%);
  color: #ffffff;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  box-shadow: 0 4px 12px rgba(4, 120, 87, 0.25);
}

.bubble-header {
  font-size: 0.75rem;
  opacity: 0.9;
  margin-bottom: 4px;
  font-weight: 700;
}

.bubble-time {
  font-weight: normal;
  margin-left: 6px;
  opacity: 0.8;
}

/* Quick Action Toolbar & Chips */
#support-chatbot-toolbar {
  padding: 10px 14px;
  background: #ffffff;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.ch-tool-btn, .ch-faq-btn {
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  color: #1f2937;
  transition: all 0.2s ease;
}

.ch-tool-btn:hover, .ch-faq-btn:hover {
  background: #e0e7ff;
  color: #3730a3;
  border-color: #a5b4fc;
  transform: translateY(-1px);
}

.ch-tool-btn:focus-visible, .ch-faq-btn:focus-visible {
  outline: 3px solid #f59e0b !important;
  outline-offset: 2px !important;
}

.ch-tool-btn.active {
  background: #dc2626;
  color: #ffffff;
  border-color: #b91c1c;
  box-shadow: 0 4px 10px rgba(220, 38, 38, 0.35);
}

/* Chat Input Footer */
#support-chatbot-footer {
  padding: 12px 14px;
  background: #ffffff;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 10px;
  align-items: center;
}

#support-chat-input {
  flex: 1;
  border: 1.5px solid #d1d5db;
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 0.9rem;
  color: #111827;
  outline: none;
  background: #ffffff;
  transition: all 0.2s ease;
}

#support-chat-input:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.25);
}

#support-chat-send {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  padding: 10px 20px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
  transition: all 0.2s ease;
}

#support-chat-send:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.45);
}

#support-chat-send:focus-visible {
  outline: 3px solid #f59e0b !important;
  outline-offset: 2px !important;
}

#support-chat-send:active {
  transform: translateY(1px);
}
