/* EcoScan CTS - estilos complementarios a Tailwind CSS */

:root {
  --eco-principal: #047857;
  --eco-claro: #d1fae5;
}

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

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

/* Respeta las zonas seguras en móviles con notch */
.app-header {
  padding-top: env(safe-area-inset-top);
}

.app-footer {
  padding-bottom: calc(1rem + env(safe-area-inset-bottom));
}

/* Caja de previsualización con proporción fija */
.preview-box {
  aspect-ratio: 4 / 3;
  max-height: 60vh;
}

/* Botón de captura: leve pulso mientras no hay imagen */
.btn-capturar {
  min-height: 12rem;
}

.btn-capturar.sin-imagen {
  animation: pulso-eco 2.4s ease-in-out infinite;
}

@keyframes pulso-eco {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.35);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
  }
}

/* Indicador de carga del botón "Analizar Residuo" */
.spinner {
  width: 1.25rem;
  height: 1.25rem;
  border: 3px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: girar 0.8s linear infinite;
}

@keyframes girar {
  to {
    transform: rotate(360deg);
  }
}

/* Aparición escalonada de las tarjetas de resultados */
.card-resultado {
  opacity: 0;
  transform: translateY(12px);
  animation: aparecer 0.45s ease-out forwards;
}

.card-resultado:nth-of-type(1) {
  animation-delay: 0.05s;
}

.card-resultado:nth-of-type(2) {
  animation-delay: 0.2s;
}

.card-resultado:nth-of-type(3) {
  animation-delay: 0.35s;
}

@keyframes aparecer {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#contenedor-resultados:focus {
  outline: none;
}

/* Accesibilidad: reduce animaciones si el usuario lo prefiere */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .btn-capturar.sin-imagen,
  .spinner {
    animation: none;
  }

  .card-resultado {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

/* Insignia del nivel de impacto ambiental */
.nivel-badge {
  display: inline-block;
  border-radius: 9999px;
  padding: 0.1rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  background: #e2e8f0;
  color: #334155;
}

.nivel-bajo {
  background: #d1fae5;
  color: #065f46;
}

.nivel-medio {
  background: #fef3c7;
  color: #92400e;
}

.nivel-alto {
  background: #fee2e2;
  color: #991b1b;
}
