/* ai-assistat.css - Estilização do Chatbot de IA Flutuante */

#ai-assistant-root {
  position: fixed;
  bottom: 24px;
  right: 24px; /* Canto Direito */
  z-index: 9999;
  font-family: 'Inter', sans-serif;
}

/* Botão Flutuante (Minimizado) */
.chat-fab {
  width: 64px;
  height: 64px;
  background-color: var(--ember, #FF6046);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,0.6);
  transition: transform 0.2s ease, background-color 0.2s ease;
  border: none;
  color: var(--void-black, #000000);
}

.chat-fab:hover {
  transform: scale(1.08);
  background-color: var(--ember-bright, #FF7B5E);
}

.chat-fab svg {
  width: 32px;
  height: 32px;
}

/* Card do Chat (Aberto) */
.ai-chat-card {
  --chat-bg: var(--gunmetal-deep, #23272E);
  --chat-border: rgba(94, 105, 118, 0.3); /* steel translúcido */
  --chat-header-bg: rgba(0, 0, 0, 0.95);
  --chat-user-bubble: var(--ember, #FF6046);
  --chat-user-text: var(--void-black, #000000);
  --chat-assistant-bubble: rgba(94, 105, 118, 0.15);
  --chat-assistant-text: var(--white, #FFFFFF);
  --chat-input-bg: var(--void-black, #000000);
  --chat-input-border: rgba(94, 105, 118, 0.4);
  --chat-input-focus: var(--ember, #FF6046);

  position: absolute;
  bottom: 84px;
  right: 0;
  width: calc(100vw - 48px);
  max-width: 400px;
  height: 550px;
  max-height: calc(100vh - 140px);
  background-color: var(--chat-bg);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8);
  border: 1px solid var(--chat-border);
  display: flex;
  flex-direction: column;
  text-align: left;
  
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.ai-chat-card.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* Header */
.ai-chat-header {
  background: var(--chat-header-bg);
  padding: 18px 20px;
  border-bottom: 1px solid var(--chat-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ai-chat-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-chat-title h2 {
  font-family: 'Oswald', sans-serif;
  color: var(--white, #ffffff);
  font-size: 17px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 0;
}

.sparkle-icon {
  color: var(--ember, #FF6046);
  width: 20px;
  height: 20px;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.header-btn {
  background: transparent;
  border: none;
  color: var(--steel-light, #8B93A0);
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  transition: color 0.15s ease, background-color 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-btn:hover {
  color: var(--white, #ffffff);
  background-color: rgba(255, 255, 255, 0.1);
}

/* Messages container */
.ai-chat-messages {
  padding: 20px;
  height: calc(100% - 138px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Scrollbar styling */
.ai-chat-messages::-webkit-scrollbar {
  width: 6px;
}
.ai-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
.ai-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(94, 105, 118, 0.4);
  border-radius: 10px;
}
.ai-chat-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(94, 105, 118, 0.6);
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 24px;
}

.sparkle-icon-large {
  width: 48px;
  height: 48px;
  color: var(--ember, #FF6046);
  margin-bottom: 16px;
}

.empty-state h3 {
  font-family: 'Oswald', sans-serif;
  color: var(--white, #ffffff);
  font-size: 18px;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.empty-state p {
  color: var(--steel-light, #8B93A0);
  font-size: 14px;
  max-width: 320px;
  line-height: 1.6;
}

/* Chat bubble container */
.chat-bubble-container {
  display: flex;
  width: 100%;
}

.chat-bubble-container.user {
  justify-content: flex-end;
}

.chat-bubble-container.assistant {
  justify-content: flex-start;
}

/* Chat bubble */
.chat-bubble {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 12px;
}

.chat-bubble-container.user .chat-bubble {
  background-color: var(--chat-user-bubble);
  color: var(--chat-user-text);
  border-bottom-right-radius: 2px;
  font-weight: 500;
}

.chat-bubble-container.assistant .chat-bubble {
  background-color: var(--chat-assistant-bubble);
  color: var(--chat-assistant-text);
  border-bottom-left-radius: 2px;
  border: 1px solid rgba(94, 105, 118, 0.3);
}

.chat-bubble p {
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
  word-break: break-word;
}

/* Typing indicator dot animation */
.dots-container {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--steel-light, #8B93A0);
  animation: pulse 1.4s infinite ease-in-out both;
}

.delay-75 { animation-delay: 0.2s; }
.delay-150 { animation-delay: 0.4s; }

@keyframes pulse {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

/* Input Form */
.ai-chat-form {
  padding: 16px;
  border-top: 1px solid var(--chat-border);
  background-color: var(--chat-bg);
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.ai-chat-form.focused {
  border-top-color: var(--chat-input-focus);
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper input {
  width: 100%;
  background-color: var(--chat-input-bg);
  border: 1px solid var(--chat-input-border);
  border-radius: 9999px;
  padding: 14px 52px 14px 20px;
  color: var(--white, #ffffff);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.input-wrapper input::placeholder {
  color: var(--steel, #5E6976);
}

.input-wrapper input:focus {
  border-color: var(--chat-input-focus);
}

.input-wrapper button {
  position: absolute;
  right: 6px;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, color 0.15s ease;
  background-color: transparent;
}

.input-wrapper button:disabled {
  color: var(--steel, #5E6976);
  cursor: not-allowed;
}

.input-wrapper button:not(:disabled) {
  color: var(--void-black, #000000);
  background-color: var(--ember, #FF6046);
}

.input-wrapper button:not(:disabled):hover {
  background-color: var(--ember-bright, #FF7B5E);
}

.input-wrapper svg {
  width: 18px;
  height: 18px;
}

.hidden {
  display: none !important;
}

.spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

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

.animate-fade-in {
  animation: fade-in 0.3s ease-out forwards;
}

/* Ajuste Responsivo para telas pequenas */
@media (max-width: 560px) {
  .ai-chat-card {
    width: calc(100vw - 32px);
    right: 0;
    bottom: 84px;
    max-height: calc(100vh - 120px);
  }
  #ai-assistant-root {
    right: 16px;
    bottom: 16px;
  }
}
