/* ==========================================================================
   RADAR SÃO JOSÉ — APP SHELL & HERO SYSTEM (DESIGN EDITORIAL)
   ========================================================================== */

:root {
  --app-header-height: 72px;
  --content-max-width: 1440px;
}

/* Header Único / Sticky */
#main-app-header {
  min-height: var(--app-header-height);
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid #e2e8f0;
}
.app-header-row { height: 71px; padding-inline: 24px; min-width: 0; }
#app-module-nav { min-width: 0; }
#user-menu-dropdown { max-width: calc(100vw - 32px); max-height: calc(100dvh - var(--app-header-height) - 16px); overflow-y: auto; }
#main-app-header button:focus-visible,
#main-app-header a:focus-visible { outline: 2px solid #087ee1; outline-offset: 3px; }
@media (max-width: 767px) {
  .app-header-row { height: 68px; padding-inline: 16px; }
}
@media (min-width: 768px) and (max-width: 1023px) {
  .app-header-row { padding-inline: 20px; gap: 16px; }
  #app-module-nav { gap: 12px; }
}

/* Navegação Textual de Módulos no Header */
.app-nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  font-family: 'Inter', sans-serif !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  color: #64748b !important;
  padding: 10px 4px !important;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s ease;
  text-decoration: none !important;
}

.app-nav-link:hover {
  color: #080e2e !important;
}

.app-nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2.5px;
  border-radius: 9999px;
  opacity: 0;
  transform: scaleX(0.65);
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  background: var(--module-nav-accent, #009bb6);
}

.app-nav-link.is-active {
  color: #080e2e !important;
  font-weight: 600 !important;
}

.app-nav-link.is-active::after {
  opacity: 1;
  transform: scaleX(1);
}

.app-nav-link[data-module="dashboard"], #btn-nav-dashboard { --module-nav-accent: #009bb6; }
.app-nav-link[data-module="report"], #btn-nav-report { --module-nav-accent: #4f46b5; }
.app-nav-link[data-module="ibge"], #btn-nav-ibge { --module-nav-accent: #2875dd; }
.app-nav-link[data-module="midia"], #btn-nav-midia { --module-nav-accent: #c20c57; }
.app-nav-link[data-module="historia"], #btn-nav-historia { --module-nav-accent: #a45b16; }
.app-nav-link[data-module="image-bank"], #btn-nav-image-bank { --module-nav-accent: #475569; }

/* Navegação Mobile */
.app-nav-link-mobile[data-module="report"] { --module-nav-accent: #4f46b5; }
.app-nav-link-mobile[data-module="ibge"] { --module-nav-accent: #2875dd; }
.app-nav-link-mobile[data-module="midia"] { --module-nav-accent: #c20c57; }
.app-nav-link-mobile[data-module="historia"] { --module-nav-accent: #a45b16; }
.app-nav-link-mobile[data-module="image-bank"] { --module-nav-accent: #475569; }

/* ==========================================================================
   HERO FULL-WIDTH SYSTEM — ALINHADO AO EIXO MACRO DO WORKSPACE
   ========================================================================== */
#app-hero-container {
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: none !important;
  margin-inline: 0 !important;
  padding-left: 16px;
  padding-right: 16px;
}
@media (min-width: 640px) {
  #app-hero-container {
    padding-left: 20px;
    padding-right: 20px;
  }
}
@media (min-width: 1024px) {
  #app-hero-container {
    padding-left: 24px !important;
    padding-right: 24px !important;
  }
}

/* Neutralizar restrição de largura em todos os wrappers e shells de hero */
#app-hero-container [id^="hero-wrapper-"],
.module-hero-shell,
.module-hero-shell--wide {
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: none !important;
  margin-inline: 0 !important;
  padding-inline: 0 !important;
}
radar-module-hero { display: block; min-width: 0; container-type: inline-size; }
.module-hero {
  --hero-accent: #009bb6;
  --hero-bg: #f8fafb;
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  min-height: 210px;
  padding: 28px 38px;
  overflow: hidden;
  border: 1px solid #e8edf1;
  border-radius: 24px;
  background: var(--hero-bg);
  font-family: 'Inter', sans-serif !important;
}
.module-hero--hub { --hero-accent: #2875dd; --hero-bg: #f1f8fd; }
.module-hero--clipping { --hero-accent: #c20c57; --hero-bg: #fcf1f5; }
.module-hero--report { --hero-accent: #4f46b5; --hero-bg: #f6f7fd; }
.module-hero--lentes { --hero-accent: #475569; --hero-bg: #f7f9fb; }
.module-hero--historia { --hero-accent: #a45b16; --hero-bg: #fcf8f1; }
.module-hero__visual { position: absolute; z-index: -1; inset: 0 0 0 39%; background: var(--hero-bg); }
.module-hero__visual img { display: block; width: 100%; height: 100%; object-fit: cover; }
.module-hero__visual::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, var(--hero-bg) 0%, color-mix(in srgb, var(--hero-bg) 98%, transparent) 12%, color-mix(in srgb, var(--hero-bg) 78%, transparent) 25%, color-mix(in srgb, var(--hero-bg) 30%, transparent) 43%, transparent 62%); }
.module-hero__content { width: 55%; min-width: 0; }
.module-hero__eyebrow { display: flex; align-items: center; gap: 14px; margin: 0 0 12px; color: var(--hero-accent); font-size: 13px; font-weight: 600; letter-spacing: .035em; line-height: 1.3; text-transform: uppercase; font-family: var(--font-ui, 'Inter', sans-serif) !important; }
.module-hero__eyebrow::after { content: ''; width: 42px; height: 2px; flex: 0 0 42px; background: currentColor; }
.module-hero__title { margin: 0; color: #080e2e; font-family: var(--font-display, 'Sora', sans-serif) !important; font-size: clamp(30px, 2.8cqw, 44px); font-weight: 700; letter-spacing: -.03em; line-height: 1.12; text-wrap: balance; }
.module-hero__description { margin: 10px 0 0; color: #536685; font-size: clamp(15px, 1.4cqw, 17px); font-weight: 400; line-height: 1.45; text-wrap: pretty; font-family: var(--font-ui, 'Inter', sans-serif) !important; }
.module-hero__description { min-height: 2.9em; }
.module-hero-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
  min-height: 36px;
  font-family: var(--font-ui, 'Inter', sans-serif) !important;
}
.module-hero-tools > button,
.module-hero-tools > div,
.module-hero-tools > a,
.module-hero-tools > [role="group"] > *,
.module-hero-tools > span:not(#historia-counter-badge) {
  min-height: 36px;
  height: auto;
  box-sizing: border-box !important;
  display: inline-flex;
  align-items: center;
}
.module-hero-tools #hub-audit-status-badge { flex-wrap: wrap; max-width: 100%; }
.module-hero-tools .text-amber-300 { color: #92400e; }
.module-hero-tools .text-emerald-300 { color: #047857; }
.module-hero-tools .text-rose-400 { color: #be123c; }
.module-hero-tools button:focus-visible { outline: 2px solid #087ee1; outline-offset: 3px; }

/* Eliminar o vão fantasma gerado por elemento oculto (#data-fetch-error) na Pesquisa */
#data-fetch-error.hidden + section,
#data-fetch-error.hidden + * {
  margin-top: 0 !important;
}

@container (max-width: 960px) {
  .module-hero { padding: 24px 28px; }
  .module-hero__content { width: 65%; }
  .module-hero__title { font-size: clamp(26px, 3.2cqw, 32px); }
  .module-hero__visual { left: 48%; }
}
@container (max-width: 600px) {
  .module-hero { min-height: 190px; padding: 22px 20px; }
  .module-hero__content { width: 100%; }
  .module-hero__eyebrow { font-size: 12px; margin-bottom: 8px; }
  .module-hero__eyebrow::after { width: 32px; flex-basis: 32px; }
  .module-hero__title { font-size: clamp(24px, 5.5cqw, 30px); }
  .module-hero__description { font-size: 15px; }
  .module-hero__visual { left: 28%; opacity: .12; }
}
@media (max-width: 639px) { .module-hero-tools { justify-content: flex-start; } }

/* Sidebar Sticky & Scroll Vertical Discreto (Abaixo do Hero) */
@media (min-width: 1024px) {
  #filter-sidebar {
    position: sticky !important;
    top: calc(var(--app-header-height) + 16px) !important;
    max-height: calc(100vh - var(--app-header-height) - 32px) !important;
    overflow-y: auto !important;
    align-self: flex-start;
  }
}
#filter-sidebar {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}
#filter-sidebar::-webkit-scrollbar {
  width: 4px;
}
#filter-sidebar::-webkit-scrollbar-track {
  background: transparent;
}
#filter-sidebar::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 9999px;
}
#filter-sidebar::-webkit-scrollbar-thumb:hover {
  background-color: #94a3b8;
}

/* Ocultar botão Limpar no topo da sidebar exclusivamente no módulo Lentes SJC */
#filter-sidebar:has(#sidebar-image-bank-filters-container:not(.hidden)) #btn-reset-filters {
  display: none !important;
}

/* Área Operacional Abaixo do Hero: Sidebar colada à esquerda com gutter refinado de 20-24px */
#app-workspace-body {
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: none !important;
  margin-inline: 0 !important;
}
@media (min-width: 1024px) {
  #app-workspace-body {
    padding-left: 24px !important;
    padding-right: 24px !important;
    gap: 24px !important;
  }
}

/* ==========================================================================
   NORMALIZAÇÃO DE ALINHAMENTO HORIZONTAL DOS BLOCOS INTERNOS (6 MÓDULOS)
   Garante alinhamento milimétrico ao eixo da coluna MAIN em todos os 6 módulos:
   Relatório, Pesquisa, Dados Públicos, Clipping, Linha do Tempo e Lentes SJC.
   ========================================================================== */
#app-workspace-body > .flex-1,
#app-workspace-body main,
#dashboard-view,
#executive-report-view,
#ibge-view,
#midia-dashboard-view,
#historia-view,
#image-bank-view {
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  margin-inline: 0 !important;
}

/* Neutralizar max-width, auto-margins e padding duplo em wrappers estruturais de conteúdo */
#ibge-view > .hub-axis-content,
#dashboard-view > .max-w-7xl,
#executive-report-view > .max-w-7xl,
#midia-dashboard-view > .max-w-7xl,
#historia-view > .max-w-7xl,
#image-bank-view > .max-w-7xl {
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: 100% !important;
  margin-inline: 0 !important;
  padding-inline: 0 !important;
}

/* Bloco Acesso Rápido aos Blocos de Pesquisa */
#dashboard-view > div > section {
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: 100% !important;
}

/* Âncoras suaves para blocos de pesquisa abaixo do header sticky */
#app-workspace-body [id^="secao-bloco-"],
#app-workspace-body section[id],
#app-workspace-body article[id],
#rep-capa {
  scroll-margin-top: calc(var(--app-header-height) + 20px);
}

/* Ocultar header e hero durante o Modo Apresentação */
body.presentation-mode #main-app-header,
body.presentation-mode #app-hero-container {
  display: none !important;
}

/* ==========================================================================
   MODO NOTURNO PROFISSIONAL (DARK MODE) — MODULE HERO SYSTEM
   ========================================================================== */
html.dark .module-hero {
  --hero-bg: #0b1528 !important;
  background: var(--hero-bg) !important;
  border-color: #1e293b !important;
  box-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.6) !important;
}
html.dark .module-hero--pesquisa {
  --hero-accent: #00B4D8 !important;
  --hero-bg: #09172e !important;
}
html.dark .module-hero--hub {
  --hero-accent: #38bdf8 !important;
  --hero-bg: #081a30 !important;
}
html.dark .module-hero--clipping {
  --hero-accent: #fb7185 !important;
  --hero-bg: #1c0e18 !important;
}
html.dark .module-hero--report {
  --hero-accent: #818cf8 !important;
  --hero-bg: #110e2c !important;
}
html.dark .module-hero--lentes {
  --hero-accent: #94a3b8 !important;
  --hero-bg: #0e172a !important;
}
html.dark .module-hero--historia {
  --hero-accent: #fbbf24 !important;
  --hero-bg: #1f170b !important;
}

html.dark .module-hero__visual {
  background: var(--hero-bg) !important;
}
html.dark .module-hero__visual img {
  opacity: 0.38 !important;
  mix-blend-mode: luminosity;
  filter: contrast(1.15) brightness(0.85);
}
html.dark .module-hero__visual::after {
  background: linear-gradient(
    90deg,
    var(--hero-bg) 0%,
    color-mix(in srgb, var(--hero-bg) 96%, transparent) 20%,
    color-mix(in srgb, var(--hero-bg) 65%, transparent) 45%,
    color-mix(in srgb, var(--hero-bg) 20%, transparent) 70%,
    transparent 100%
  ) !important;
}
html.dark .module-hero__title {
  color: #f8fafc !important;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}
html.dark .module-hero__description {
  color: #cbd5e1 !important;
}
html.dark .module-hero__eyebrow {
  color: var(--hero-accent) !important;
}
html.dark .module-hero-tools button,
html.dark .module-hero-tools [role="group"] > * {
  background-color: #152238 !important;
  border-color: #1e293b !important;
  color: #f1f5f9 !important;
}
html.dark .module-hero-tools button:hover {
  background-color: #1e293b !important;
  border-color: #38bdf8 !important;
  color: #ffffff !important;
}
