/* 
 * Chat Styles Compartilhados - Sistema Principal e Widget
 * Este arquivo garante que ambos usem exatamente o mesmo layout
 */

/* CSS Variables - Cores exatas do Tailwind */
:root {
  --primary: 207 90% 54%;
  --primary-foreground: 211 100% 99%;
  --slate-50: 248 250 252;
  --slate-100: 241 245 249;
  --slate-200: 226 232 240;
  --slate-300: 203 213 225;
  --slate-400: 148 163 184;
  --slate-500: 100 116 139;
  --slate-600: 71 85 105;
  --slate-700: 51 65 85;
  --slate-800: 30 41 59;
  --slate-900: 15 23 42;
  --blue-100: 219 234 254;
  --blue-700: 29 78 216;
}

/* Container do Chat */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: white;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* Header do Chat */
.chat-header {
  display: none;
  padding: 1rem;
  border-bottom: 1px solid rgb(226 232 240 / 1); /* border-slate-200 */
  background: white;
}

@media (min-width: 1024px) {
  .chat-header {
    display: block;
  }
}

.chat-header-content {
  display: flex;
  align-items: center;
}

.chat-header-icon {
  width: 2.5rem; /* w-10 */
  height: 2.5rem; /* h-10 */
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgb(209 213 219 / 1); /* border-gray-300 */
  margin-right: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-header-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-header-title {
  font-size: 1.125rem; /* text-lg */
  font-weight: 600; /* font-semibold */
  color: rgb(15 23 42 / 1); /* text-slate-900 */
}

/* Messages Container */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem; /* p-3 */
  display: flex;
  flex-direction: column;
  gap: 0.5rem; /* Reduzido de 1rem para 0.5rem */
  background: white;
}

@media (min-width: 1024px) {
  .chat-messages {
    padding: 1.5rem; /* lg:p-6 */
    gap: 0.75rem; /* Reduzido de 1.5rem para 0.75rem */
  }
}

/* Chat Messages */
.chat-message {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.chat-message.user {
  justify-content: flex-end;
  margin-left: 20%;
}

.chat-message-content-wrapper {
  max-width: 80%;
}

.chat-message.user .chat-message-content-wrapper {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.chat-message-content {
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  word-wrap: break-word;
  line-height: 1.5;
}

.chat-message-content.user {
  background-color: #3b82f6;
  color: white;
  border-bottom-right-radius: 0.25rem;
  margin-bottom: 0.25rem;
}

.chat-message-content.assistant {
  background-color: #f1f5f9;
  color: #334155;
  border-bottom-left-radius: 0.25rem;
}

.chat-message-timestamp {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 0.25rem;
}

.chat-message.user .chat-message-timestamp {
  text-align: right;
}

/* Typing Indicator */
.chat-typing {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem; /* space-x-3 */
}

.chat-typing-avatar {
  width: 1.5rem; /* w-6 */
  height: 1.5rem; /* h-6 */
  background: hsl(var(--primary)); /* bg-primary */
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white;
}

@media (min-width: 1024px) {
  .chat-typing-avatar {
    width: 2rem; /* lg:w-8 */
    height: 2rem; /* lg:h-8 */
  }
}

.chat-typing-content {
  flex: 1;
}

.chat-typing-bubble {
  background: rgb(241 245 249 / 1); /* bg-slate-100 */
  border-radius: 1rem; /* rounded-2xl */
  border-top-left-radius: 0.25rem; /* rounded-tl-md */
  padding: 0.75rem; /* p-3 */
  width: 3rem; /* w-12 */
}

@media (min-width: 1024px) {
  .chat-typing-bubble {
    padding: 1rem; /* lg:p-4 */
    width: 4rem; /* lg:w-16 */
  }
}

.chat-typing-dots {
  display: flex;
  gap: 0.25rem; /* space-x-1 */
}

.chat-typing-dot {
  width: 0.5rem; /* w-2 */
  height: 0.5rem; /* h-2 */
  background: rgb(148 163 184 / 1); /* bg-slate-400 */
  border-radius: 50%;
  animation: chat-bounce 1.4s infinite ease-in-out;
}

.chat-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.chat-typing-dot:nth-child(2) { animation-delay: -0.16s; }
.chat-typing-dot:nth-child(3) { animation-delay: 0s; }

@keyframes chat-bounce {
  0%, 80%, 100% { 
    transform: scale(0);
    opacity: 0.5;
  }
  40% { 
    transform: scale(1);
    opacity: 1;
  }
}

/* Chat Input Container */
.chat-input {
  padding: 0.75rem; /* p-3 */
  border-top: 1px solid rgb(226 232 240 / 1); /* border-slate-200 */
  background: white;
}

@media (min-width: 1024px) {
  .chat-input {
    padding: 1.5rem; /* lg:p-6 */
  }
}

/* Chat Input Form */
.chat-input-form {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem; /* space-x-2 */
}

@media (min-width: 1024px) {
  .chat-input-form {
    gap: 1rem; /* lg:space-x-4 */
  }
}

.chat-input-textarea-container {
  flex: 1;
}

.chat-input-textarea {
  width: 100%;
  resize: none;
  border-radius: 1rem; /* rounded-2xl */
  border: 1px solid rgb(203 213 225 / 1); /* border-slate-300 */
  padding: 0.5rem 0.75rem; /* px-3 py-2 */
  font-size: 0.875rem; /* text-sm */
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  min-height: 44px;
  max-height: 120px;
  font-family: inherit;
  line-height: 1.5;
}

@media (min-width: 1024px) {
  .chat-input-textarea {
    padding: 0.75rem 1rem; /* lg:px-4 lg:py-3 */
    min-height: 48px;
  }
}

.chat-input-textarea::placeholder {
  color: rgb(100 116 139 / 1); /* placeholder-slate-500 */
}

.chat-input-textarea:focus {
  border-color: hsl(var(--primary)); /* focus:border-primary */
  box-shadow: 0 0 0 1px hsl(var(--primary)); /* focus:ring-1 focus:ring-primary */
}

/* Chat Input Info */
.chat-input-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
}

.chat-input-hint {
  font-size: 0.75rem; /* text-xs */
  color: rgb(100 116 139 / 1); /* text-slate-500 */
  display: none;
}

@media (min-width: 640px) {
  .chat-input-hint {
    display: block;
  }
}

.chat-input-counter {
  font-size: 0.75rem; /* text-xs */
  color: rgb(100 116 139 / 1); /* text-slate-500 */
}

/* Chat Send Button */
.chat-send-button {
  background: hsl(var(--primary)); /* bg-primary */
  color: white;
  border: none;
  border-radius: 1rem; /* rounded-2xl */
  padding: 0.5rem 0.75rem; /* px-3 py-2 */
  cursor: pointer;
  font-size: 0.875rem; /* text-sm */
  font-weight: 500; /* font-medium */
  transition: background-color 0.3s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0;
  min-height: 44px;
}

@media (min-width: 1024px) {
  .chat-send-button {
    padding: 0.75rem 1.5rem; /* lg:px-6 lg:py-3 */
    min-height: 48px;
  }
}

.chat-send-button:hover:not(:disabled) {
  background: rgb(29 78 216 / 1); /* hover:bg-blue-700 */
}

.chat-send-button:disabled {
  background: rgb(148 163 184 / 1); /* disabled:bg-slate-400 */
  cursor: not-allowed;
  opacity: 0.6;
}

.chat-send-button-text {
  display: none;
}

@media (min-width: 1024px) {
  .chat-send-button-text {
    display: inline;
  }
}

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

.chat-messages::-webkit-scrollbar-track {
  background: rgb(248 250 252 / 1);
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgb(203 213 225 / 1);
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: rgb(148 163 184 / 1);
}

/* Widget Specific Overrides */
.widget-chat .chat-header {
  display: block; /* Sempre mostrar no widget */
}

/* Loading States */
.chat-loading {
  opacity: 0.7;
  pointer-events: none;
}

/* Focus States */
.chat-input-textarea:focus-visible {
  outline: 2px solid hsl(var(--primary));
  outline-offset: 2px;
}

/* High Contrast Support - REMOVIDO para evitar bordas extras */

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .chat-typing-dot {
    animation: none;
  }
  
  .chat-send-button {
    transition: none;
  }
  
  .chat-input-textarea {
    transition: none;
  }
}