/* =====================================================
   ECOTRACE AMAZÔNIA — FASE 2 STYLES
   ===================================================== */

/* ── Genética ──────────────────────────────────────── */
.gen-tabs {
  display: flex;
  gap: .5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.gen-tab {
  padding: .6rem 1.25rem;
  border-radius: 8px;
  border: 2px solid var(--color-border);
  background: var(--color-bg-card);
  color: var(--color-text-muted);
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.gen-tab:hover { border-color: var(--color-primary); color: var(--color-primary); }
.gen-tab.active {
  background: var(--gradient-brand);
  border-color: var(--color-accent);
  color: white;
}
.gen-tab-content { display: none; }
.gen-tab-content.active { display: block; }

/* fingerprint grid */
.fingerprint-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}
.fingerprint-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1.25rem;
  transition: box-shadow .2s;
}
.fingerprint-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.08); }
.fp-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: .75rem;
}
.fp-header > i { font-size: 1.5rem; color: var(--color-primary); }
.fp-header > div { flex: 1; }
.fp-header > div strong { display: block; font-size: .9rem; }
.fp-header > div small { color: var(--color-text-muted); font-size: .78rem; }
.fp-hash {
  background: #f8fafc;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: .6rem 1rem;
  margin-bottom: .75rem;
}
.fp-hash code {
  font-size: .85rem;
  color: var(--color-violet);
  font-weight: 600;
  letter-spacing: .5px;
}
.fp-alelos { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .75rem; }
.fp-alelo-row {
  display: flex;
  justify-content: space-between;
  font-size: .8rem;
  padding: .25rem 0;
  border-bottom: 1px solid var(--color-border);
}
.fp-marcador { color: var(--color-text-muted); }
.fp-valor { font-weight: 600; font-family: monospace; }
.fp-actions { padding-top: .5rem; }

/* fingerprint detail modal */
.fingerprint-detail { padding: .5rem; }
.fp-id-box {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: linear-gradient(135deg, #ede9fb, #f0f9ff);
  border: 1px solid #c4b5fd;
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}
.fp-id-box > i { font-size: 2.5rem; color: var(--color-primary); }
.fp-id-title { font-size: .8rem; color: var(--color-text-muted); margin-bottom: .25rem; }
.fp-id-hash { font-size: 1.1rem; font-weight: 700; color: var(--color-violet); font-family: monospace; letter-spacing: 1px; }
.fp-table { margin-bottom: 1rem; }
.fp-auth-info {
  background: #f0f9ff;
  border-left: 4px solid var(--color-cyan);
  padding: 1rem;
  border-radius: 0 8px 8px 0;
  font-size: .85rem;
  color: var(--color-text-secondary);
  display: flex;
  gap: .75rem;
}
.fp-hash-inline {
  font-size: .8rem;
  background: #f8fafc;
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--color-primary);
}

/* diversity */
.gen-diversity-info { margin-top: 1.5rem; }
.diversity-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1.5rem;
}
.diversity-card h4 { margin-bottom: 1rem; color: var(--color-text-secondary); font-size: .9rem; }
.diversity-grid { display: flex; flex-direction: column; gap: .75rem; }
.diversity-item { display: flex; align-items: center; gap: 1rem; }
.diversity-label { width: 100px; font-size: .85rem; font-style: italic; color: var(--color-text-secondary); }
.diversity-bar-wrap {
  flex: 1;
  height: 12px;
  background: #e2e8f0;
  border-radius: 6px;
  overflow: hidden;
}
.diversity-bar { height: 100%; border-radius: 6px; transition: width 1s; }
.diversity-val { width: 70px; font-weight: 600; font-size: .85rem; color: var(--color-primary); }
.diversity-note { margin-top: 1rem; font-size: .8rem; color: var(--color-text-muted); display: flex; gap: .5rem; align-items: center; }

/* badge levels */
.badge-level-alto { background: #dcfce7; color: #16a34a; padding: 2px 8px; border-radius: 12px; font-size: .78rem; font-weight: 500; }
.badge-level-muito-alto { background: #e8f5e9; color: #166534; padding: 2px 8px; border-radius: 12px; font-size: .78rem; font-weight: 500; }
.badge-level-médio, .badge-level-medio { background: #fef3c7; color: #d97706; padding: 2px 8px; border-radius: 12px; font-size: .78rem; font-weight: 500; }

/* ── Leaflet Mapa ────────────────────────────────── */
.leaflet-legend-overlay {
  position: absolute;
  bottom: 20px;
  left: 20px;
  z-index: 1000;
  background: white;
  border-radius: 10px;
  padding: .75rem 1rem;
  box-shadow: 0 4px 15px rgba(0,0,0,.15);
  font-size: .82rem;
}
.leaflet-legend-overlay .legend-title {
  font-weight: 600;
  margin-bottom: .5rem;
  color: var(--color-text-primary);
  font-size: .85rem;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.leaflet-legend-overlay .legend-item {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .3rem;
  color: var(--color-text-secondary);
}
.matrix-map-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: .875rem 1rem;
  cursor: pointer;
  transition: all .2s;
}
.matrix-map-card:hover {
  border-color: var(--color-primary);
  box-shadow: 0 3px 12px rgba(22, 163, 74, .12);
  transform: translateY(-2px);
}

/* ── Analytics ───────────────────────────────────── */
.score-badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 700;
  font-size: .8rem;
}
.score-Aplus { background: #dcfce7; color: #15803d; }
.score-A { background: #e8f5e9; color: #16a34a; }
.score-Bplus { background: #fef3c7; color: #d97706; }
.score-B { background: #fff0f3; color: #ef4444; }

/* ── Aprovações ──────────────────────────────────── */
.apr-tabs {
  display: flex;
  gap: .5rem;
  margin-bottom: 1.25rem;
}
.apr-tab {
  padding: .6rem 1.25rem;
  border-radius: 8px;
  border: 2px solid var(--color-border);
  background: var(--color-bg-card);
  color: var(--color-text-muted);
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.apr-tab:hover { border-color: var(--color-primary); color: var(--color-primary); }
.apr-tab.active { background: var(--gradient-brand); border-color: var(--color-accent); color: white; }
.tab-count {
  background: rgba(255,255,255,.3);
  border-radius: 12px;
  padding: 1px 7px;
  font-size: .78rem;
}
.apr-tab.active .tab-count { background: rgba(255,255,255,.25); }
.apr-tab-content { display: none; }
.apr-tab-content.active { display: block; }

.aprova-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: .875rem;
  transition: box-shadow .2s;
}
.aprova-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.06); }
.aprova-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: .6rem;
}
.aprova-code { font-weight: 700; font-size: .9rem; color: var(--color-text-primary); }
.aprova-tipo { font-size: .95rem; font-weight: 600; color: var(--color-text-secondary); margin-bottom: .6rem; }
.aprova-meta {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  font-size: .82rem;
  color: var(--color-text-muted);
  margin-bottom: .875rem;
}
.aprova-meta span { display: flex; align-items: center; gap: .35rem; }
.aprova-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.aprova-restricted {
  font-size: .82rem;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: .4rem;
  margin: 0;
}
.prio-badge {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: .3rem;
}

/* ── Documentos ──────────────────────────────────── */
.alert-banner {
  border-radius: 10px;
  padding: .875rem 1.25rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: .875rem;
  font-weight: 500;
}
.alert-banner.error { background: #fff0f3; color: #ef4444; border-left: 4px solid #ef4444; }
.alert-banner.warning { background: #fffbeb; color: #d97706; border-left: 4px solid #f59e0b; }

.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.doc-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: all .25s;
}
.doc-card:hover { box-shadow: 0 6px 24px rgba(0,0,0,.1); transform: translateY(-2px); }
.doc-card-header {
  padding: 1.25rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  position: relative;
}
.doc-status-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 0 0 1px rgba(0,0,0,.1);
}
.doc-card-body { padding: .875rem 1.25rem 1.25rem; }
.doc-nome { font-weight: 600; font-size: .9rem; margin-bottom: .4rem; color: var(--color-text-primary); }
.doc-tipo { margin-bottom: .6rem; }
.doc-meta { display: flex; flex-direction: column; gap: .25rem; font-size: .78rem; color: var(--color-text-muted); }
.doc-meta span { display: flex; align-items: center; gap: .4rem; }

/* ── Offline ─────────────────────────────────────── */
.offline-status-card {
  border-radius: 14px;
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
.offline-status-card.online { background: #f0fdf4; border: 2px solid #bbf7d0; }
.offline-status-card.offline { background: #fff0f3; border: 2px solid #fecdd3; }
.offline-status-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}
.online .offline-status-icon { background: #dcfce7; color: #16a34a; }
.offline .offline-status-icon { background: #fee2e2; color: #ef4444; }
.offline-status-info { flex: 1; }
.offline-status-info h3 { margin: 0 0 .3rem; font-size: 1.05rem; }
.offline-status-info p { margin: 0; font-size: .875rem; color: var(--color-text-muted); }

.offline-queue { display: flex; flex-direction: column; gap: .75rem; }
.queue-item {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.queue-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--color-primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
}
.queue-info { flex: 1; display: flex; flex-direction: column; gap: .2rem; }
.queue-info strong { font-size: .875rem; }
.queue-info span { font-size: .8rem; color: var(--color-text-muted); }
.queue-info small { font-size: .75rem; color: var(--color-text-muted); }
.queue-status { min-width: 120px; display: flex; justify-content: flex-end; }

.how-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin: 1rem 0 1.5rem;
}
.how-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1.25rem;
  text-align: center;
}
.how-icon {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-violet-light), var(--color-accent-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: var(--color-violet);
  margin: 0 auto .875rem;
}
.how-card h4 { font-size: .875rem; margin-bottom: .4rem; }
.how-card p { font-size: .8rem; color: var(--color-text-muted); margin: 0; }

.offline-demo {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1.25rem;
}
.offline-demo h4 { margin-bottom: 1rem; font-size: .9rem; }
.demo-buttons { display: flex; gap: .75rem; flex-wrap: wrap; }

/* ── Portal Externo ──────────────────────────────── */
.portal-preview {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  overflow: hidden;
}
.portal-preview-header {
  background: linear-gradient(135deg, #ede9fb, #d1f5ef);
  padding: 2rem;
  text-align: center;
  border-bottom: 1px solid var(--color-border);
}
.portal-preview-header i { font-size: 2.5rem; color: var(--color-violet); margin-bottom: .75rem; display: block; }
.portal-preview-header h2 { margin: 0 0 .5rem; }
.portal-preview-header p { margin: 0; color: var(--color-text-muted); font-size: .9rem; }
.portal-features {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--color-border);
}
.portal-feature { text-align: center; }
.portal-feature i { font-size: 1.75rem; color: var(--color-primary); margin-bottom: .5rem; display: block; }
.portal-feature h4 { font-size: .9rem; margin-bottom: .3rem; }
.portal-feature p { font-size: .8rem; color: var(--color-text-muted); margin: 0; }
.portal-demo-search { padding: 1.5rem 2rem; }
.portal-demo-search h3 { margin-bottom: 1rem; font-size: 1rem; }
.portal-result-card {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow: hidden;
  margin-top: 1rem;
}
.portal-result-header {
  background: linear-gradient(135deg, #ede9fb, #d1f5ef);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.portal-result-header i { font-size: 2rem; color: var(--color-violet); }
.portal-result-header > div { flex: 1; }
.portal-result-header h3 { margin: 0 0 .25rem; font-size: 1rem; }
.portal-result-header p { margin: 0; font-size: .8rem; color: var(--color-text-muted); }
.portal-chain {
  display: flex;
  align-items: center;
  padding: 1.5rem;
  gap: 0;
  overflow-x: auto;
}
.chain-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-width: 100px;
}
.chain-icon {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1rem;
  margin-bottom: .5rem;
}
.chain-info strong { display: block; font-size: .8rem; }
.chain-info span { display: block; font-size: .75rem; color: var(--color-text-muted); }
.chain-info small { font-size: .7rem; color: var(--color-text-muted); }
.chain-connector {
  flex: 1;
  height: 2px;
  background: linear-gradient(to right, var(--color-primary), var(--color-cyan));
  min-width: 30px;
}
.portal-result-footer {
  padding: 1rem 1.5rem;
  background: #f8fafc;
  display: flex;
  justify-content: flex-end;
}

/* ── Nova Análise Modal ──────────────────────────── */
#modal-nova-analise {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1050;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

/* ── Table header ────────────────────────────────── */
.table-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
}
.table-header h3 {
  margin: 0;
  font-size: .95rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* ── Badges extras ───────────────────────────────── */
.badge-danger {
  background: #fff0f3;
  color: #ef4444;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: .78rem;
  font-weight: 500;
}
.badge-warning {
  background: #fffbeb;
  color: #d97706;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: .78rem;
  font-weight: 500;
}
.badge-info {
  background: #e0f7fa;
  color: #0891b2;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: .78rem;
  font-weight: 500;
}
.badge-success {
  background: #dcfce7;
  color: #16a34a;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: .78rem;
  font-weight: 500;
}
.badge-primary {
  background: var(--color-primary-light);
  color: var(--color-primary);
  padding: 3px 10px;
  border-radius: 12px;
  font-size: .78rem;
  font-weight: 500;
}
.badge-secondary {
  background: #f1f5f9;
  color: #64748b;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: .78rem;
  font-weight: 500;
}

/* btn variants */
.btn-success {
  background: #16a34a;
  color: white;
  border: none;
  padding: .5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: .85rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  transition: background .2s;
}
.btn-success:hover { background: #15803d; }
.btn-danger {
  background: #ef4444;
  color: white;
  border: none;
  padding: .5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: .85rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  transition: background .2s;
}
.btn-danger:hover { background: #dc2626; }
.btn-sm {
  padding: .35rem .75rem !important;
  font-size: .8rem !important;
}
.btn-view {
  background: #e0f7fa;
  color: #0891b2;
}
.btn-view:hover { background: #b2ebf2; }
.btn-success.btn-icon {
  background: #dcfce7;
  color: #16a34a;
}
.btn-success.btn-icon:hover { background: #bbf7d0; }

/* ── Nav badge ─────────────────────────────────── */
.nav-notif-badge {
  background: #ef4444;
  color: white;
  border-radius: 10px;
  padding: 1px 6px;
  font-size: .68rem;
  font-weight: 700;
  margin-left: 4px;
  vertical-align: middle;
}

/* ── Detail modal ──────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}
.detail-section.full-width { grid-column: 1 / -1; }
.detail-section h4 {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--color-text-muted);
  margin-bottom: .75rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid var(--color-border);
}
.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .35rem 0;
  font-size: .875rem;
  border-bottom: 1px solid #f1f5f9;
}
.detail-row > span:first-child { color: var(--color-text-muted); }
.detail-row > strong, .detail-row > code { color: var(--color-text-primary); }

/* ── Empty state ────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--color-text-muted);
}
.empty-state i { font-size: 3rem; margin-bottom: 1rem; display: block; opacity: .4; }
.empty-state p { font-size: .9rem; margin: 0; }

/* ── Responsive ─────────────────────────────────── */
@media (max-width: 768px) {
  .fingerprint-grid,
  .portal-features,
  .how-grid { grid-template-columns: 1fr; }
  .gen-tabs { overflow-x: auto; flex-wrap: nowrap; padding-bottom: .25rem; }
  .portal-chain { gap: .5rem; }
  .chain-connector { min-width: 15px; }
  .detail-grid { grid-template-columns: 1fr; }
  .aprova-meta { gap: .75rem; }
  .offline-status-card { flex-direction: column; text-align: center; }
}
