/* Material Takeoff AI — Fase 3: dark / neón Cad-scan + resultados */

:root {
  --mai-neon-bg: #0a0f1e;
  --mai-neon-green: #00ff88;
  --mai-neon-blue: #00aaff;
  --mai-neon-yellow: #ffcc00;
  --mai-neon-grid: rgba(0, 170, 255, 0.12);
}

.mai-neon-modal {
  background: var(--mai-neon-bg);
  color: #e6ecff;
  border: 1px solid rgba(0, 255, 136, 0.18);
  box-shadow:
    0 0 0 1px rgba(0, 255, 136, 0.08),
    0 20px 80px rgba(0, 0, 0, 0.55);
}

.mai-neon-header {
  border-bottom: 1px solid rgba(0, 170, 255, 0.2);
  background: linear-gradient(90deg, rgba(0, 255, 136, 0.08), rgba(0, 170, 255, 0.06));
}

.mai-scan-wrap {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  min-height: 240px;
  background: radial-gradient(ellipse at 50% 20%, rgba(0, 170, 255, 0.12), transparent 55%),
    var(--mai-neon-bg);
}

.mai-scan-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 40, 80, 0.35) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 40, 80, 0.35) 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: 0.15;
  pointer-events: none;
}

.mai-scan-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--mai-neon-green),
    rgba(0, 255, 136, 0.9),
    transparent
  );
  box-shadow: 0 0 18px rgba(0, 255, 136, 0.75);
  animation: maiScanSweep 3.2s linear infinite;
  pointer-events: none;
  z-index: 6;
}

@keyframes maiScanSweep {
  0% {
    top: 0;
    opacity: 0.35;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    top: calc(100% - 3px);
    opacity: 0.35;
  }
}

.mai-blueprint-svg {
  position: absolute;
  inset: 6%;
  width: 88%;
  height: 88%;
  z-index: 3;
}

.mai-blueprint-root .mai-bp-path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: maiBpDrawLoop 5.2s cubic-bezier(0.42, 0, 0.2, 1) infinite;
}

.mai-blueprint-root .mai-bp-path:nth-child(1) {
  animation-delay: 0s;
}
.mai-blueprint-root .mai-bp-path:nth-child(2) {
  animation-delay: 0.06s;
}
.mai-blueprint-root .mai-bp-path:nth-child(3) {
  animation-delay: 0.11s;
}
.mai-blueprint-root .mai-bp-path:nth-child(4) {
  animation-delay: 0.15s;
}
.mai-blueprint-root .mai-bp-path:nth-child(5) {
  animation-delay: 0.19s;
}
.mai-blueprint-root .mai-bp-path:nth-child(6) {
  animation-delay: 0.23s;
}
.mai-blueprint-root .mai-bp-path:nth-child(7) {
  animation-delay: 0.27s;
}
.mai-blueprint-root .mai-bp-path:nth-child(8) {
  animation-delay: 0.32s;
}
.mai-blueprint-root .mai-bp-path:nth-child(9) {
  animation-delay: 0.38s;
}
.mai-blueprint-root .mai-bp-path:nth-child(10) {
  animation-delay: 0.42s;
}
.mai-blueprint-root .mai-bp-path:nth-child(11) {
  animation-delay: 0.46s;
}
.mai-blueprint-root .mai-bp-path:nth-child(12) {
  animation-delay: 0.5s;
}
.mai-blueprint-root .mai-bp-path:nth-child(13) {
  animation-delay: 0.55s;
}
.mai-blueprint-root .mai-bp-path:nth-child(14) {
  animation-delay: 0.6s;
}

@keyframes maiBpDrawLoop {
  0% {
    stroke-dashoffset: 1;
    opacity: 0.2;
  }
  8% {
    opacity: 1;
  }
  34% {
    stroke-dashoffset: 0;
  }
  78% {
    stroke-dashoffset: 0;
    opacity: 1;
  }
  86% {
    opacity: 0.45;
  }
  100% {
    stroke-dashoffset: 1;
    opacity: 0.2;
  }
}

.mai-bp-nodes {
  pointer-events: none;
}

.mai-bp-node {
  opacity: 0;
  stroke: rgba(255, 255, 255, 0.5);
  stroke-width: 0.35;
  animation: maiBpNodePulse 5.2s ease-in-out infinite;
}

.mai-bp-node--post {
  fill: #00aaff;
  filter: drop-shadow(0 0 4px rgba(0, 170, 255, 0.9));
}

.mai-bp-node--bal {
  fill: #00ff88;
  filter: drop-shadow(0 0 3px rgba(0, 255, 136, 0.85));
}

.mai-bp-node:nth-child(1) {
  animation-delay: 0.72s;
}
.mai-bp-node:nth-child(2) {
  animation-delay: 0.75s;
}
.mai-bp-node:nth-child(3) {
  animation-delay: 0.78s;
}
.mai-bp-node:nth-child(4) {
  animation-delay: 0.81s;
}
.mai-bp-node:nth-child(5) {
  animation-delay: 0.84s;
}
.mai-bp-node:nth-child(6) {
  animation-delay: 1s;
}
.mai-bp-node:nth-child(7) {
  animation-delay: 1.04s;
}
.mai-bp-node:nth-child(8) {
  animation-delay: 1.08s;
}
.mai-bp-node:nth-child(9) {
  animation-delay: 1.12s;
}

@keyframes maiBpNodePulse {
  0%,
  30% {
    opacity: 0;
  }
  40% {
    opacity: 1;
  }
  78% {
    opacity: 1;
  }
  88%,
  100% {
    opacity: 0.3;
  }
}

.mai-stage-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(0, 170, 255, 0.2);
  background: rgba(0, 20, 40, 0.35);
  font-size: 12px;
}

.mai-stage-row--active {
  border-color: rgba(0, 170, 255, 0.55);
  box-shadow: 0 0 0 1px rgba(0, 170, 255, 0.15);
}

.mai-stage-row--done {
  border-color: rgba(0, 255, 136, 0.45);
  color: var(--mai-neon-green);
}

.mai-neon-card {
  border-radius: 12px;
  border: 1px solid rgba(0, 255, 136, 0.2);
  background: rgba(8, 16, 32, 0.65);
  padding: 12px;
  box-shadow: inset 0 0 40px rgba(0, 170, 255, 0.04);
}

.mai-neon-card--blue {
  border-color: rgba(0, 170, 255, 0.35);
}

.mai-neon-card--green {
  border-color: rgba(0, 255, 136, 0.35);
}

.mai-neon-card--yellow {
  border-color: rgba(255, 204, 0, 0.35);
}

.mai-neon-card--white {
  border-color: rgba(255, 255, 255, 0.35);
}

.mai-num-big {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.mai-fade-enter-active,
.mai-fade-leave-active {
  transition: opacity 0.45s ease;
}
.mai-fade-enter-from,
.mai-fade-leave-to {
  opacity: 0;
}

/* Modal “Analizando con IA”: más ancho y área de escaneo más alta */
.mai-neon-modal--scanning {
  width: 100%;
  max-width: min(96vw, 72rem);
}
.mai-neon-modal--scanning .mai-scan-wrap {
  min-height: min(52vh, 560px);
}
@media (min-width: 768px) {
  .mai-neon-modal--scanning .mai-scan-wrap {
    min-height: min(58vh, 680px);
  }
}
.mai-neon-modal--scanning .mai-blueprint-svg {
  width: 100%;
  height: min(42vh, 440px);
  display: block;
}

/* Modal reporte de análisis: ancho casi pantalla completa + tipografía legible */
.mai-neon-modal--report {
  width: 100%;
  max-width: min(94vw, 88rem);
}

.mai-report-body {
  font-size: 1.0625rem;
  line-height: 1.55;
}

.mai-report-body > .border-b p.text-lg {
  font-size: 1.375rem;
}

.mai-report-body .mai-neon-card {
  padding: 1rem 1.25rem;
}

.mai-report-body .mai-neon-card > p:first-child {
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
}

.mai-report-body .mai-num-big {
  font-size: 2.35rem;
}

.mai-report-body h4 {
  font-size: 1.125rem;
}

.mai-report-body .mai-report-table {
  font-size: 1rem;
}

.mai-report-body .mai-report-table th,
.mai-report-body .mai-report-table td {
  padding: 0.7rem 1.1rem;
}

.mai-report-body .flex.flex-wrap.gap-x-4 {
  font-size: 0.9375rem;
}

.mai-report-body .flex.h-3 {
  height: 0.85rem;
}

.mai-report-footer .text-xs {
  font-size: 0.9375rem;
}

@media (min-width: 1280px) {
  .mai-neon-modal--report {
    max-width: min(92vw, 96rem);
  }

  .mai-report-body {
    font-size: 1.125rem;
  }

  .mai-report-body .mai-report-table {
    font-size: 1.0625rem;
  }

  .mai-report-body .mai-num-big {
    font-size: 2.5rem;
  }
}

/* Modal más ancho cuando la fase activa es vista 3D (antes de expandir a pantalla completa) */
.mai-neon-modal--view3d {
  max-width: min(98vw, 96rem);
  min-height: min(88vh, 860px);
}
.mai-neon-modal--view3d .mai-3d-host {
  min-height: min(62vh, 640px);
}
@media (min-width: 1024px) {
  .mai-neon-modal--view3d .mai-3d-host {
    min-height: min(72vh, 760px);
  }
}

/* Vista 3D a pantalla completa (escapa del modal con overflow hidden) */
.mai-3d-view-shell--expanded {
  position: fixed;
  inset: 0;
  z-index: 99999;
  width: 100vw;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  border-radius: 0;
  box-shadow: none;
}
.mai-3d-view-shell--expanded .flex.flex-1.min-h-0 {
  flex: 1 1 auto;
  min-height: 0;
}
.mai-3d-view-shell--expanded .mai-3d-host {
  min-height: min(72vh, 640px);
}
@media (min-width: 1024px) {
  .mai-3d-view-shell--expanded .mai-3d-host {
    min-height: calc(100dvh - 88px);
  }
}

.mai-3d-host {
  position: relative;
  min-height: 360px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(0, 100, 160, 0.35);
  background: #121a26;
}

/* Escaneo IA: plano real del proyecto + overlay profesional */
.mai-scan-photo-wrap {
  min-height: min(48vh, 520px);
  position: relative;
}

.mai-scan-plan-photo {
  position: absolute;
  inset: 5%;
  width: 90%;
  height: 90%;
  object-fit: contain;
  object-position: center;
  filter: saturate(1.05) contrast(1.06) brightness(0.97);
  z-index: 2;
}

.mai-scan-canvas-overlay {
  position: absolute;
  inset: 0;
  z-index: 7;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.mai-scan-vignette {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 45%, transparent 52%, rgba(10, 15, 30, 0.55) 100%);
}

.mai-scan-corner {
  position: absolute;
  width: 24px;
  height: 24px;
  z-index: 5;
  pointer-events: none;
  border-color: rgba(0, 255, 136, 0.45);
}

.mai-scan-corner--tl {
  top: 10px;
  left: 10px;
  border-top: 2px solid;
  border-left: 2px solid;
}

.mai-scan-corner--tr {
  top: 10px;
  right: 10px;
  border-top: 2px solid;
  border-right: 2px solid;
}

.mai-scan-corner--bl {
  bottom: 10px;
  left: 10px;
  border-bottom: 2px solid;
  border-left: 2px solid;
}

.mai-scan-corner--br {
  bottom: 10px;
  right: 10px;
  border-bottom: 2px solid;
  border-right: 2px solid;
}

.mai-scan-shimmer {
  mix-blend-mode: screen;
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background: linear-gradient(
    135deg,
    transparent 42%,
    rgba(0, 170, 255, 0.14) 50%,
    transparent 58%
  );
  background-size: 220% 220%;
  animation: maiDiagShimmer 4.5s ease-in-out infinite;
  opacity: 0.85;
}

@keyframes maiDiagShimmer {
  0% {
    background-position: 0% 40%;
  }
  55% {
    background-position: 100% 60%;
  }
  100% {
    background-position: 0% 40%;
  }
}

.mai-scan-line.mai-scan-line--sync {
  animation: none;
  opacity: 0.95;
  height: 2px;
  box-shadow:
    0 0 20px rgba(0, 255, 136, 0.9),
    0 0 48px rgba(0, 170, 255, 0.5);
}

.mai-scan-hud {
  position: absolute;
  left: 12px;
  bottom: 10px;
  z-index: 6;
  pointer-events: none;
}

.mai-scan-hud-inner {
  font-size: 9px;
  letter-spacing: 0.35em;
  font-weight: 700;
  color: rgba(0, 255, 136, 0.92);
  text-shadow:
    0 0 8px rgba(0, 255, 136, 0.5),
    0 0 20px rgba(0, 170, 255, 0.4);
}

.mai-scan-pixel {
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 8px;
  vertical-align: middle;
  border-radius: 1px;
  background: rgba(0, 255, 136, 0.95);
  animation: maiPixelBlink 1.1s step-end infinite;
}

.mai-scan-pixel--glow {
  box-shadow:
    0 0 6px rgba(0, 255, 136, 0.95),
    0 0 14px rgba(0, 170, 255, 0.6);
}

@keyframes maiPixelBlink {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
  100% {
    opacity: 1;
  }
}

.mai-3d-overlay {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, rgba(0, 255, 136, 0.06), transparent 60%);
}

@media print {
  .mai-no-print {
    display: none !important;
  }
  #mai-report-print-root {
    background: #fff !important;
    color: #111 !important;
  }
  #mai-report-print-root .mai-neon-card,
  #mai-report-print-root .mai-num-big {
    border-color: #ddd !important;
    color: #111 !important;
    background: #f9fafb !important;
  }
}
