/* ==========================================================
   ALVINO FUTURO — camada visual 3D (leve) para index e painel
   Não altera a lógica: só aparência, animação e interações.
   ========================================================== */
:root {
  --af-neon: #34d399;
  --af-neon-2: #22d3ee;
  --af-neon-3: #8b5cf6;
  --af-deep: #04070d;
  --af-glass: rgba(10, 18, 34, 0.72);
  --af-line: rgba(52, 211, 153, 0.22);
  --af-orbit-surface: rgba(6, 12, 24, .97);
  --af-text: #e2e8f0;
  --af-backdrop: rgba(0, 0, 0, .8);
  --af-focus: 0 0 24px rgba(52, 211, 153, .4);
}

/* Orbites: les fenêtres gardent leur orientation pour rester lisibles. */
.af-orbit { position: relative; height: 560px; width: 100%; isolation: isolate; }
.af-orbit[hidden] { display: none; }
.af-orbit-track { display: block !important; position: absolute; inset: 0; }
.af-orbit-window { position: absolute !important; top: 50%; left: 50%; width: 238px; height: 216px; margin: 0; padding: 18px !important; overflow: hidden; border-radius: 8px !important; cursor: pointer; background: var(--af-orbit-surface) !important; transition: border-color .2s, box-shadow .2s; }
.af-orbit-window h3, .af-orbit-window h4 { font-size: 15px; margin-top: 12px; }
.af-orbit-window p { font-size: 12px; }
.af-orbit-window:focus-visible, .af-orbit-window:hover { outline: 2px solid var(--af-neon); box-shadow: var(--af-focus); }
.af-orbit-window .af-icon { width: 36px; height: 36px; border-radius: 8px; }
.af-orbit-core { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 154px; height: 154px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--af-neon); font-size: 11px; z-index: 11; pointer-events: none; }
.af-orbit-core img { width: 58px; height: 58px; border-radius: 50%; object-fit: cover; }
.af-radar-rings { position: absolute; inset: 0; border: 1px solid var(--af-neon-2); border-radius: 50%; box-shadow: var(--af-focus); }
.af-radar-rings::before, .af-radar-rings::after { content: ''; position: absolute; inset: -15px; border: 1px dashed var(--af-line); border-radius: 50%; }
.af-radar-rings::after { inset: 18px; border-style: solid; }
.af-orbit-dialog { width: min(560px, calc(100% - 32px)); max-height: 85vh; padding: 52px 24px 24px; border-radius: 8px; border: 1px solid var(--af-neon); background: var(--af-orbit-surface); color: var(--af-text); margin: auto; }
.af-orbit-dialog::backdrop { background: var(--af-backdrop); backdrop-filter: blur(6px); }
.af-dialog-close { position: absolute; right: 10px; top: 10px; border-radius: 8px; }
.af-dialog-content > * { width: 100%; height: auto; overflow: visible; transform: none !important; }
.af-compact-meter { align-self: start; }
.af-compact-meter > .glass-card { padding: 24px !important; gap: 16px; }
.af-compact-meter .af-chart-wrap canvas { height: 140px; }
#demonstracao.af-hero-player { max-width: none; margin: 0; padding-top: 0; }
.af-hero-player > .text-center { display: none; }
.af-hero-player > .glass-card { padding: 16px; border-radius: 8px; }
.af-hero-player video { object-fit: contain; }
.af-hero-player video + div { pointer-events: none; }
@media (max-width: 640px) {
  .af-orbit { height: 680px; }
  .af-orbit-window { width: 140px; height: 140px; padding: 12px !important; }
  .af-orbit-window h3, .af-orbit-window h4 { font-size: 12px; line-height: 1.4; margin-top: 8px; }
  .af-orbit-window p { display: none; }
  .af-orbit-core { width: 110px; height: 110px; font-size: 9px; }
  .af-orbit-core img { width: 42px; height: 42px; }
}

/* Fundo 3D (canvas) */
#af-bg {
  position: fixed; inset: 0; width: 100vw; height: 100vh;
  z-index: -1; pointer-events: none; opacity: .9;
}
.bg-video-overlay { background: radial-gradient(1200px 600px at 70% 10%, rgba(16,185,129,.10), transparent 60%), rgba(4,7,13,.86) !important; }

/* Vidro neon */
.glass-card {
  background: linear-gradient(160deg, rgba(14,24,44,.82), rgba(6,12,24,.74)) !important;
  border-color: rgba(52,211,153,.28) !important;
  backdrop-filter: blur(14px) saturate(140%);
  box-shadow: 0 0 0 1px rgba(52,211,153,.06) inset, 0 20px 50px -25px rgba(0,0,0,.8), 0 0 40px -18px rgba(16,185,129,.45);
  transition: transform .35s cubic-bezier(.2,.8,.2,1), box-shadow .35s ease, border-color .35s ease;
  transform-style: preserve-3d;
}
header.glass-card { box-shadow: 0 1px 0 rgba(52,211,153,.18), 0 10px 30px -20px rgba(16,185,129,.5); }

/* Cartões com tilt 3D */
.af-tilt { transform: perspective(900px) rotateX(var(--rx,0deg)) rotateY(var(--ry,0deg)) translateZ(0); will-change: transform; }
.af-tilt::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(420px circle at var(--mx,50%) var(--my,50%), rgba(52,211,153,.14), transparent 45%);
  opacity: 0; transition: opacity .3s;
}
.af-tilt:hover::after { opacity: 1; }
.af-tilt:hover { border-color: rgba(52,211,153,.55) !important; box-shadow: 0 25px 60px -25px rgba(16,185,129,.55), 0 0 0 1px rgba(52,211,153,.25) inset; }
.af-rel { position: relative; }

/* Ícones reagem ao mouse */
a svg, button svg, .af-icon { transition: transform .35s cubic-bezier(.3,1.6,.5,1), filter .3s, color .3s; }
a:hover svg, button:hover svg, .af-card:hover .af-icon {
  transform: scale(1.18) rotate(-8deg) translateZ(20px);
  filter: drop-shadow(0 0 8px rgba(52,211,153,.85));
  color: var(--af-neon);
}
header img { transition: transform .5s cubic-bezier(.3,1.6,.5,1), box-shadow .3s; }
header a:hover img { transform: rotateY(180deg) scale(1.05); box-shadow: 0 0 25px rgba(52,211,153,.6); }

/* Botões luminosos */
button, a { -webkit-tap-highlight-color: transparent; }
button[class*="from-emerald"], a[class*="from-emerald"] { position: relative; overflow: hidden; }
button[class*="from-emerald"]::before, a[class*="from-emerald"]::before {
  content: ""; position: absolute; top: 0; left: -120%; width: 60%; height: 100%;
  background: linear-gradient(110deg, transparent, rgba(255,255,255,.45), transparent);
  transform: skewX(-20deg); transition: left .7s ease;
}
button[class*="from-emerald"]:hover::before, a[class*="from-emerald"]:hover::before { left: 140%; }
button:active { transform: scale(.97); }

/* Títulos neon */
h1 span[class*="bg-clip-text"] { background-size: 200% auto; animation: af-shine 6s linear infinite; }
@keyframes af-shine { to { background-position: 200% center; } }

/* Licitômetro vivo */
#licitometroTotal { text-shadow: 0 0 24px rgba(52,211,153,.45); font-variant-numeric: tabular-nums; transition: color .3s; }
#licitometroTotal.af-flash { animation: af-flash .8s ease; }
@keyframes af-flash { 0%{color:#fff;text-shadow:0 0 40px #34d399} 100%{} }
.af-live { display:inline-flex; align-items:center; gap:6px; font-size:10px; font-weight:800; letter-spacing:.12em; color:#34d399; background:rgba(16,185,129,.12); border:1px solid rgba(52,211,153,.35); padding:3px 9px; border-radius:999px; }
.af-live i { width:7px; height:7px; border-radius:50%; background:#34d399; box-shadow:0 0 10px #34d399; animation: af-pulse 1.2s infinite; }
@keyframes af-pulse { 50% { opacity:.25; transform:scale(.7);} }
.af-chart-wrap { position: relative; background: rgba(4,8,16,.85); border:1px solid rgba(52,211,153,.18); border-radius: 16px; padding: 14px 14px 10px; }
.af-chart-wrap canvas { width: 100%; height: 190px; display:block; }
.af-legend { display:flex; flex-wrap:wrap; gap:10px 16px; justify-content:center; font-size:11px; color:#cbd5e1; margin-top:8px; }
.af-legend span { display:inline-flex; align-items:center; gap:6px; }
.af-legend b { width:8px; height:8px; border-radius:50%; display:inline-block; }
.af-legend em { font-style:normal; font-weight:800; font-variant-numeric: tabular-nums; }
.af-up { color:#34d399; } .af-down { color:#f87171; }

/* Carrossel genérico */
.af-carousel { position: relative; }
.af-track {
  display: flex !important; gap: 20px; overflow-x: auto; scroll-snap-type: x mandatory;
  scroll-behavior: smooth; padding: 6px 4px 18px; scrollbar-width: none; grid-template-columns: none !important;
}
.af-track::-webkit-scrollbar { display: none; }
.af-track > * { flex: 0 0 calc((100% - 40px) / 3); scroll-snap-align: start; min-width: 0; }
@media (max-width: 1100px) { .af-track > * { flex-basis: calc((100% - 20px) / 2); } }
@media (max-width: 680px)  { .af-track > * { flex-basis: 86%; } }
.af-nav { display:flex; gap:8px; }
.af-btn {
  width: 42px; height: 42px; border-radius: 14px; display:grid; place-items:center;
  background: rgba(13,21,39,.85); border:1px solid rgba(52,211,153,.35); color:#34d399;
  transition: transform .25s, box-shadow .25s, background .25s;
}
.af-btn:hover { transform: translateY(-2px) scale(1.06); box-shadow: 0 0 20px rgba(52,211,153,.5); background: rgba(16,185,129,.15); }
.af-dots { display:flex; gap:6px; justify-content:center; margin-top: 4px; }
.af-dots button { width:8px; height:8px; border-radius:99px; background:#1e293b; transition: all .3s; }
.af-dots button.on { width:26px; background: linear-gradient(90deg,#10b981,#22d3ee); }

/* Seção recursos */
.af-card { position: relative; padding: 26px; border-radius: 24px; }
.af-card .af-icon { width: 52px; height: 52px; border-radius: 16px; display:grid; place-items:center; color:#34d399;
  background: radial-gradient(circle at 30% 30%, rgba(52,211,153,.35), rgba(16,185,129,.05)); border:1px solid rgba(52,211,153,.35); box-shadow: 0 0 25px -6px rgba(52,211,153,.6); }
.af-sep { display:flex; align-items:center; gap:16px; color:#94a3b8; font-size:12px; font-weight:800; letter-spacing:.18em; text-transform:uppercase; }
.af-sep::before, .af-sep::after { content:""; flex:1; height:1px; background: linear-gradient(90deg, transparent, rgba(52,211,153,.4), transparent); }

/* Marquee UFs */
.af-marquee { overflow:hidden; mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); }
.af-marquee-inner { display:flex; gap:14px; width:max-content; animation: af-scroll 40s linear infinite; }
.af-marquee:hover .af-marquee-inner { animation-play-state: paused; }
.af-uf { font-weight:800; font-size:13px; color:#cbd5e1; padding:10px 18px; border-radius:14px; border:1px solid rgba(52,211,153,.25); background: rgba(13,21,39,.7); white-space:nowrap; transition: all .3s; }
.af-uf:hover { color:#04070d; background:#34d399; box-shadow: 0 0 22px rgba(52,211,153,.7); transform: translateY(-3px); }
@keyframes af-scroll { to { transform: translateX(-50%); } }

/* Entrada ao rolar */
.af-reveal { opacity: 0; transform: translateY(26px); transition: opacity .7s ease, transform .7s ease; }
.af-reveal.af-in { opacity: 1; transform: none; }

/* Responsivo extra */
@media (max-width: 640px) {
  main { padding-left: 16px !important; padding-right: 16px !important; }
  .af-chart-wrap canvas { height: 160px; }
  #licitometroTotal { font-size: 2rem !important; }
}
img, video, canvas { max-width: 100%; }

@media (prefers-reduced-motion: reduce) {
  .af-marquee-inner, h1 span[class*="bg-clip-text"] { animation: none; }
  .af-reveal { opacity: 1; transform: none; }
  .af-tilt { transform: none !important; }
}

/* Guia do Licitante: cartões clicáveis com leitura completa no modal. */
#af-recursos > .af-card { cursor: pointer; }
#af-recursos > .af-card:focus-visible { outline: 2px solid #34d399; outline-offset: 3px; }
.af-guide-dialog { position: fixed; inset: 0; overflow-y: auto; border-radius: 20px; }
.af-guide-dialog .af-dialog-content > .af-card { box-shadow: none; border: 0; background: transparent !important; padding: 8px !important; }
.af-guide-dialog .af-dialog-content p { font-size: 15px; line-height: 1.7; color: #cbd5e1; }
