/* ==========================================================================
   PORTAL DELIBERATIVO ABR TELECOM - STYLESYSTEM (styles.css)
   ========================================================================== */

/* --- TOOLTIP CUSTOMIZADO (substitui o title= nativo do navegador) --- */
/* Dentro de @layer components para PERDER para as utilities do Tailwind
   (@layer utilities): regra fora de layer venceria .fixed/.absolute
   independente de especificidade, quebrando os botões flutuantes. */
@layer components {
  [data-tooltip] {
    position: relative;
  }
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translate(-50%, 4px);
  background: #1c0640;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.3;
  padding: 5px 9px;
  border-radius: 8px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
  z-index: 70;
  box-shadow: 0 6px 16px rgba(28, 6, 64, 0.25);
}
[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

/* O botão do Assistente fica colado na borda direita da tela (bottom-6 right-6)
   — a tooltip centralizada padrão vazaria para fora do viewport e cortaria o
   texto. Aqui ela nasce alinhada à direita do botão e cresce para a esquerda. */
#assistantTriggerBtn::after {
  left: auto;
  right: 0;
  transform: translateY(4px);
}
#assistantTriggerBtn:hover::after,
#assistantTriggerBtn:focus-visible::after {
  transform: translateY(0);
}

/* --- DECLARAÇÕES DE TRANSICÕES E ESTADO DO SPA --- */
.screen {
  display: none !important;
}
.screen.active {
  display: block !important;
}

.wizard-step-content {
  display: none !important;
}
.wizard-step-content.active {
  display: block !important;
}

/* Scrollbar Customizado */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* --- ESTILOS DE LAYOUT --- */
.app-container {
  font-family: 'Inter', sans-serif;
  background-color: #f8fafc;
}

/* Estilo do Menu Lateral */
.sidebar {
  background: linear-gradient(180deg, #371475 0%, #1c0640 100%);
  box-shadow: 4px 0 24px rgba(55, 20, 117, 0.15);
}

.nav-btn {
  border: 1px solid transparent;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-btn.active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff !important;
  border-left: 3px solid #b896f5;
  box-shadow: inset 2px 0 8px rgba(255, 255, 255, 0.05);
}

/* --- WIZARD E DIVISÃO DE TELAS (SPLIT PANEL) --- */
.wizard-workspace {
  display: flex;
  height: calc(100vh - 120px);
  gap: 1.5rem;
}

.wizard-panel {
  flex: 1;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.3s ease;
}

.preview-panel {
  width: 48%;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.3s ease;
}

.wizard-workspace.full-preview .wizard-panel {
  display: none !important;
}

.wizard-workspace.full-preview .preview-panel {
  width: 100% !important;
}

.wizard-workspace.no-preview .preview-panel {
  display: none !important;
}

/* --- FORMATO EXECUTIVO FÍSICO A4 --- */
.paper-container {
  flex: 1;
  overflow-y: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 1.5rem;
  background: #cbd5e1;
}

.a4-sheet {
  width: 210mm;
  min-height: 297mm;
  background: #ffffff;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.15);
  box-sizing: border-box;
  padding: 20mm 15mm;
  position: relative;
}

.a4-page {
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: justify;
}

.page-break {
  page-break-before: always;
  border-top: 1px dashed #e2e8f0;
  margin-top: 15mm;
  padding-top: 15mm;
}

/* --- DESIGN DO MANUAL DO CONSELHEIRO --- */
.manual-container {
  display: flex;
  height: calc(100vh - 160px);
  gap: 1.5rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.manual-sidebar {
  width: 280px;
  background: #f8fafc;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
}

.manual-content {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  text-align: left;
}

.manual-menu-item {
  text-align: left;
  padding: 0.75rem 1.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
  border-left: 3px solid transparent;
  transition: all 0.2s ease;
}

.manual-menu-item:hover {
  background: #f1f5f9;
  color: #371475;
}

.manual-menu-item.active {
  background: #f5f0ff;
  color: #371475;
  border-left-color: #6330BF;
}

.manual-search-box {
  padding: 1rem;
  border-bottom: 1px solid #e2e8f0;
}

.manual-glossary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

/* --- DIRETRIZES DE IMPRESSÃO --- */
@media print {
  body, html {
    background: #ffffff !important;
    color: #000000 !important;
    width: 210mm !important;
    height: auto !important;
  }
  
  /* Oculta tudo que não faz parte do documento deliberativo */
  .sidebar,
  .main-header,
  .preview-header,
  .wizard-panel,
  .main-footer,
  .simulation-console,
  .btn,
  select,
  input {
    display: none !important;
  }
  
  .main-content,
  .screen-container,
  .wizard-workspace,
  .preview-panel,
  .paper-container {
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
    display: block !important;
    height: auto !important;
    width: 100% !important;
    background: none !important;
    box-shadow: none !important;
  }
  
  .a4-sheet {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 210mm !important;
    height: auto !important;
    overflow: visible !important;
  }
  
  .a4-page {
    border: none !important;
    page-break-after: always !important;
    page-break-inside: avoid !important;
    height: 297mm !important;
    padding: 20mm !important;
    box-sizing: border-box;
  }
  
  .page-break {
    page-break-before: always !important;
    border-top: none !important;
    margin-top: 0 !important;
    padding-top: 0 !important;
  }
}

/* --- BADGES E ELEMENTOS DE INTERFACE --- */
.badge-status {
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.675rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.badge-status.rascunho { background-color: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; }
.badge-status.em_validacao { background-color: #fffbeb; color: #b45309; border: 1px solid #fcd34d; }
.badge-status.aprovado { background-color: #ecfdf5; color: #047857; border: 1px solid #6ee7b7; }
.badge-status.em_circuito { background-color: #eff6ff; color: #1d4ed8; border: 1px solid #93c5fd; }
.badge-status.aprovado_circuito { background-color: #10b981; color: #ffffff; }
.badge-status.rejeitado_circuito { background-color: #ef4444; color: #ffffff; }

/* Central de Simulação de Comunicação */
.simulation-console {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  width: 420px;
  max-height: 480px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 0.75rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.simulation-console.minimized {
  height: 48px;
}

.simulation-console.sandbox-disabled {
  display: none;
}

.simulation-log-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.simulation-log-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 0.5rem;
  padding: 0.75rem;
  text-align: left;
}

/* Destaques visuais */
.highlight-box {
  border-left: 4px solid #c5a059;
  background-color: #fdfaf2;
  border-radius: 0 0.5rem 0.5rem 0;
  padding: 1rem;
}

.highlight-box-danger {
  border-left: 4px solid #ef4444;
  background-color: #fef2f2;
  border-radius: 0 0.5rem 0.5rem 0;
  padding: 1rem;
}

.accordion-header {
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.accordion-header:hover {
  background-color: #f8fafc;
}

/* --- ESTILOS DO ASSISTENTE VIRTUAL & EXTRAS --- */
#assistantChatPanel.active {
  opacity: 1 !important;
  transform: translateY(0) !important;
  pointer-events: auto !important;
}

.chat-bubble-user {
  align-self: flex-end;
  background-color: #f5f0ff;
  color: #371475;
  border: 1px solid #b896f5;
  border-radius: 0.75rem 0.75rem 0 0.75rem;
  padding: 0.75rem;
  max-width: 85%;
  text-align: left;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  position: relative;
}

.chat-bubble-bot {
  align-self: flex-start;
  background-color: #ffffff;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem 0.75rem 0.75rem 0;
  padding: 0.75rem;
  max-width: 85%;
  text-align: left;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  position: relative;
}

/* Ocultação em impressão física ou geração de PDF institucional */
@media print {
  #assistantTriggerBtn,
  #assistantChatPanel,
  #manualScrollTopBtn,
  #helpScrollTopBtn {
    display: none !important;
  }
}

/* --- REGRA DE EXIBIÇÃO DE MODAIS ATIVOS (PORTADO SEM CONFLITO DE LAYOUT) --- */
.modal-overlay.active {
  opacity: 1 !important;
  pointer-events: auto !important;
}
.modal-overlay.active .modal-card {
  transform: translateY(0) !important;
}

/* --- ADAPTAÇÕES DE RESPONSIVIDADE MOBILE --- */
@media (max-width: 1023px) {
  .sidebar {
    position: fixed !important;
    top: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10000 !important;
    box-shadow: 8px 0 32px rgba(15, 23, 42, 0.25);
  }
  .sidebar.open {
    transform: translateX(0) !important;
  }
  
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
  }
  .sidebar-backdrop.active {
    display: block;
    opacity: 1;
  }

  /* Ajustes da casca SPA */
  .app-container {
    flex-direction: column !important;
  }
  .main-content {
    overflow-y: auto !important;
    height: calc(100vh - 64px) !important;
  }
}

@media (max-width: 480px) {
  .simulation-console {
    width: calc(100vw - 2rem) !important;
    left: 1rem !important;
    right: 1rem !important;
    bottom: 1rem !important;
    max-height: 380px !important;
  }
}



