/**
 * SUS 360 — Portal 1.0.0
 * css/portal.css
 *
 * Estilo próprio da página inicial: hero, seções e cartões dos painéis
 * estratégicos e da capacidade instalada, menu no celular, modo de painel em
 * tela cheia (iframe), selos e animações da página.
 *
 * Depende de: Design System SUS 360 1.0.0 (fundacao/vars.css, base/ e
 * componentes/), carregado antes deste arquivo.
 */

/* ── Bloco 1: estilo principal da página ── */
[x-cloak] {
  display: none !important;
}

/* Sobrescreve o reset.css — a cor dos links vaza para o topo e o menu. Força as cores corretas. */
.header a,
.header-nav a,
.nav-dropdown-menu-hd a,
a.nav-link-hd,
a.dd-item-hd {
  color: var(--text-primary);
}
a.dd-item-hd:hover {
  color: var(--sus-blue);
}
a.dd-item-hd.dd-active {
  background: rgba(0, 73, 144, 0.1);
  color: var(--text-primary);
  font-weight: 700;
  border-left: 3px solid var(--sus-blue);
  padding-left: 9px;
}
a.nav-link-hd {
  color: var(--text-secondary);
}
a.logo,
a.logo:hover {
  color: inherit;
  text-decoration: none;
}
a.gov-logo,
a.gov-logo:hover {
  color: inherit;
  text-decoration: none;
}

/* Botão voltar no topo (.topbar-back): nenhum elemento da página usa esta classe hoje */
.topbar-back {
  display: none;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.topbar-back:hover {
  background: var(--sus-blue);
  color: #fff;
  border-color: var(--sus-blue);
  text-decoration: none;
}
.topbar-back i {
  font-size: 13px;
}
/* Info do painel no topo — aparece só com painel ativo */
#topbar-panel-info,
.panel-info-sep {
  display: none;
}
body.dashboard-active #topbar-panel-info,
body.dashboard-active .panel-info-sep {
  display: flex;
}
#topbar-panel-source {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-body);
  color: var(--text-primary);
  font-family: var(--font-family);
  overflow-x: hidden;
}

/* PRINCIPAL */
.landing-main {
  flex: 1;
  padding-top: var(--header-height);
  width: 100%;
}

/* SEÇÕES — largura total com conteúdo centralizado */
.ls {
  width: 100%;
  padding: 48px 32px;
}

.ls-inner {
  max-width: 1200px;
  margin: 0 auto;
}

.ls.alt {
  background: var(--bg-elevated);
}

/* DESTAQUE */
.hero {
  text-align: center;
  padding: 20px 32px 40px;
}

.hero-lottie {
  width: 100%;
  max-width: 840px;
  height: 350px;
  margin: 0 auto 8px;
}

.hero-lottie dotlottie-wc {
  width: 100%;
  height: 100%;
}

.hero h1 {
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  font-weight: 900;
  letter-spacing: -2px;
  margin: 0;
  line-height: 1;
}

.g360 {
  background: linear-gradient(135deg, var(--sus-blue), var(--color-info));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.15rem;
  color: var(--text-muted);
  margin: 12px auto 0;
  max-width: 620px;
  line-height: 1.6;
}

.hero p strong {
  color: var(--text-secondary);
  font-weight: 600;
}

/* CABEÇALHOS DE SEÇÃO */
.sh {
  text-align: center;
  margin-bottom: 32px;
}

.sh-lottie {
  width: 220px;
  height: 350px;
  margin: 0 auto -10px;
}

.sh-lottie dotlottie-wc {
  width: 100%;
  height: 100%;
}

.sh h2 {
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 800;
  letter-spacing: -0.5px;
  margin: 0;
}

.sh p {
  font-size: var(--font-size-base);
  color: var(--text-muted);
  margin-top: 4px;
}

.sh p strong {
  color: var(--text-secondary);
}

/* PATE — logo grande + animação compacta */
.pate-lottie {
  width: 100%;
  max-width: 450px;
  height: 140px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.pate-lottie dotlottie-wc {
  width: 100%;
  height: 100%;
}

.pate-logo-wrap {
  text-align: center;
  margin: -12px 0 28px;
}

.pate-logo-wrap img {
  max-width: 400px;
  width: 100%;
}

/* GRADE DE CARDS */
.cg {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(165px, 200px));
  gap: 14px;
  justify-content: center;
}

.cg.cg-pate {
  grid-template-columns: repeat(3, 1fr);
  max-width: 780px;
  margin: 0 auto;
  gap: 16px;
}

/* MINI CARD */
.mc {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 22px 12px 16px;
  min-height: 200px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--text-primary);
  transition: all 0.25s ease;
  cursor: pointer;
}

.mc:hover {
  text-decoration: none;
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: transparent;
}

.mc:active {
  transform: translateY(-2px);
}

.mc-i {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 22px;
  margin-bottom: 12px;
  transition: transform 0.25s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.mc:hover .mc-i {
  transform: scale(1.12) rotate(-3deg);
}

.mc-t {
  font-size: var(--font-size-sm);
  font-weight: 600;
  line-height: 1.3;
}

/* ── Card PATE (maior) ── */
.mc.mc-pate {
  padding: 28px 16px 22px;
}

.mc.mc-pate .mc-i {
  width: 60px;
  height: 60px;
  font-size: 26px;
  border-radius: 16px;
}

.mc.mc-pate .mc-t {
  font-size: var(--font-size-lg);
}

/* ── Cards em destaque — brilho animado (cor via --fc) ── */
.mc.mc-featured {
  --fc: 16, 185, 129;
  border-color: rgba(var(--fc), 0.35);
  background: linear-gradient(
    135deg,
    var(--bg-card) 0%,
    rgba(var(--fc), 0.05) 100%
  );
  box-shadow:
    0 0 0 1px rgba(var(--fc), 0.1),
    0 0 24px rgba(var(--fc), 0.12),
    0 8px 24px rgba(0, 0, 0, 0.06);
  animation: feat-glow 3s ease-in-out infinite;
}
.mc.mc-featured:hover {
  border-color: rgba(var(--fc), 0.6);
  box-shadow:
    0 0 0 1px rgba(var(--fc), 0.25),
    0 0 36px rgba(var(--fc), 0.22),
    0 12px 32px rgba(0, 0, 0, 0.1);
}
.mc.mc-featured.mc-feat-violet {
  --fc: 139, 92, 246;
}
.mc.mc-featured.mc-feat-orange {
  --fc: 249, 115, 22;
}
.mc.mc-featured.mc-feat-sky {
  --fc: 14, 165, 233;
}

@keyframes feat-glow {
  0%,
  100% {
    box-shadow:
      0 0 0 1px rgba(var(--fc), 0.1),
      0 0 24px rgba(var(--fc), 0.12),
      0 8px 24px rgba(0, 0, 0, 0.06);
  }
  50% {
    box-shadow:
      0 0 0 1px rgba(var(--fc), 0.2),
      0 0 36px rgba(var(--fc), 0.18),
      0 10px 28px rgba(0, 0, 0, 0.08);
  }
}
body.dark .mc.mc-featured {
  border-color: rgba(var(--fc), 0.28);
  background: linear-gradient(
    135deg,
    var(--bg-card) 0%,
    rgba(var(--fc), 0.07) 100%
  );
}
body.dark .mc.mc-featured:hover {
  border-color: rgba(var(--fc), 0.45);
  box-shadow:
    0 0 0 1px rgba(var(--fc), 0.15),
    0 0 40px rgba(var(--fc), 0.2),
    0 12px 32px rgba(0, 0, 0, 0.2);
}

/* ── Brilho sutil no ícone dos cards novos ── */
.mc.mc-featured .mc-i {
  position: relative;
  overflow: hidden;
}
.mc.mc-featured .mc-i::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -80%;
  width: 40%;
  height: 200%;
  background: linear-gradient(
    105deg,
    transparent 0%,
    rgba(255, 255, 255, 0) 40%,
    rgba(255, 255, 255, 0.25) 50%,
    rgba(255, 255, 255, 0) 60%,
    transparent 100%
  );
  animation: icon-shine 5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes icon-shine {
  0%,
  70%,
  100% {
    left: -80%;
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  40% {
    left: 130%;
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

/* ── Card desativado ── */
.mc.locked {
  opacity: 0.35;
  pointer-events: none;
}

.mc .mc-badge {
  font-size: 9px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--border-light);
  color: var(--text-muted);
  margin-top: 8px;
}
.mc {
  position: relative;
  overflow: visible;
}
.mc .mc-badge.novo {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 2.5px 7px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 3px;
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.25);
}
.mc .mc-badge.novo::before {
  content: "✦";
  font-size: 8px;
  opacity: 0.8;
}
body.dark .mc .mc-badge.novo {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border-color: rgba(110, 231, 183, 0.2);
}

/* GRADIENTES DE ÍCONES */
.ic-gov {
  background: linear-gradient(135deg, #1351b4, #0c326f);
}
.ic-blue {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}
.ic-rose {
  background: linear-gradient(135deg, #f43f5e, #e11d48);
}
.ic-cyan {
  background: linear-gradient(135deg, #06b6d4, #0891b2);
}
.ic-purple {
  background: linear-gradient(135deg, #a855f7, #7c3aed);
}
.ic-red {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}
.ic-orange {
  background: linear-gradient(135deg, #f97316, #ea580c);
}
.ic-sky {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
}
.ic-indigo {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
}
.ic-emerald {
  background: linear-gradient(135deg, #10b981, #059669);
}
.ic-teal {
  background: linear-gradient(135deg, #14b8a6, #0d9488);
}
.ic-amber {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}
.ic-slate {
  background: linear-gradient(135deg, #64748b, #475569);
}
.ic-violet {
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
}
.ic-pink {
  background: linear-gradient(135deg, #ec4899, #db2777);
}
.ic-lime {
  background: linear-gradient(135deg, #84cc16, #65a30d);
}

/* RODAPÉ */
.landing-footer {
  text-align: center;
  padding: 40px 24px;
  border-top: 1px solid var(--border-light);
}

.ft-lottie {
  width: 180px;
  margin: 0 auto 16px;
}

.ft-lottie dotlottie-wc {
  width: 100%;
  height: 100%;
}

.ft-text {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  line-height: 1.6;
}

.ft-text strong {
  color: var(--text-secondary);
  font-weight: 600;
}

.ft-gov {
  margin-top: 20px;
}

.ft-gov img {
  width: 90px;
  opacity: 0.5;
  transition: opacity 0.2s;
}

.ft-gov img:hover {
  opacity: 0.8;
}

body.dark .ft-gov img {
  filter: brightness(0) invert(1);
  opacity: 0.35;
}

body.dark .ft-gov img:hover {
  opacity: 0.6;
}

/* AJUSTE DO MENU MOBILE — o desfoque do cabeçalho quebra o position:fixed da sobreposição. Remove o desfoque com o menu aberto. */
body.mobile-menu-open .header {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* RESPONSIVO */
@media (max-width: 900px) {
  .ls {
    padding: 36px 20px;
  }
  .hero {
    padding: 16px 20px 32px;
  }
  .hero-lottie {
    height: 180px;
  }
  .sh-lottie {
    width: 180px;
    height: 180px;
  }
}

@media (max-width: 680px) {
  .ls {
    padding: 28px 16px;
  }
  .hero {
    padding: 12px 16px 24px;
  }
  .hero-lottie {
    height: 300px;
    max-width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .hero-lottie dotlottie-wc {
    transform: scale(1.8);
    transform-origin: 40% center;
  }
  .hero p {
    font-size: 1rem;
  }
  .sh-lottie {
    width: 150px;
    height: 150px;
  }
  .cg {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
  }
  .mc.mc-featured {
    padding-top: 42px;
    min-height: 120px;
  }
  .cg.cg-pate {
    gap: 10px;
    max-width: 840px;
  }
  .pate-logo-wrap img {
    max-width: 280px;
  }
}

@media (max-width: 520px) {
  .cg.cg-pate {
    grid-template-columns: 1fr 1fr;
  }
  .cg.cg-pate .mc {
    grid-column: 1 / -1;
  }
}

@media (max-width: 400px) {
  .cg {
    grid-template-columns: 1fr 1fr;
  }
  .cg.cg-pate {
    grid-template-columns: 1fr;
  }
  .cg.cg-pate .mc-featured {
    grid-column: auto;
  }
}

/* PAINEL — modo iframe em tela cheia (Kibana / Power BI) */

body.dashboard-active .landing-main {
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden !important;
  padding-top: 0 !important;
}

body.dashboard-active #landing-home,
body.dashboard-active .landing-footer {
  display: none !important;
}

#dashboard-view {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

body.dashboard-active #dashboard-view {
  display: block;
}

/* Botão voltar no topo (.topbar-back): sem uso na página hoje */

#dashboard-target {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
}

.iframe-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
}

.iframe-wrapper iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Painéis estratégicos — ajuste isolado (.ls-strat/.cg-strat) */
.ls-strat {
  position: relative;
}
.ls-strat::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(1200px, 100%);
  height: 1px;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    transparent,
    var(--border-color) 18%,
    var(--border-color) 82%,
    transparent
  );
}
.ls-strat .sh {
  position: relative;
  padding-bottom: 18px;
}
.ls-strat .sh::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 48px;
  height: 1px;
  background: var(--text-muted);
  opacity: 0.55;
}
body.dark .ls-strat .sh::after {
  opacity: 0.45;
}
.cg-strat {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
  gap: 16px;
  margin: 0 auto;
  max-width: 880px;
}
.cg-strat .mc {
  flex: 0 0 200px;
  width: 200px;
  min-height: 200px;
  box-sizing: border-box;
}
@media (min-width: 768px) and (max-width: 1024px) {
  .cg-strat {
    max-width: 700px;
  }
}
@media (min-width: 480px) and (max-width: 767px) {
  .cg-strat {
    max-width: 432px;
    gap: 12px;
  }
}
@media (max-width: 479px) {
  .cg-strat {
    max-width: 320px;
    gap: 12px;
  }
  .cg-strat .mc {
    flex: 0 0 100%;
    width: 100%;
    min-height: 0;
    padding: 20px 16px;
  }
}

/* ── Bloco 2: selo "atualizado" dos cartões ── */
.mc .mc-badge.mc-badge-upd {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.3px;
  padding: 3px 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
  animation: mcUpdPulse 2.2s ease-in-out infinite;
}
.mc-badge-upd .bi-arrow-repeat {
  display: inline-block;
  font-weight: 700;
  animation: mcUpdSpin 1.5s linear infinite;
}
@keyframes mcUpdSpin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes mcUpdPulse {
  0%,
  100% {
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
  }
  50% {
    box-shadow: 0 2px 16px rgba(16, 185, 129, 0.7);
  }
}

/* ── Bloco 3: animação de pulso ── */
@keyframes sus360m-pulse {
  0%,
  100% {
    opacity: 0.4;
    transform: scale(0.95);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}
@keyframes sus360m-bar {
  0% {
    left: -40%;
  }
  100% {
    left: 100%;
  }
}
.sus360m-icon {
  animation: sus360m-pulse 2.5s ease-in-out infinite;
}
.sus360m-bar-track {
  position: relative;
  width: 180px;
  height: 3px;
  border-radius: 2px;
  overflow: hidden;
  margin-top: 0.5rem;
  background: var(--border-color);
}
.sus360m-bar-fill {
  position: absolute;
  width: 40%;
  height: 100%;
  border-radius: 2px;
  background: var(--sus-blue);
  animation: sus360m-bar 1.8s ease-in-out infinite;
}
