/* --- SISTEMA DE DESIGN AGÊNCIA EVOLUIR (70/20/10) --- */
:root {
  --bg-carbon: #080a0f;       /* 70% Fundo Geral */
  --bg-structure: #14213d;    /* 20% Estrutura */
  --accent-cyan: #00F0FF;     /* 10% Destaques / Ações */
  
  --border-color: #1c2e54;    /* Linhas de Fluxo Rígidas */
  --text-main: #e7ecf3;       /* Texto Claro Principal */
  --text-muted: #9aa4b2;      /* Texto de Apoio */
  --text-title: #ffffff;      /* Título Principal */
  
  --font-inter: 'Inter', system-ui, -apple-system, sans-serif;
}

/* --- TEMA CLARO --- */
body.light-theme {
  --bg-carbon: #f4f6fa;
  --bg-structure: #ffffff;
  --accent-cyan: #00A3B4;
  --border-color: #cbd5e1;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-title: #0f172a;
}

/* Reset básico e tipografia Inter */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-carbon);
  color: var(--text-main);
  font-family: var(--font-inter);
  font-size: 14px;
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* Marca d'água "EV" sutil no fundo (3% a 4% de opacidade) */
.watermark-bg {
  position: absolute;
  top: 10%;
  left: 20%;
  font-size: 40vw;
  font-weight: 900;
  color: #14213d;
  opacity: 0.035;
  pointer-events: none;
  z-index: 0;
  line-height: 1;
}

/* Layout Principal */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  z-index: 1;
  position: relative;
}

/* Sidebar Rígida (20% estrutural) */
.sidebar {
  width: 260px;
  background-color: var(--bg-structure);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-ev {
  background-color: var(--bg-carbon);
  color: var(--accent-cyan);
  font-weight: 800;
  font-size: 18px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-color);
}

.brand-name {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.5px;
  color: var(--text-title);
}

.brand-sub {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
}

/* Slogan Obrigatório em destaque didático */
.slogan-box {
  padding: 18px;
  margin: 15px;
  background-color: var(--bg-carbon);
  border: 1px solid var(--border-color);
}

.slogan-text {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-cyan);
  line-height: 1.4;
  text-align: center;
  font-style: italic;
}

.sidebar-nav {
  flex: 1;
  padding: 10px 15px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 12px 15px;
  width: 100%;
  text-align: left;
  font-family: var(--font-inter);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.1s ease;
}

.nav-item:hover {
  color: var(--text-main);
  background-color: rgba(255, 255, 255, 0.02);
}

.nav-item.active {
  color: var(--accent-cyan);
  background-color: var(--bg-carbon);
  border-left: 3px solid var(--accent-cyan);
}

.nav-icon {
  width: 18px;
  height: 18px;
}

.sidebar-footer {
  padding: 15px 20px;
  border-top: 1px solid var(--border-color);
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
}

/* Área de Conteúdo */
.main-content {
  flex: 1;
  padding: 30px;
  overflow-y: auto;
  position: relative;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.section-header {
  margin-bottom: 25px;
}

.section-header h1 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-title);
  margin-bottom: 4px;
}

.section-header p {
  color: var(--text-muted);
}

/* Grid de Métricas (Linhas de fluxo finas conectando os cards) */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 15px;
  margin-bottom: 30px;
}

.metric-card {
  background-color: var(--bg-structure);
  border: 1px solid var(--border-color);
  padding: 15px;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Simula conexão por linhas de fluxo */
.metric-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--border-color);
}

.metric-card.highlight::after {
  background-color: var(--accent-cyan);
}

.metric-title {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 5px;
}

.metric-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-title);
}

.metric-card.highlight .metric-value {
  color: var(--accent-cyan);
}

/* Card Rígido e Retangular */
.dashboard-card {
  background-color: var(--bg-structure);
  border: 1px solid var(--border-color);
  padding: 20px;
  margin-bottom: 25px;
}

.dashboard-card h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-title);
  margin-bottom: 15px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Barra de Ação de Analise Rápida */
.action-bar {
  border-left: 3px solid var(--accent-cyan);
}

.search-form {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
}

.search-form input {
  flex: 1;
  background-color: var(--bg-carbon);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 12px 15px;
  font-family: var(--font-inter);
  outline: none;
}

.search-form input:focus {
  border-color: var(--accent-cyan);
}

/* Botões Ciano Rígidos */
.btn-cyan {
  background-color: var(--accent-cyan);
  color: var(--bg-carbon);
  border: none;
  font-weight: 800;
  font-family: var(--font-inter);
  padding: 12px 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity 0.1s ease;
}

.btn-cyan:hover {
  opacity: 0.9;
}

.btn-cyan.secondary {
  background-color: var(--bg-carbon);
  color: var(--accent-cyan);
  border: 1px solid var(--accent-cyan);
}

.btn-cyan.secondary:hover {
  background-color: rgba(0, 240, 255, 0.05);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  font-family: var(--font-inter);
  font-weight: 600;
  padding: 10px 15px;
  cursor: pointer;
  transition: all 0.1s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-ghost:hover {
  color: var(--text-main);
  border-color: var(--text-muted);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 11px;
}

.btn-full {
  width: 100%;
  margin-bottom: 10px;
}

.form-tip {
  font-size: 11px;
  color: var(--text-muted);
}

.ext-badge {
  color: var(--accent-cyan);
  font-weight: 700;
}

/* Tabela Rígida */
.leads-card {
  padding: 0;
}

.leads-card .card-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.leads-card h3 {
  margin-bottom: 0;
}

.table-wrapper {
  overflow-x: auto;
}

.leads-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.leads-table th {
  background-color: rgba(255, 255, 255, 0.01);
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 11px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-color);
}

.leads-table td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
}

.leads-table tr:hover td {
  background-color: rgba(255, 255, 255, 0.01);
}

/* Badges e Status */
.badge-priority {
  font-weight: 800;
  font-size: 12px;
  color: var(--accent-cyan);
}

.badge-priority.low {
  color: var(--text-muted);
}

.status-badge {
  display: inline-block;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  background-color: var(--bg-carbon);
  border: 1px solid var(--border-color);
}

.status-badge.Novo { color: #f59e0b; border-color: #f59e0b; }
.status-badge.Analisando { color: #3b82f6; border-color: #3b82f6; }
.status-badge.Qualificado { color: var(--accent-cyan); border-color: var(--accent-cyan); }
.status-badge.Abordado { color: #10b981; border-color: #10b981; }
.status-badge.Erro { color: #ef4444; border-color: #ef4444; }

.empty-state {
  text-align: center;
  padding: 40px !important;
  color: var(--text-muted);
  font-style: italic;
}

/* Links Rápidos */
.lead-link {
  color: var(--accent-cyan);
  text-decoration: none;
  font-weight: 600;
}

.lead-link:hover {
  text-decoration: underline;
}

.action-buttons {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* Aba Configurações */
.settings-grid {
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.debug-box {
  background-color: #080a0f;
  color: #00F0FF;
  border: 1px solid #1c2e54;
  font-family: monospace;
  font-size: 11px;
  padding: 12px;
  overflow: auto;
  max-height: 180px;
  margin-top: 10px;
  white-space: pre-wrap;
  word-break: break-all;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 6px;
}

.form-group input,
.form-group select {
  width: 100%;
  background-color: var(--bg-carbon);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 12px;
  font-family: var(--font-inter);
  outline: none;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--accent-cyan);
}

.field-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.setup-list {
  padding-left: 20px;
  color: var(--text-main);
  font-size: 12px;
}

.setup-list li {
  margin-bottom: 10px;
}

.setup-list code {
  background-color: var(--bg-carbon);
  padding: 2px 5px;
  border: 1px solid var(--border-color);
}

.info-card {
  border-left: 3px solid var(--border-color);
}

.form-actions {
  margin-top: 15px;
  text-align: right;
}

/* MODAL DE DETALHES */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(8, 10, 15, 0.85);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-backdrop.active {
  display: flex;
}

.modal {
  width: min(920px, 94vw);
  max-height: 85vh;
  background-color: var(--bg-structure);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-title);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 26px;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

.modal-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 24px;
}

.details-column {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.details-column h3 {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 6px;
}

/* Auditorias de pixel com bolinhas de status */
.audit-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.audit-item {
  background-color: var(--bg-carbon);
  border: 1px solid var(--border-color);
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.audit-label {
  font-weight: 600;
}

.audit-status {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.audit-status.ok { color: var(--accent-cyan); }
.audit-status.err { color: #ef4444; }
.audit-status.warn { color: #f59e0b; }

.seo-box {
  background-color: var(--bg-carbon);
  border: 1px solid var(--border-color);
  padding: 12px;
  font-size: 12px;
}

.seo-box h4 {
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--accent-cyan);
}

.seo-box p {
  margin-bottom: 6px;
  word-break: break-all;
}

/* Coluna da direita com Abas de Diagnóstico vs WhatsApp */
.text-column {
  display: flex;
  flex-direction: column;
  height: 50vh;
}

.tab-headers {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 15px;
}

.tab-title {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 10px 15px;
  font-family: var(--font-inter);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.tab-title.active {
  color: var(--accent-cyan);
  border-bottom-color: var(--accent-cyan);
}

.tab-panels {
  flex: 1;
  background-color: var(--bg-carbon);
  border: 1px solid var(--border-color);
  overflow-y: auto;
}

.tab-panel {
  display: none;
  padding: 15px;
  height: 100%;
}

.tab-panel.active {
  display: block;
}

/* Previews de IA */
.markdown-preview,
.copy-preview {
  font-family: var(--font-inter);
  white-space: pre-wrap;
  font-size: 13px;
  color: var(--text-main);
}

.copy-wrapper {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
}

.copy-preview {
  flex: 1;
  margin-bottom: 15px;
}

.lead-footer-info {
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

/* Ícones nos botões */
.btn-icon {
  width: 16px;
  height: 16px;
}

.row-flex {
  display: flex;
  gap: 10px;
}

.flex-1 { flex: 1; }
.text-center { text-align: center; }

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: var(--bg-structure);
  border: 1px solid var(--accent-cyan);
  color: var(--accent-cyan);
  padding: 12px 20px;
  font-weight: 700;
  z-index: 2000;
  display: none;
}

.toast.active {
  display: block;
  animation: slideUp 0.15s ease-out;
}

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

.icon-spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
