/* ==========================================================================
   TUIUIU CHATBOT WIDGET - PANTANAL ESCOLA DE ARTES (TEMA BRANCO / LIGHT)
   ========================================================================== */

/* Garantir que o cursor customizado fique por cima de todo o widget */
.custom-cursor {
  z-index: 10000000 !important;
}

@media (pointer: fine) {
  #ollama-chat-trigger,
  #ollama-chat-window,
  #ollama-chat-window *,
  .ollama-widget-textarea,
  .ollama-widget-send,
  .ollama-widget-close {
    cursor: none !important;
  }
}

/* Botão Flutuante (Trigger) */
#ollama-chat-trigger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: #ffffff;
  border: 2px solid #ffffff;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  z-index: 999990;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#ollama-chat-trigger:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.35);
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

#ollama-chat-trigger:active {
  transform: scale(0.96);
}

/* Badge de Notificação */
.ollama-trigger-badge {
  position: absolute;
  top: 0px;
  right: 0px;
  width: 14px;
  height: 14px;
  background-color: #22c55e;
  border: 2px solid #ffffff;
  border-radius: 50%;
}

/* Janela do Chatbot Widget (Branca) */
#ollama-chat-window {
  position: fixed;
  bottom: 94px;
  right: 24px;
  width: 380px;
  height: 550px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 110px);
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 999990;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) scale(0.94);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: #1e293b;
}

#ollama-chat-window.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* Header do Widget (Branco) */
.ollama-widget-header {
  padding: 14px 18px;
  background: #ffffff;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ollama-widget-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ollama-widget-avatar {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ollama-widget-title {
  font-weight: 700;
  font-size: 0.98rem;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ollama-widget-sub {
  font-size: 0.72rem;
  color: #2563eb;
  background: #eff6ff;
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid #dbeafe;
  font-weight: 600;
}

.ollama-widget-close {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: all 0.2s;
}

.ollama-widget-close:hover {
  color: #0f172a;
  background: #f1f5f9;
}

/* Área de Mensagens (Fundo Claro) */
.ollama-widget-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
  background: #f8fafc;
}

.ollama-w-msg-row {
  display: flex;
  gap: 10px;
  width: 100%;
}

.ollama-w-msg-row.user {
  flex-direction: row-reverse;
}

.ollama-w-bubble {
  max-width: 85%;
  padding: 11px 15px;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.5;
  word-break: break-word;
}

.ollama-w-msg-row.user .ollama-w-bubble {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  border-bottom-right-radius: 3px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.ollama-w-msg-row.assistant .ollama-w-bubble {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  color: #1e293b;
  border-bottom-left-radius: 3px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* Estilos de Links Clicáveis */
.ollama-w-bubble a, .ollama-chat-link {
  color: #2563eb !important;
  font-weight: 600;
  text-decoration: underline;
  word-break: break-all;
  transition: color 0.2s;
}

.ollama-w-msg-row.user .ollama-w-bubble a {
  color: #93c5fd !important;
}

.ollama-w-bubble a:hover {
  color: #1d4ed8 !important;
  text-decoration: underline;
}

.ollama-w-bubble code {
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.84em;
  color: #0f172a;
  border: 1px solid #e2e8f0;
}

.ollama-w-bubble pre {
  background: #0f172a;
  color: #f8fafc;
  padding: 12px;
  border-radius: 10px;
  overflow-x: auto;
  margin: 8px 0;
}

.ollama-w-cursor {
  display: inline-block;
  width: 6px;
  height: 14px;
  background-color: #2563eb;
  vertical-align: middle;
  margin-left: 2px;
  animation: ollamaBlink 0.8s infinite;
}

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

/* Animação de Thinking (Pensando...) */
.ollama-w-thinking {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #64748b;
  font-size: 0.88rem;
  font-weight: 500;
  padding: 2px 0;
}

.ollama-w-thinking-icon {
  color: #2563eb;
  font-size: 16px;
  display: inline-block;
  animation: thinkingSpin 2s infinite linear;
}

@keyframes thinkingSpin {
  0% { transform: rotate(0deg); }
  50% { transform: rotate(180deg) scale(1.15); }
  100% { transform: rotate(360deg); }
}

.ollama-w-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 2px;
}

.ollama-w-dots span {
  width: 6px;
  height: 6px;
  background-color: #2563eb;
  border-radius: 50%;
  display: inline-block;
  animation: thinkingBounce 1.4s infinite ease-in-out both;
}

.ollama-w-dots span:nth-child(1) { animation-delay: 0s; }
.ollama-w-dots span:nth-child(2) { animation-delay: 0.2s; }
.ollama-w-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes thinkingBounce {
  0%, 80%, 100% { transform: scale(0.3); opacity: 0.3; }
  40% { transform: scale(1); opacity: 1; }
}

/* Área de Input do Widget (Branca & Elegante) */
.ollama-widget-input-area {
  padding: 14px 16px 16px;
  background: #ffffff;
  border-top: 1px solid #f1f5f9;
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.ollama-widget-textarea {
  flex: 1;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 18px;
  color: #0f172a;
  font-family: inherit;
  font-size: 0.9rem;
  padding: 11px 16px;
  outline: none;
  resize: none;
  max-height: 120px;
  min-height: 44px;
  height: 44px;
  line-height: 1.4;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}

.ollama-widget-textarea::-webkit-scrollbar {
  display: none;
}

.ollama-widget-textarea::placeholder {
  color: #94a3b8;
  font-size: 0.88rem;
}

.ollama-widget-textarea:focus {
  border-color: #2563eb;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.ollama-widget-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #2563eb;
  border: none;
  color: #ffffff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
  transition: transform 0.2s, background-color 0.2s, opacity 0.2s;
}

.ollama-widget-send:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none;
}

.ollama-widget-send:not(:disabled):hover {
  transform: scale(1.06);
  background-color: #1d4ed8;
}

/* Ajuste Responsivo Mobile */
@media (max-width: 480px) {
  #ollama-chat-window {
    bottom: 84px;
    right: 12px;
    left: 12px;
    width: auto;
    max-width: none;
    height: calc(100vh - 100px);
  }
}
