/* SP FUMIGACION CAMION - certificado público v16
   Ajuste final: celdas grises, estado interno animado, fondo página negro/verde.
*/

html.sp-cert-public-v15,
body.sp-cert-public-v15,
body.sp-public-page,
body.public-certificate-page{
  background:
    radial-gradient(circle at 12% 0%, rgba(10, 92, 58, .38), transparent 34%),
    radial-gradient(circle at 90% 12%, rgba(0, 70, 43, .28), transparent 30%),
    linear-gradient(135deg, #020604 0%, #03120c 45%, #061d13 100%) !important;
  color:#111 !important;
}

body.sp-cert-public-v15{
  min-height:100dvh !important;
  overflow:auto !important;
}

body.sp-cert-public-v15 .stage-wrap,
body.public-certificate-page .stage-wrap,
body.sp-public-page .stage-wrap{
  background:transparent !important;
}

body.sp-cert-public-v15 .page-stage,
body.public-certificate-page .page-stage,
body.sp-public-page .page-stage{
  display:flex !important;
  justify-content:center !important;
}

body.sp-cert-public-v15 #pageMain,
body.sp-cert-public-v15 .page,
body.public-certificate-page #pageMain,
body.public-certificate-page .page,
body.sp-public-page #pageMain,
body.sp-public-page .page{
  background:#fff !important;
  color:#111 !important;
  font-family:Arial, Helvetica, sans-serif !important;
  border:1px solid rgba(38, 194, 126, .52) !important;
  box-shadow:0 18px 52px rgba(0,0,0,.46) !important;
}

body.sp-cert-public-v15 #pageMain *,
body.public-certificate-page #pageMain *,
body.sp-public-page #pageMain *{
  color:inherit;
}

/* Celdas: izquierda verde claro, derecha gris como el certificado original. */
body.sp-cert-public-v15 #pageMain .code-label,
body.sp-cert-public-v15 #pageMain .vehicle-label,
body.sp-cert-public-v15 #pageMain .owner-label,
body.sp-cert-public-v15 #pageMain .merchandise-label,
body.sp-cert-public-v15 #pageMain .date-label,
body.sp-cert-public-v15 #pageMain .label,
body.public-certificate-page #pageMain .code-label,
body.public-certificate-page #pageMain .vehicle-label,
body.public-certificate-page #pageMain .owner-label,
body.public-certificate-page #pageMain .merchandise-label,
body.public-certificate-page #pageMain .date-label,
body.public-certificate-page #pageMain .label,
body.sp-public-page #pageMain .code-label,
body.sp-public-page #pageMain .vehicle-label,
body.sp-public-page #pageMain .owner-label,
body.sp-public-page #pageMain .merchandise-label,
body.sp-public-page #pageMain .date-label,
body.sp-public-page #pageMain .label,
body.sp-cert-public-v15 #pageMain table td:nth-child(odd),
body.public-certificate-page #pageMain table td:nth-child(odd),
body.sp-public-page #pageMain table td:nth-child(odd){
  background:#d5e6ec !important;
  color:#053624 !important;
  font-weight:700 !important;
}

body.sp-cert-public-v15 #pageMain .code-value,
body.sp-cert-public-v15 #pageMain .vehicle-value,
body.sp-cert-public-v15 #pageMain .owner-value,
body.sp-cert-public-v15 #pageMain .merchandise-value,
body.sp-cert-public-v15 #pageMain .date-value,
body.sp-cert-public-v15 #pageMain .value,
body.public-certificate-page #pageMain .code-value,
body.public-certificate-page #pageMain .vehicle-value,
body.public-certificate-page #pageMain .owner-value,
body.public-certificate-page #pageMain .merchandise-value,
body.public-certificate-page #pageMain .date-value,
body.public-certificate-page #pageMain .value,
body.sp-public-page #pageMain .code-value,
body.sp-public-page #pageMain .vehicle-value,
body.sp-public-page #pageMain .owner-value,
body.sp-public-page #pageMain .merchandise-value,
body.sp-public-page #pageMain .date-value,
body.sp-public-page #pageMain .value,
body.sp-cert-public-v15 #pageMain table td:nth-child(even),
body.public-certificate-page #pageMain table td:nth-child(even),
body.sp-public-page #pageMain table td:nth-child(even){
  background:#ececec !important;
  color:#111 !important;
  font-weight:600 !important;
}

/* No estado flotante fuera del certificado. */
body > #sp-cert-status-v15,
body > .sp-cert-status-v15,
.stage-wrap > #sp-cert-status-v15,
.stage-wrap > .sp-cert-status-v15,
.page-stage > #sp-cert-status-v15,
.page-stage > .sp-cert-status-v15{
  display:none !important;
}

/* Estado interno animado, abajo izquierda del certificado. */
body.sp-cert-public-v15 #pageMain #sp-cert-status-v15,
body.public-certificate-page #pageMain #sp-cert-status-v15,
body.sp-public-page #pageMain #sp-cert-status-v15,
#pageMain #sp-cert-status-v15.sp-cert-status-v15{
  position:absolute !important;
  left:34px !important;
  bottom:36mm !important;
  z-index:30 !important;
  width:176px !important;
  height:38px !important;
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  border-radius:10px !important;
  border:1px solid rgba(255,255,255,.40) !important;
  font-family:Arial, Helvetica, sans-serif !important;
  font-size:14px !important;
  line-height:1 !important;
  font-weight:900 !important;
  letter-spacing:2px !important;
  text-transform:uppercase !important;
  overflow:hidden !important;
  transform:translateZ(0);
  animation:spStatusPulseV16 2.6s ease-in-out infinite !important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.32), inset 0 -14px 24px rgba(0,0,0,.24), 0 8px 17px rgba(0,0,0,.22) !important;
}

#pageMain #sp-cert-status-v15.sp-cert-status-v15::before{
  content:"" !important;
  position:absolute !important;
  inset:-70% !important;
  background:linear-gradient(115deg, transparent 34%, rgba(255,255,255,.46) 48%, transparent 62%) !important;
  transform:translateX(-80%) rotate(8deg);
  animation:spStatusSweepV16 3.2s linear infinite !important;
  pointer-events:none !important;
}

#pageMain #sp-cert-status-v15.sp-cert-status-v15 span{
  position:relative !important;
  z-index:2 !important;
  color:#fff !important;
  text-shadow:0 1px 0 rgba(0,0,0,.62), 0 0 9px rgba(255,255,255,.20) !important;
}

#pageMain #sp-cert-status-v15.sp-status-vigente{
  background:linear-gradient(135deg, #003d25 0%, #119a61 52%, #02442b 100%) !important;
}

#pageMain #sp-cert-status-v15.sp-status-vencido{
  background:linear-gradient(135deg, #3a0508 0%, #c01822 52%, #59080c 100%) !important;
}

#pageMain #sp-cert-status-v15.sp-status-por-vencer{
  background:linear-gradient(135deg, #513b00 0%, #dba90e 52%, #6b4c00 100%) !important;
}

#pageMain #sp-cert-status-v15.sp-status-anulado{
  background:linear-gradient(135deg, #202020 0%, #6f6f6f 52%, #111 100%) !important;
}

@keyframes spStatusPulseV16{
  0%,100%{filter:saturate(1) brightness(1); transform:translateY(0);}
  50%{filter:saturate(1.12) brightness(1.09); transform:translateY(-1px);}
}

@keyframes spStatusSweepV16{
  0%{transform:translateX(-90%) rotate(8deg); opacity:0;}
  14%{opacity:.95;}
  46%{transform:translateX(90%) rotate(8deg); opacity:.72;}
  70%,100%{transform:translateX(115%) rotate(8deg); opacity:0;}
}

@media screen and (min-width:769px){
  body.sp-cert-public-v15 .stage-wrap,
  body.public-certificate-page .stage-wrap,
  body.sp-public-page .stage-wrap{
    min-height:100dvh !important;
    display:flex !important;
    justify-content:center !important;
    align-items:flex-start !important;
    padding:28px 16px !important;
    overflow:auto !important;
  }
}

@media screen and (max-width:768px){
  html.sp-cert-public-v15,
  body.sp-cert-public-v15{
    width:100% !important;
    min-width:0 !important;
    overflow:auto !important;
    -webkit-overflow-scrolling:touch !important;
  }

  body.sp-cert-public-v15 .stage-wrap,
  body.public-certificate-page .stage-wrap,
  body.sp-public-page .stage-wrap{
    width:100% !important;
    min-height:100dvh !important;
    display:block !important;
    padding:12px !important;
    overflow:auto !important;
    -webkit-overflow-scrolling:touch !important;
  }

  body.sp-cert-public-v15 .page-stage,
  body.public-certificate-page .page-stage,
  body.sp-public-page .page-stage{
    width:210mm !important;
    min-width:210mm !important;
    margin:0 !important;
    transform:none !important;
  }
}

@media print{
  html,
  body{
    background:#fff !important;
    padding:0 !important;
    overflow:hidden !important;
  }

  body.sp-cert-public-v15 #pageMain,
  body.public-certificate-page #pageMain,
  body.sp-public-page #pageMain{
    border:none !important;
    box-shadow:none !important;
  }

  #sp-cert-status-v15,
  .sp-cert-status-v15{
    display:none !important;
  }
}


/* v18: celdas corregidas: izquierda verde, derecha gris, texto negro normal */
:root{
  --sp-v18-green-cell:#d5e6de;
  --sp-v18-gray-cell:#ececec;
  --sp-v18-text:#111111;
}

/* No mostrar estados viejos externos */
body > #sp-cert-status-v13,
body > .sp-cert-status-v13,
.stage-wrap > #sp-cert-status-v13,
.stage-wrap > .sp-cert-status-v13,
.page-stage > #sp-cert-status-v13,
.page-stage > .sp-cert-status-v13{
  display:none !important;
}

/* Filas del certificado */
#pageMain .vehicle-row,
.page .vehicle-row,
#pageMain .owner-row,
.page .owner-row,
#pageMain .merchandise-row,
.page .merchandise-row,
#pageMain .vehicle-dates .date-row,
.page .vehicle-dates .date-row,
#pageMain .full-row,
.page .full-row,
#pageMain .row,
.page .row{
  display:grid !important;
  grid-template-columns:150px minmax(0, 1fr) !important;
  align-items:stretch !important;
  gap:0 !important;
  min-height:27px !important;
  margin-bottom:5px !important;
  border:0 !important;
  background:transparent !important;
  color:var(--sp-v18-text) !important;
}

/* Celda izquierda: verde claro */
#pageMain .code-label,
.page .code-label,
#pageMain .vehicle-label,
.page .vehicle-label,
#pageMain .owner-label,
.page .owner-label,
#pageMain .merchandise-label,
.page .merchandise-label,
#pageMain .date-label,
.page .date-label,
#pageMain .label,
.page .label,
#pageMain table td:nth-child(odd),
.page table td:nth-child(odd){
  display:flex !important;
  align-items:center !important;
  box-sizing:border-box !important;
  min-height:100% !important;
  padding:0 9px !important;
  background:var(--sp-v18-green-cell) !important;
  color:var(--sp-v18-text) !important;
  font-family:Arial, Helvetica, sans-serif !important;
  font-weight:400 !important;
  text-shadow:none !important;
  letter-spacing:0 !important;
  border:0 !important;
}

/* Celda derecha: gris */
#pageMain .code-value,
.page .code-value,
#pageMain .vehicle-value,
.page .vehicle-value,
#pageMain .owner-value,
.page .owner-value,
#pageMain .merchandise-value,
.page .merchandise-value,
#pageMain .date-value,
.page .date-value,
#pageMain .value,
.page .value,
#pageMain table td:nth-child(even),
.page table td:nth-child(even){
  display:flex !important;
  align-items:center !important;
  box-sizing:border-box !important;
  min-height:100% !important;
  padding:0 9px !important;
  background:var(--sp-v18-gray-cell) !important;
  color:var(--sp-v18-text) !important;
  font-family:Arial, Helvetica, sans-serif !important;
  font-weight:400 !important;
  text-shadow:none !important;
  letter-spacing:0 !important;
  border:0 !important;
}

/* Mantener tamaños especiales del código de verificación */
#pageMain .code-box,
.page .code-box{
  display:grid !important;
  grid-template-columns:160px 82px 46px !important;
}
#pageMain .code-box .code-label,
.page .code-box .code-label{
  justify-content:center !important;
  font-size:12px !important;
}
#pageMain .code-box .code-value,
.page .code-box .code-value{
  justify-content:center !important;
  font-size:13px !important;
  font-weight:400 !important;
}

/* Preservar ancho de bloques largos */
#pageMain .owner-rows,
.page .owner-rows,
#pageMain .merchandise-row,
.page .merchandise-row,
#pageMain .vehicle-dates,
.page .vehicle-dates{
  width:calc(100% - 62px) !important;
}
