/* AI Assistant Widget - Floating Chat Button */
.ai-assistant-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Floating Button */
.ai-assistant-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d4af37 0%, #f2d57a 50%, #c8922e 100%);
  border: 2px solid rgba(212, 175, 55, 0.3);
  box-shadow: 0 8px 24px rgba(212, 175, 55, 0.4), 0 0 0 0 rgba(212, 175, 55, 0);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.ai-assistant-btn:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 12px 32px rgba(212, 175, 55, 0.5), 0 0 0 4px rgba(212, 175, 55, 0.15);
}

.ai-assistant-btn:active {
  transform: translateY(0) scale(0.98);
}

.ai-assistant-btn:focus {
  outline: 2px solid rgba(212, 175, 55, 0.6);
  outline-offset: 2px;
}

.ai-assistant-btn svg {
  width: 28px;
  height: 28px;
  color: #1a1a1a;
  transition: transform 0.3s ease;
}

.ai-assistant-btn[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

/* Video Frame - Moldura redonda para o vídeo */
.ai-assistant-video-frame {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  background: linear-gradient(135deg, #d4af37 0%, #f2d57a 50%, #c8922e 100%);
  border: 2px solid rgba(212, 175, 55, 0.3);
  box-shadow: 0 8px 24px rgba(212, 175, 55, 0.4);
}

/* Avatar Video */
.ai-assistant-avatar-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

/* Pulse animation for attention */
@keyframes aiPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.4);
  }
  70% {
    box-shadow: 0 0 0 12px rgba(212, 175, 55, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(212, 175, 55, 0);
  }
}

.ai-assistant-btn:not([aria-expanded="true"]) {
  animation: aiPulse 2s ease-in-out infinite;
}

/* Chat Window */
.ai-assistant-window {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 380px;
  max-width: calc(100vw - 48px);
  background: linear-gradient(180deg, rgba(26, 26, 26, 0.98) 0%, rgba(17, 17, 17, 0.99) 100%);
  border: 1px solid rgba(212, 175, 55, 0.22);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(212, 175, 55, 0.1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

/* Header */
.ai-assistant-header {
  padding: 16px 18px;
  background: linear-gradient(180deg, rgba(43, 43, 43, 0.96) 0%, rgba(26, 26, 26, 0.98) 100%);
  border-bottom: 1px solid rgba(212, 175, 55, 0.18);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ai-assistant-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.ai-assistant-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.2), rgba(242, 213, 122, 0.1));
  border: 1px solid rgba(212, 175, 55, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ai-assistant-icon svg {
  width: 20px;
  height: 20px;
  color: #d4af37;
}

.ai-assistant-info {
  flex: 1;
  min-width: 0;
}

.ai-assistant-name {
  font-size: 14px;
  font-weight: 700;
  color: #f5f7fb;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-assistant-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: #2bb6a8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.ai-assistant-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2bb6a8;
  animation: statusPulse 1.5s ease-in-out infinite;
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.ai-assistant-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.ai-assistant-close:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

.ai-assistant-close:focus {
  outline: 2px solid rgba(212, 175, 55, 0.5);
  outline-offset: 2px;
}

.ai-assistant-close svg {
  width: 18px;
  height: 18px;
}

/* Messages Area */
.ai-assistant-messages {
  flex: 1;
  padding: 16px 18px;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 200px;
  max-height: 400px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-assistant-messages::-webkit-scrollbar {
  width: 4px;
}

.ai-assistant-messages::-webkit-scrollbar-track {
  background: rgba(43, 43, 43, 0.4);
  border-radius: 2px;
}

.ai-assistant-messages::-webkit-scrollbar-thumb {
  background: rgba(212, 175, 55, 0.4);
  border-radius: 2px;
}

.ai-assistant-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(212, 175, 55, 0.6);
}

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

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

.ai-message.assistant {
  align-self: flex-start;
  background: rgba(43, 43, 43, 0.8);
  border: 1px solid rgba(212, 175, 55, 0.15);
  color: #f5f7fb;
  border-bottom-left-radius: 4px;
}

.ai-message.user {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.15), rgba(242, 213, 122, 0.08));
  border: 1px solid rgba(212, 175, 55, 0.25);
  color: #f5f7fb;
  border-bottom-right-radius: 4px;
}

.ai-message .message-time {
  display: block;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 6px;
  text-align: right;
}

/* Input Area */
.ai-assistant-input-area {
  padding: 14px 18px 16px;
  background: rgba(26, 26, 26, 0.96);
  border-top: 1px solid rgba(212, 175, 55, 0.12);
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.ai-assistant-input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  background: rgba(11, 24, 48, 0.8);
  border: 1px solid rgba(212, 175, 55, 0.18);
  border-radius: 12px;
  color: #f5f7fb;
  font-size: 13px;
  line-height: 1.4;
  resize: none;
  transition: all 0.2s ease;
  font-family: inherit;
}

.ai-assistant-input::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

.ai-assistant-input:focus {
  outline: none;
  border-color: rgba(212, 175, 55, 0.4);
  background: rgba(11, 24, 48, 0.92);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.ai-assistant-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ai-assistant-send {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, #d4af37 0%, #f2d57a 50%, #c8922e 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.ai-assistant-send:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(212, 175, 55, 0.3);
}

.ai-assistant-send:active:not(:disabled) {
  transform: translateY(0);
}

.ai-assistant-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ai-assistant-send:focus {
  outline: 2px solid rgba(212, 175, 55, 0.5);
  outline-offset: 2px;
}

.ai-assistant-send svg {
  width: 18px;
  height: 18px;
  color: #1a1a1a;
}

/* Typing Indicator */
.ai-typing-indicator {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  background: rgba(43, 43, 43, 0.6);
  border-radius: 12px;
  align-self: flex-start;
  animation: messageSlide 0.3s ease-out;
}

.ai-typing-indicator span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(212, 175, 55, 0.6);
  animation: typingBounce 1.4s ease-in-out infinite;
}

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

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

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

/* Mobile Responsive */
@media (max-width: 768px) {
  .ai-assistant-widget {
    bottom: 16px;
    right: 16px;
  }

  .ai-assistant-btn {
    width: 52px;
    height: 52px;
  }

  .ai-assistant-btn svg {
    width: 24px;
    height: 24px;
  }

  .ai-assistant-window {
    bottom: 72px;
    right: 0;
    width: calc(100vw - 32px);
    max-width: 340px;
  }

  .ai-assistant-messages {
    min-height: 180px;
    max-height: 350px;
  }

  .ai-assistant-header {
    padding: 14px 16px;
  }

  .ai-assistant-icon {
    width: 32px;
    height: 32px;
  }

  .ai-assistant-icon svg {
    width: 18px;
    height: 18px;
  }

  .ai-assistant-name {
    font-size: 13px;
  }

  .ai-assistant-input-area {
    padding: 12px 16px 14px;
  }

  .ai-assistant-send {
    width: 38px;
    height: 38px;
  }

  .ai-assistant-send svg {
    width: 16px;
    height: 16px;
  }
}

@media (max-width: 480px) {
  .ai-assistant-widget {
    bottom: 12px;
    right: 12px;
  }

  .ai-assistant-window {
    width: calc(100vw - 24px);
    bottom: 68px;
  }

  .ai-assistant-messages {
    min-height: 160px;
    max-height: 300px;
    padding: 14px 16px;
  }

  .ai-message {
    font-size: 12px;
    padding: 10px 12px;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .ai-assistant-window {
    border-width: 2px;
  }

  .ai-assistant-btn {
    border-width: 3px;
  }

  .ai-message.assistant {
    border-width: 2px;
  }

  .ai-message.user {
    border-width: 2px;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .ai-assistant-btn,
  .ai-assistant-window,
  .ai-message,
  .ai-typing-indicator {
    animation: none;
    transition: none;
  }

  .ai-assistant-btn:hover,
  .ai-assistant-send:hover {
    transform: none;
  }
}
