/* ==========================================================================
   Variáveis Globais
   ========================================================================== */
:root {
  /* Cores */
  --primary-color: #005A92;
  --secondary-color: #BC9D32;
  --success-color: #427842;
  --neutral-color: #A0A0A0;
  --warning-color: #333333;
  --text-color: #000000;
  
  /* Gradientes */
  --bg-gradient: linear-gradient(135deg, #f6f8fc 0%, #ffffff 100%);
  --banner-gradient: linear-gradient(90deg, #FFB74D, #FFA726);
  
  /* Sombras */
  --shadow-sm: 0 1px 3px rgba(0, 90, 146, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(0, 90, 146, 0.15);
  --shadow-lg: 0 10px 15px -3px rgba(0, 90, 146, 0.2);
  
  /* Layout */
  --banner-height: 150px;
  --banner-height-mobile: 140px;
  
  /* Fontes */
  --font-primary: 'Antenna Regular', system-ui, sans-serif;
  --font-bold: 'Antenna Bold', sans-serif;
  --font-logo: 'Boris Black Bloxx', sans-serif;
}

/* ==========================================================================
   Reset e Estilos Base
   ========================================================================== */
* { 
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-primary);
  background: var(--bg-gradient);
  color: var(--text-color);
  line-height: 1.6;
}

/* ==========================================================================
   Utilitários
   ========================================================================== */
.hidden {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   Componentes - Logo
   ========================================================================== */
.logo-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}

.logo-text {
  font-family: var(--font-logo);
  font-weight: 700;
  font-size: 32px;
  color: var(--primary-color);
}

.logo-separator {
  color: var(--neutral-color);
  opacity: 0.5;
}

.logo-subtitle {
  font-family: var(--font-bold);
  font-weight: 500;
  color: var(--primary-color);
  font-size: 16px;
}

/* ==========================================================================
   Componentes - Banner de Avaliação
   ========================================================================== */
.evaluation-banner {
  background: var(--banner-gradient);
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  padding: 16px 24px;
  box-shadow: var(--shadow-md);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  height: var(--banner-height);
  display: flex;
  align-items: center;
}

.banner-content {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.banner-title {
  font-family: var(--font-bold);
  font-size: 16px;
  font-weight: 700;
  color: var(--warning-color);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.banner-description {
  font-size: 13px;
  line-height: 1.5;
  color: var(--warning-color);
  opacity: 0.9;
  max-width: 800px;
  margin: 0 auto;
}

.banner-warning {
  font-size: 13px;
  font-weight: 500;
  color: var(--warning-color);
  background: rgba(255, 255, 255, 0.4);
  padding: 8px 16px;
  border-radius: 8px;
  display: inline-block;
  box-shadow: var(--shadow-sm);
  margin: 0 auto;
}

/* Ajustes responsivos para o banner */
@media (max-width: 768px) {
  :root {
    --banner-height: var(--banner-height-mobile);
  }
  
  .evaluation-banner {
    padding: 16px;
    height: var(--banner-height-mobile);
  }
  
  .banner-content {
    gap: 8px;
  }

  .banner-title {
    font-size: 14px;
    margin-bottom: 2px;
  }

  .banner-description,
  .banner-warning {
    font-size: 12px;
  }

  .banner-warning {
    padding: 6px 12px;
  }
}

@media (max-width: 480px) {
  .evaluation-banner {
    padding: 12px;
  }

  .banner-content {
    gap: 6px;
  }

  .banner-title {
    font-size: 13px;
  }

  .banner-description,
  .banner-warning {
    font-size: 11px;
  }

  .banner-warning {
    padding: 4px 10px;
  }
}

/* ==========================================================================
   Componentes - Chat Container
   ========================================================================== */
.chat-container {
  position: fixed;
  top: var(--banner-height);
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 1000px;
  height: calc(100vh - var(--banner-height));
  background: white;
  z-index: 800;
  display: flex;
  flex-direction: column;
  border-radius: 24px 24px 0 0;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
  overflow: hidden;
}

/* ==========================================================================
   Componentes - Histórico de Mensagens
   ========================================================================== */
.historico {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
  scroll-behavior: smooth;
}

.mensagem {
  max-width: 80%;
  margin-bottom: 24px;
  animation: fadeScale 0.3s ease;
  word-wrap: break-word;
}

.pergunta {
  margin-left: auto;
  background: var(--primary-color);
  color: white;
  padding: 16px 24px;
  border-radius: 20px;
  border-bottom-right-radius: 4px;
  box-shadow: var(--shadow-md);
}

/* ==========================================================================
   Componentes - Serviços
   ========================================================================== */
.servico-item {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  min-height: 180px;
  gap: 8px;
  background: white;
  border: 1px solid var(--neutral-color);
  border-radius: 16px;
  padding: 20px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   Componentes - Botões
   ========================================================================== */
.botao-acesso {
  display: inline-block;
  padding: 12px 24px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  font-family: var(--font-bold);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

/* ==========================================================================
   Animações
   ========================================================================== */
@keyframes fadeScale {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ==========================================================================
   Media Queries
   ========================================================================== */
@media (max-width: 768px) {
  .chat-container {
    border-radius: 0;
    height: calc(100vh - var(--banner-height-mobile));
  }
  
  .historico {
    padding: 16px;
  }
  
  .servico-item {
    padding: 16px;
  }
}

/* ==========================================================================
   Tela de introdução
   ========================================================================== */
.intro-container {
  position: fixed;
  top: var(--banner-height);
  left: 0;
  width: 100%;
  height: calc(100vh - var(--banner-height));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg-gradient);
  z-index: 900;
  overflow-y: auto;
}

.intro-container.hidden {
  display: none;
}

.intro-content {
  width: 100%;
  max-width: 720px;
  background: rgba(255, 255, 255, 0.95);
  padding: 48px;
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
  margin-top: 48px;
}

.intro-content h1 {
  font-family: 'Antenna Bold', sans-serif;
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--primary-color);
}

/* Botão primário */
.btn-primario {
  display: inline-block;
  padding: 16px 32px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 100px;
  font-family: 'Antenna Bold', sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
  margin-top: 24px;
}

.btn-primario:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  background: #004a7a;
}

/* Estilos para o container de feedback e botões de feedback */
.feedback-container {
  display: flex;
  align-items: center;
  gap: 12px; /* Aumentado de 8px para melhor espaçamento */
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--gray-200);
  position: relative;
  min-height: 44px; /* Altura fixa para manter consistência */
}

.btn-feedback {
  background: transparent;
  border: none;
  padding: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative; /* Adicionado */
  width: 44px; /* Largura fixa */
  height: 44px; /* Altura fixa */
}

.btn-feedback img {
  width: 28px;  /* Aumentado de 20px */
  height: 28px; /* Aumentado de 20px */
  transition: opacity 0.3s ease, transform 0.3s ease, fill 0.3s ease;
  fill: var(--neutral-color);
}

.btn-feedback:hover {
  transform: scale(1.2);
}

.btn-feedback:disabled {
  opacity: 0.6;
  cursor: default;
}

.btn-feedback.selected {
  transform: scale(1.2);
}

.btn-feedback.hidden {
  width: 0;
  padding: 0;
  margin: 0;
  opacity: 0;
  visibility: hidden;
  transform: scale(0);
}

.btn-feedback.selected[data-feedback="like"] {
  color: var(--success-color);
}

.btn-feedback.selected[data-feedback="dislike"] {
  color: var(--neutral-color);
}

.btn-feedback.selected img {
  fill: var(--primary-color); /* SVG fica azul quando selecionado */
}

.feedback-message {
  font-family: 'Antenna Regular', sans-serif;
  font-size: 14px;
  color: var(--primary-color);
  position: absolute;
  left: 56px; /* Ajustado para ficar após o botão */
  top: 50%; /* Centraliza verticalmente */
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity 0.3s ease;
  white-space: nowrap; /* Mantém o texto em uma linha */
}

.feedback-message.visible {
  opacity: 1;
  color: var(--primary-color);
}

/* Estilos para o botão "Novo Chat" */
.btn-novo-chat {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--primary-color);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  font-family: 'Antenna Bold', sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-novo-chat:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99,102,241,0.2);
  background: #004a7a;
}

/* Estilos para o chat header */
.chat-header {
  padding: 14px;
  background: white;
  border-bottom: 2px solid var(--primary-color);
}

/* Estilos para o container de serviços */
.servicos-relacionados {
  margin-top: 24px;
  width: 100%;
}

.servicos-relacionados h4 {
  color: var(--gray-700);
  font-size: 1em; /* Aumentado de 0.85em */
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0.02em;
  margin: 16px 0 16px 0; /* Aumentado margins */
  padding: 4px 0 8px 0; /* Reduzido padding */
  border-bottom: 1px solid var(--primary-color);
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.servicos-relacionados h4::before {
  content: '';
  display: block;
  width: 3px;
  height: 16px;
  background: var(--primary-color);
  border-radius: 2px;
  margin-right: 4px;
}

.servicos-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.servicos-secundarios-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  align-items: stretch;
}

.servicos-secundarios-grid:has(:only-child) {
  grid-template-columns: minmax(0, 500px); /* Limita a largura máxima */
  justify-content: center;
}

/* Estilos adicionais para formatação do serviço */
.servico-item h3 {
  color: var(--primary-color);
  font-size: 1.15em; /* Reduzido de 1.25em */
  font-weight: 600;
  line-height: 1.4;
  height: auto;
  min-height: 2.4em; /* Reduzido de 2.8em */
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  letter-spacing: -0.01em;
  font-family: 'Antenna Bold', sans-serif;
}

.orgao-text {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--gray-700);
  font-size: 0.9em; /* Reduzido de 0.95em */
  font-weight: 500;
  margin: 0;
  height: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.orgao-text::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  background-color: var(--primary-color);
  border-radius: 50%;
  opacity: 0.6;
}

.descricao-text {
  color: var(--text-color);
  font-size: 0.9em; /* Reduzido de 0.95em */
  line-height: 1.5; /* Reduzido de 1.6 */
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: auto;
  min-height: 4.2em; /* Reduzido de 4.8em */
  opacity: 0.9;
  white-space: pre-line; /* Adiciona essa linha para preservar quebras de linha */
}

.botao-acesso {
  background: var(--primary-color);
  color: white;
  font-weight: 600;
  font-size: 0.9em; /* Reduzido de 0.95em */
  padding: 12px 24px; /* Reduzido de 14px 28px */
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px; /* Reduzido de 16px */
  box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.2);
}

.botao-acesso:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 16px -4px rgba(99, 102, 241, 0.3);
  background: #004a7a;
}

.botao-acesso::after {
  content: '→';
  font-size: 1.2em;
  transition: transform 0.3s ease;
}

.botao-acesso:hover::after {
  transform: translateX(4px);
}

/* Grid de serviços com melhor espaçamento */
.servicos-grid {
  display: grid;
  gap: 16px; /* Reduzido de 24px */
  margin-top: 24px;
}

.servicos-secundarios-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px; /* Reduzido de 24px */
  align-items: stretch;
}

.servicos-secundarios-grid:has(:only-child) {
  grid-template-columns: minmax(0, 600px);
  justify-content: center;
}

/* Cabeçalho da seção de serviços relacionados */
.servicos-relacionados h4 {
  color: var(--gray-700);
  font-size: 1em; /* Aumentado de 0.85em */
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.05em;
  margin: 8px 0 12px 0; 
  padding: 4px 0 8px 0; 
  border-bottom: 1px solid var(--primary-color);
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.servicos-relacionados h4::before {
  content: '';
  display: block;
  width: 3px;
  height: 16px;
  background: var(--primary-color);
  border-radius: 2px;
  margin-right: 4px;
}

/* Estilo comum para cabeçalhos de seção */
.secao-header {
  color: var(--gray-700);
  font-size: 1em; /* Aumentado de 0.85em */
  font-weight: 500; /* Reduzido de 600 para ficar mais elegante */
  text-transform: none; /* Removido o uppercase */
  letter-spacing: 0.02em; /* Reduzido de 0.05em */
  margin: 8px 0 16px 0; /* Aumentado margin-bottom para dar mais espaço */
  padding: 4px 0 8px 0; /* Reduzido padding */
  border-bottom: 1px solid var(--primary-color);
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.secao-header::before {
  content: '';
  display: block;
  width: 3px;
  height: 16px;
  background: var(--primary-color);
  border-radius: 2px;
  margin-right: 4px;
}

/* Ajuste para o cabeçalho de serviços relacionados */
.servicos-relacionados h4 {
  color: var(--gray-700);
  font-size: 1em; /* Aumentado de 0.85em */
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0.02em;
  margin: 16px 0 16px 0; /* Aumentado margins */
  padding: 4px 0 8px 0; /* Reduzido padding */
  border-bottom: 1px solid var(--primary-color);
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.servicos-relacionados h4::before {
  content: '';
  display: block;
  width: 3px;
  height: 16px;
  background: var(--primary-color);
  border-radius: 2px;
  margin-right: 4px;
}

/* Efeito de digitação */
.typing-dots::after {
  content: '';
  animation: typingDots 1.5s infinite;
}

@keyframes typingDots {
  0% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
  100% { content: ''; }
}

/* Responsividade */
@media (max-width: 768px) {
  .evaluation-banner {
    padding: 16px;
    height: var(--banner-height-mobile);
  }

  .banner-content {
    gap: 8px;
  }

  .intro-container {
    padding: 24px 16px;
    align-items: flex-start;
  }

  .intro-content {
    padding: 32px;
    margin-top: 64px;
  }

  .chat-container {
    top: var(--banner-height-mobile);
    height: calc(100vh - var(--banner-height-mobile));
    border-radius: 0;
  }

  .chat-header {
    padding: 12px;
    position: sticky;
    top: 0;
    width: 100%;
    z-index: 10;
    background: white;
  }

  .historico {
    flex: 1;
    padding: 16px;
    padding-bottom: 80px;
  }

  .entrada {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 12px;
    background: white;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
  }

  .entrada input[type="text"] {
    padding: 12px 16px;
    font-size: 14px;
  }

  .entrada button {
    padding: 12px 20px;
    font-size: 14px;
  }

  .btn-novo-chat {
    padding: 6px 12px;
    font-size: 12px;
  }

  .mensagem {
    max-width: 95%;
    margin-bottom: 16px;
  }

  .servico-item {
    padding: 16px;
  }

  .servicos-secundarios-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .servico-principal {
    min-height: auto;
  }

  .botao-acesso {
    padding: 10px 20px;
    font-size: 14px;
  }

  .feedback-container {
    margin-top: 12px;
    gap: 8px;
  }

  .btn-feedback {
    width: 36px;
    height: 36px;
  }

  .btn-feedback img {
    width: 24px;
    height: 24px;
  }

  .chat-container, .intro-container {
    margin-top: 0;
  }
}

/* Ajustes específicos para telas muito pequenas */
@media (max-width: 480px) {
  .intro-container {
    padding: 16px;
  }

  .intro-content {
    padding: 24px;
    margin-top: 48px;
  }

  .banner-content {
    gap: 6px;
  }

  .banner-title {
    font-size: 13px;
  }

  .banner-description,
  .banner-warning {
    font-size: 11px;
  }

  .historico {
    padding: 12px;
    padding-bottom: 70px;
  }

  .entrada {
    padding: 8px 12px;
  }
}

/* Ajustes para evitar zoom em inputs no iOS */
@media screen and (-webkit-min-device-pixel-ratio: 0) { 
  select,
  textarea,
  input[type="text"] {
    font-size: 16px !important;
  }
}

/* Ajustes para orientação paisagem em dispositivos móveis */
@media (max-height: 500px) and (orientation: landscape) {
  .chat-header {
    padding: 8px;
  }

  .historico {
    padding-top: 60px;
    padding-bottom: 60px;
  }

  .entrada {
    padding: 8px;
  }
}

/* Ajuste do botão secundário para manter consistência */
.botao-secundario {
  background: var(--primary-color);
  opacity: 0.9;
}

.botao-secundario:hover {
  opacity: 1;
  background: #004a7a;
}

.tag-beta {
    background-color: #000;
    color: #FFA726;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 1px;
}

.version-tag {
    background: linear-gradient(90deg, #FFB74D, #FFA726);
    color: #000;
    padding: 4px 12px;
    border-radius: 4px;
    margin-left: 8px;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 1px;
    text-transform: uppercase;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* ==========================================================================
   Componentes - Área de Entrada de Mensagem
   ========================================================================== */
.entrada {
  position: sticky;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 16px 24px;
  background: white;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  display: flex;
  gap: 12px;
  align-items: center;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
  z-index: 100;
}

.entrada input[type="text"] {
  flex: 1;
  min-width: 0; /* Permite que o input encolha corretamente */
  height: 48px;
  padding: 0 20px;
  border: 2px solid var(--neutral-color);
  border-radius: var(--border-radius-full);
  font-size: 16px;
  font-family: var(--font-primary);
  color: var(--text-color);
  background: white;
  transition: all 0.3s ease;
}

.entrada input[type="text"]:hover {
  border-color: var(--primary-color);
  box-shadow: 0 2px 8px rgba(0, 90, 146, 0.1);
}

.entrada input[type="text"]:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px rgba(0, 90, 146, 0.1);
  background: white;
}

.entrada input[type="text"]::placeholder {
  color: var(--neutral-color);
  opacity: 0.8;
}

.entrada button {
  height: 48px;
  padding: 0 28px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--border-radius-full);
  font-family: var(--font-bold);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(0, 90, 146, 0.2);
}

.entrada button:hover {
  background: #004a7a;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 90, 146, 0.3);
}

.entrada button:active {
  transform: translateY(1px);
  box-shadow: 0 2px 4px rgba(0, 90, 146, 0.2);
}

/* Ajustes responsivos para a área de entrada */
@media (max-width: 768px) {
  .entrada {
    position: relative;
    bottom: 5.5vh;
    left: 0;
    padding: 12px 16px;
    gap: 8px;
  }

  .entrada input[type="text"] {
    height: 44px;
    padding: 0 16px;
    font-size: 15px;
  }

  .entrada button {
    height: 44px;
    padding: 0 20px;
    font-size: 15px;
    min-width: 80px;
  }
}

@media (max-width: 480px) {
  .entrada {
    padding: 8px 12px;
  }

  .entrada input[type="text"] {
    height: 40px;
    padding: 0 12px;
    font-size: 14px;
  }

  .entrada button {
    height: 40px;
    padding: 0 16px;
    font-size: 14px;
    min-width: 70px;
  }
}

/* Ajuste para evitar que o teclado virtual cubra o campo em dispositivos móveis */
@media (max-height: 500px) {
  .entrada {
    position: sticky;
  }
}