/**
 * UB Connect Chatbot Styles
 * Modern, responsive chatbot interface
 */

/* ============================================
   Chatbot Container
============================================ */
.ub-chatbot {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* ============================================
   Chat Toggle Button
============================================ */
.chat-toggle {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a4d8f 0%, #2563a8 100%);
  border: none;
  box-shadow: 0 4px 20px rgba(26, 77, 143, 0.4);
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.chat-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 25px rgba(26, 77, 143, 0.5);
}

.chat-toggle:active {
  transform: scale(0.95);
}

.chat-toggle svg {
  width: 28px;
  height: 28px;
  transition: all 0.3s ease;
}

.chat-toggle .close-icon {
  display: none;
  position: absolute;
}

.chat-toggle.active .chat-icon {
  display: none;
}

.chat-toggle.active .close-icon {
  display: block;
}

.chat-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #e74c3c;
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

/* ============================================
   Chat Window
============================================ */
.chat-window {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 380px;
  height: 600px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.chat-window.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* ============================================
   Chat Header
============================================ */
.chat-header {
  background: linear-gradient(135deg, #1a4d8f 0%, #2563a8 100%);
  color: white;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 16px 16px 0 0;
}

.chat-header-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-avatar {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.chat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-header-text h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.chat-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  opacity: 0.9;
  margin-top: 2px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2ecc71;
  animation: blink 2s infinite;
}

@keyframes blink {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.chat-minimize {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  color: white;
}

.chat-minimize:hover {
  background: rgba(255, 255, 255, 0.3);
}

.chat-minimize svg {
  width: 20px;
  height: 20px;
}

/* ============================================
   Chat Messages
============================================ */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #f8f9fa;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: #cbd5e0;
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: #a0aec0;
}

/* Welcome Message */
.chat-welcome {
  text-align: center;
  padding: 30px 20px;
  animation: fadeInUp 0.5s ease;
}

.welcome-icon {
  font-size: 48px;
  margin-bottom: 15px;
}

.chat-welcome h3 {
  margin: 0 0 10px 0;
  font-size: 20px;
  color: #1a4d8f;
}

.chat-welcome p {
  margin: 0;
  color: #64748b;
  font-size: 14px;
  line-height: 1.6;
}

/* Chat Messages */
.chat-message {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.user-message {
  justify-content: flex-end;
}

.bot-message {
  justify-content: flex-start;
}

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.message-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.message-content {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.user-message .message-content {
  background: linear-gradient(135deg, #1a4d8f 0%, #2563a8 100%);
  color: white;
  border-bottom-right-radius: 4px;
}

.bot-message .message-content {
  background: white;
  color: #2d3748;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.message-content a {
  color: inherit;
  text-decoration: underline;
}

.message-content .bullet {
  color: #1a4d8f;
  font-weight: bold;
  margin-right: 5px;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
}

.typing-indicator .message-content {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
  animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.7;
  }
  30% {
    transform: translateY(-10px);
    opacity: 1;
  }
}

/* ============================================
   Quick Actions
============================================ */
.quick-actions {
  padding: 15px 20px;
  background: white;
  border-top: 1px solid #e2e8f0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-action-btn {
  padding: 8px 16px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  font-size: 13px;
  color: #1a4d8f;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.quick-action-btn:hover {
  background: #e2e8f0;
  border-color: #cbd5e0;
  transform: translateY(-1px);
}

.quick-action-btn:active {
  transform: translateY(0);
}

/* ============================================
   Chat Input Area
============================================ */
.chat-input-area {
  padding: 15px 20px;
  background: white;
  border-top: 1px solid #e2e8f0;
  border-radius: 0 0 16px 16px;
}

.chat-form {
  display: flex;
  gap: 10px;
  align-items: center;
}

.chat-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 24px;
  font-size: 14px;
  outline: none;
  transition: all 0.2s ease;
  background: #f8f9fa;
}

.chat-input:focus {
  border-color: #1a4d8f;
  background: white;
  box-shadow: 0 0 0 3px rgba(26, 77, 143, 0.1);
}

.chat-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a4d8f 0%, #2563a8 100%);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.chat-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(26, 77, 143, 0.3);
}

.chat-send-btn:active {
  transform: scale(0.95);
}

.chat-send-btn svg {
  width: 18px;
  height: 18px;
}

/* ============================================
   Responsive Design
============================================ */
@media (max-width: 768px) {
  .ub-chatbot {
    bottom: 15px;
    right: 15px;
  }

  .chat-window {
    width: calc(100vw - 30px);
    max-width: 380px;
    height: 550px;
    bottom: 75px;
  }

  .chat-toggle {
    width: 55px;
    height: 55px;
  }

  .chat-toggle svg {
    width: 24px;
    height: 24px;
  }
}

@media (max-width: 480px) {
  .chat-window {
    width: calc(100vw - 20px);
    height: calc(100vh - 100px);
    max-height: 600px;
    right: 10px;
    bottom: 70px;
  }

  .ub-chatbot {
    bottom: 10px;
    right: 10px;
  }

  .chat-messages {
    padding: 15px;
  }

  .message-content {
    max-width: 85%;
    font-size: 13px;
  }

  .quick-actions {
    padding: 12px 15px;
  }

  .quick-action-btn {
    font-size: 12px;
    padding: 6px 12px;
  }
}

/* ============================================
   Accessibility
============================================ */
@media (prefers-reduced-motion: reduce) {
  .chat-window,
  .chat-toggle,
  .chat-message,
  .chat-welcome {
    animation: none;
    transition: none;
  }
}

/* Focus styles for keyboard navigation */
.chat-toggle:focus,
.chat-minimize:focus,
.chat-send-btn:focus,
.quick-action-btn:focus {
  outline: 2px solid #1a4d8f;
  outline-offset: 2px;
}

.chat-input:focus {
  outline: none;
}

