/* Assistente de Encaixe da Agenda - Fase C (chat), patch C2.
   Painel lateral (drawer) - padrao NOVO nesta tela (nao existe drawer em
   nenhuma outra tela do sistema hoje - ver
   private/docs/planos/AGENDA_IA_ALOCACAO_FASEC_ARQUITETURA_2026-09-19.md).
   Cantos arredondados so no lado que nao cola na borda da tela (AGENTS.md:
   "todo popup/modal tem cantos arredondados"). */

/* Sem reset global de box-sizing no projeto (so por componente) - aplicado
   aqui pra toda a arvore do painel, senao qualquer elemento com
   width:100% + padding/border (textarea, input, select) ultrapassa o
   limite do container. Antes so passava despercebido porque o excesso
   sumia fora da tela no lado direito (padrao); ficou visivel entrando por
   cima da agenda quando o painel foi pro lado esquerdo. */
#painelAssistenteAgenda,
#painelAssistenteAgenda * {
  box-sizing: border-box;
}

#painelAssistenteAgenda {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: 400px;
  max-width: 92vw;
  background: #fff;
  box-shadow: -8px 0 24px rgba(15, 23, 42, 0.22);
  border-radius: 12px 0 0 12px;
  z-index: 20001;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
  font-family: inherit;
}

#painelAssistenteAgenda.aberto {
  transform: translateX(0);
}

/* Painel deslocavel para o outro lado da tela (botao "⇆" no header) - deixa
   o usuario ver o lado oposto da agenda enquanto conversa com o assistente. */
#painelAssistenteAgenda.assistente-lado-esquerda {
  right: auto;
  left: 0;
  box-shadow: 8px 0 24px rgba(15, 23, 42, 0.22);
  border-radius: 0 12px 12px 0;
  transform: translateX(-100%);
}

#painelAssistenteAgenda.assistente-lado-esquerda.aberto {
  transform: translateX(0);
}

#painelAssistenteAgenda.assistente-lado-esquerda .assistente-header {
  border-radius: 0 12px 0 0;
}

#painelAssistenteAgenda.assistente-lado-esquerda .assistente-footer {
  border-radius: 0 0 12px 0;
}

.assistente-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid #e2e8f0;
  border-radius: 12px 0 0 0;
  background: #f8fafc;
}

.assistente-header-titulo {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin: 0;
  flex: 1;
  min-width: 0;
}

.assistente-header-marca {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: #1f2937;
}

.assistente-header-marca img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  border-radius: 4px;
}

.assistente-header-subtitulo {
  font-size: 0.74rem;
  font-weight: 600;
  color: #64748b;
}

.assistente-disclaimer {
  font-size: 0.7rem;
  line-height: 1.35;
  color: #92400e;
  background: #fffbeb;
  border-bottom: 1px solid #fde68a;
  padding: 0.5rem 1rem;
}

.assistente-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: none;
  border-radius: 999px;
  background: #e9f0ff;
  color: #1f4271;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
  min-height: 38px;
  padding: 0 0.9rem;
  cursor: pointer;
  transition: 0.2s;
}

.assistente-btn:hover {
  background: #d4e3ff;
}

.assistente-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.assistente-btn--primary {
  background: #1f4271;
  color: #fff;
}

.assistente-btn--primary:hover {
  background: #16305a;
}

.assistente-btn-icon {
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  color: #64748b;
  font-size: 1.1rem;
}

.assistente-btn-icon:hover {
  background: #e2e8f0;
}

.assistente-historico {
  border-bottom: 1px solid #e2e8f0;
  padding: 0.6rem 1rem;
  background: #fff;
}

.assistente-historico-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  font-size: 0.8rem;
  font-weight: 700;
  color: #475569;
  cursor: pointer;
  padding: 0.2rem 0;
}

.assistente-historico-lista {
  margin-top: 0.5rem;
  max-height: 160px;
  overflow-y: auto;
  display: none;
}

.assistente-historico-lista.aberta {
  display: block;
}

.assistente-historico-item {
  display: block;
  width: 100%;
  text-align: left;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  margin-bottom: 0.35rem;
  font-size: 0.78rem;
  color: #334155;
  cursor: pointer;
}

.assistente-historico-item:hover {
  background: #eef2ff;
}

.assistente-thread {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: #f9fafb;
}

.assistente-msg {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.assistente-msg--user {
  align-items: flex-end;
}

.assistente-msg--bot {
  align-items: flex-start;
}

.assistente-bubble {
  max-width: 100%;
  padding: 0.6rem 0.8rem;
  border-radius: 12px;
  font-size: 0.85rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

.assistente-msg--user .assistente-bubble {
  background: #1f4271;
  color: #fff;
  border-radius: 12px 12px 2px 12px;
}

.assistente-msg--bot .assistente-bubble {
  background: #fff;
  color: #1f2937;
  border: 1px solid #e2e8f0;
  border-radius: 2px 12px 12px 12px;
}

.assistente-feedback {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.assistente-feedback-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.1rem 0.3rem;
  border-radius: 6px;
}

.assistente-feedback-btn:hover {
  background: #e2e8f0;
}

.assistente-feedback-ok {
  font-size: 0.72rem;
  color: #64748b;
}

.assistente-pendencia-form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.75rem;
  width: 100%;
}

.assistente-campo {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.assistente-campo-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #475569;
}

.assistente-campo input,
.assistente-campo select {
  min-height: 38px;
  height: 38px;
  line-height: 1.45;
  padding: 0.35rem 0.5rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.85rem;
}

.assistente-campo-dupla {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.assistente-campo-nota {
  font-size: 0.7rem;
  color: #94a3b8;
}

.assistente-sugestoes {
  width: 100%;
}

.assistente-sugestoes-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.assistente-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  font-size: 0.8rem;
  color: #1f2937;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.assistente-card-datas {
  font-weight: 700;
  color: #1f4271;
}

.assistente-card-motivo {
  color: #16803c;
  font-size: 0.74rem;
}

.assistente-card-aviso {
  color: #b45309;
  font-size: 0.74rem;
}

.assistente-sugestoes-more {
  margin-top: 0.5rem;
  display: flex;
  justify-content: center;
}

.assistente-snapshot {
  font-size: 0.74rem;
  color: #64748b;
  font-style: italic;
}

.assistente-footer {
  border-top: 1px solid #e2e8f0;
  padding: 0.75rem 1rem;
  background: #fff;
  border-radius: 0 0 0 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.assistente-footer .assistente-btn {
  flex: 1 1 calc(50% - 0.4rem);
}

.assistente-footer-texto-livre-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  width: 100%;
  margin-bottom: 0.4rem;
}

.assistente-footer-texto-livre {
  width: 100%;
  min-height: 72px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
  font-size: 0.85rem;
  line-height: 1.4;
  font-family: inherit;
  color: #1f2937;
  background: #fff;
  resize: vertical;
}

.assistente-footer-texto-livre:focus {
  outline: none;
  border-color: #1f4271;
}

.assistente-footer-texto-livre-row .assistente-btn {
  align-self: flex-end;
}
