/* ==========================================================================
   HANGARE AI LABS — ESTILOS PRINCIPAIS & ANIMAÇÕES UX (V3)
   Inspirado no dinamismo tátil da Accelera 360 GrowthAI System
   ========================================================================== */

@import './tokens.css';

@tailwind base;
@tailwind components;
@tailwind utilities;

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--f-b);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  position: relative;
  transition: background-color var(--dur-med) var(--ease), color var(--dur-med) var(--ease);
}

/* Regras de Tamanho e Alternância das Logos Oficiais */
.logo-dark, .logo-light {
  height: 38px;
  width: auto;
  max-width: 170px;
  object-fit: contain;
}

:root[data-theme="dark"] .logo-dark, html.dark .logo-dark { display: block !important; }
:root[data-theme="dark"] .logo-light, html.dark .logo-light { display: none !important; }
:root[data-theme="light"] .logo-dark, html.light .logo-dark { display: none !important; }
:root[data-theme="light"] .logo-light, html.light .logo-light { display: block !important; }

/* Fundo com Malha Técnica e Luzes Difusas Sutis */
body::before {
  content: '';
  position: fixed;
  inset: -10%;
  z-index: -1;
  pointer-events: none;
  background-image: var(--lattice);
  background-attachment: fixed;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 20%, #000 40%, rgba(0,0,0,0.2) 100%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 20%, #000 40%, rgba(0,0,0,0.2) 100%);
}

.ambient-glow {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  overflow: hidden;
}

.ambient-glow::before {
  content: '';
  position: absolute;
  top: -15%;
  left: 20%;
  width: 60vw;
  height: 50vh;
  background: radial-gradient(circle, rgba(0, 229, 204, 0.08) 0%, rgba(4, 35, 62, 0) 70%);
  filter: blur(80px);
}

.ambient-glow::after {
  content: '';
  position: absolute;
  top: 40%;
  right: 10%;
  width: 50vw;
  height: 60vh;
  background: radial-gradient(circle, rgba(0, 160, 148, 0.06) 0%, rgba(4, 35, 62, 0) 70%);
  filter: blur(100px);
}

/* Tipografia Editorial */
.font-heading { font-family: var(--f-h); }
.font-serif-italic { font-family: var(--f-s); font-style: italic; }
.font-mono { font-family: var(--f-m); }
.font-tabular { font-variant-numeric: tabular-nums; }

/* ==========================================================================
   ESTRUTURA EM SHEETS (FOLHAS / PAINÉIS EDITORIAIS SOBREPOSTOS)
   ========================================================================== */
.sheet-wrap {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 1rem;
}

@media (min-width: 768px) {
  .sheet-wrap {
    padding: 4rem 1.5rem;
  }
}

.sheet {
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 1.5rem;
  padding: 2.25rem 1.5rem;
  box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: relative;
  overflow: hidden;
  transition: transform var(--dur-med) var(--ease), border-color var(--dur-med) var(--ease);
}

@media (min-width: 768px) {
  .sheet {
    padding: 3.5rem 3rem;
    border-radius: 2rem;
  }
}

/* ==========================================================================
   SCROLL REVEAL COM CASCATA & RISE
   ========================================================================== */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.75s var(--ease), transform 0.75s var(--ease);
  transition-delay: var(--d, 0ms);
  will-change: opacity, transform;
}

.reveal.rise {
  transform: translateY(36px);
}

.reveal.vis {
  opacity: 1;
  transform: translateY(0);
}

/* Linhas que se desenham no scroll */
.draw {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  transition: stroke-dashoffset 1.8s var(--ease);
}

.draw.on {
  stroke-dashoffset: 0;
}

/* ==========================================================================
   MACHINE DASHBOARD — SIMULAÇÃO EM TEMPO REAL DA ESTEIRA DE PROCESSOS IA
   ========================================================================== */
.machine-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  padding: 1.75rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 50px -15px rgba(0, 0, 0, 0.5);
}

.dash-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}

.dash-stat-item {
  display: flex;
  flex-direction: column;
}

.dash-stat-label {
  font-family: var(--f-m);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.dash-stat-val {
  font-family: var(--f-h);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

@media (min-width: 640px) {
  .dash-stat-val {
    font-size: 2rem;
  }
}

.dash-stat-suffix {
  font-size: 0.875rem;
  color: var(--accent);
  font-weight: 500;
  margin-left: 0.25rem;
}

/* Grid de Nós de IA (Dots) */
.dash-dots-container {
  padding: 1.5rem 0;
  position: relative;
}

.dash-dots-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 0.65rem;
}

@media (max-width: 480px) {
  .dash-dots-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 0.5rem;
  }
}

.dash-dot {
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--faint);
  position: relative;
  transition: all 0.5s var(--ease);
}

.dash-dot.dot-flash {
  background: var(--cyan-bright);
  box-shadow: 0 0 16px 4px rgba(56, 189, 248, 0.8);
  transform: scale(1.3);
}

.dash-dot.dot-active {
  background: var(--emerald);
  box-shadow: 0 0 8px 1px rgba(0, 160, 148, 0.4);
}

.dash-dot.dot-pulse {
  animation: dotBreathe 3s infinite ease-in-out;
}

@keyframes dotBreathe {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 6px rgba(0, 229, 204, 0.3);
  }
  50% {
    transform: scale(1.2);
    box-shadow: 0 0 14px rgba(0, 229, 204, 0.8);
  }
}

/* Popups Flutuantes de Faturamento / Economia */
.dot-money {
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 160, 148, 0.95);
  color: #FFFFFF;
  font-family: var(--f-m);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 30;
  animation: floatUpFade 2.4s var(--ease) forwards;
  box-shadow: 0 4px 12px rgba(0, 160, 148, 0.4);
}

.dot-setup {
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 229, 204, 0.95);
  color: #030812;
  font-family: var(--f-m);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 30;
  animation: floatUpBig 2.8s var(--ease) forwards;
  box-shadow: 0 4px 16px rgba(0, 229, 204, 0.6);
}

@keyframes floatUpFade {
  0% {
    opacity: 0;
    transform: translate(-50%, 10px) scale(0.85);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1.05);
  }
  80% {
    opacity: 1;
    transform: translate(-50%, -16px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -32px) scale(0.9);
  }
}

@keyframes floatUpBig {
  0% {
    opacity: 0;
    transform: translate(-50%, 12px) scale(0.75);
  }
  15% {
    opacity: 1;
    transform: translate(-50%, -2px) scale(1.15);
  }
  75% {
    opacity: 1;
    transform: translate(-50%, -24px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -46px) scale(0.85);
  }
}

/* Feed de Atividade da Máquina */
.dash-feed {
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-height: 4.5rem;
}

.dash-feed-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--f-m);
  font-size: 0.75rem;
  color: var(--body);
  opacity: 0;
  transform: translateY(6px);
  transition: all 0.35s var(--ease);
}

.dash-feed-item--active {
  opacity: 1;
  transform: translateY(0);
}

.dash-feed-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
}

/* ==========================================================================
   MARQUEE CONTÍNUO (TRILHO INFINITO)
   ========================================================================== */
.mural-marquee {
  width: 100%;
  overflow: hidden;
  position: relative;
  mask-image: linear-gradient(to right, transparent, #000 12%, #000 88%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, #000 12%, #000 88%, transparent);
}

.mural-track {
  display: flex;
  width: max-content;
  gap: 1.25rem;
  animation: marqueeScroll 36s linear infinite;
  will-change: transform;
}

.mural-track:hover {
  animation-play-state: paused;
}

@keyframes marqueeScroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.mural-card {
  width: 290px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 1.25rem;
  flex-shrink: 0;
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease);
}

.mural-card:hover {
  transform: translateY(-4px);
  border-color: var(--line-accent);
}

/* ==========================================================================
   BARRA DE VAGAS / LOTE DINÂMICA
   ========================================================================== */
.lote-bar-container {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  width: 100%;
  max-width: 380px;
}

.lote-bar-track {
  width: 100%;
  height: 8px;
  border-radius: 9999px;
  background: var(--line);
  overflow: hidden;
  position: relative;
}

.lote-bar-fill {
  height: 100%;
  width: var(--lote-w, 87%);
  border-radius: 9999px;
  background: linear-gradient(90deg, var(--emerald) 0%, var(--accent) 100%);
  transition: width 1.5s var(--ease);
  box-shadow: 0 0 10px var(--accent-glow);
}

/* ==========================================================================
   STICKY CTA INFERIOR
   ========================================================================== */
.sticky-cta {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  z-index: 45;
  background: var(--sheet-solid);
  border: 1px solid var(--line-accent);
  padding: 0.75rem 1.25rem;
  border-radius: 9999px;
  box-shadow: 0 12px 35px -8px rgba(0, 0, 0, 0.6), 0 0 20px rgba(0, 229, 204, 0.2);
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: transform 0.45s var(--ease), opacity 0.45s var(--ease);
  opacity: 0;
  pointer-events: none;
}

.sticky-cta.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.sticky-cta.hidden {
  transform: translateX(-50%) translateY(120%);
  opacity: 0;
  pointer-events: none;
}

/* ==========================================================================
   MODAL DE CAPTURA & AGENDAMENTO
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(3, 8, 18, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s var(--ease);
}

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

.modal-box {
  background: var(--sheet-solid);
  border: 1px solid var(--line-accent);
  border-radius: 1.5rem;
  padding: 2.25rem;
  width: 100%;
  max-width: 480px;
  position: relative;
  transform: scale(0.92) translateY(12px);
  transition: transform 0.35s var(--ease);
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8);
}

.modal-overlay.active .modal-box {
  transform: scale(1) translateY(0);
}

.modal-close-btn {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

.modal-close-btn:hover {
  color: var(--ink);
  border-color: var(--accent);
}

/* Inputs do Formulário */
.form-input {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  padding: 0.85rem 1rem;
  color: var(--ink);
  font-family: var(--f-b);
  font-size: 0.95rem;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* FAQ Accordion */
.faq-details {
  border-bottom: 1px solid var(--line);
  padding: 1.25rem 0;
  transition: border-color 0.2s var(--ease);
}

.faq-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  list-style: none;
  font-family: var(--f-h);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--ink);
  transition: color 0.2s var(--ease);
}

.faq-summary::-webkit-details-marker {
  display: none;
}

.faq-summary:hover {
  color: var(--accent);
}

.faq-icon {
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease);
}

.faq-details[open] .faq-icon {
  transform: rotate(45deg);
  border-color: var(--accent);
  color: var(--accent);
}

.faq-content {
  padding-top: 0.85rem;
  color: var(--body);
  font-size: 0.95rem;
  line-height: 1.65;
}

/* Suporte a Redução de Movimento */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal {
    opacity: 1 !important;
    transform: none !important;
  }
  .mural-track {
    animation: none !important;
    overflow-x: auto;
  }
}
