/* ==========================================================================
   CONFIGURAÇÃO GERAL E SISTEMA DE CORES (Vibe Café Orgânico & Tech)
   ========================================================================== */
:root {
  --bg-primary: #0b0f0d;
  --bg-secondary: #121815;
  --bg-sidebar: #0e1310;
  --bg-card: rgba(22, 32, 27, 0.65);
  
  --primary: #10b981;
  --primary-hover: #059669;
  --primary-glow: rgba(16, 185, 129, 0.15);
  
  --accent: #d97706; /* Cor café/terra */
  --accent-glow: rgba(217, 119, 6, 0.15);
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dark: #374151;
  
  --border-light: rgba(16, 185, 129, 0.12);
  --border-focus: rgba(16, 185, 129, 0.4);
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
  
  --font-sans: 'Inter', sans-serif;
  --font-display: 'Outfit', sans-serif;
  
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: rgba(16, 185, 129, 0.2) transparent;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar Personalizada */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(16, 185, 129, 0.25);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* ==========================================================================
   LAYOUT PRINCIPAL (Grid / Flexbox)
   ========================================================================== */
.app-container {
  display: grid;
  grid-template-columns: 320px 1fr;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* ==========================================================================
   SIDEBAR (Painel Esquerdo)
   ========================================================================== */
.sidebar {
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  height: 100%;
  z-index: 10;
  transition: transform var(--transition-normal);
  overflow: hidden; /* Evita rolagem da sidebar inteira */
}

.brand {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0; /* Impede que o cabeçalho encolha */
}

.brand-icon {
  background: linear-gradient(135deg, var(--primary), #047857);
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  color: white;
}

.brand-icon i {
  width: 22px;
  height: 22px;
}

.brand-text h1 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(120deg, #fff, #a7f3d0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text span {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  display: block;
}

/* Card de Status */
.status-card {
  margin: 20px 20px 10px 20px;
  padding: 16px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
  flex-shrink: 0; /* Impede que o status encolha */
}

.status-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.status-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.status-indicator {
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
}

.status-indicator.ready {
  color: #34d399;
  background: rgba(52, 211, 153, 0.1);
}

.status-indicator.ready .dot {
  background-color: #34d399;
  box-shadow: 0 0 8px #34d399;
}

.status-indicator.need_ingestion {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.1);
}

.status-indicator.need_ingestion .dot {
  background-color: #fbbf24;
  box-shadow: 0 0 8px #fbbf24;
}

.status-indicator.loading {
  color: #60a5fa;
  background: rgba(96, 165, 250, 0.1);
}

.status-indicator.loading .dot {
  background-color: #60a5fa;
  animation: pulse 1.5s infinite alternate;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 12px;
}

.status-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 12px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* Sessão de Documentos */
.doc-section {
  padding: 16px 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0; /* Permite que o container encolha e faça a lista interna rolar */
}

.doc-section h3 {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.doc-section h3 i {
  width: 16px;
  height: 16px;
  color: var(--primary);
}

.doc-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.doc-list li {
  padding: 10px 14px;
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all var(--transition-fast);
}

.doc-list li:hover {
  background-color: rgba(16, 185, 129, 0.05);
  border-color: rgba(16, 185, 129, 0.2);
  transform: translateX(4px);
}

.doc-list li i {
  color: var(--primary);
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.empty-docs {
  color: var(--text-muted);
  text-align: center;
  font-style: italic;
  padding: 20px !important;
  justify-content: center;
}

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  background-color: rgba(0, 0, 0, 0.15);
}

/* ==========================================================================
   ÁREA DO CHAT (Painel Central)
   ========================================================================== */
.chat-area {
  display: flex;
  flex-direction: column;
  height: 100%;
  background-color: var(--bg-primary);
  position: relative;
  overflow: hidden; /* Evita que a área de chat estique a página */
  min-height: 0; /* Impede expansão vertical do container */
}

.chat-header {
  padding: 20px 32px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: rgba(18, 24, 21, 0.6);
  backdrop-filter: blur(8px);
}

.header-info h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
}

.header-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.mobile-menu-toggle {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-main);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
}

/* Caixa de Boas-vindas */
.welcome-box {
  max-width: 720px;
  margin: 40px auto;
  padding: 32px;
  background: linear-gradient(135deg, rgba(22, 32, 27, 0.5), rgba(13, 19, 16, 0.5));
  border: 1px solid var(--border-light);
  border-radius: 24px;
  text-align: center;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(10px);
}

.welcome-icon {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--accent), #92400e);
  margin: 0 auto 20px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 8px 24px var(--accent-glow);
}

.welcome-icon i {
  width: 32px;
  height: 32px;
}

.welcome-box h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 12px;
  background: linear-gradient(120deg, #ffffff, #fcd34d);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.welcome-box p {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 30px;
}

.suggestions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  text-align: left;
}

.suggestion-card {
  padding: 14px 18px;
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all var(--transition-fast);
}

.suggestion-card:hover {
  background-color: rgba(16, 185, 129, 0.06);
  border-color: rgba(16, 185, 129, 0.25);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.suggestion-card i {
  width: 18px;
  height: 18px;
  color: var(--primary);
  flex-shrink: 0;
}

.suggestion-card span {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-main);
  line-height: 1.3;
}

/* Área de Mensagens */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-height: 0; /* Impede que a lista de mensagens expanda o container */
}

.message-wrapper {
  display: flex;
  gap: 16px;
  max-width: 800px;
  animation: fadeIn 0.4s ease forwards;
}

.message-wrapper.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message-wrapper.ai {
  align-self: flex-start;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.user .avatar {
  background: linear-gradient(135deg, var(--accent), #b45309);
}

.ai .avatar {
  background: linear-gradient(135deg, var(--primary), #047857);
}

.avatar i {
  width: 20px;
  height: 20px;
}

.bubble {
  padding: 14px 18px;
  border-radius: 16px;
  font-size: 0.92rem;
  line-height: 1.55;
  box-shadow: var(--shadow-sm);
}

.user .bubble {
  background-color: var(--bg-card);
  color: var(--text-main);
  border: 1px solid rgba(217, 119, 6, 0.2);
  border-top-right-radius: 4px;
}

.ai .bubble {
  background-color: var(--bg-secondary);
  color: var(--text-main);
  border: 1px solid var(--border-light);
  border-top-left-radius: 4px;
}

/* Estilo Markdown nas bolhas da IA */
.bubble h1, .bubble h2, .bubble h3 {
  font-family: var(--font-display);
  margin-top: 14px;
  margin-bottom: 8px;
  font-weight: 600;
  color: #fff;
}
.bubble h1 { font-size: 1.25rem; }
.bubble h2 { font-size: 1.15rem; }
.bubble h3 { font-size: 1.05rem; }
.bubble h1:first-child, .bubble h2:first-child, .bubble h3:first-child { margin-top: 0; }

.bubble p {
  margin-bottom: 12px;
}
.bubble p:last-child {
  margin-bottom: 0;
}

.bubble ul, .bubble ol {
  margin-left: 20px;
  margin-bottom: 12px;
}

.bubble li {
  margin-bottom: 4px;
}

.bubble strong {
  color: #a7f3d0; /* Destaque em verde claro */
  font-weight: 600;
}

/* Seção de rodapé da bolha da IA (Visualizar Fontes) */
.ai-actions {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: flex-end;
}

.view-sources-btn {
  background: transparent;
  border: none;
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all var(--transition-fast);
}

.view-sources-btn:hover {
  background-color: var(--primary-glow);
  color: #34d399;
}

/* Indicador de Digitação (AI Loading) */
.bubble.loading-bubble {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 14px 24px;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background-color: var(--text-muted);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

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

/* Barra Inferior de Input */
.chat-footer {
  padding: 20px 32px 32px 32px;
  background-color: var(--bg-primary);
}

.input-form {
  max-width: 800px;
  margin: 0 auto;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 18px;
  display: flex;
  align-items: center;
  padding: 6px 6px 6px 18px;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-fast);
}

.input-form:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 14px var(--primary-glow);
}

.input-form input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 0.95rem;
  padding: 10px 0;
  outline: none;
  font-family: var(--font-sans);
}

.input-form input::placeholder {
  color: var(--text-muted);
}

.send-btn {
  background: linear-gradient(135deg, var(--primary), #047857);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2);
  transition: all var(--transition-fast);
}

.send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 14px rgba(16, 185, 129, 0.35);
}

.send-btn i {
  width: 18px;
  height: 18px;
}

.send-btn:disabled {
  background: var(--text-dark);
  color: var(--text-muted);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ==========================================================================
   DRAWER DE FONTES (Painel Direito)
   ========================================================================== */
/* ==========================================================================
   DRAWER DE FONTES (Painel Direito - Nítido, Alto Contraste e Elegante)
   ========================================================================== */
.sources-drawer {
  position: absolute;
  top: 0;
  right: -420px; /* Escondido por padrão */
  width: 420px;
  height: 100%;
  background-color: #0d120f; /* Cor sólida e nítida sem transparência/blur */
  border-left: 1px solid rgba(16, 185, 129, 0.25);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.sources-drawer.open {
  right: 0;
}

.drawer-header {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(16, 185, 129, 0.2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #121915;
}

.drawer-header h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 10px;
}

.drawer-header h3 i {
  color: var(--primary);
  width: 20px;
  height: 20px;
}

.close-drawer {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #f3f4f6;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.close-drawer:hover {
  background-color: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.4);
}

.drawer-content {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.empty-sources {
  color: var(--text-muted);
  font-size: 0.88rem;
  text-align: center;
  margin-top: 40px;
  line-height: 1.6;
}

.source-item {
  padding: 16px;
  background-color: #16201b; /* Card escuro sólido com alta visibilidade */
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform var(--transition-fast);
}

.source-item:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.source-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.source-title {
  font-weight: 700;
  font-size: 0.88rem;
  color: #ffffff; /* Texto branco nítido */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.source-title i {
  color: #d97706;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.source-match {
  font-size: 0.75rem;
  font-weight: 700;
  color: #34d399;
  background-color: rgba(52, 211, 153, 0.15);
  border: 1px solid rgba(52, 211, 153, 0.3);
  padding: 3px 8px;
  border-radius: 6px;
}

.source-page {
  font-size: 0.78rem;
  color: #f3f4f6;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 8px;
  border-radius: 6px;
  display: inline-block;
  margin-top: 2px;
}

.source-snippet {
  font-size: 0.86rem;
  color: #e5e7eb; /* Texto cinza bem claro e legível */
  line-height: 1.55;
  background-color: #0a0e0c; /* Fundo interno contrastante */
  padding: 12px 14px;
  border-radius: 10px;
  border-left: 3px solid var(--primary); /* Barra verde vibrante */
  font-family: var(--font-sans);
}

/* Overlay para versão Mobile quando o Drawer/Menu abre */
.drawer-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 95;
  animation: fadeIn 0.2s ease forwards;
}

/* ==========================================================================
   ANIMAÇÕES
   ========================================================================== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  from { opacity: 0.4; }
  to { opacity: 1; }
}

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

/* ==========================================================================
   ÁREA DE UPLOAD (Painel Lateral)
   ========================================================================== */
.upload-section {
  padding: 10px 20px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0; /* Impede que a área de upload encolha */
}

.upload-section h3 {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.upload-section h3 i {
  color: var(--primary);
  width: 16px;
  height: 16px;
}

.upload-dropzone {
  border: 2px dashed rgba(16, 185, 129, 0.25);
  background-color: rgba(255, 255, 255, 0.01);
  border-radius: 14px;
  padding: 18px 12px;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: all var(--transition-normal);
}

.upload-dropzone:hover, .upload-dropzone.dragover {
  border-color: var(--primary);
  background-color: rgba(16, 185, 129, 0.06);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.1);
}

.upload-icon {
  width: 28px;
  height: 28px;
  color: var(--primary);
  opacity: 0.8;
  transition: transform var(--transition-fast);
}

.upload-dropzone:hover .upload-icon {
  transform: translateY(-2px);
}

.upload-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
  font-weight: 500;
}

.upload-progress-container {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.progress-bar-wrapper {
  background-color: rgba(255, 255, 255, 0.05);
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.02);
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), #34d399);
  border-radius: 3px;
  transition: width 0.4s ease;
}

.progress-status {
  font-size: 0.7rem;
  color: var(--primary);
  font-weight: 600;
  text-align: center;
  display: block;
}

/* Botão de Documentação da API no Header */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.api-docs-btn {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition-fast);
}

.api-docs-btn:hover {
  background: rgba(16, 185, 129, 0.2);
  border-color: var(--primary);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.api-docs-btn i {
  width: 16px;
  height: 16px;
}

/* ==========================================================================
   MODAL DE DOCUMENTAÇÃO DA API
   ========================================================================== */
.api-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition-normal);
}

.api-modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.api-modal-container {
  width: 90%;
  max-width: 800px;
  max-height: 85vh;
  background-color: #0e1411;
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.api-modal-header {
  padding: 20px 28px;
  border-bottom: 1px solid rgba(16, 185, 129, 0.15);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #131c17;
}

.api-modal-title {
  display: flex;
  align-items: center;
  gap: 14px;
}

.api-modal-title i {
  color: var(--primary);
  width: 28px;
  height: 28px;
  padding: 8px;
  background: rgba(16, 185, 129, 0.12);
  border-radius: 10px;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.api-modal-title h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffffff;
}

.api-modal-title p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.close-api-modal {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #f3f4f6;
  cursor: pointer;
  padding: 8px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.close-api-modal:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.4);
}

.api-modal-nav {
  display: flex;
  background-color: #0b0f0d;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0 20px;
  gap: 6px;
  overflow-x: auto;
}

.api-tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  padding: 12px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.api-tab-btn:hover {
  color: #ffffff;
}

.api-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.api-modal-body {
  padding: 24px 28px;
  overflow-y: auto;
  flex: 1;
  color: var(--text-main);
}

.api-tab-content {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.api-tab-content.active {
  display: flex;
}

.api-tab-content h4 {
  font-size: 1.05rem;
  color: #ffffff;
  margin-bottom: 4px;
}

.api-tab-content h5 {
  font-size: 0.88rem;
  color: #34d399;
  margin-top: 10px;
  margin-bottom: 4px;
}

.api-tab-content p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.api-endpoint-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #141c18;
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 12px 16px;
  border-radius: 12px;
}

.http-method {
  background: var(--primary);
  color: #000;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 6px;
}

.endpoint-url {
  font-family: monospace;
  font-size: 0.9rem;
  color: #a7f3d0;
}

.code-block {
  background-color: #060908;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 14px;
  overflow-x: auto;
  font-family: monospace;
  font-size: 0.82rem;
  color: #d1d5db;
  line-height: 1.5;
}

.api-steps-list {
  margin-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.api-steps-list li strong {
  color: #ffffff;
}

.integration-guide-card {
  background: #141c18;
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 16px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.integration-guide-card h5 {
  margin: 0;
}

/* ==========================================================================
   RESPONSIVIDADE (Mobile & Tablets)
   ========================================================================== */
@media (max-width: 768px) {
  .app-container {
    grid-template-columns: 1fr;
  }
  
  .sidebar {
    position: absolute;
    left: -320px;
    width: 300px;
    box-shadow: var(--shadow-lg);
  }
  
  .sidebar.open {
    transform: translateX(320px);
  }
  
  .mobile-menu-toggle {
    display: block;
  }
  
  .chat-header {
    padding: 16px 20px;
  }
  
  .messages-container {
    padding: 20px 16px;
  }
  
  .welcome-box {
    padding: 24px 16px;
    margin: 20px 0;
  }
  
  .suggestions-grid {
    grid-template-columns: 1fr;
  }
  
  .chat-footer {
    padding: 16px;
  }
  
  .input-form {
    padding: 4px 4px 4px 12px;
  }
  
  .sources-drawer {
    width: 100%;
    right: -100%;
  }
  
  .sources-drawer.open {
    right: 0;
  }
}
