/* AI Chat Widget Styles */

.chat-widget {
  position: fixed;
  bottom: 90px; /* Above contact-bar (was 20px) */
  right: 20px;
  z-index: 9999;
  font-family: inherit;
}

/* Chat Toggle Button */
.chat-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.chat-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 25px rgba(102, 126, 234, 0.5);
}

.chat-toggle svg {
  width: 28px;
  height: 28px;
  fill: white;
}

.chat-toggle .chat-close {
  display: none;
}

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

.chat-widget.open .chat-toggle .chat-close {
  display: block;
}

/* Chat Window */
.chat-window {
  position: absolute;
  bottom: 75px;
  right: 0;
  width: 380px;
  max-width: calc(100vw - 40px);
  height: 500px;
  max-height: calc(100vh - 200px);
  background: #0d1a2d;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  display: none;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-widget.open .chat-window {
  display: flex;
  animation: chatSlideUp 0.3s ease;
}

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

/* Chat Header */
.chat-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.chat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.chat-header-info h4 {
  margin: 0;
  color: white;
  font-size: 16px;
  font-weight: 600;
}

.chat-header-info p {
  margin: 2px 0 0 0;
  color: rgba(255, 255, 255, 0.8);
  font-size: 12px;
}

/* Maximize Button */
.chat-maximize {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  color: white;
  transition: background 0.2s ease;
  margin-left: auto;
}

.chat-maximize:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Send Transcript Button */
.chat-send-transcript {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  color: white;
  transition: background 0.2s ease;
}

.chat-send-transcript:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Chat Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #0d1a2d;
}

.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

/* Message Bubbles */
.chat-message {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  animation: messageSlide 0.3s ease;
}

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

.chat-message.bot {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.chat-message.user {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

/* Chat message formatting */
.chat-message .chat-heading {
  display: block;
  color: #a5b4fc;
  margin: 8px 0 4px 0;
  font-size: 13px;
}

.chat-message .chat-heading:first-child {
  margin-top: 0;
}

.chat-message .chat-list {
  margin: 4px 0;
  padding-left: 16px;
  list-style: none;
}

.chat-message .chat-list li {
  margin: 2px 0;
  padding-left: 8px;
  position: relative;
}

.chat-message .chat-list li::before {
  content: "•";
  position: absolute;
  left: -8px;
  color: #667eea;
}

.chat-message strong {
  color: #c7d2fe;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  max-width: 60px;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite;
}

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

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

@keyframes typingBounce {
  0%, 60%, 100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-8px);
  }
}

/* Chat Input */
.chat-input-container {
  padding: 16px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-input-wrapper {
  display: flex;
  gap: 8px;
  align-items: center;
}

.chat-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-size: 14px;
  outline: none;
  transition: border-color 0.3s ease, background 0.3s ease;
}

.chat-input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.chat-input:focus {
  border-color: #667eea;
  background: rgba(255, 255, 255, 0.1);
}

.chat-send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.chat-send:hover {
  transform: scale(1.05);
}

.chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chat-send svg {
  width: 20px;
  height: 20px;
  fill: white;
}

/* Quick Actions */
.chat-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.quick-action {
  padding: 8px 14px;
  background: rgba(102, 126, 234, 0.2);
  border: 1px solid rgba(102, 126, 234, 0.3);
  border-radius: 20px;
  color: #a5b4fc;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.quick-action:hover {
  background: rgba(102, 126, 234, 0.3);
  border-color: rgba(102, 126, 234, 0.5);
}

/* Mobile Responsive */
@media (max-width: 480px) {
  .chat-widget {
    bottom: 140px; /* Above contact-bar on mobile (taller with stacked elements) */
    right: 10px;
  }

  .chat-window {
    width: calc(100vw - 20px);
    right: -5px;
    height: 450px;
  }

  .chat-toggle {
    width: 54px;
    height: 54px;
  }
}

/* Animation for notification badge */
.chat-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 20px;
  height: 20px;
  background: #ef4444;
  border-radius: 50%;
  color: white;
  font-size: 11px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: badgePulse 2s infinite;
}

@keyframes badgePulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

/* Maximized Chat Window */
.chat-widget.maximized .chat-window {
  position: fixed;
  top: 20px;
  left: 20px;
  right: 20px;
  bottom: 100px;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  border-radius: 16px;
  z-index: 10000;
}

@media (max-width: 480px) {
  .chat-widget.maximized .chat-window {
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 80px;
    border-radius: 12px;
  }
}
